X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fzpool%2Fzpool_main.c;h=3b8157392f37b8e7ebaf929ee5e9947b561c9fdd;hb=492b8e9e7b6f3df55eed04f7288db6b62c17c668;hp=3859bf737a382287f493ebdb5463b75acd89bb0a;hpb=9b020fd97a3dc449a94baec028b30b1fe3c2d5bc;p=zfs.git diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 3859bf7..3b81573 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -241,7 +241,7 @@ get_usage(zpool_help_t idx) { "\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[,...]> " " ...\n")); @@ -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) { @@ -1541,7 +1533,9 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts, 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; @@ -1579,14 +1573,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); @@ -4228,6 +4220,7 @@ zpool_do_history(int argc, char **argv) typedef struct ev_opts { int verbose; + int scripted; int follow; int clear; } ev_opts_t; @@ -4342,7 +4335,7 @@ zpool_do_events_nvprint(nvlist_t *nvl, int depth) 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: { @@ -4472,7 +4465,8 @@ zpool_do_events_next(ev_opts_t *opts) 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, @@ -4523,11 +4517,14 @@ zpool_do_events(int argc, char **argv) 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;