1 /* guestmount - mount guests using libguestfs and FUSE
2 * Copyright (C) 2009 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 * Derived from the example program 'fusexmp.c':
19 * Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
21 * This program can be distributed under the terms of the GNU GPL.
22 * See the file COPYING.
25 #define FUSE_USE_VERSION 26
43 #include <sys/types.h>
51 #include "guestmount.h"
54 /* See <attr/xattr.h> */
56 #define ENOATTR ENODATA
59 static guestfs_h *g = NULL;
60 static int read_only = 0;
62 int dir_cache_timeout = 60;
64 /* This is ugly: guestfs errors are strings, FUSE wants -errno. We
65 * have to do the conversion as best we can.
73 const char *err = guestfs_last_error (g);
79 fprintf (stderr, "%s\n", err);
81 /* Add a few of our own ... */
83 /* This indicates guestfsd died. Translate into a hard EIO error.
84 * Arguably we could relaunch the guest if we hit this error.
86 if (strstr (err, "call launch before using this function"))
89 /* See if it matches an errno string in the host. */
90 for (i = 0; i < MAX_ERRNO; ++i) {
91 const char *e = strerror (i);
92 if (e && strstr (err, e) != NULL)
96 /* Too bad, return a generic error. */
100 static struct guestfs_xattr_list *
101 copy_xattr_list (const struct guestfs_xattr *first, size_t num)
103 struct guestfs_xattr_list *xattrs;
105 xattrs = malloc (sizeof *xattrs);
106 if (xattrs == NULL) {
112 xattrs->val = malloc (num * sizeof (struct guestfs_xattr));
113 if (xattrs->val == NULL) {
120 for (i = 0; i < num; ++i) {
121 xattrs->val[i].attrname = strdup (first[i].attrname);
122 xattrs->val[i].attrval_len = first[i].attrval_len;
123 xattrs->val[i].attrval = malloc (first[i].attrval_len);
124 memcpy (xattrs->val[i].attrval, first[i].attrval, first[i].attrval_len);
131 fg_readdir (const char *path, void *buf, fuse_fill_dir_t filler,
132 off_t offset, struct fuse_file_info *fi)
137 dir_cache_remove_all_expired (now);
139 struct guestfs_dirent_list *ents;
141 ents = guestfs_readdir (g, path);
146 for (i = 0; i < ents->len; ++i) {
148 memset (&stat, 0, sizeof stat);
150 stat.st_ino = ents->val[i].ino;
151 switch (ents->val[i].ftyp) {
152 case 'b': stat.st_mode = S_IFBLK; break;
153 case 'c': stat.st_mode = S_IFCHR; break;
154 case 'd': stat.st_mode = S_IFDIR; break;
155 case 'f': stat.st_mode = S_IFIFO; break;
156 case 'l': stat.st_mode = S_IFLNK; break;
157 case 'r': stat.st_mode = S_IFREG; break;
158 case 's': stat.st_mode = S_IFSOCK; break;
161 default: stat.st_mode = 0;
164 /* Copied from the example, which also ignores 'offset'. I'm
165 * not quite sure how this is ever supposed to work on large
168 if (filler (buf, ents->val[i].name, &stat, 0))
172 /* Now prepopulate the directory caches. This step is just an
173 * optimization, don't worry if it fails.
175 char **names = malloc ((ents->len + 1) * sizeof (char *));
177 for (i = 0; i < ents->len; ++i)
178 names[i] = ents->val[i].name;
181 struct guestfs_stat_list *ss = guestfs_lstatlist (g, path, names);
183 for (i = 0; i < ss->len; ++i) {
184 if (ss->val[i].ino >= 0) {
187 statbuf.st_dev = ss->val[i].dev;
188 statbuf.st_ino = ss->val[i].ino;
189 statbuf.st_mode = ss->val[i].mode;
190 statbuf.st_nlink = ss->val[i].nlink;
191 statbuf.st_uid = ss->val[i].uid;
192 statbuf.st_gid = ss->val[i].gid;
193 statbuf.st_rdev = ss->val[i].rdev;
194 statbuf.st_size = ss->val[i].size;
195 statbuf.st_blksize = ss->val[i].blksize;
196 statbuf.st_blocks = ss->val[i].blocks;
197 statbuf.st_atime = ss->val[i].atime;
198 statbuf.st_mtime = ss->val[i].mtime;
199 statbuf.st_ctime = ss->val[i].ctime;
201 lsc_insert (path, names[i], now, &statbuf);
204 guestfs_free_stat_list (ss);
207 struct guestfs_xattr_list *xattrs = guestfs_lxattrlist (g, path, names);
210 struct guestfs_xattr *first;
211 struct guestfs_xattr_list *copy;
212 for (i = 0, ni = 0; i < xattrs->len; ++i, ++ni) {
213 assert (strlen (xattrs->val[i].attrname) == 0);
214 if (xattrs->val[i].attrval_len > 0) {
216 first = &xattrs->val[i];
218 for (; i < xattrs->len && strlen (xattrs->val[i].attrname) > 0; ++i)
221 copy = copy_xattr_list (first, num);
223 xac_insert (path, names[ni], now, copy);
228 guestfs_free_xattr_list (xattrs);
231 char **links = guestfs_readlinklist (g, path, names);
233 for (i = 0; names[i] != NULL; ++i) {
235 /* Note that rlc_insert owns the string links[i] after this, */
236 rlc_insert (path, names[i], now, links[i]);
238 /* which is why we have to free links[i] here. */
241 free (links); /* free the array, not the strings */
247 guestfs_free_dirent_list (ents);
253 fg_getattr (const char *path, struct stat *statbuf)
255 const struct stat *buf;
257 buf = lsc_lookup (path);
259 memcpy (statbuf, buf, sizeof *statbuf);
263 struct guestfs_stat *r;
265 r = guestfs_lstat (g, path);
269 statbuf->st_dev = r->dev;
270 statbuf->st_ino = r->ino;
271 statbuf->st_mode = r->mode;
272 statbuf->st_nlink = r->nlink;
273 statbuf->st_uid = r->uid;
274 statbuf->st_gid = r->gid;
275 statbuf->st_rdev = r->rdev;
276 statbuf->st_size = r->size;
277 statbuf->st_blksize = r->blksize;
278 statbuf->st_blocks = r->blocks;
279 statbuf->st_atime = r->atime;
280 statbuf->st_mtime = r->mtime;
281 statbuf->st_ctime = r->ctime;
283 guestfs_free_stat (r);
288 /* Nautilus loves to use access(2) to test everything about a file,
289 * such as whether it's executable. Therefore treat this a lot like
293 fg_access (const char *path, int mask)
298 if (read_only && (mask & W_OK))
301 r = fg_getattr (path, &statbuf);
302 if (r < 0 || mask == F_OK)
305 struct fuse_context *fuse = fuse_get_context ();
310 ( fuse->uid == statbuf.st_uid ? statbuf.st_mode & S_IRUSR
311 : fuse->gid == statbuf.st_gid ? statbuf.st_mode & S_IRGRP
312 : statbuf.st_mode & S_IROTH);
315 ( fuse->uid == statbuf.st_uid ? statbuf.st_mode & S_IWUSR
316 : fuse->gid == statbuf.st_gid ? statbuf.st_mode & S_IWGRP
317 : statbuf.st_mode & S_IWOTH);
320 ( fuse->uid == statbuf.st_uid ? statbuf.st_mode & S_IXUSR
321 : fuse->gid == statbuf.st_gid ? statbuf.st_mode & S_IXGRP
322 : statbuf.st_mode & S_IXOTH);
324 return ok ? 0 : -EACCES;
328 fg_readlink (const char *path, char *buf, size_t size)
333 r = rlc_lookup (path);
335 r = guestfs_readlink (g, path);
341 /* Note this is different from the real readlink(2) syscall. FUSE wants
342 * the string to be always nul-terminated, even if truncated.
344 size_t len = strlen (r);
348 memcpy (buf, r, len);
352 char *tmp = (char *) r;
360 fg_mknod (const char *path, mode_t mode, dev_t rdev)
364 if (read_only) return -EROFS;
366 dir_cache_invalidate (path);
368 r = guestfs_mknod (g, mode, major (rdev), minor (rdev), path);
376 fg_mkdir (const char *path, mode_t mode)
380 if (read_only) return -EROFS;
382 dir_cache_invalidate (path);
384 r = guestfs_mkdir_mode (g, path, mode);
392 fg_unlink (const char *path)
396 if (read_only) return -EROFS;
398 dir_cache_invalidate (path);
400 r = guestfs_rm (g, path);
408 fg_rmdir (const char *path)
412 if (read_only) return -EROFS;
414 dir_cache_invalidate (path);
416 r = guestfs_rmdir (g, path);
424 fg_symlink (const char *from, const char *to)
428 if (read_only) return -EROFS;
430 dir_cache_invalidate (to);
432 r = guestfs_ln_s (g, from, to);
440 fg_rename (const char *from, const char *to)
444 if (read_only) return -EROFS;
446 dir_cache_invalidate (from);
447 dir_cache_invalidate (to);
449 /* XXX It's not clear how close the 'mv' command is to the
450 * rename syscall. We might need to add the rename syscall
451 * to the guestfs(3) API.
453 r = guestfs_mv (g, from, to);
461 fg_link (const char *from, const char *to)
465 if (read_only) return -EROFS;
467 dir_cache_invalidate (from);
468 dir_cache_invalidate (to);
470 r = guestfs_ln (g, from, to);
478 fg_chmod (const char *path, mode_t mode)
482 if (read_only) return -EROFS;
484 dir_cache_invalidate (path);
486 r = guestfs_chmod (g, mode, path);
494 fg_chown (const char *path, uid_t uid, gid_t gid)
498 if (read_only) return -EROFS;
500 dir_cache_invalidate (path);
502 r = guestfs_lchown (g, uid, gid, path);
510 fg_truncate (const char *path, off_t size)
514 if (read_only) return -EROFS;
516 dir_cache_invalidate (path);
518 r = guestfs_truncate_size (g, path, size);
526 fg_utimens (const char *path, const struct timespec ts[2])
530 if (read_only) return -EROFS;
532 dir_cache_invalidate (path);
534 time_t atsecs = ts[0].tv_sec;
535 long atnsecs = ts[0].tv_nsec;
536 time_t mtsecs = ts[1].tv_sec;
537 long mtnsecs = ts[1].tv_nsec;
540 if (atnsecs == UTIME_NOW)
544 if (atnsecs == UTIME_OMIT)
548 if (mtnsecs == UTIME_NOW)
552 if (mtnsecs == UTIME_OMIT)
556 r = guestfs_utimens (g, path, atsecs, atnsecs, mtsecs, mtnsecs);
563 /* This call is quite hard to emulate through the guestfs(3) API. In
564 * one sense it's a little like access (see above) because it tests
565 * whether opening a file would succeed given the flags. But it also
566 * has side effects such as truncating the file if O_TRUNC is given.
567 * Therefore we need to emulate it ... painfully.
570 fg_open (const char *path, struct fuse_file_info *fi)
574 if (fi->flags & O_WRONLY) {
579 exists = guestfs_exists (g, path);
583 if (fi->flags & O_CREAT) {
587 dir_cache_invalidate (path);
589 /* Exclusive? File must not exist already. */
590 if (fi->flags & O_EXCL) {
595 /* Create? Touch it and optionally truncate it. */
596 r = guestfs_touch (g, path);
600 if (fi->flags & O_TRUNC) {
601 r = guestfs_truncate (g, path);
606 /* Not create, just check it exists. */
615 fg_read (const char *path, char *buf, size_t size, off_t offset,
616 struct fuse_file_info *fi)
622 fprintf (stderr, "fg_read: %s: size %zu offset %ju\n",
625 /* The guestfs protocol limits size to somewhere over 2MB. We just
626 * reduce the requested size here accordingly and push the problem
627 * up to every user. http://www.jwz.org/doc/worse-is-better.html
629 const size_t limit = 2 * 1024 * 1024;
633 r = guestfs_pread (g, path, size, offset, &rsize);
637 /* This should never happen, but at least it stops us overflowing
638 * the output buffer if it does happen.
643 memcpy (buf, r, rsize);
650 fg_write (const char *path, const char *buf, size_t size,
651 off_t offset, struct fuse_file_info *fi)
653 if (read_only) return -EROFS;
655 dir_cache_invalidate (path);
658 const size_t limit = 2 * 1024 * 1024;
663 r = guestfs_pwrite (g, path, buf, size, offset);
671 fg_statfs (const char *path, struct statvfs *stbuf)
673 struct guestfs_statvfs *r;
675 r = guestfs_statvfs (g, path);
679 stbuf->f_bsize = r->bsize;
680 stbuf->f_frsize = r->frsize;
681 stbuf->f_blocks = r->blocks;
682 stbuf->f_bfree = r->bfree;
683 stbuf->f_bavail = r->bavail;
684 stbuf->f_files = r->files;
685 stbuf->f_ffree = r->ffree;
686 stbuf->f_favail = r->favail;
687 stbuf->f_fsid = r->fsid;
688 stbuf->f_flag = r->flag;
689 stbuf->f_namemax = r->namemax;
691 guestfs_free_statvfs (r);
697 fg_release (const char *path, struct fuse_file_info *fi)
699 /* Just a stub. This method is optional and can safely be left
705 /* Emulate this by calling sync. */
706 static int fg_fsync(const char *path, int isdatasync,
707 struct fuse_file_info *fi)
711 r = guestfs_sync (g);
719 fg_setxattr (const char *path, const char *name, const char *value,
720 size_t size, int flags)
724 if (read_only) return -EROFS;
726 dir_cache_invalidate (path);
728 /* XXX Underlying guestfs(3) API doesn't understand the flags. */
729 r = guestfs_lsetxattr (g, name, value, size, path);
736 /* The guestfs(3) API for getting xattrs is much easier to use
737 * than the real syscall. Unfortunately we now have to emulate
738 * the real syscall using that API :-(
741 fg_getxattr (const char *path, const char *name, char *value,
744 const struct guestfs_xattr_list *xattrs;
747 xattrs = xac_lookup (path);
748 if (xattrs == NULL) {
749 xattrs = guestfs_lgetxattrs (g, path);
757 for (i = 0; i < xattrs->len; ++i) {
758 if (STREQ (xattrs->val[i].attrname, name)) {
759 size_t sz = xattrs->val[i].attrval_len;
762 memcpy (value, xattrs->val[i].attrval, sz);
769 guestfs_free_xattr_list ((struct guestfs_xattr_list *) xattrs);
774 /* Ditto as above. */
776 fg_listxattr (const char *path, char *list, size_t size)
778 const struct guestfs_xattr_list *xattrs;
781 xattrs = xac_lookup (path);
782 if (xattrs == NULL) {
783 xattrs = guestfs_lgetxattrs (g, path);
791 for (i = 0; i < xattrs->len; ++i) {
792 size_t len = strlen (xattrs->val[i].attrname) + 1;
794 memcpy (list, xattrs->val[i].attrname, len);
805 guestfs_free_xattr_list ((struct guestfs_xattr_list *) xattrs);
811 fg_removexattr(const char *path, const char *name)
815 if (read_only) return -EROFS;
817 dir_cache_invalidate (path);
819 r = guestfs_lremovexattr (g, name, path);
826 static struct fuse_operations fg_operations = {
827 .getattr = fg_getattr,
829 .readlink = fg_readlink,
830 .readdir = fg_readdir,
833 .symlink = fg_symlink,
840 .truncate = fg_truncate,
841 .utimens = fg_utimens,
846 .release = fg_release,
848 .setxattr = fg_setxattr,
849 .getxattr = fg_getxattr,
850 .listxattr = fg_listxattr,
851 .removexattr = fg_removexattr,
865 static void add_drives (struct drv *);
866 static void mount_mps (struct mp *);
868 static void __attribute__((noreturn))
871 const char *tmp_argv[] = { program_name, "--help", NULL };
872 fuse_main (2, (char **) tmp_argv, &fg_operations, NULL);
876 static void __attribute__((noreturn))
879 if (status != EXIT_SUCCESS)
880 fprintf (stderr, _("Try `%s --help' for more information.\n"),
884 _("%s: FUSE module for libguestfs\n"
885 "%s lets you mount a virtual machine filesystem\n"
886 "Copyright (C) 2009 Red Hat Inc.\n"
888 " %s [--options] [-- [--FUSE-options]] mountpoint\n"
890 " -a|--add image Add image\n"
891 " --dir-cache-timeout Set readdir cache timeout (default 5 sec)\n"
892 " --fuse-help Display extra FUSE options\n"
893 " --help Display help message and exit\n"
894 " -m|--mount dev[:mnt] Mount dev on mnt (if omitted, /)\n"
895 " -n|--no-sync Don't autosync\n"
896 " -o|--option opt Pass extra option to FUSE\n"
897 " -r|--ro Mount read-only\n"
898 " --selinux Enable SELinux support\n"
899 " --trace Trace guestfs API calls (to stderr)\n"
900 " -v|--verbose Verbose messages\n"
901 " -V|--version Display version and exit\n"
903 program_name, program_name, program_name);
909 main (int argc, char *argv[])
911 setlocale (LC_ALL, "");
912 bindtextdomain (PACKAGE, LOCALEBASEDIR);
913 textdomain (PACKAGE);
915 enum { HELP_OPTION = CHAR_MAX + 1 };
917 /* The command line arguments are broadly compatible with (a subset
918 * of) guestfish. Thus we have to deal mainly with -a, -m and --ro.
920 static const char *options = "a:m:no:rv?V";
921 static const struct option long_options[] = {
922 { "add", 1, 0, 'a' },
923 { "dir-cache-timeout", 1, 0, 0 },
924 { "fuse-help", 0, 0, 0 },
925 { "help", 0, 0, HELP_OPTION },
926 { "mount", 1, 0, 'm' },
927 { "no-sync", 0, 0, 'n' },
928 { "option", 1, 0, 'o' },
930 { "selinux", 0, 0, 0 },
931 { "trace", 0, 0, 0 },
932 { "verbose", 0, 0, 'v' },
933 { "version", 0, 0, 'V' },
937 struct drv *drvs = NULL;
939 struct mp *mps = NULL;
947 const char **fuse_argv = NULL;
949 #define ADD_FUSE_ARG(str) \
952 fuse_argv = realloc (fuse_argv, (1+fuse_argc) * sizeof (char *)); \
954 perror ("realloc"); \
955 exit (EXIT_FAILURE); \
957 fuse_argv[fuse_argc-1] = (str); \
958 fuse_argv[fuse_argc] = NULL; \
961 /* LC_ALL=C is required so we can parse error messages. */
962 setenv ("LC_ALL", "C", 1);
964 /* Set global program name that is not polluted with libtool artifacts. */
965 set_program_name (argv[0]);
967 memset (&sa, 0, sizeof sa);
968 sa.sa_handler = SIG_IGN;
969 sa.sa_flags = SA_RESTART;
970 sigaction (SIGPIPE, &sa, NULL);
972 /* Various initialization. */
975 g = guestfs_create ();
977 fprintf (stderr, _("guestfs_create: failed to create handle\n"));
981 guestfs_set_autosync (g, 1);
982 guestfs_set_recovery_proc (g, 0);
984 ADD_FUSE_ARG (program_name);
985 /* MUST be single-threaded. You cannot have two threads accessing the
986 * same libguestfs handle, and opening more than one handle is likely
987 * to be very expensive.
991 /* If developing, add ./appliance to the path. Note that libtools
992 * interferes with this because uninstalled guestfish is a shell
993 * script that runs the real program with an absolute path. Detect
996 * BUT if LIBGUESTFS_PATH environment variable is already set by
997 * the user, then don't override it.
999 if (getenv ("LIBGUESTFS_PATH") == NULL &&
1001 (argv[0][0] != '/' || strstr (argv[0], "/.libs/lt-") != NULL))
1002 guestfs_set_path (g, "appliance:" GUESTFS_DEFAULT_PATH);
1005 c = getopt_long (argc, argv, options, long_options, &option_index);
1009 case 0: /* options which are long only */
1010 if (STREQ (long_options[option_index].name, "dir-cache-timeout"))
1011 dir_cache_timeout = atoi (optarg);
1012 else if (STREQ (long_options[option_index].name, "fuse-help"))
1014 else if (STREQ (long_options[option_index].name, "selinux"))
1015 guestfs_set_selinux (g, 1);
1016 else if (STREQ (long_options[option_index].name, "trace")) {
1017 ADD_FUSE_ARG ("-f");
1018 guestfs_set_trace (g, 1);
1019 guestfs_set_recovery_proc (g, 1);
1022 fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
1023 program_name, long_options[option_index].name, option_index);
1024 exit (EXIT_FAILURE);
1029 if (access (optarg, R_OK) != 0) {
1031 exit (EXIT_FAILURE);
1033 drv = malloc (sizeof (struct drv));
1036 exit (EXIT_FAILURE);
1038 drv->filename = optarg;
1044 mp = malloc (sizeof (struct mp));
1047 exit (EXIT_FAILURE);
1049 p = strchr (optarg, ':');
1052 mp->mountpoint = p+1;
1054 mp->mountpoint = bad_cast ("/");
1055 mp->device = optarg;
1061 guestfs_set_autosync (g, 0);
1065 ADD_FUSE_ARG ("-o");
1066 ADD_FUSE_ARG (optarg);
1075 guestfs_set_verbose (g, verbose);
1079 struct guestfs_version *v = guestfs_version (g);
1080 printf ("%s %"PRIi64".%"PRIi64".%"PRIi64"%s\n", program_name,
1081 v->major, v->minor, v->release, v->extra);
1082 exit (EXIT_SUCCESS);
1086 usage (EXIT_SUCCESS);
1089 usage (EXIT_FAILURE);
1093 /* We must have at least one -a and at least one -m. */
1094 if (!drvs || !mps) {
1096 _("%s: must have at least one -a and at least one -m option\n"),
1098 exit (EXIT_FAILURE);
1101 /* We'd better have a mountpoint. */
1102 if (optind+1 != argc) {
1104 _("%s: you must specify a mountpoint in the host filesystem\n"),
1106 exit (EXIT_FAILURE);
1109 /* Do the guest drives and mountpoints. */
1111 if (guestfs_launch (g) == -1)
1112 exit (EXIT_FAILURE);
1115 /* FUSE example does this, not clear if it's necessary, but ... */
1116 if (guestfs_umask (g, 0) == -1)
1117 exit (EXIT_FAILURE);
1119 /* At the last minute, remove the libguestfs error handler. In code
1120 * above this point, the default error handler has been used which
1121 * sends all errors to stderr. Now before entering FUSE itself we
1122 * want to silence errors so we can convert them (see error()
1125 guestfs_set_error_handler (g, NULL, NULL);
1127 /* Finish off FUSE args. */
1128 ADD_FUSE_ARG (argv[optind]);
1131 It says about the line containing the for-statement:
1132 error: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow]
1135 fprintf (stderr, "guestmount: invoking FUSE with args [");
1136 for (i = 0; i < fuse_argc; ++i) {
1137 if (i > 0) fprintf (stderr, ", ");
1138 fprintf (stderr, "%s", fuse_argv[i]);
1140 fprintf (stderr, "]\n");
1144 r = fuse_main (fuse_argc, (char **) fuse_argv, &fg_operations, NULL);
1150 exit (r == -1 ? 1 : 0);
1153 /* List is built in reverse order, so add them in reverse order. */
1155 add_drives (struct drv *drv)
1160 add_drives (drv->next);
1162 r = guestfs_add_drive (g, drv->filename);
1164 r = guestfs_add_drive_ro (g, drv->filename);
1166 exit (EXIT_FAILURE);
1170 /* List is built in reverse order, so mount them in reverse order. */
1172 mount_mps (struct mp *mp)
1177 mount_mps (mp->next);
1179 /* Don't use guestfs_mount here because that will default to mount
1180 * options -o sync,noatime. For more information, see guestfs(3)
1181 * section "LIBGUESTFS GOTCHAS".
1183 const char *options = read_only ? "ro" : "";
1184 r = guestfs_mount_options (g, options, mp->device, mp->mountpoint);
1186 exit (EXIT_FAILURE);