Skip to content

Commit 08b1b21

Browse files
gdamorebehlendorf
authored andcommitted
Illumos #2803: zfs get guid pretty-prints the output
Reviewed by: Eric Schrock <eric.schrock@delphix.com> Reviewed by: Richard Elling <richard.elling@gmail.com> Reviewed by: Alexander Eremin <alexander.eremin@nexenta.com> Approved by: Dan McDonald <danmcd@nexenta.com> References: https://www.illumos.org/issues/2803 Ported by: Martin Matuska <martin@matuska.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
1 parent e956d65 commit 08b1b21

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/libzfs/libzfs_dataset.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
2424
* Copyright (c) 2010 Nexenta Systems, Inc. All rights reserved.
2525
* Copyright (c) 2012 by Delphix. All rights reserved.
26+
* Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved.
2627
* Copyright (c) 2012 Pawel Jakub Dawidek <pawel@dawidek.net>.
2728
*/
2829

@@ -2313,6 +2314,17 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
23132314
}
23142315
break;
23152316

2317+
case ZFS_PROP_GUID:
2318+
/*
2319+
* GUIDs are stored as numbers, but they are identifiers.
2320+
* We don't want them to be pretty printed, because pretty
2321+
* printing mangles the ID into a truncated and useless value.
2322+
*/
2323+
if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
2324+
return (-1);
2325+
(void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val);
2326+
break;
2327+
23162328
default:
23172329
switch (zfs_prop_get_type(prop)) {
23182330
case PROP_TYPE_NUMBER:

0 commit comments

Comments
 (0)