Skip to content

Commit

Permalink
zfs get: add '-t fs' and '-t vol' options
Browse files Browse the repository at this point in the history
Make `zfs get` accept `fs` for `filesystem` and `vol` for `volume`.

Reviewed-by: Rob Norris <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan <[email protected]>
Closes #16117
  • Loading branch information
ErrorNoInternet authored Apr 22, 2024
1 parent 7e52795 commit c346068
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
22 changes: 16 additions & 6 deletions cmd/zfs/zfs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2146,15 +2146,25 @@ found2:;

for (char *tok; (tok = strsep(&optarg, ",")); ) {
static const char *const type_opts[] = {
"filesystem", "volume",
"snapshot", "snap",
"filesystem",
"fs",
"volume",
"vol",
"snapshot",
"snap",
"bookmark",
"all" };
"all"
};
static const int type_types[] = {
ZFS_TYPE_FILESYSTEM, ZFS_TYPE_VOLUME,
ZFS_TYPE_SNAPSHOT, ZFS_TYPE_SNAPSHOT,
ZFS_TYPE_FILESYSTEM,
ZFS_TYPE_FILESYSTEM,
ZFS_TYPE_VOLUME,
ZFS_TYPE_VOLUME,
ZFS_TYPE_SNAPSHOT,
ZFS_TYPE_SNAPSHOT,
ZFS_TYPE_BOOKMARK,
ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK };
ZFS_TYPE_DATASET | ZFS_TYPE_BOOKMARK
};

for (i = 0; i < ARRAY_SIZE(type_opts); ++i)
if (strcmp(tok, type_opts[i]) == 0) {
Expand Down
11 changes: 10 additions & 1 deletion man/man8/zfs-set.8
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
.\" Copyright 2018 Nexenta Systems, Inc.
.\" Copyright 2019 Joyent, Inc.
.\"
.Dd March 16, 2022
.Dd April 20, 2024
.Dt ZFS-SET 8
.Os
.
Expand Down Expand Up @@ -158,6 +158,15 @@ A comma-separated list of types to display, where
.Ar type
is one of
.Sy filesystem , snapshot , volume , bookmark , No or Sy all .
.Sy fs ,
.Sy snap ,
or
.Sy vol
can be used as aliases for
.Sy filesystem ,
.Sy snapshot ,
or
.Sy volume .
.El
.It Xo
.Nm zfs
Expand Down

0 comments on commit c346068

Please sign in to comment.