summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorAllan Jude <[email protected]>2020-09-25 17:37:10 -0400
committerGitHub <[email protected]>2020-09-25 14:37:10 -0700
commitcf2667759f4583bddd4b6ce8167e48b041ae1ea3 (patch)
tree5d824bb6c9054cbea04b06e450f4b1a9610ad8b0 /cmd
parentacfd2d4641a137a1a22c206597ef951d406a1cf6 (diff)
zfs userspace: use zfs_path_to_zhandle so argument can be a path
Change zfs userspace subcommand to use zfs_path_to_zhandle() so that the provided dataset can be a path (/usr) or a dataset (rpool/usr). Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Allan Jude <[email protected]> Closes #8915
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index 20579157d..42c180890 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -363,16 +363,16 @@ get_usage(zfs_help_t idx)
return (gettext("\tuserspace [-Hinp] [-o field[,...]] "
"[-s field] ...\n"
"\t [-S field] ... [-t type[,...]] "
- "<filesystem|snapshot>\n"));
+ "<filesystem|snapshot|path>\n"));
case HELP_GROUPSPACE:
return (gettext("\tgroupspace [-Hinp] [-o field[,...]] "
"[-s field] ...\n"
"\t [-S field] ... [-t type[,...]] "
- "<filesystem|snapshot>\n"));
+ "<filesystem|snapshot|path>\n"));
case HELP_PROJECTSPACE:
return (gettext("\tprojectspace [-Hp] [-o field[,...]] "
"[-s field] ... \n"
- "\t [-S field] ... <filesystem|snapshot>\n"));
+ "\t [-S field] ... <filesystem|snapshot|path>\n"));
case HELP_PROJECT:
return (gettext("\tproject [-d|-r] <directory|file ...>\n"
"\tproject -c [-0] [-d|-r] [-p id] <directory|file ...>\n"
@@ -2481,11 +2481,13 @@ zfs_do_upgrade(int argc, char **argv)
/*
* zfs userspace [-Hinp] [-o field[,...]] [-s field [-s field]...]
- * [-S field [-S field]...] [-t type[,...]] filesystem | snapshot
+ * [-S field [-S field]...] [-t type[,...]]
+ * filesystem | snapshot | path
* zfs groupspace [-Hinp] [-o field[,...]] [-s field [-s field]...]
- * [-S field [-S field]...] [-t type[,...]] filesystem | snapshot
+ * [-S field [-S field]...] [-t type[,...]]
+ * filesystem | snapshot | path
* zfs projectspace [-Hp] [-o field[,...]] [-s field [-s field]...]
- * [-S field [-S field]...] filesystem | snapshot
+ * [-S field [-S field]...] filesystem | snapshot | path
*
* -H Scripted mode; elide headers and separate columns by tabs.
* -i Translate SID to POSIX ID.
@@ -3191,7 +3193,7 @@ zfs_do_userspace(int argc, char **argv)
} while (delim != NULL);
}
- if ((zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM |
+ if ((zhp = zfs_path_to_zhandle(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM |
ZFS_TYPE_SNAPSHOT)) == NULL)
return (1);
if (zhp->zfs_head_type != ZFS_TYPE_FILESYSTEM) {