Remove HAVE_ZPL from commands and libraries
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 16 Dec 2010 23:11:40 +0000 (15:11 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 5 Feb 2011 00:14:34 +0000 (16:14 -0800)
Thanks to the previous few commits we can now build all of the
user space commands and libraries with support for the zpl.

cmd/zfs/zfs_main.c
cmd/zinject/zinject.c
cmd/zpool/zpool_main.c
lib/libzfs/libzfs_changelist.c
lib/libzfs/libzfs_dataset.c
lib/libzfs/libzfs_mount.c
lib/libzfs/libzfs_util.c

index 8d75d2a..d27fcbf 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)
 {
@@ -3400,7 +3385,6 @@ share_mount(int op, int argc, char **argv)
 
        return (ret);
 }
-#endif  /* HAVE_ZPL */
 
 /*
  * zfs mount -a [nfs]
@@ -3411,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 */
 }
 
 /*
@@ -3427,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;
@@ -3818,7 +3793,6 @@ unshare_unmount(int op, int argc, char **argv)
 
        return (ret);
 }
-#endif  /* HAVE_ZPL */
 
 /*
  * zfs unmount -a
@@ -3829,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 */
 }
 
 /*
@@ -3845,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 */
index e76e626..d584ead 100644 (file)
@@ -951,20 +951,16 @@ main(int argc, char **argv)
        if (dataset[0] != '\0' && domount) {
                if ((zhp = zfs_open(g_zfs, dataset, ZFS_TYPE_DATASET)) == NULL)
                        return (1);
-#ifdef HAVE_ZPL
                if (zfs_unmount(zhp, NULL, 0) != 0)
                        return (1);
-#endif /* HAVE_ZPL */
        }
 
        record.zi_error = error;
 
        ret = register_handler(pool, flags, &record, quiet);
 
-#ifdef HAVE_ZPL
        if (dataset[0] != '\0' && domount)
                ret = (zfs_mount(zhp, NULL, 0) != 0);
-#endif /* HAVE_ZPL */
 
        libzfs_fini(g_zfs);
 
index 1e9b3b6..bad4e2a 100644 (file)
@@ -716,9 +716,7 @@ zpool_do_create(int argc, char **argv)
            (strcmp(mountpoint, ZFS_MOUNTPOINT_LEGACY) != 0 &&
            strcmp(mountpoint, ZFS_MOUNTPOINT_NONE) != 0)) {
                char buf[MAXPATHLEN];
-#ifdef HAVE_ZPL
                DIR *dirp;
-#endif
 
                if (mountpoint && mountpoint[0] != '/') {
                        (void) fprintf(stderr, gettext("invalid mountpoint "
@@ -743,7 +741,6 @@ zpool_do_create(int argc, char **argv)
                                    mountpoint);
                }
 
-#ifdef HAVE_ZPL
                if ((dirp = opendir(buf)) == NULL && errno != ENOENT) {
                        (void) fprintf(stderr, gettext("mountpoint '%s' : "
                            "%s\n"), buf, strerror(errno));
@@ -766,7 +763,6 @@ zpool_do_create(int argc, char **argv)
                                goto errout;
                        }
                }
-#endif /* HAVE_ZPL */
        }
 
        if (dryrun) {
@@ -797,12 +793,8 @@ zpool_do_create(int argc, char **argv)
                                            zfs_prop_to_name(
                                            ZFS_PROP_MOUNTPOINT),
                                            mountpoint) == 0);
-#ifdef HAVE_ZPL
                                if (zfs_mount(pool, NULL, 0) == 0)
                                        ret = zfs_shareall(pool);
-#else
-                               ret = 0;
-#endif /* HAVE_ZPL */
                                zfs_close(pool);
                        }
                } else if (libzfs_errno(g_zfs) == EZFS_INVALIDNAME) {
@@ -1579,14 +1571,12 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
        if ((zhp = zpool_open_canfail(g_zfs, name)) == NULL)
                return (1);
 
-#if HAVE_ZPL
        if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL &&
            !(flags & ZFS_IMPORT_ONLY) &&
            zpool_enable_datasets(zhp, mntopts, 0) != 0) {
                zpool_close(zhp);
                return (1);
        }
-#endif /* HAVE_ZPL */
 
        zpool_close(zhp);
        return (0);
index 6f067d5..0bcfc04 100644 (file)
@@ -93,7 +93,6 @@ struct prop_changelist {
 int
 changelist_prefix(prop_changelist_t *clp)
 {
-#ifdef HAVE_ZPL
        prop_changenode_t *cn;
        int ret = 0;
 
@@ -142,9 +141,6 @@ changelist_prefix(prop_changelist_t *clp)
                (void) changelist_postfix(clp);
 
        return (ret);
-#else
-       return 0;
-#endif  /* HAVE_ZPL */
 }
 
 /*
@@ -159,7 +155,6 @@ changelist_prefix(prop_changelist_t *clp)
 int
 changelist_postfix(prop_changelist_t *clp)
 {
-#ifdef HAVE_ZPL
        prop_changenode_t *cn;
        char shareopts[ZFS_MAXPROPLEN];
        int errors = 0;
@@ -260,9 +255,6 @@ changelist_postfix(prop_changelist_t *clp)
        }
 
        return (errors ? -1 : 0);
-#else
-       return 0;
-#endif  /* HAVE_ZPL */
 }
 
 /*
@@ -325,7 +317,6 @@ changelist_rename(prop_changelist_t *clp, const char *src, const char *dst)
 int
 changelist_unshare(prop_changelist_t *clp, zfs_share_proto_t *proto)
 {
-#ifdef HAVE_ZPL
        prop_changenode_t *cn;
        int ret = 0;
 
@@ -340,9 +331,6 @@ changelist_unshare(prop_changelist_t *clp, zfs_share_proto_t *proto)
        }
 
        return (ret);
-#else
-       return 0;
-#endif
 }
 
 /*
index d4b59f2..378bbc7 100644 (file)
@@ -995,7 +995,6 @@ badlabel:
 
                        /*FALLTHRU*/
 
-#ifdef HAVE_ZPL
                case ZFS_PROP_SHARESMB:
                case ZFS_PROP_SHARENFS:
                        /*
@@ -1106,7 +1105,6 @@ badlabel:
                        }
 
                        break;
-#endif /* HAVE_ZPL */
                case ZFS_PROP_UTF8ONLY:
                        chosen_utf = (int)intval;
                        break;
@@ -2745,7 +2743,6 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
                        goto ancestorerr;
                }
 
-#ifdef HAVE_ZPL
                if (zfs_mount(h, NULL, 0) != 0) {
                        opname = dgettext(TEXT_DOMAIN, "mount");
                        goto ancestorerr;
@@ -2755,7 +2752,6 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
                        opname = dgettext(TEXT_DOMAIN, "share");
                        goto ancestorerr;
                }
-#endif /* HAVE_ZPL */
 
                zfs_close(h);
        }
@@ -4037,28 +4033,6 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received)
        return (0);
 }
 
-#ifdef HAVE_ZPL
-int
-zfs_deleg_share_nfs(libzfs_handle_t *hdl, char *dataset, char *path,
-    char *resource, void *export, void *sharetab,
-    int sharemax, zfs_share_op_t operation)
-{
-       zfs_cmd_t zc = { "\0", "\0", "\0", "\0", 0 };
-       int error;
-
-       (void) strlcpy(zc.zc_name, dataset, sizeof (zc.zc_name));
-       (void) strlcpy(zc.zc_value, path, sizeof (zc.zc_value));
-       if (resource)
-               (void) strlcpy(zc.zc_string, resource, sizeof (zc.zc_string));
-       zc.zc_share.z_sharedata = (uint64_t)(uintptr_t)sharetab;
-       zc.zc_share.z_exportdata = (uint64_t)(uintptr_t)export;
-       zc.zc_share.z_sharetype = operation;
-       zc.zc_share.z_sharemax = sharemax;
-       error = ioctl(hdl->libzfs_fd, ZFS_IOC_SHARE, &zc);
-       return (error);
-}
-#endif /* HAVE_ZPL */
-
 void
 zfs_prune_proplist(zfs_handle_t *zhp, uint8_t *props)
 {
index 977b2ee..f55b16b 100644 (file)
@@ -84,7 +84,6 @@
 #include <sys/systeminfo.h>
 #define        MAXISALEN       257     /* based on sysinfo(2) man page */
 
-#ifdef HAVE_ZPL
 static int zfs_share_proto(zfs_handle_t *, zfs_share_proto_t *);
 zfs_share_type_t zfs_is_shared_proto(zfs_handle_t *, char **,
     zfs_share_proto_t);
@@ -1343,53 +1342,3 @@ out:
 
        return (ret);
 }
-
-#else  /* HAVE_ZPL */
-
-int
-zfs_unshare_iscsi(zfs_handle_t *zhp)
-{
-       return 0;
-}
-
-int
-zfs_unmount(zfs_handle_t *zhp, const char *mountpoint, int flags)
-{
-       return 0;
-}
-
-void
-remove_mountpoint(zfs_handle_t *zhp) {
-       return;
-}
-
-boolean_t
-is_mounted(libzfs_handle_t *zfs_hdl, const char *special, char **where)
-{
-       return B_FALSE;
-}
-
-boolean_t
-zfs_is_mounted(zfs_handle_t *zhp, char **where)
-{
-       return is_mounted(zhp->zfs_hdl, zfs_get_name(zhp), where);
-}
-
-boolean_t
-zfs_is_shared(zfs_handle_t *zhp)
-{
-       return B_FALSE;
-}
-
-int
-zpool_enable_datasets(zpool_handle_t *zhp, const char *mntopts, int flags)
-{
-       return B_FALSE;
-}
-
-int
-zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
-{
-       return B_FALSE;
-}
-#endif /* HAVE_ZPL */
index 37dba8d..163cd16 100644 (file)
@@ -727,9 +727,7 @@ libzfs_fini(libzfs_handle_t *hdl)
 #endif
        if (hdl->libzfs_sharetab)
                (void) fclose(hdl->libzfs_sharetab);
-#ifdef HAVE_ZPL
        zfs_uninit_libshare(hdl);
-#endif
        if (hdl->libzfs_log_str)
                (void) free(hdl->libzfs_log_str);
        zpool_free_handles(hdl);