summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2012-02-23 19:13:19 +0000
committermm <mm@FreeBSD.org>2012-02-23 19:13:19 +0000
commit4893c2aa29d31ac64397003e1a8767f84b25587e (patch)
tree9e5bb8fe23d903bc350479480dac7e5e91332f1a /cddl
parented3a2531c10fbd1590f221e54b69cc743b2c07ad (diff)
downloadFreeBSD-src-4893c2aa29d31ac64397003e1a8767f84b25587e.zip
FreeBSD-src-4893c2aa29d31ac64397003e1a8767f84b25587e.tar.gz
Import illumos changeset 13608 [1]:
add support for "-t <datatype>" argument to zfs get References: https://www.illumos.org/issues/1936 Update zfs(8) manpage in respect of [1]. Fix typo in zfs(8) manpage. Obtained from: illumos (issue #1936) MFC after: 1 week
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/cmd/zfs/zfs.816
-rw-r--r--cddl/contrib/opensolaris/cmd/zfs/zfs_main.c39
2 files changed, 49 insertions, 6 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs.8 b/cddl/contrib/opensolaris/cmd/zfs/zfs.8
index d1793ad..58e986f 100644
--- a/cddl/contrib/opensolaris/cmd/zfs/zfs.8
+++ b/cddl/contrib/opensolaris/cmd/zfs/zfs.8
@@ -1,5 +1,5 @@
'\" te
-.\" Copyright (c) 2011, Martin Matuska <mm@FreeBSD.org>.
+.\" Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>.
.\" All Rights Reserved.
.\"
.\" The contents of this file are subject to the terms of the
@@ -18,8 +18,8 @@
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
-.\" Copyright 2011 Nexenta Systems, Inc. All rights reserved.
.\" Copyright (c) 2011 by Delphix. All rights reserved.
+.\" Copyright (c) 2012 Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2011, Pawel Jakub Dawidek <pjd@FreeBSD.org>
.\"
.\" $FreeBSD$
@@ -113,6 +113,7 @@
.Op Fl r Ns | Ns Fl d Ar depth
.Op Fl Hp
.Op Fl o Ar all | field Ns Op , Ns Ar ...
+.Op Fl t Ar type Ns Op , Ns Ar ...
.Op Fl s Ar source Ns Op , Ns Ar ...
.Ar all | property Ns Op , Ns Ar ...
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
@@ -1753,7 +1754,7 @@ A comma-separated list of types to display, where
is one of
.Sy filesystem , snapshot , volume , No or Sy all .
For example, specifying
-.Fl o Cm snapshot
+.Fl t Cm snapshot
displays only snapshots.
.It Fl s Ar property
A property for sorting the output by column in ascending order based on the
@@ -1811,6 +1812,7 @@ section.
.Op Fl r Ns | Ns Fl d Ar depth
.Op Fl Hp
.Op Fl o Ar all | field Ns Op , Ns Ar ...
+.Op Fl t Ar type Ns Op , Ns Ar ...
.Op Fl s Ar source Ns Op , Ns Ar ...
.Ar all | property Ns Op , Ns Ar ...
.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
@@ -1871,6 +1873,14 @@ Default values are
The keyword
.Cm all
specifies all columns.
+.It Fl t Ar type Ns Op , Ns Ar ...
+A comma-separated list of types to display, where
+.Ar type
+is one of
+.Sy filesystem , snapshot , volume , No or Sy all .
+For example, specifying
+.Fl t Cm snapshot
+displays only snapshots.
.It Fl s Ar source Ns Op , Ns Ar ...
A comma-separated list of sources to display. Those properties coming from a
source other than those in this list are ignored. Each source must be one of
diff --git a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
index 30434cc..410246a 100644
--- a/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
+++ b/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
@@ -227,7 +227,8 @@ get_usage(zfs_help_t idx)
"<snapshot>[%<snapname>][,...]\n"));
case HELP_GET:
return (gettext("\tget [-rHp] [-d max] "
- "[-o \"all\" | field[,...]] [-s source[,...]]\n"
+ "[-o \"all\" | field[,...]] [-t type[,...]] "
+ "[-s source[,...]]\n"
"\t <\"all\" | property[,...]> "
"[filesystem|volume|snapshot] ...\n"));
case HELP_INHERIT:
@@ -1473,6 +1474,7 @@ zfs_do_get(int argc, char **argv)
{
zprop_get_cbdata_t cb = { 0 };
int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
+ int types = ZFS_TYPE_DATASET;
char *value, *fields;
int ret = 0;
int limit = 0;
@@ -1489,7 +1491,7 @@ zfs_do_get(int argc, char **argv)
cb.cb_type = ZFS_TYPE_DATASET;
/* check options */
- while ((c = getopt(argc, argv, ":d:o:s:rHp")) != -1) {
+ while ((c = getopt(argc, argv, ":d:o:s:rt:Hp")) != -1) {
switch (c) {
case 'p':
cb.cb_literal = B_TRUE;
@@ -1607,6 +1609,37 @@ zfs_do_get(int argc, char **argv)
}
break;
+ case 't':
+ types = 0;
+ flags &= ~ZFS_ITER_PROP_LISTSNAPS;
+ while (*optarg != '\0') {
+ static char *type_subopts[] = { "filesystem",
+ "volume", "snapshot", "all", NULL };
+
+ switch (getsubopt(&optarg, type_subopts,
+ &value)) {
+ case 0:
+ types |= ZFS_TYPE_FILESYSTEM;
+ break;
+ case 1:
+ types |= ZFS_TYPE_VOLUME;
+ break;
+ case 2:
+ types |= ZFS_TYPE_SNAPSHOT;
+ break;
+ case 3:
+ types = ZFS_TYPE_DATASET;
+ break;
+
+ default:
+ (void) fprintf(stderr,
+ gettext("invalid type '%s'\n"),
+ value);
+ usage(B_FALSE);
+ }
+ }
+ break;
+
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
@@ -1650,7 +1683,7 @@ zfs_do_get(int argc, char **argv)
cb.cb_first = B_TRUE;
/* run for each object */
- ret = zfs_for_each(argc, argv, flags, ZFS_TYPE_DATASET, NULL,
+ ret = zfs_for_each(argc, argv, flags, types, NULL,
&cb.cb_proplist, limit, get_callback, &cb);
if (cb.cb_proplist == &fake_name)
OpenPOWER on IntegriCloud