diff options
Diffstat (limited to 'cmd/zfs/zfs_main.c')
-rw-r--r-- | cmd/zfs/zfs_main.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 21c4d4334..57eb30528 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -1922,6 +1922,16 @@ 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>'). + */ + if (types == ZFS_TYPE_SNAPSHOT && + (flags & ZFS_ITER_RECURSE) == 0 && limit == 0) { + flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE); + limit = 1; + } + if (zprop_get_list(g_zfs, fields, &cb.cb_proplist, ZFS_TYPE_DATASET) != 0) usage(B_FALSE); @@ -3417,6 +3427,16 @@ 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>'). + */ + if (types == ZFS_TYPE_SNAPSHOT && + (flags & ZFS_ITER_RECURSE) == 0 && limit == 0) { + flags |= (ZFS_ITER_DEPTH_LIMIT | ZFS_ITER_RECURSE); + limit = 1; + } + + /* * If the user specifies '-o all', the zprop_get_list() doesn't * normally include the name of the dataset. For 'zfs list', we always * want this property to be first. |