"\tupgrade -v\n"
"\tupgrade [-V version] <-a | pool ...>\n"));
case HELP_EVENTS:
- return (gettext("\tevents [-vfc]\n"));
+ return (gettext("\tevents [-vHfc]\n"));
case HELP_GET:
return (gettext("\tget <\"all\" | property[,...]> "
"<pool> ...\n"));
}
/* pass off to get_vdev_spec for processing */
- nvroot = make_root_vdev(zhp, force, !force, B_FALSE, dryrun,
+ nvroot = make_root_vdev(zhp, NULL, force, !force, B_FALSE, dryrun,
argc, argv);
if (nvroot == NULL) {
zpool_close(zhp);
}
/* pass off to get_vdev_spec for bulk processing */
- nvroot = make_root_vdev(NULL, force, !force, B_FALSE, dryrun,
+ nvroot = make_root_vdev(NULL, props, force, !force, B_FALSE, dryrun,
argc - 1, argv + 1);
if (nvroot == NULL)
goto errout;
(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 "
mountpoint);
}
-#ifdef HAVE_ZPL
if ((dirp = opendir(buf)) == NULL && errno != ENOENT) {
(void) fprintf(stderr, gettext("mountpoint '%s' : "
"%s\n"), buf, strerror(errno));
goto errout;
}
}
-#endif /* HAVE_ZPL */
}
if (dryrun) {
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) {
if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID,
&hostid) == 0) {
- if ((unsigned long)hostid != gethostid()) {
+ unsigned long system_hostid = gethostid() & 0xffffffff;
+
+ if ((unsigned long)hostid != system_hostid) {
char *hostname;
uint64_t timestamp;
time_t t;
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);
pool_list_update(list);
if ((npools = pool_list_count(list)) == 0)
- break;
-
- /*
- * Refresh all statistics. This is done as an explicit step
- * before calculating the maximum name width, so that any
- * configuration changes are properly accounted for.
- */
- (void) pool_list_iter(list, B_FALSE, refresh_iostat, &cb);
+ (void) printf(gettext("no pools available\n"));
+ else {
+ /*
+ * Refresh all statistics. This is done as an
+ * explicit step before calculating the maximum name
+ * width, so that any * configuration changes are
+ * properly accounted for.
+ */
+ (void) pool_list_iter(list, B_FALSE, refresh_iostat,
+ &cb);
- /*
- * Iterate over all pools to determine the maximum width
- * for the pool / device name column across all pools.
- */
- cb.cb_namewidth = 0;
- (void) pool_list_iter(list, B_FALSE, get_namewidth, &cb);
+ /*
+ * Iterate over all pools to determine the maximum width
+ * for the pool / device name column across all pools.
+ */
+ cb.cb_namewidth = 0;
+ (void) pool_list_iter(list, B_FALSE, get_namewidth,
+ &cb);
- if (timestamp_fmt != NODATE)
- print_timestamp(timestamp_fmt);
+ if (timestamp_fmt != NODATE)
+ print_timestamp(timestamp_fmt);
- /*
- * If it's the first time, or verbose mode, print the header.
- */
- if (++cb.cb_iteration == 1 || verbose)
- print_iostat_header(&cb);
+ /*
+ * If it's the first time, or verbose mode, print the
+ * header.
+ */
+ if (++cb.cb_iteration == 1 || verbose)
+ print_iostat_header(&cb);
- (void) pool_list_iter(list, B_FALSE, print_iostat, &cb);
+ (void) pool_list_iter(list, B_FALSE, print_iostat, &cb);
- /*
- * If there's more than one pool, and we're not in verbose mode
- * (which prints a separator for us), then print a separator.
- */
- if (npools > 1 && !verbose)
- print_iostat_separator(&cb);
+ /*
+ * If there's more than one pool, and we're not in
+ * verbose mode (which prints a separator for us),
+ * then print a separator.
+ */
+ if (npools > 1 && !verbose)
+ print_iostat_separator(&cb);
- if (verbose)
- (void) printf("\n");
+ if (verbose)
+ (void) printf("\n");
+ }
/*
* Flush the output so that redirection to a file isn't buffered
ret = for_each_pool(argc, argv, B_TRUE, &cb.cb_proplist,
list_callback, &cb);
- if (argc == 0 && cb.cb_first && !cb.cb_scripted) {
+ if (argc == 0 && cb.cb_first)
(void) printf(gettext("no pools available\n"));
+ else if (argc && cb.cb_first) {
+ /* cannot open the given pool */
zprop_free_list(cb.cb_proplist);
- return (0);
+ return (1);
}
if (interval == 0)
return (1);
}
- nvroot = make_root_vdev(zhp, force, B_FALSE, replacing, B_FALSE,
+ nvroot = make_root_vdev(zhp, NULL, force, B_FALSE, replacing, B_FALSE,
argc, argv);
if (nvroot == NULL) {
zpool_close(zhp);
typedef struct ev_opts {
int verbose;
+ int scripted;
int follow;
int clear;
} ev_opts_t;
printf(gettext("(embedded nvlist)\n"));
(void) nvpair_value_nvlist(nvp, &cnv);
zpool_do_events_nvprint(cnv, depth + 8);
- printf(gettext("%*s(end %s)\n"), depth, "", name);
+ printf(gettext("%*s(end %s)"), depth, "", name);
break;
case DATA_TYPE_NVLIST_ARRAY: {
cleanup_fd = open(ZFS_DEV, O_RDWR);
VERIFY(cleanup_fd >= 0);
- (void) printf(gettext("%-30s %s\n"), "TIME", "CLASS");
+ if (!opts->scripted)
+ (void) printf(gettext("%-30s %s\n"), "TIME", "CLASS");
while (1) {
ret = zpool_events_next(g_zfs, &nvl, &dropped,
int c;
/* check options */
- while ((c = getopt(argc, argv, "vfc")) != -1) {
+ while ((c = getopt(argc, argv, "vHfc")) != -1) {
switch (c) {
case 'v':
opts.verbose = 1;
break;
+ case 'H':
+ opts.scripted = 1;
+ break;
case 'f':
opts.follow = 1;
break;