Remove HAVE_ZPL from commands and libraries

Thanks to the previous few commits we can now build all of the
user space commands and libraries with support for the zpl.
This commit is contained in:
Brian Behlendorf 2010-12-16 15:11:40 -08:00
parent 9a616b5d17
commit b4ead57cfb
7 changed files with 0 additions and 139 deletions

View File

@ -318,7 +318,6 @@ safe_malloc(size_t size)
return (data); return (data);
} }
#ifdef HAVE_ZPL
static char * static char *
safe_strdup(char *str) safe_strdup(char *str)
{ {
@ -329,7 +328,6 @@ safe_strdup(char *str)
return (dupstr); return (dupstr);
} }
#endif /* HAVE_ZPL */
/* /*
* Callback routine that will print out information for each of * 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 */ #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 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 time_t pt_begin;
static char *pt_header = NULL; static char *pt_header = NULL;
@ -549,7 +546,6 @@ finish_progress(char *done)
free(pt_header); free(pt_header);
pt_header = NULL; pt_header = NULL;
} }
#endif /* HAVE_ZPL */
/* /*
* zfs clone [-p] [-o prop=value] ... <snap> <fs | vol> * 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); ret = zfs_clone(zhp, argv[1], props);
/* create the mountpoint if necessary */ /* create the mountpoint if necessary */
#ifdef HAVE_ZPL
if (ret == 0) { if (ret == 0) {
zfs_handle_t *clone; zfs_handle_t *clone;
@ -643,7 +638,6 @@ zfs_do_clone(int argc, char **argv)
zfs_close(clone); zfs_close(clone);
} }
} }
#endif /* HAVE_ZPL */
zfs_close(zhp); zfs_close(zhp);
nvlist_free(props); 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 * verbose error message to let the user know that their filesystem was
* in fact created, even if we failed to mount or share it. * in fact created, even if we failed to mount or share it.
*/ */
#ifdef HAVE_ZPL
if (canmount == ZFS_CANMOUNT_ON) { if (canmount == ZFS_CANMOUNT_ON) {
if (zfs_mount(zhp, NULL, 0) != 0) { if (zfs_mount(zhp, NULL, 0) != 0) {
(void) fprintf(stderr, gettext("filesystem " (void) fprintf(stderr, gettext("filesystem "
@ -843,7 +836,6 @@ zfs_do_create(int argc, char **argv)
ret = 1; ret = 1;
} }
} }
#endif /* HAVE_ZPL */
error: error:
if (zhp) if (zhp)
@ -2340,7 +2332,6 @@ typedef struct rollback_cbdata {
* 'cb_dependent' is set, then this is a dependent and we should report it * 'cb_dependent' is set, then this is a dependent and we should report it
* without checking the transaction group. * without checking the transaction group.
*/ */
#ifdef HAVE_ZPL
static int static int
rollback_check(zfs_handle_t *zhp, void *data) rollback_check(zfs_handle_t *zhp, void *data)
{ {
@ -2400,12 +2391,10 @@ rollback_check(zfs_handle_t *zhp, void *data)
zfs_close(zhp); zfs_close(zhp);
return (0); return (0);
} }
#endif /* HAVE_ZPL */
static int static int
zfs_do_rollback(int argc, char **argv) zfs_do_rollback(int argc, char **argv)
{ {
#ifdef HAVE_ZPL
int ret; int ret;
int c; int c;
boolean_t force = B_FALSE; boolean_t force = B_FALSE;
@ -2487,9 +2476,6 @@ out:
return (0); return (0);
else else
return (1); 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 SPINNER_TIME 3 /* seconds */
#define MOUNT_TIME 5 /* seconds */ #define MOUNT_TIME 5 /* seconds */
#ifdef HAVE_ZPL
static int static int
get_one_dataset(zfs_handle_t *zhp, void *data) get_one_dataset(zfs_handle_t *zhp, void *data)
{ {
@ -3400,7 +3385,6 @@ share_mount(int op, int argc, char **argv)
return (ret); return (ret);
} }
#endif /* HAVE_ZPL */
/* /*
* zfs mount -a [nfs] * zfs mount -a [nfs]
@ -3411,11 +3395,7 @@ share_mount(int op, int argc, char **argv)
static int static int
zfs_do_mount(int argc, char **argv) zfs_do_mount(int argc, char **argv)
{ {
#ifdef HAVE_ZPL
return (share_mount(OP_MOUNT, argc, argv)); 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 static int
zfs_do_share(int argc, char **argv) zfs_do_share(int argc, char **argv)
{ {
#ifdef HAVE_ZPL
return (share_mount(OP_SHARE, argc, argv)); return (share_mount(OP_SHARE, argc, argv));
#else
return ENOSYS;
#endif /* HAVE_ZPL */
} }
#ifdef HAVE_ZPL
typedef struct unshare_unmount_node { typedef struct unshare_unmount_node {
zfs_handle_t *un_zhp; zfs_handle_t *un_zhp;
char *un_mountp; char *un_mountp;
@ -3818,7 +3793,6 @@ unshare_unmount(int op, int argc, char **argv)
return (ret); return (ret);
} }
#endif /* HAVE_ZPL */
/* /*
* zfs unmount -a * zfs unmount -a
@ -3829,11 +3803,7 @@ unshare_unmount(int op, int argc, char **argv)
static int static int
zfs_do_unmount(int argc, char **argv) zfs_do_unmount(int argc, char **argv)
{ {
#ifdef HAVE_ZPL
return (unshare_unmount(OP_MOUNT, argc, argv)); 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 static int
zfs_do_unshare(int argc, char **argv) zfs_do_unshare(int argc, char **argv)
{ {
#ifdef HAVE_ZPL
return (unshare_unmount(OP_SHARE, argc, argv)); return (unshare_unmount(OP_SHARE, argc, argv));
#else
return ENOSYS;
#endif /* HAVE_ZPL */
} }
/* ARGSUSED */ /* ARGSUSED */

View File

@ -951,20 +951,16 @@ main(int argc, char **argv)
if (dataset[0] != '\0' && domount) { if (dataset[0] != '\0' && domount) {
if ((zhp = zfs_open(g_zfs, dataset, ZFS_TYPE_DATASET)) == NULL) if ((zhp = zfs_open(g_zfs, dataset, ZFS_TYPE_DATASET)) == NULL)
return (1); return (1);
#ifdef HAVE_ZPL
if (zfs_unmount(zhp, NULL, 0) != 0) if (zfs_unmount(zhp, NULL, 0) != 0)
return (1); return (1);
#endif /* HAVE_ZPL */
} }
record.zi_error = error; record.zi_error = error;
ret = register_handler(pool, flags, &record, quiet); ret = register_handler(pool, flags, &record, quiet);
#ifdef HAVE_ZPL
if (dataset[0] != '\0' && domount) if (dataset[0] != '\0' && domount)
ret = (zfs_mount(zhp, NULL, 0) != 0); ret = (zfs_mount(zhp, NULL, 0) != 0);
#endif /* HAVE_ZPL */
libzfs_fini(g_zfs); libzfs_fini(g_zfs);

View File

@ -716,9 +716,7 @@ zpool_do_create(int argc, char **argv)
(strcmp(mountpoint, ZFS_MOUNTPOINT_LEGACY) != 0 && (strcmp(mountpoint, ZFS_MOUNTPOINT_LEGACY) != 0 &&
strcmp(mountpoint, ZFS_MOUNTPOINT_NONE) != 0)) { strcmp(mountpoint, ZFS_MOUNTPOINT_NONE) != 0)) {
char buf[MAXPATHLEN]; char buf[MAXPATHLEN];
#ifdef HAVE_ZPL
DIR *dirp; DIR *dirp;
#endif
if (mountpoint && mountpoint[0] != '/') { if (mountpoint && mountpoint[0] != '/') {
(void) fprintf(stderr, gettext("invalid mountpoint " (void) fprintf(stderr, gettext("invalid mountpoint "
@ -743,7 +741,6 @@ zpool_do_create(int argc, char **argv)
mountpoint); mountpoint);
} }
#ifdef HAVE_ZPL
if ((dirp = opendir(buf)) == NULL && errno != ENOENT) { if ((dirp = opendir(buf)) == NULL && errno != ENOENT) {
(void) fprintf(stderr, gettext("mountpoint '%s' : " (void) fprintf(stderr, gettext("mountpoint '%s' : "
"%s\n"), buf, strerror(errno)); "%s\n"), buf, strerror(errno));
@ -766,7 +763,6 @@ zpool_do_create(int argc, char **argv)
goto errout; goto errout;
} }
} }
#endif /* HAVE_ZPL */
} }
if (dryrun) { if (dryrun) {
@ -797,12 +793,8 @@ zpool_do_create(int argc, char **argv)
zfs_prop_to_name( zfs_prop_to_name(
ZFS_PROP_MOUNTPOINT), ZFS_PROP_MOUNTPOINT),
mountpoint) == 0); mountpoint) == 0);
#ifdef HAVE_ZPL
if (zfs_mount(pool, NULL, 0) == 0) if (zfs_mount(pool, NULL, 0) == 0)
ret = zfs_shareall(pool); ret = zfs_shareall(pool);
#else
ret = 0;
#endif /* HAVE_ZPL */
zfs_close(pool); zfs_close(pool);
} }
} else if (libzfs_errno(g_zfs) == EZFS_INVALIDNAME) { } 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) if ((zhp = zpool_open_canfail(g_zfs, name)) == NULL)
return (1); return (1);
#if HAVE_ZPL
if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL && if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL &&
!(flags & ZFS_IMPORT_ONLY) && !(flags & ZFS_IMPORT_ONLY) &&
zpool_enable_datasets(zhp, mntopts, 0) != 0) { zpool_enable_datasets(zhp, mntopts, 0) != 0) {
zpool_close(zhp); zpool_close(zhp);
return (1); return (1);
} }
#endif /* HAVE_ZPL */
zpool_close(zhp); zpool_close(zhp);
return (0); return (0);

View File

@ -93,7 +93,6 @@ struct prop_changelist {
int int
changelist_prefix(prop_changelist_t *clp) changelist_prefix(prop_changelist_t *clp)
{ {
#ifdef HAVE_ZPL
prop_changenode_t *cn; prop_changenode_t *cn;
int ret = 0; int ret = 0;
@ -142,9 +141,6 @@ changelist_prefix(prop_changelist_t *clp)
(void) changelist_postfix(clp); (void) changelist_postfix(clp);
return (ret); return (ret);
#else
return 0;
#endif /* HAVE_ZPL */
} }
/* /*
@ -159,7 +155,6 @@ changelist_prefix(prop_changelist_t *clp)
int int
changelist_postfix(prop_changelist_t *clp) changelist_postfix(prop_changelist_t *clp)
{ {
#ifdef HAVE_ZPL
prop_changenode_t *cn; prop_changenode_t *cn;
char shareopts[ZFS_MAXPROPLEN]; char shareopts[ZFS_MAXPROPLEN];
int errors = 0; int errors = 0;
@ -260,9 +255,6 @@ changelist_postfix(prop_changelist_t *clp)
} }
return (errors ? -1 : 0); 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 int
changelist_unshare(prop_changelist_t *clp, zfs_share_proto_t *proto) changelist_unshare(prop_changelist_t *clp, zfs_share_proto_t *proto)
{ {
#ifdef HAVE_ZPL
prop_changenode_t *cn; prop_changenode_t *cn;
int ret = 0; int ret = 0;
@ -340,9 +331,6 @@ changelist_unshare(prop_changelist_t *clp, zfs_share_proto_t *proto)
} }
return (ret); return (ret);
#else
return 0;
#endif
} }
/* /*

View File

@ -995,7 +995,6 @@ badlabel:
/*FALLTHRU*/ /*FALLTHRU*/
#ifdef HAVE_ZPL
case ZFS_PROP_SHARESMB: case ZFS_PROP_SHARESMB:
case ZFS_PROP_SHARENFS: case ZFS_PROP_SHARENFS:
/* /*
@ -1106,7 +1105,6 @@ badlabel:
} }
break; break;
#endif /* HAVE_ZPL */
case ZFS_PROP_UTF8ONLY: case ZFS_PROP_UTF8ONLY:
chosen_utf = (int)intval; chosen_utf = (int)intval;
break; break;
@ -2745,7 +2743,6 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
goto ancestorerr; goto ancestorerr;
} }
#ifdef HAVE_ZPL
if (zfs_mount(h, NULL, 0) != 0) { if (zfs_mount(h, NULL, 0) != 0) {
opname = dgettext(TEXT_DOMAIN, "mount"); opname = dgettext(TEXT_DOMAIN, "mount");
goto ancestorerr; goto ancestorerr;
@ -2755,7 +2752,6 @@ create_parents(libzfs_handle_t *hdl, char *target, int prefixlen)
opname = dgettext(TEXT_DOMAIN, "share"); opname = dgettext(TEXT_DOMAIN, "share");
goto ancestorerr; goto ancestorerr;
} }
#endif /* HAVE_ZPL */
zfs_close(h); zfs_close(h);
} }
@ -4037,28 +4033,6 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received)
return (0); 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 void
zfs_prune_proplist(zfs_handle_t *zhp, uint8_t *props) zfs_prune_proplist(zfs_handle_t *zhp, uint8_t *props)
{ {

View File

@ -84,7 +84,6 @@
#include <sys/systeminfo.h> #include <sys/systeminfo.h>
#define MAXISALEN 257 /* based on sysinfo(2) man page */ #define MAXISALEN 257 /* based on sysinfo(2) man page */
#ifdef HAVE_ZPL
static int zfs_share_proto(zfs_handle_t *, zfs_share_proto_t *); 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_type_t zfs_is_shared_proto(zfs_handle_t *, char **,
zfs_share_proto_t); zfs_share_proto_t);
@ -1343,53 +1342,3 @@ out:
return (ret); 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 */

View File

@ -727,9 +727,7 @@ libzfs_fini(libzfs_handle_t *hdl)
#endif #endif
if (hdl->libzfs_sharetab) if (hdl->libzfs_sharetab)
(void) fclose(hdl->libzfs_sharetab); (void) fclose(hdl->libzfs_sharetab);
#ifdef HAVE_ZPL
zfs_uninit_libshare(hdl); zfs_uninit_libshare(hdl);
#endif
if (hdl->libzfs_log_str) if (hdl->libzfs_log_str)
(void) free(hdl->libzfs_log_str); (void) free(hdl->libzfs_log_str);
zpool_free_handles(hdl); zpool_free_handles(hdl);