Linux 2.6.35 compat, fops->fsync()
[zfs.git] / cmd / zfs / zfs_main.c
index e1cca2d..86f0d5c 100644 (file)
@@ -318,7 +318,6 @@ safe_malloc(size_t size)
        return (data);
 }
 
-#ifdef HAVE_ZPL
 static char *
 safe_strdup(char *str)
 {
@@ -329,7 +328,6 @@ safe_strdup(char *str)
 
        return (dupstr);
 }
-#endif /* HAVE_ZPL */
 
 /*
  * Callback routine that will print out information for each of
@@ -497,7 +495,6 @@ parse_depth(char *opt, int *flags)
 
 #define        PROGRESS_DELAY 2                /* seconds */
 
-#ifdef HAVE_ZPL
 static char *pt_reverse = "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
 static time_t pt_begin;
 static char *pt_header = NULL;
@@ -549,7 +546,6 @@ finish_progress(char *done)
        free(pt_header);
        pt_header = NULL;
 }
-#endif /* HAVE_ZPL */
 
 /*
  * zfs clone [-p] [-o prop=value] ... <snap> <fs | vol>
@@ -631,7 +627,6 @@ zfs_do_clone(int argc, char **argv)
        ret = zfs_clone(zhp, argv[1], props);
 
        /* create the mountpoint if necessary */
-#ifdef HAVE_ZPL
        if (ret == 0) {
                zfs_handle_t *clone;
 
@@ -643,7 +638,6 @@ zfs_do_clone(int argc, char **argv)
                        zfs_close(clone);
                }
        }
-#endif /* HAVE_ZPL */
 
        zfs_close(zhp);
        nvlist_free(props);
@@ -831,7 +825,6 @@ zfs_do_create(int argc, char **argv)
         * verbose error message to let the user know that their filesystem was
         * in fact created, even if we failed to mount or share it.
         */
-#ifdef HAVE_ZPL
        if (canmount == ZFS_CANMOUNT_ON) {
                if (zfs_mount(zhp, NULL, 0) != 0) {
                        (void) fprintf(stderr, gettext("filesystem "
@@ -843,7 +836,6 @@ zfs_do_create(int argc, char **argv)
                        ret = 1;
                }
        }
-#endif /* HAVE_ZPL */
 
 error:
        if (zhp)
@@ -2340,7 +2332,6 @@ typedef struct rollback_cbdata {
  * 'cb_dependent' is set, then this is a dependent and we should report it
  * without checking the transaction group.
  */
-#ifdef HAVE_ZPL
 static int
 rollback_check(zfs_handle_t *zhp, void *data)
 {
@@ -2400,12 +2391,10 @@ rollback_check(zfs_handle_t *zhp, void *data)
        zfs_close(zhp);
        return (0);
 }
-#endif /* HAVE_ZPL */
 
 static int
 zfs_do_rollback(int argc, char **argv)
 {
-#ifdef HAVE_ZPL
        int ret;
        int c;
        boolean_t force = B_FALSE;
@@ -2487,9 +2476,6 @@ out:
                return (0);
        else
                return (1);
-#else
-       return ENOSYS;
-#endif /*HAVE_ZPL*/
 }
 
 /*
@@ -2955,7 +2941,6 @@ zfs_do_release(int argc, char **argv)
 #define        SPINNER_TIME 3          /* seconds */
 #define        MOUNT_TIME 5            /* seconds */
 
-#ifdef HAVE_ZPL
 static int
 get_one_dataset(zfs_handle_t *zhp, void *data)
 {
@@ -3275,7 +3260,7 @@ share_mount(int op, int argc, char **argv)
        int flags = 0;
 
        /* check options */
-       while ((c = getopt(argc, argv, op == OP_MOUNT ? ":avo:O" : "a"))
+       while ((c = getopt(argc, argv, op == OP_MOUNT ? ":avo:" : "a"))
            != -1) {
                switch (c) {
                case 'a':
@@ -3298,9 +3283,6 @@ share_mount(int op, int argc, char **argv)
                        append_options(options, optarg);
                        break;
 
-               case 'O':
-                       flags |= MS_OVERLAY;
-                       break;
                case ':':
                        (void) fprintf(stderr, gettext("missing argument for "
                            "'%c' option\n"), optopt);
@@ -3368,7 +3350,7 @@ share_mount(int op, int argc, char **argv)
                }
 
                /*
-                * When mount is given no arguments, go through /etc/mnttab and
+                * When mount is given no arguments, go through /etc/mtab and
                 * display any active ZFS mounts.  We hide any snapshots, since
                 * they are controlled automatically.
                 */
@@ -3403,7 +3385,6 @@ share_mount(int op, int argc, char **argv)
 
        return (ret);
 }
-#endif  /* HAVE_ZPL */
 
 /*
  * zfs mount -a [nfs]
@@ -3414,11 +3395,7 @@ share_mount(int op, int argc, char **argv)
 static int
 zfs_do_mount(int argc, char **argv)
 {
-#ifdef HAVE_ZPL
        return (share_mount(OP_MOUNT, argc, argv));
-#else
-       return ENOSYS;
-#endif  /* HAVE_ZPL */
 }
 
 /*
@@ -3430,14 +3407,9 @@ zfs_do_mount(int argc, char **argv)
 static int
 zfs_do_share(int argc, char **argv)
 {
-#ifdef HAVE_ZPL
        return (share_mount(OP_SHARE, argc, argv));
-#else
-       return ENOSYS;
-#endif  /* HAVE_ZPL */
 }
 
-#ifdef HAVE_ZPL
 typedef struct unshare_unmount_node {
        zfs_handle_t    *un_zhp;
        char            *un_mountp;
@@ -3456,7 +3428,7 @@ unshare_unmount_compare(const void *larg, const void *rarg, void *unused)
 
 /*
  * Convenience routine used by zfs_do_umount() and manual_unmount().  Given an
- * absolute path, find the entry /etc/mnttab, verify that its a ZFS filesystem,
+ * absolute path, find the entry /etc/mtab, verify that its a ZFS filesystem,
  * and unmount it appropriately.
  */
 static int
@@ -3470,7 +3442,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
        ino_t path_inode;
 
        /*
-        * Search for the path in /etc/mnttab.  Rather than looking for the
+        * Search for the path in /etc/mtab.  Rather than looking for the
         * specific path, which can be fooled by non-standard paths (i.e. ".."
         * or "//"), we stat() the path and search for the corresponding
         * (major,minor) device pair.
@@ -3497,7 +3469,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
                            "currently mounted\n"), cmdname, path);
                        return (1);
                }
-               (void) fprintf(stderr, gettext("warning: %s not in mnttab\n"),
+               (void) fprintf(stderr, gettext("warning: %s not in mtab\n"),
                    path);
                if ((ret = umount2(path, flags)) != 0)
                        (void) fprintf(stderr, gettext("%s: %s\n"), path,
@@ -3539,8 +3511,8 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
                    strcmp(smbshare_prop, "off") == 0) {
                        (void) fprintf(stderr, gettext("cannot unshare "
                            "'%s': legacy share\n"), path);
-                       (void) fprintf(stderr, gettext("use "
-                           "unshare(1M) to unshare this filesystem\n"));
+                       (void) fprintf(stderr, gettext("use exportfs(8) "
+                           "or smbcontrol(1) to unshare this filesystem\n"));
                } else if (!zfs_is_shared(zhp)) {
                        (void) fprintf(stderr, gettext("cannot unshare '%s': "
                            "not currently shared\n"), path);
@@ -3559,7 +3531,7 @@ unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
                        (void) fprintf(stderr, gettext("cannot unmount "
                            "'%s': legacy mountpoint\n"),
                            zfs_get_name(zhp));
-                       (void) fprintf(stderr, gettext("use umount(1M) "
+                       (void) fprintf(stderr, gettext("use umount(8) "
                            "to unmount this filesystem\n"));
                } else {
                        ret = zfs_unmountall(zhp, flags);
@@ -3609,8 +3581,8 @@ unshare_unmount(int op, int argc, char **argv)
                /*
                 * We could make use of zfs_for_each() to walk all datasets in
                 * the system, but this would be very inefficient, especially
-                * since we would have to linearly search /etc/mnttab for each
-                * one.  Instead, do one pass through /etc/mnttab looking for
+                * since we would have to linearly search /etc/mtab for each
+                * one.  Instead, do one pass through /etc/mtab looking for
                 * zfs entries and call zfs_unmount() for each one.
                 *
                 * Things get a little tricky if the administrator has created
@@ -3821,7 +3793,6 @@ unshare_unmount(int op, int argc, char **argv)
 
        return (ret);
 }
-#endif  /* HAVE_ZPL */
 
 /*
  * zfs unmount -a
@@ -3832,11 +3803,7 @@ unshare_unmount(int op, int argc, char **argv)
 static int
 zfs_do_unmount(int argc, char **argv)
 {
-#ifdef HAVE_ZPL
        return (unshare_unmount(OP_MOUNT, argc, argv));
-#else
-       return ENOSYS;
-#endif  /* HAVE_ZPL */
 }
 
 /*
@@ -3848,11 +3815,7 @@ zfs_do_unmount(int argc, char **argv)
 static int
 zfs_do_unshare(int argc, char **argv)
 {
-#ifdef HAVE_ZPL
        return (unshare_unmount(OP_SHARE, argc, argv));
-#else
-       return ENOSYS;
-#endif  /* HAVE_ZPL */
 }
 
 /* ARGSUSED */
@@ -3912,7 +3875,9 @@ static const option_map_t option_map[] = {
 #endif
        /* Valid options not found in mount(8) */
        { MNTOPT_BIND,          MS_BIND         },
+#ifdef MS_REC
        { MNTOPT_RBIND,         MS_BIND|MS_REC  },
+#endif
        { MNTOPT_COMMENT,       MS_COMMENT      },
        { MNTOPT_BOOTWAIT,      MS_COMMENT      },
        { MNTOPT_NOBOOTWAIT,    MS_COMMENT      },