mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Remove requirement for -d 1 for zfs list and zfs get with bookmarks
df58307 removed the need to specify -d 1 when zfs list and zfs get are
called with -t snapshot on a datset. This commit extends the same
behaviour to -t bookmark.
This commit also introduces the 'snap' shorthand for snapshots from
zfs list to zfs get.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Kjeld Schouten <kjeld@schouten-lebbing.nl>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes #9589
This commit is contained in:
committed by
Brian Behlendorf
parent
7ae3f8dc8f
commit
8221bcf1e4
+12
-11
@@ -1965,7 +1965,7 @@ zfs_do_get(int argc, char **argv)
|
||||
flags &= ~ZFS_ITER_PROP_LISTSNAPS;
|
||||
while (*optarg != '\0') {
|
||||
static char *type_subopts[] = { "filesystem",
|
||||
"volume", "snapshot", "bookmark",
|
||||
"volume", "snapshot", "snap", "bookmark",
|
||||
"all", NULL };
|
||||
|
||||
switch (getsubopt(&optarg, type_subopts,
|
||||
@@ -1977,12 +1977,13 @@ zfs_do_get(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_BOOKMARK;
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
types = ZFS_TYPE_DATASET |
|
||||
ZFS_TYPE_BOOKMARK;
|
||||
break;
|
||||
@@ -2015,11 +2016,11 @@ zfs_do_get(int argc, char **argv)
|
||||
fields = argv[0];
|
||||
|
||||
/*
|
||||
* Handle users who want to get all snapshots of the current
|
||||
* dataset (ex. 'zfs get -t snapshot refer <dataset>').
|
||||
* Handle users who want to get all snapshots or bookmarks
|
||||
* of a dataset (ex. 'zfs get -t snapshot refer <dataset>').
|
||||
*/
|
||||
if (types == ZFS_TYPE_SNAPSHOT && argc > 1 &&
|
||||
(flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
|
||||
if ((types == ZFS_TYPE_SNAPSHOT || types == ZFS_TYPE_BOOKMARK) &&
|
||||
argc > 1 && (flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
|
||||
flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE);
|
||||
limit = 1;
|
||||
}
|
||||
@@ -3519,11 +3520,11 @@ zfs_do_list(int argc, char **argv)
|
||||
types &= ~ZFS_TYPE_SNAPSHOT;
|
||||
|
||||
/*
|
||||
* Handle users who want to list all snapshots of the current
|
||||
* dataset (ex. 'zfs list -t snapshot <dataset>').
|
||||
* Handle users who want to list all snapshots or bookmarks
|
||||
* of the current dataset (ex. 'zfs list -t snapshot <dataset>').
|
||||
*/
|
||||
if (types == ZFS_TYPE_SNAPSHOT && argc > 0 &&
|
||||
(flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
|
||||
if ((types == ZFS_TYPE_SNAPSHOT || types == ZFS_TYPE_BOOKMARK) &&
|
||||
argc > 0 && (flags & ZFS_ITER_RECURSE) == 0 && limit == 0) {
|
||||
flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE);
|
||||
limit = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user