return (data);
}
+#ifdef HAVE_ZPL
static char *
safe_strdup(char *str)
{
return (dupstr);
}
+#endif /* HAVE_ZPL */
/*
* Callback routine that will print out information for each of
#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;
free(pt_header);
pt_header = NULL;
}
+#endif /* HAVE_ZPL */
+
/*
* zfs clone [-p] [-o prop=value] ... <snap> <fs | vol>
*
ret = zfs_clone(zhp, argv[1], props);
/* create the mountpoint if necessary */
+#ifdef HAVE_ZPL
if (ret == 0) {
zfs_handle_t *clone;
zfs_close(clone);
}
}
+#endif /* HAVE_ZPL */
zfs_close(zhp);
nvlist_free(props);
* 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 "
ret = 1;
}
}
+#endif /* HAVE_ZPL */
error:
if (zhp)
#define SPINNER_TIME 3 /* seconds */
#define MOUNT_TIME 5 /* seconds */
+#ifdef HAVE_ZPL
static int
get_one_dataset(zfs_handle_t *zhp, void *data)
{
return (ret);
}
+#endif /* HAVE_ZPL */
/*
* zfs mount -a [nfs]
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 */
}
/*
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;
return (ret);
}
+#endif /* HAVE_ZPL */
/*
* zfs unmount -a
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 */
}
/*
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 */
* Called when invoked as /etc/fs/zfs/mount. Do the mount if the mountpoint is
* 'legacy'. Otherwise, complain that use should be using 'zfs mount'.
*/
+#ifdef HAVE_ZPL
static int
manual_mount(int argc, char **argv)
{
return (unshare_unmount_path(OP_MOUNT, argv[0], flags, B_TRUE));
}
+#endif /* HAVE_ZPL */
static int
find_command_idx(char *command, int *idx)
{
int ret;
int i = 0;
+#ifdef HAVE_ZPL
char *progname;
+#endif
char *cmdname;
(void) setlocale(LC_ALL, "");
opterr = 0;
- if ((g_zfs = libzfs_init()) == NULL) {
- (void) fprintf(stderr, gettext("internal error: failed to "
- "initialize ZFS library\n"));
- return (1);
- }
-
- zpool_set_history_str("zfs", argc, argv, history_str);
- verify(zpool_stage_history(g_zfs, history_str) == 0);
-
- libzfs_print_on_error(g_zfs, B_TRUE);
-
if ((mnttab_file = fopen(MNTTAB, "r")) == NULL) {
(void) fprintf(stderr, gettext("internal error: unable to "
"open %s\n"), MNTTAB);
return (1);
}
+#ifdef HAVE_ZPL
/*
* This command also doubles as the /etc/fs mount and unmount program.
* Determine if we should take this behavior based on argv[0].
} else if (strcmp(progname, "umount") == 0) {
ret = manual_unmount(argc, argv);
} else {
+#else
+ {
+#endif /* HAVE_ZPL */
/*
* Make sure the user has specified some command.
*/
/*
* Special case '-?'
*/
- if (strcmp(cmdname, "-?") == 0)
+ if ((strcmp(cmdname, "-?") == 0) ||
+ (strcmp(cmdname, "--help") == 0))
usage(B_TRUE);
+ if ((g_zfs = libzfs_init()) == NULL)
+ return (1);
+
+ zpool_set_history_str("zfs", argc, argv, history_str);
+ verify(zpool_stage_history(g_zfs, history_str) == 0);
+
+ libzfs_print_on_error(g_zfs, B_TRUE);
+
/*
* Run the appropriate command.
*/