2803 zfs get guid pretty-prints the output
authorGarrett D'Amore <garrett@damore.org>
Wed, 06 Jun 2012 10:01:43 -0700
changeset 13715 351036203e4b
parent 13714 e2f6dabb84ef
child 13716 3db0c1979163
2803 zfs get guid pretty-prints the output Reviewed by: Eric Schrock <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Alexander Eremin <[email protected]> Approved by: Dan McDonald <[email protected]>
usr/src/lib/libzfs/common/libzfs_dataset.c
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c	Wed Jun 06 01:19:29 2012 -0700
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c	Wed Jun 06 10:01:43 2012 -0700
@@ -23,6 +23,7 @@
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2012 DEY Storage Systems, Inc.  All rights reserved.
  */
 
 #include <ctype.h>
@@ -2280,6 +2281,17 @@
 		}
 		break;
 
+	case ZFS_PROP_GUID:
+		/*
+		 * GUIDs are stored as numbers, but they are identifiers.
+		 * We don't want them to be pretty printed, because pretty
+		 * printing mangles the ID into a truncated and useless value.
+		 */
+		if (get_numeric_property(zhp, prop, src, &source, &val) != 0)
+			return (-1);
+		(void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val);
+		break;
+
 	default:
 		switch (zfs_prop_get_type(prop)) {
 		case PROP_TYPE_NUMBER: