mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-27 16:39:08 +00:00
MFV r258384:
2583 Add -p (parsable) option to zfs list illumos/illumos-gate@43d68d68c1 MFC after: 2 weeks
This commit is contained in:
commit
4e5c0539bb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259850
@ -29,7 +29,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd October 23, 2013
|
.Dd December 24, 2013
|
||||||
.Dt ZFS 8
|
.Dt ZFS 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -102,7 +102,7 @@
|
|||||||
.Nm
|
.Nm
|
||||||
.Cm list
|
.Cm list
|
||||||
.Op Fl r Ns | Ns Fl d Ar depth
|
.Op Fl r Ns | Ns Fl d Ar depth
|
||||||
.Op Fl H
|
.Op Fl Hp
|
||||||
.Op Fl o Ar property Ns Oo , Ns property Ns Oc Ns ...
|
.Op Fl o Ar property Ns Oo , Ns property Ns Oc Ns ...
|
||||||
.Op Fl t Ar type Ns Oo , Ns type Ns Oc Ns ...
|
.Op Fl t Ar type Ns Oo , Ns type Ns Oc Ns ...
|
||||||
.Oo Fl s Ar property Oc Ns ...
|
.Oo Fl s Ar property Oc Ns ...
|
||||||
@ -1807,7 +1807,7 @@ only dataset that can be renamed recursively.
|
|||||||
.Nm
|
.Nm
|
||||||
.Cm list
|
.Cm list
|
||||||
.Op Fl r Ns | Ns Fl d Ar depth
|
.Op Fl r Ns | Ns Fl d Ar depth
|
||||||
.Op Fl H
|
.Op Fl Hp
|
||||||
.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
|
.Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
|
||||||
.Op Fl t Ar type Ns Oo , Ns Ar type Oc Ns ...
|
.Op Fl t Ar type Ns Oo , Ns Ar type Oc Ns ...
|
||||||
.Oo Fl s Ar property Oc Ns ...
|
.Oo Fl s Ar property Oc Ns ...
|
||||||
@ -1838,6 +1838,8 @@ will display only the dataset and its direct children.
|
|||||||
.It Fl H
|
.It Fl H
|
||||||
Used for scripting mode. Do not print headers and separate fields by a single
|
Used for scripting mode. Do not print headers and separate fields by a single
|
||||||
tab instead of arbitrary white space.
|
tab instead of arbitrary white space.
|
||||||
|
.It Fl p
|
||||||
|
Display numbers in parsable (exact) values.
|
||||||
.It Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
|
.It Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
|
||||||
A comma-separated list of properties to display. The property must be:
|
A comma-separated list of properties to display. The property must be:
|
||||||
.Bl -bullet -offset 2n
|
.Bl -bullet -offset 2n
|
||||||
@ -1978,7 +1980,7 @@ Display output in a form more easily parsed by scripts. Any headers are
|
|||||||
omitted, and fields are explicitly separated by a single tab instead of an
|
omitted, and fields are explicitly separated by a single tab instead of an
|
||||||
arbitrary amount of space.
|
arbitrary amount of space.
|
||||||
.It Fl p
|
.It Fl p
|
||||||
Display numbers in parseable (exact) values.
|
Display numbers in parsable (exact) values.
|
||||||
.It Fl o Cm all | Ar field Ns Oo , Ns Ar field Oc Ns ...
|
.It Fl o Cm all | Ar field Ns Oo , Ns Ar field Oc Ns ...
|
||||||
A comma-separated list of columns to display. Supported values are
|
A comma-separated list of columns to display. Supported values are
|
||||||
.Sy name,property,value,received,source .
|
.Sy name,property,value,received,source .
|
||||||
@ -2820,7 +2822,7 @@ option of
|
|||||||
.It \&P Ta event port (not supported on Fx )
|
.It \&P Ta event port (not supported on Fx )
|
||||||
.El
|
.El
|
||||||
.It Fl H
|
.It Fl H
|
||||||
Give more parseable tab-separated output, without header lines and without
|
Give more parsable tab-separated output, without header lines and without
|
||||||
arrows.
|
arrows.
|
||||||
.It Fl t
|
.It Fl t
|
||||||
Display the path's inode change time as the first column of output.
|
Display the path's inode change time as the first column of output.
|
||||||
|
@ -18,10 +18,12 @@
|
|||||||
*
|
*
|
||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
@ -109,7 +111,8 @@ zfs_callback(zfs_handle_t *zhp, void *data)
|
|||||||
cb->cb_props_table);
|
cb->cb_props_table);
|
||||||
|
|
||||||
if (zfs_expand_proplist(zhp, cb->cb_proplist,
|
if (zfs_expand_proplist(zhp, cb->cb_proplist,
|
||||||
(cb->cb_flags & ZFS_ITER_RECVD_PROPS))
|
(cb->cb_flags & ZFS_ITER_RECVD_PROPS),
|
||||||
|
(cb->cb_flags & ZFS_ITER_LITERAL_PROPS))
|
||||||
!= 0) {
|
!= 0) {
|
||||||
free(node);
|
free(node);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -18,9 +18,11 @@
|
|||||||
*
|
*
|
||||||
* CDDL HEADER END
|
* CDDL HEADER END
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ZFS_ITER_H
|
#ifndef ZFS_ITER_H
|
||||||
@ -44,6 +46,7 @@ typedef struct zfs_sort_column {
|
|||||||
#define ZFS_ITER_DEPTH_LIMIT (1 << 3)
|
#define ZFS_ITER_DEPTH_LIMIT (1 << 3)
|
||||||
#define ZFS_ITER_RECVD_PROPS (1 << 4)
|
#define ZFS_ITER_RECVD_PROPS (1 << 4)
|
||||||
#define ZFS_ITER_SIMPLE (1 << 5)
|
#define ZFS_ITER_SIMPLE (1 << 5)
|
||||||
|
#define ZFS_ITER_LITERAL_PROPS (1 << 6)
|
||||||
|
|
||||||
int zfs_for_each(int, char **, int options, zfs_type_t,
|
int zfs_for_each(int, char **, int options, zfs_type_t,
|
||||||
zfs_sort_column_t *, zprop_list_t **, int, zfs_iter_f, void *);
|
zfs_sort_column_t *, zprop_list_t **, int, zfs_iter_f, void *);
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
|
|
||||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
* Copyright 2012 Milan Jurik. All rights reserved.
|
* Copyright 2012 Milan Jurik. All rights reserved.
|
||||||
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
||||||
@ -29,6 +28,7 @@
|
|||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
||||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -249,9 +249,8 @@ get_usage(zfs_help_t idx)
|
|||||||
case HELP_UNJAIL:
|
case HELP_UNJAIL:
|
||||||
return (gettext("\tunjail <jailid|jailname> <filesystem>\n"));
|
return (gettext("\tunjail <jailid|jailname> <filesystem>\n"));
|
||||||
case HELP_LIST:
|
case HELP_LIST:
|
||||||
return (gettext("\tlist [-rH][-d max] "
|
return (gettext("\tlist [-Hp] [-r|-d max] [-o property[,...]] "
|
||||||
"[-o property[,...]] [-t type[,...]] [-s property] ...\n"
|
"[-s property]...\n\t [-S property]... [-t type[,...]] "
|
||||||
"\t [-S property] ... "
|
|
||||||
"[filesystem|volume|snapshot] ...\n"));
|
"[filesystem|volume|snapshot] ...\n"));
|
||||||
case HELP_MOUNT:
|
case HELP_MOUNT:
|
||||||
return (gettext("\tmount\n"
|
return (gettext("\tmount\n"
|
||||||
@ -310,12 +309,12 @@ get_usage(zfs_help_t idx)
|
|||||||
"<filesystem|volume>\n"));
|
"<filesystem|volume>\n"));
|
||||||
case HELP_USERSPACE:
|
case HELP_USERSPACE:
|
||||||
return (gettext("\tuserspace [-Hinp] [-o field[,...]] "
|
return (gettext("\tuserspace [-Hinp] [-o field[,...]] "
|
||||||
"[-s field] ...\n\t[-S field] ... "
|
"[-s field]...\n\t [-S field]... [-t type[,...]] "
|
||||||
"[-t type[,...]] <filesystem|snapshot>\n"));
|
"<filesystem|snapshot>\n"));
|
||||||
case HELP_GROUPSPACE:
|
case HELP_GROUPSPACE:
|
||||||
return (gettext("\tgroupspace [-Hinp] [-o field[,...]] "
|
return (gettext("\tgroupspace [-Hinp] [-o field[,...]] "
|
||||||
"[-s field] ...\n\t[-S field] ... "
|
"[-s field]...\n\t [-S field]... [-t type[,...]] "
|
||||||
"[-t type[,...]] <filesystem|snapshot>\n"));
|
"<filesystem|snapshot>\n"));
|
||||||
case HELP_HOLD:
|
case HELP_HOLD:
|
||||||
return (gettext("\thold [-r] <tag> <snapshot> ...\n"));
|
return (gettext("\thold [-r] <tag> <snapshot> ...\n"));
|
||||||
case HELP_HOLDS:
|
case HELP_HOLDS:
|
||||||
@ -2124,7 +2123,7 @@ zfs_do_upgrade(int argc, char **argv)
|
|||||||
* -i Translate SID to POSIX ID.
|
* -i Translate SID to POSIX ID.
|
||||||
* -n Print numeric ID instead of user/group name.
|
* -n Print numeric ID instead of user/group name.
|
||||||
* -o Control which fields to display.
|
* -o Control which fields to display.
|
||||||
* -p Use exact (parseable) numeric output.
|
* -p Use exact (parsable) numeric output.
|
||||||
* -s Specify sort columns, descending order.
|
* -s Specify sort columns, descending order.
|
||||||
* -S Specify sort columns, ascending order.
|
* -S Specify sort columns, ascending order.
|
||||||
* -t Control which object types to display.
|
* -t Control which object types to display.
|
||||||
@ -2811,24 +2810,25 @@ zfs_do_userspace(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* list [-r][-d max] [-H] [-o property[,property]...] [-t type[,type]...]
|
* list [-Hp][-r|-d max] [-o property[,...]] [-s property] ... [-S property] ...
|
||||||
* [-s property [-s property]...] [-S property [-S property]...]
|
* [-t type[,...]] [filesystem|volume|snapshot] ...
|
||||||
* <dataset> ...
|
|
||||||
*
|
*
|
||||||
* -r Recurse over all children
|
* -H Scripted mode; elide headers and separate columns by tabs.
|
||||||
|
* -p Display values in parsable (literal) format.
|
||||||
|
* -r Recurse over all children.
|
||||||
* -d Limit recursion by depth.
|
* -d Limit recursion by depth.
|
||||||
* -H Scripted mode; elide headers and separate columns by tabs
|
|
||||||
* -o Control which fields to display.
|
* -o Control which fields to display.
|
||||||
* -t Control which object types to display.
|
|
||||||
* -s Specify sort columns, descending order.
|
* -s Specify sort columns, descending order.
|
||||||
* -S Specify sort columns, ascending order.
|
* -S Specify sort columns, ascending order.
|
||||||
|
* -t Control which object types to display.
|
||||||
*
|
*
|
||||||
* When given no arguments, lists all filesystems in the system.
|
* When given no arguments, list all filesystems in the system.
|
||||||
* Otherwise, list the specified datasets, optionally recursing down them if
|
* Otherwise, list the specified datasets, optionally recursing down them if
|
||||||
* '-r' is specified.
|
* '-r' is specified.
|
||||||
*/
|
*/
|
||||||
typedef struct list_cbdata {
|
typedef struct list_cbdata {
|
||||||
boolean_t cb_first;
|
boolean_t cb_first;
|
||||||
|
boolean_t cb_literal;
|
||||||
boolean_t cb_scripted;
|
boolean_t cb_scripted;
|
||||||
zprop_list_t *cb_proplist;
|
zprop_list_t *cb_proplist;
|
||||||
} list_cbdata_t;
|
} list_cbdata_t;
|
||||||
@ -2837,8 +2837,9 @@ typedef struct list_cbdata {
|
|||||||
* Given a list of columns to display, output appropriate headers for each one.
|
* Given a list of columns to display, output appropriate headers for each one.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
print_header(zprop_list_t *pl)
|
print_header(list_cbdata_t *cb)
|
||||||
{
|
{
|
||||||
|
zprop_list_t *pl = cb->cb_proplist;
|
||||||
char headerbuf[ZFS_MAXPROPLEN];
|
char headerbuf[ZFS_MAXPROPLEN];
|
||||||
const char *header;
|
const char *header;
|
||||||
int i;
|
int i;
|
||||||
@ -2879,19 +2880,19 @@ print_header(zprop_list_t *pl)
|
|||||||
* to the described layout.
|
* to the described layout.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted)
|
print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb)
|
||||||
{
|
{
|
||||||
|
zprop_list_t *pl = cb->cb_proplist;
|
||||||
boolean_t first = B_TRUE;
|
boolean_t first = B_TRUE;
|
||||||
char property[ZFS_MAXPROPLEN];
|
char property[ZFS_MAXPROPLEN];
|
||||||
nvlist_t *userprops = zfs_get_user_props(zhp);
|
nvlist_t *userprops = zfs_get_user_props(zhp);
|
||||||
nvlist_t *propval;
|
nvlist_t *propval;
|
||||||
char *propstr;
|
char *propstr;
|
||||||
boolean_t right_justify;
|
boolean_t right_justify;
|
||||||
int width;
|
|
||||||
|
|
||||||
for (; pl != NULL; pl = pl->pl_next) {
|
for (; pl != NULL; pl = pl->pl_next) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
if (scripted)
|
if (cb->cb_scripted)
|
||||||
(void) printf("\t");
|
(void) printf("\t");
|
||||||
else
|
else
|
||||||
(void) printf(" ");
|
(void) printf(" ");
|
||||||
@ -2906,22 +2907,22 @@ print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted)
|
|||||||
right_justify = zfs_prop_align_right(pl->pl_prop);
|
right_justify = zfs_prop_align_right(pl->pl_prop);
|
||||||
} else if (pl->pl_prop != ZPROP_INVAL) {
|
} else if (pl->pl_prop != ZPROP_INVAL) {
|
||||||
if (zfs_prop_get(zhp, pl->pl_prop, property,
|
if (zfs_prop_get(zhp, pl->pl_prop, property,
|
||||||
sizeof (property), NULL, NULL, 0, B_FALSE) != 0)
|
sizeof (property), NULL, NULL, 0,
|
||||||
|
cb->cb_literal) != 0)
|
||||||
propstr = "-";
|
propstr = "-";
|
||||||
else
|
else
|
||||||
propstr = property;
|
propstr = property;
|
||||||
|
|
||||||
right_justify = zfs_prop_align_right(pl->pl_prop);
|
right_justify = zfs_prop_align_right(pl->pl_prop);
|
||||||
} else if (zfs_prop_userquota(pl->pl_user_prop)) {
|
} else if (zfs_prop_userquota(pl->pl_user_prop)) {
|
||||||
if (zfs_prop_get_userquota(zhp, pl->pl_user_prop,
|
if (zfs_prop_get_userquota(zhp, pl->pl_user_prop,
|
||||||
property, sizeof (property), B_FALSE) != 0)
|
property, sizeof (property), cb->cb_literal) != 0)
|
||||||
propstr = "-";
|
propstr = "-";
|
||||||
else
|
else
|
||||||
propstr = property;
|
propstr = property;
|
||||||
right_justify = B_TRUE;
|
right_justify = B_TRUE;
|
||||||
} else if (zfs_prop_written(pl->pl_user_prop)) {
|
} else if (zfs_prop_written(pl->pl_user_prop)) {
|
||||||
if (zfs_prop_get_written(zhp, pl->pl_user_prop,
|
if (zfs_prop_get_written(zhp, pl->pl_user_prop,
|
||||||
property, sizeof (property), B_FALSE) != 0)
|
property, sizeof (property), cb->cb_literal) != 0)
|
||||||
propstr = "-";
|
propstr = "-";
|
||||||
else
|
else
|
||||||
propstr = property;
|
propstr = property;
|
||||||
@ -2936,19 +2937,17 @@ print_dataset(zfs_handle_t *zhp, zprop_list_t *pl, boolean_t scripted)
|
|||||||
right_justify = B_FALSE;
|
right_justify = B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = pl->pl_width;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is being called in scripted mode, or if this is the
|
* If this is being called in scripted mode, or if this is the
|
||||||
* last column and it is left-justified, don't include a width
|
* last column and it is left-justified, don't include a width
|
||||||
* format specifier.
|
* format specifier.
|
||||||
*/
|
*/
|
||||||
if (scripted || (pl->pl_next == NULL && !right_justify))
|
if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify))
|
||||||
(void) printf("%s", propstr);
|
(void) printf("%s", propstr);
|
||||||
else if (right_justify)
|
else if (right_justify)
|
||||||
(void) printf("%*s", width, propstr);
|
(void) printf("%*s", pl->pl_width, propstr);
|
||||||
else
|
else
|
||||||
(void) printf("%-*s", width, propstr);
|
(void) printf("%-*s", pl->pl_width, propstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) printf("\n");
|
(void) printf("\n");
|
||||||
@ -2964,11 +2963,11 @@ list_callback(zfs_handle_t *zhp, void *data)
|
|||||||
|
|
||||||
if (cbp->cb_first) {
|
if (cbp->cb_first) {
|
||||||
if (!cbp->cb_scripted)
|
if (!cbp->cb_scripted)
|
||||||
print_header(cbp->cb_proplist);
|
print_header(cbp);
|
||||||
cbp->cb_first = B_FALSE;
|
cbp->cb_first = B_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_dataset(zhp, cbp->cb_proplist, cbp->cb_scripted);
|
print_dataset(zhp, cbp);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -2977,7 +2976,6 @@ static int
|
|||||||
zfs_do_list(int argc, char **argv)
|
zfs_do_list(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
boolean_t scripted = B_FALSE;
|
|
||||||
static char default_fields[] =
|
static char default_fields[] =
|
||||||
"name,used,available,referenced,mountpoint";
|
"name,used,available,referenced,mountpoint";
|
||||||
int types = ZFS_TYPE_DATASET;
|
int types = ZFS_TYPE_DATASET;
|
||||||
@ -2991,11 +2989,15 @@ zfs_do_list(int argc, char **argv)
|
|||||||
int flags = ZFS_ITER_PROP_LISTSNAPS | ZFS_ITER_ARGS_CAN_BE_PATHS;
|
int flags = ZFS_ITER_PROP_LISTSNAPS | ZFS_ITER_ARGS_CAN_BE_PATHS;
|
||||||
|
|
||||||
/* check options */
|
/* check options */
|
||||||
while ((c = getopt(argc, argv, ":d:o:rt:Hs:S:")) != -1) {
|
while ((c = getopt(argc, argv, "HS:d:o:prs:t:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'o':
|
case 'o':
|
||||||
fields = optarg;
|
fields = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
cb.cb_literal = B_TRUE;
|
||||||
|
flags |= ZFS_ITER_LITERAL_PROPS;
|
||||||
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
limit = parse_depth(optarg, &flags);
|
limit = parse_depth(optarg, &flags);
|
||||||
break;
|
break;
|
||||||
@ -3003,7 +3005,7 @@ zfs_do_list(int argc, char **argv)
|
|||||||
flags |= ZFS_ITER_RECURSE;
|
flags |= ZFS_ITER_RECURSE;
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
scripted = B_TRUE;
|
cb.cb_scripted = B_TRUE;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if (zfs_add_sort_column(&sortcol, optarg,
|
if (zfs_add_sort_column(&sortcol, optarg,
|
||||||
@ -3093,7 +3095,6 @@ zfs_do_list(int argc, char **argv)
|
|||||||
!= 0)
|
!= 0)
|
||||||
usage(B_FALSE);
|
usage(B_FALSE);
|
||||||
|
|
||||||
cb.cb_scripted = scripted;
|
|
||||||
cb.cb_first = B_TRUE;
|
cb.cb_first = B_TRUE;
|
||||||
|
|
||||||
ret = zfs_for_each(argc, argv, flags, types, sortcol, &cb.cb_proplist,
|
ret = zfs_for_each(argc, argv, flags, types, sortcol, &cb.cb_proplist,
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
|
||||||
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
* Copyright (c) 2011 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
||||||
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
||||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LIBZFS_H
|
#ifndef _LIBZFS_H
|
||||||
@ -463,7 +463,8 @@ typedef struct zprop_list {
|
|||||||
boolean_t pl_fixed;
|
boolean_t pl_fixed;
|
||||||
} zprop_list_t;
|
} zprop_list_t;
|
||||||
|
|
||||||
extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t);
|
extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t,
|
||||||
|
boolean_t);
|
||||||
extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *);
|
extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *);
|
||||||
|
|
||||||
#define ZFS_MOUNTPOINT_NONE "none"
|
#define ZFS_MOUNTPOINT_NONE "none"
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2013 by Delphix. All rights reserved.
|
* Copyright (c) 2013 by Delphix. All rights reserved.
|
||||||
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
|
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
|
||||||
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
|
|
||||||
* Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
* Copyright (c) 2011-2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
* Copyright (c) 2012 Martin Matuska <mm@FreeBSD.org>. All rights reserved.
|
||||||
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
||||||
|
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -3882,7 +3882,8 @@ zfs_get_recvd_props(zfs_handle_t *zhp)
|
|||||||
* of the RECEIVED column.
|
* of the RECEIVED column.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received)
|
zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received,
|
||||||
|
boolean_t literal)
|
||||||
{
|
{
|
||||||
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
libzfs_handle_t *hdl = zhp->zfs_hdl;
|
||||||
zprop_list_t *entry;
|
zprop_list_t *entry;
|
||||||
@ -3944,18 +3945,18 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received)
|
|||||||
* Now go through and check the width of any non-fixed columns
|
* Now go through and check the width of any non-fixed columns
|
||||||
*/
|
*/
|
||||||
for (entry = *plp; entry != NULL; entry = entry->pl_next) {
|
for (entry = *plp; entry != NULL; entry = entry->pl_next) {
|
||||||
if (entry->pl_fixed)
|
if (entry->pl_fixed && !literal)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (entry->pl_prop != ZPROP_INVAL) {
|
if (entry->pl_prop != ZPROP_INVAL) {
|
||||||
if (zfs_prop_get(zhp, entry->pl_prop,
|
if (zfs_prop_get(zhp, entry->pl_prop,
|
||||||
buf, sizeof (buf), NULL, NULL, 0, B_FALSE) == 0) {
|
buf, sizeof (buf), NULL, NULL, 0, literal) == 0) {
|
||||||
if (strlen(buf) > entry->pl_width)
|
if (strlen(buf) > entry->pl_width)
|
||||||
entry->pl_width = strlen(buf);
|
entry->pl_width = strlen(buf);
|
||||||
}
|
}
|
||||||
if (received && zfs_prop_get_recvd(zhp,
|
if (received && zfs_prop_get_recvd(zhp,
|
||||||
zfs_prop_to_name(entry->pl_prop),
|
zfs_prop_to_name(entry->pl_prop),
|
||||||
buf, sizeof (buf), B_FALSE) == 0)
|
buf, sizeof (buf), literal) == 0)
|
||||||
if (strlen(buf) > entry->pl_recvd_width)
|
if (strlen(buf) > entry->pl_recvd_width)
|
||||||
entry->pl_recvd_width = strlen(buf);
|
entry->pl_recvd_width = strlen(buf);
|
||||||
} else {
|
} else {
|
||||||
@ -3968,7 +3969,7 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received)
|
|||||||
}
|
}
|
||||||
if (received && zfs_prop_get_recvd(zhp,
|
if (received && zfs_prop_get_recvd(zhp,
|
||||||
entry->pl_user_prop,
|
entry->pl_user_prop,
|
||||||
buf, sizeof (buf), B_FALSE) == 0)
|
buf, sizeof (buf), literal) == 0)
|
||||||
if (strlen(buf) > entry->pl_recvd_width)
|
if (strlen(buf) > entry->pl_recvd_width)
|
||||||
entry->pl_recvd_width = strlen(buf);
|
entry->pl_recvd_width = strlen(buf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user