diff options
author | Dmitry Khasanov <[email protected]> | 2013-07-05 18:01:44 +0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-07-09 15:58:05 -0700 |
commit | 131cc95ca78b8552c13555d2cded791808008ff3 (patch) | |
tree | 90018a1dc98bcc07bcf98f1cb15bc5672409ee15 /lib/libzfs | |
parent | 51a3ae72d23d89d35a4a67059b39e870d66a2495 (diff) |
Add FreeBSD 'zpool labelclear' command
The FreeBSD implementation of zfs adds the 'zpool labelclear'
command. Since this functionality is helpful and straight
forward to add it is being included in ZoL.
References:
freebsd/freebsd@119a041dc9230275239a8de68c534c0754181e7e
Ported-by: Dmitry Khasanov <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #1126
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/libzfs_import.c | 4 | ||||
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 30 |
2 files changed, 32 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c index 58b6043be..de9851e60 100644 --- a/lib/libzfs/libzfs_import.c +++ b/lib/libzfs/libzfs_import.c @@ -902,8 +902,8 @@ zpool_read_label(int fd, nvlist_t **config) /* * Given a file descriptor, clear (zero) the label information. This function - * is currently only used in the appliance stack as part of the ZFS sysevent - * module. + * is used in the appliance stack as part of the ZFS sysevent module and + * to implement the "zpool labelclear" command. */ int zpool_clear_label(int fd) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index eca1dc36a..a6cacd370 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -205,6 +205,36 @@ zpool_state_to_name(vdev_state_t state, vdev_aux_t aux) } /* + * Map POOL STATE to printed strings. + */ +const char * +zpool_pool_state_to_name(pool_state_t state) +{ + switch (state) { + default: + break; + case POOL_STATE_ACTIVE: + return (gettext("ACTIVE")); + case POOL_STATE_EXPORTED: + return (gettext("EXPORTED")); + case POOL_STATE_DESTROYED: + return (gettext("DESTROYED")); + case POOL_STATE_SPARE: + return (gettext("SPARE")); + case POOL_STATE_L2CACHE: + return (gettext("L2CACHE")); + case POOL_STATE_UNINITIALIZED: + return (gettext("UNINITIALIZED")); + case POOL_STATE_UNAVAIL: + return (gettext("UNAVAIL")); + case POOL_STATE_POTENTIALLY_ACTIVE: + return (gettext("POTENTIALLY_ACTIVE")); + } + + return (gettext("UNKNOWN")); +} + +/* * Get a zpool property value for 'prop' and return the value in * a pre-allocated buffer. */ |