forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2583 Add -p (parsable) option to zfs list References: https://www.illumos.org/issues/2583 illumos/illumos-gate@43d68d6 Ported-by: Gregor Kopka <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes: openzfs#937
- Loading branch information
Showing
6 changed files
with
69 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,11 @@ | |
* | ||
* CDDL HEADER END | ||
*/ | ||
|
||
/* | ||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2012 Pawel Jakub Dawidek <[email protected]>. | ||
* Copyright 2013 Nexenta Systems, Inc. All rights reserved. | ||
*/ | ||
|
||
#include <libintl.h> | ||
|
@@ -108,7 +110,8 @@ zfs_callback(zfs_handle_t *zhp, void *data) | |
cb->cb_props_table); | ||
|
||
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) { | ||
free(node); | ||
return (-1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,9 +24,9 @@ | |
* Copyright (c) 2013 by Delphix. All rights reserved. | ||
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved. | ||
* Copyright (c) 2012 Pawel Jakub Dawidek <[email protected]>. | ||
* Copyright 2012 Nexenta Systems, Inc. All rights reserved. | ||
* Copyright (c) 2013 Martin Matuska. All rights reserved. | ||
* Copyright (c) 2013 Steven Hartland. All rights reserved. | ||
* Copyright 2013 Nexenta Systems, Inc. All rights reserved. | ||
*/ | ||
|
||
#include <ctype.h> | ||
|
@@ -4157,7 +4157,8 @@ zfs_get_user_props(zfs_handle_t *zhp) | |
* of the RECEIVED column. | ||
*/ | ||
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; | ||
zprop_list_t *entry; | ||
|
@@ -4219,18 +4220,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 | ||
*/ | ||
for (entry = *plp; entry != NULL; entry = entry->pl_next) { | ||
if (entry->pl_fixed) | ||
if (entry->pl_fixed && !literal) | ||
continue; | ||
|
||
if (entry->pl_prop != ZPROP_INVAL) { | ||
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) | ||
entry->pl_width = strlen(buf); | ||
} | ||
if (received && zfs_prop_get_recvd(zhp, | ||
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) | ||
entry->pl_recvd_width = strlen(buf); | ||
} else { | ||
|
@@ -4243,7 +4244,7 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received) | |
} | ||
if (received && zfs_prop_get_recvd(zhp, | ||
entry->pl_user_prop, | ||
buf, sizeof (buf), B_FALSE) == 0) | ||
buf, sizeof (buf), literal) == 0) | ||
if (strlen(buf) > entry->pl_recvd_width) | ||
entry->pl_recvd_width = strlen(buf); | ||
} | ||
|
Oops, something went wrong.