X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fzfs%2Fzfs_main.c;h=761c9f76a9fec578a9be85ebe1494e833daf7eea;hb=cf81b00a73fe47fdb21586ac1cc179b734540973;hp=82a6d569fcac852548cece15cb80d4ca148e940d;hpb=4c069d349440cbf1ebe234d65b53ab41eaea5569;p=zfs.git diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 82a6d56..761c9f7 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -229,7 +229,7 @@ get_usage(zfs_help_t idx) return (gettext("\tlist [-rH][-d max] " "[-o property[,...]] [-t type[,...]] [-s property] ...\n" "\t [-S property] ... " - "[filesystem|volume|snapshot] ...\n")); + "[filesystem|volume|snapshot|snap] ...\n")); case HELP_MOUNT: return (gettext("\tmount\n" "\tmount [-vO] [-o opts] <-a | filesystem>\n")); @@ -254,7 +254,7 @@ get_usage(zfs_help_t idx) case HELP_SHARE: return (gettext("\tshare <-a | filesystem>\n")); case HELP_SNAPSHOT: - return (gettext("\tsnapshot [-r] [-o property=value] ... " + return (gettext("\tsnapshot|snap [-r] [-o property=value] ... " "\n")); case HELP_UNMOUNT: return (gettext("\tunmount [-f] " @@ -2374,7 +2374,7 @@ zfs_do_userspace(int argc, char **argv) boolean_t prtnum = B_FALSE; boolean_t parseable = B_FALSE; boolean_t sid2posix = B_FALSE; - int error; + int error = 0; int c; zfs_sort_column_t *default_sortcol = NULL; zfs_sort_column_t *sortcol = NULL; @@ -2766,7 +2766,7 @@ zfs_do_list(int argc, char **argv) flags &= ~ZFS_ITER_PROP_LISTSNAPS; while (*optarg != '\0') { static char *type_subopts[] = { "filesystem", - "volume", "snapshot", "all", NULL }; + "volume", "snapshot", "snap", "all", NULL }; switch (getsubopt(&optarg, type_subopts, &value)) { @@ -2777,9 +2777,10 @@ zfs_do_list(int argc, char **argv) types |= ZFS_TYPE_VOLUME; break; case 2: + case 3: types |= ZFS_TYPE_SNAPSHOT; break; - case 3: + case 4: types = ZFS_TYPE_DATASET; break; @@ -2834,7 +2835,7 @@ zfs_do_list(int argc, char **argv) zfs_free_sort_columns(sortcol); if (ret == 0 && cb.cb_first && !cb.cb_scripted) - (void) printf(gettext("no datasets available\n")); + (void) fprintf(stderr, gettext("no datasets available\n")); return (ret); } @@ -5139,7 +5140,7 @@ zfs_do_holds(int argc, char **argv) print_holds(scripted, cb.cb_max_namelen, cb.cb_max_taglen, nvl); if (nvlist_empty(nvl)) - (void) printf(gettext("no datasets available\n")); + (void) fprintf(stderr, gettext("no datasets available\n")); nvlist_free(nvl); @@ -5469,7 +5470,7 @@ share_mount(int op, int argc, char **argv) int flags = 0; /* check options */ - while ((c = getopt(argc, argv, op == OP_MOUNT ? ":avo:" : "a")) + while ((c = getopt(argc, argv, op == OP_MOUNT ? ":avo:O" : "a")) != -1) { switch (c) { case 'a': @@ -5491,7 +5492,9 @@ share_mount(int op, int argc, char **argv) /* option validation is done later */ append_options(options, optarg); break; - + case 'O': + flags |= MS_OVERLAY; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -6160,6 +6163,12 @@ main(int argc, char **argv) cmdname = "receive"; /* + * The 'snap' command is an alias for 'snapshot' + */ + if (strcmp(cmdname, "snap") == 0) + cmdname = "snapshot"; + + /* * Special case '-?' */ if ((strcmp(cmdname, "-?") == 0) ||