summaryrefslogtreecommitdiff
path: root/usr/src/cmd/zfs
diff options
context:
space:
mode:
authorgw25295 <none@none>2007-02-14 19:54:59 -0800
committergw25295 <none@none>2007-02-14 19:54:59 -0800
commit66e2aacc02a4625d105fb249ad16c27e79604ff2 (patch)
tree9a363742a4b7924843562237260aa366613d128b /usr/src/cmd/zfs
parentbd8f0338e0109a8df4e34499bdf42e592c77eeda (diff)
downloadillumos-joyent-66e2aacc02a4625d105fb249ad16c27e79604ff2.tar.gz
6483718 need a stable interface to get all native properties
6514071 recent changes to zfs.h breaks Sun Cluster
Diffstat (limited to 'usr/src/cmd/zfs')
-rw-r--r--usr/src/cmd/zfs/zfs_main.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/usr/src/cmd/zfs/zfs_main.c b/usr/src/cmd/zfs/zfs_main.c
index 6abfb3097e..bf235cae54 100644
--- a/usr/src/cmd/zfs/zfs_main.c
+++ b/usr/src/cmd/zfs/zfs_main.c
@@ -239,6 +239,35 @@ safe_malloc(size_t size)
}
/*
+ * Callback routinue that will print out information for each of the
+ * the properties.
+ */
+static zfs_prop_t
+usage_prop_cb(zfs_prop_t prop, void *cb)
+{
+ FILE *fp = cb;
+
+ (void) fprintf(fp, "\t%-13s ", zfs_prop_to_name(prop));
+
+ if (zfs_prop_readonly(prop))
+ (void) fprintf(fp, " NO ");
+ else
+ (void) fprintf(fp, " YES ");
+
+ if (zfs_prop_inheritable(prop))
+ (void) fprintf(fp, " YES ");
+ else
+ (void) fprintf(fp, " NO ");
+
+ if (zfs_prop_values(prop) == NULL)
+ (void) fprintf(fp, "-\n");
+ else
+ (void) fprintf(fp, "%s\n", zfs_prop_values(prop));
+
+ return (ZFS_PROP_CONT);
+}
+
+/*
* Display usage message. If we're inside a command, display only the usage for
* that command. Otherwise, iterate over the entire command table and display
* a complete usage message.
@@ -286,24 +315,9 @@ usage(boolean_t requested)
(void) fprintf(fp, "\n\t%-13s %s %s %s\n\n",
"PROPERTY", "EDIT", "INHERIT", "VALUES");
- for (i = 0; i < ZFS_NPROP_VISIBLE; i++) {
- (void) fprintf(fp, "\t%-13s ", zfs_prop_to_name(i));
-
- if (zfs_prop_readonly(i))
- (void) fprintf(fp, " NO ");
- else
- (void) fprintf(fp, " YES ");
+ /* Iterate over all properties */
+ (void) zfs_prop_iter(usage_prop_cb, fp, B_FALSE);
- if (zfs_prop_inheritable(i))
- (void) fprintf(fp, " YES ");
- else
- (void) fprintf(fp, " NO ");
-
- if (zfs_prop_values(i) == NULL)
- (void) fprintf(fp, "-\n");
- else
- (void) fprintf(fp, "%s\n", zfs_prop_values(i));
- }
(void) fprintf(fp, gettext("\nSizes are specified in bytes "
"with standard units such as K, M, G, etc.\n"));
(void) fprintf(fp, gettext("\n\nUser-defined properties can "