From b1b8ab34de515a5e83206da22c3d7e563241b021 Mon Sep 17 00:00:00 2001 From: lling Date: Wed, 28 Mar 2007 12:48:13 -0700 Subject: PSARC 2007/083 ZFS bootable datasets 4929890 ZFS Boot support for the x86 platform 6479807 pools need properties 6531774 reserve bits in directory entry for file type --- usr/src/lib/libzfs/common/libzfs.h | 52 +++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 12 deletions(-) (limited to 'usr/src/lib/libzfs/common/libzfs.h') diff --git a/usr/src/lib/libzfs/common/libzfs.h b/usr/src/lib/libzfs/common/libzfs.h index 2967ef0d11..307d2dcf89 100644 --- a/usr/src/lib/libzfs/common/libzfs.h +++ b/usr/src/lib/libzfs/common/libzfs.h @@ -94,7 +94,10 @@ enum { EZFS_NOHISTORY, /* no history object */ EZFS_UNSHAREISCSIFAILED, /* iscsitgtd failed request to unshare */ EZFS_SHAREISCSIFAILED, /* iscsitgtd failed request to share */ - EZFS_UNKNOWN /* unknown error */ + EZFS_POOLPROPS, /* couldn't retrieve pool props */ + EZFS_POOL_NOTSUP, /* ops not supported for this type of pool */ + EZFS_POOL_INVALARG, /* invalid argument for this pool operation */ + EZFS_UNKNOWN }; /* @@ -161,6 +164,15 @@ extern int zpool_vdev_remove(zpool_handle_t *, const char *); extern int zpool_clear(zpool_handle_t *, const char *); extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *); +/* + * Functions to manage pool properties + */ +extern int zpool_set_prop(zpool_handle_t *, const char *, const char *); +extern int zpool_get_prop(zpool_handle_t *, zfs_prop_t, char *, + size_t proplen, zfs_source_t *); +extern const char *zpool_prop_to_name(zpool_prop_t); +extern const char *zpool_prop_values(zpool_prop_t); + /* * Pool health statistics. */ @@ -237,16 +249,6 @@ extern void zfs_close(zfs_handle_t *); extern zfs_type_t zfs_get_type(const zfs_handle_t *); extern const char *zfs_get_name(const zfs_handle_t *); -typedef enum { - ZFS_SRC_NONE = 0x1, - ZFS_SRC_DEFAULT = 0x2, - ZFS_SRC_TEMPORARY = 0x4, - ZFS_SRC_LOCAL = 0x8, - ZFS_SRC_INHERITED = 0x10 -} zfs_source_t; - -#define ZFS_SRC_ALL 0x1f - /* * Property management functions. Some functions are shared with the kernel, * and are found in sys/fs/zfs.h. @@ -267,6 +269,7 @@ extern uint64_t zfs_prop_default_numeric(zfs_prop_t); extern int zfs_prop_is_string(zfs_prop_t prop); extern const char *zfs_prop_column_name(zfs_prop_t); extern boolean_t zfs_prop_align_right(zfs_prop_t); +extern void nicebool(int value, char *buf, size_t buflen); typedef struct zfs_proplist { zfs_prop_t pl_prop; @@ -277,14 +280,39 @@ typedef struct zfs_proplist { boolean_t pl_fixed; } zfs_proplist_t; +typedef zfs_proplist_t zpool_proplist_t; + extern int zfs_get_proplist(libzfs_handle_t *, char *, zfs_proplist_t **); -extern void zfs_free_proplist(zfs_proplist_t *); +extern int zpool_get_proplist(libzfs_handle_t *, char *, zpool_proplist_t **); extern int zfs_expand_proplist(zfs_handle_t *, zfs_proplist_t **); +extern int zpool_expand_proplist(zpool_handle_t *, zpool_proplist_t **); +extern void zfs_free_proplist(zfs_proplist_t *); extern nvlist_t *zfs_get_user_props(zfs_handle_t *); #define ZFS_MOUNTPOINT_NONE "none" #define ZFS_MOUNTPOINT_LEGACY "legacy" +/* + * Functions for printing properties from zfs/zpool + */ +typedef struct libzfs_get_cbdata { + int cb_sources; + int cb_columns[4]; + int cb_colwidths[5]; + boolean_t cb_scripted; + boolean_t cb_literal; + boolean_t cb_first; + zfs_proplist_t *cb_proplist; +} libzfs_get_cbdata_t; + +void libzfs_print_one_property(const char *, libzfs_get_cbdata_t *, + const char *, const char *, zfs_source_t, const char *); + +#define GET_COL_NAME 1 +#define GET_COL_PROPERTY 2 +#define GET_COL_VALUE 3 +#define GET_COL_SOURCE 4 + /* * Iterator functions. */ -- cgit v1.2.3