Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170701476
D3994.id9687.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D3994.id9687.diff
View Options
Index: cddl/contrib/opensolaris/cmd/zfs/zfs.8
===================================================================
--- cddl/contrib/opensolaris/cmd/zfs/zfs.8
+++ cddl/contrib/opensolaris/cmd/zfs/zfs.8
@@ -31,7 +31,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 14, 2015
+.Dd October 24, 2015
.Dt ZFS 8
.Os
.Sh NAME
@@ -272,8 +272,10 @@
.Ar tag snapshot Ns ...
.Nm
.Cm holds
-.Op Fl r
-.Ar snapshot Ns ...
+.Op Fl Hp
+.Op Fl r Ns | Ns Fl d Ar depth
+.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot Ns
+.Ns ...
.Nm
.Cm release
.Op Fl r
Index: cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
===================================================================
--- cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
+++ cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
@@ -329,7 +329,8 @@
case HELP_HOLD:
return (gettext("\thold [-r] <tag> <snapshot> ...\n"));
case HELP_HOLDS:
- return (gettext("\tholds [-r] <snapshot> ...\n"));
+ return (gettext("\tholds [-Hp] [-r|-d depth] "
+ "<filesystem|volume|snapshot> ...\n"));
case HELP_RELEASE:
return (gettext("\trelease [-r] <tag> <snapshot> ...\n"));
case HELP_DIFF:
@@ -5543,7 +5544,8 @@
*
*/
static void
-print_holds(boolean_t scripted, size_t nwidth, size_t tagwidth, nvlist_t *nvl)
+print_holds(boolean_t scripted, boolean_t literal, size_t nwidth,
+ size_t tagwidth, nvlist_t *nvl)
{
int i;
nvpair_t *nvp = NULL;
@@ -5576,10 +5578,14 @@
size_t sepnum = scripted ? 1 : 2;
(void) nvpair_value_uint64(nvp2, &val);
- time = (time_t)val;
- (void) localtime_r(&time, &t);
- (void) strftime(tsbuf, DATETIME_BUF_LEN,
- gettext(STRFTIME_FMT_STR), &t);
+ if (literal)
+ snprintf(tsbuf, DATETIME_BUF_LEN, "%llu", val);
+ else {
+ time = (time_t)val;
+ (void) localtime_r(&time, &t);
+ (void) strftime(tsbuf, DATETIME_BUF_LEN,
+ gettext(STRFTIME_FMT_STR), &t);
+ }
(void) printf("%-*s%*c%-*s%*c%s\n", nwidth, zname,
sepnum, sep, tagwidth, tagname, sepnum, sep, tsbuf);
@@ -5600,7 +5606,7 @@
const char *zname = zfs_get_name(zhp);
size_t znamelen = strnlen(zname, ZFS_MAXNAMELEN);
- if (cbp->cb_recursive) {
+ if (cbp->cb_recursive && cbp->cb_snapname != NULL) {
const char *snapname;
char *delim = strchr(zname, '@');
if (delim == NULL)
@@ -5628,9 +5634,12 @@
}
/*
- * zfs holds [-r] <snap> ...
+ * zfs holds [-Hp] [-r | -d max] <dataset|snap> ...
*
- * -r Recursively hold
+ * -H Suppress header output
+ * -p Output literal values
+ * -r Recursively search for holds
+ * -d max Limit depth of recursive search
*/
static int
zfs_do_holds(int argc, char **argv)
@@ -5639,8 +5648,9 @@
int c;
int i;
boolean_t scripted = B_FALSE;
+ boolean_t literal = B_FALSE;
boolean_t recursive = B_FALSE;
- const char *opts = "rH";
+ const char *opts = "d:rHp";
nvlist_t *nvl;
int types = ZFS_TYPE_SNAPSHOT;
@@ -5653,12 +5663,19 @@
/* check options */
while ((c = getopt(argc, argv, opts)) != -1) {
switch (c) {
+ case 'd':
+ limit = parse_depth(optarg, &flags);
+ recursive = B_TRUE;
+ break;
case 'r':
recursive = B_TRUE;
break;
case 'H':
scripted = B_TRUE;
break;
+ case 'p':
+ literal = B_TRUE;
+ break;
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
@@ -5684,18 +5701,14 @@
for (i = 0; i < argc; ++i) {
char *snapshot = argv[i];
const char *delim;
- const char *snapname;
+ const char *snapname = NULL;
delim = strchr(snapshot, '@');
- if (delim == NULL) {
- (void) fprintf(stderr,
- gettext("'%s' is not a snapshot\n"), snapshot);
- ++errors;
- continue;
+ if (delim != NULL) {
+ snapname = delim + 1;
+ if (recursive)
+ snapshot[delim - snapshot] = '\0';
}
- snapname = delim + 1;
- if (recursive)
- snapshot[delim - snapshot] = '\0';
cb.cb_recursive = recursive;
cb.cb_snapname = snapname;
@@ -5713,7 +5726,8 @@
/*
* 2. print holds data
*/
- print_holds(scripted, cb.cb_max_namelen, cb.cb_max_taglen, nvl);
+ print_holds(scripted, literal, cb.cb_max_namelen, cb.cb_max_taglen,
+ nvl);
if (nvlist_empty(nvl))
(void) printf(gettext("no datasets available\n"));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 7, 2:38 AM (16 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38405755
Default Alt Text
D3994.id9687.diff (4 KB)
Attached To
Mode
D3994: Extend 'zfs holds -r' to accept a dataset, instead of only a snapshot as input
Attached
Detach File
Event Timeline
Log In to Comment