usr/src/lib/libzfs/common/libzfs.h
changeset 2676 5cee47eddab6
parent 2665 7b208a92357b
child 2885 c0259887ebbc
equal deleted inserted replaced
2675:54d99ec6d12d 2676:5cee47eddab6
   199  */
   199  */
   200 extern nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **);
   200 extern nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **);
   201 extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *);
   201 extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *);
   202 extern int zpool_get_errlog(zpool_handle_t *, nvlist_t ***, size_t *);
   202 extern int zpool_get_errlog(zpool_handle_t *, nvlist_t ***, size_t *);
   203 
   203 
   204 #define	ZPOOL_ERR_DATASET	"dataset"
       
   205 #define	ZPOOL_ERR_OBJECT	"object"
       
   206 #define	ZPOOL_ERR_RANGE		"range"
       
   207 
       
   208 /*
   204 /*
   209  * Import and export functions
   205  * Import and export functions
   210  */
   206  */
   211 extern int zpool_export(zpool_handle_t *);
   207 extern int zpool_export(zpool_handle_t *);
   212 extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *,
   208 extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *,
   244 
   240 
   245 /*
   241 /*
   246  * Property management functions.  Some functions are shared with the kernel,
   242  * Property management functions.  Some functions are shared with the kernel,
   247  * and are found in sys/fs/zfs.h.
   243  * and are found in sys/fs/zfs.h.
   248  */
   244  */
   249 const char *zfs_prop_to_name(zfs_prop_t);
   245 extern const char *zfs_prop_to_name(zfs_prop_t);
   250 int zfs_prop_set(zfs_handle_t *, zfs_prop_t, const char *);
   246 extern int zfs_prop_set(zfs_handle_t *, const char *, const char *);
   251 int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t, zfs_source_t *,
   247 extern int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t,
   252     char *, size_t, boolean_t);
   248     zfs_source_t *, char *, size_t, boolean_t);
   253 int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *, zfs_source_t *,
   249 extern int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *,
   254     char *, size_t);
   250     zfs_source_t *, char *, size_t);
   255 uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
   251 extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
   256 int zfs_prop_validate(libzfs_handle_t *, zfs_prop_t, const char *, uint64_t *);
   252 extern const char *zfs_prop_get_string(zfs_handle_t *, zfs_prop_t);
   257 int zfs_prop_inheritable(zfs_prop_t);
   253 extern int zfs_prop_inherit(zfs_handle_t *, const char *);
   258 int zfs_prop_inherit(zfs_handle_t *, zfs_prop_t);
   254 extern const char *zfs_prop_values(zfs_prop_t);
   259 const char *zfs_prop_values(zfs_prop_t);
   255 extern int zfs_prop_valid_for_type(zfs_prop_t, int);
   260 int zfs_prop_valid_for_type(zfs_prop_t, int);
   256 extern const char *zfs_prop_default_string(zfs_prop_t prop);
   261 const char *zfs_prop_default_string(zfs_prop_t prop);
   257 extern uint64_t zfs_prop_default_numeric(zfs_prop_t);
   262 uint64_t zfs_prop_default_numeric(zfs_prop_t);
   258 extern int zfs_prop_is_string(zfs_prop_t prop);
   263 int zfs_prop_is_string(zfs_prop_t prop);
   259 extern const char *zfs_prop_column_name(zfs_prop_t);
   264 const char *zfs_prop_column_name(zfs_prop_t);
   260 extern boolean_t zfs_prop_align_right(zfs_prop_t);
   265 const char *zfs_prop_column_format(zfs_prop_t);
   261 
   266 int zfs_get_proplist(char *fields, zfs_prop_t *proplist, int max, int *count,
   262 typedef struct zfs_proplist {
   267     char **badopt);
   263 	zfs_prop_t	pl_prop;
       
   264 	char		*pl_user_prop;
       
   265 	struct zfs_proplist *pl_next;
       
   266 	boolean_t	pl_all;
       
   267 	size_t		pl_width;
       
   268 	boolean_t	pl_fixed;
       
   269 } zfs_proplist_t;
       
   270 
       
   271 extern int zfs_get_proplist(libzfs_handle_t *, char *, zfs_proplist_t **);
       
   272 extern void zfs_free_proplist(zfs_proplist_t *);
       
   273 extern int zfs_expand_proplist(zfs_handle_t *, zfs_proplist_t **);
       
   274 extern nvlist_t *zfs_get_user_props(zfs_handle_t *);
   268 
   275 
   269 #define	ZFS_MOUNTPOINT_NONE	"none"
   276 #define	ZFS_MOUNTPOINT_NONE	"none"
   270 #define	ZFS_MOUNTPOINT_LEGACY	"legacy"
   277 #define	ZFS_MOUNTPOINT_LEGACY	"legacy"
   271 
   278 
   272 /*
   279 /*
   281 
   288 
   282 /*
   289 /*
   283  * Functions to create and destroy datasets.
   290  * Functions to create and destroy datasets.
   284  */
   291  */
   285 extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
   292 extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
   286     const char *, const char *);
   293     nvlist_t *);
   287 extern int zfs_destroy(zfs_handle_t *);
   294 extern int zfs_destroy(zfs_handle_t *);
   288 extern int zfs_destroy_snaps(zfs_handle_t *, char *);
   295 extern int zfs_destroy_snaps(zfs_handle_t *, char *);
   289 extern int zfs_clone(zfs_handle_t *, const char *);
   296 extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
   290 extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t);
   297 extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t);
   291 extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, int);
   298 extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, int);
   292 extern int zfs_rename(zfs_handle_t *, const char *);
   299 extern int zfs_rename(zfs_handle_t *, const char *);
   293 extern int zfs_send(zfs_handle_t *, zfs_handle_t *);
   300 extern int zfs_send(zfs_handle_t *, zfs_handle_t *);
   294 extern int zfs_receive(libzfs_handle_t *, const char *, int, int, int,
   301 extern int zfs_receive(libzfs_handle_t *, const char *, int, int, int,
   329 
   336 
   330 /*
   337 /*
   331  * Utility function to convert a number to a human-readable form.
   338  * Utility function to convert a number to a human-readable form.
   332  */
   339  */
   333 extern void zfs_nicenum(uint64_t, char *, size_t);
   340 extern void zfs_nicenum(uint64_t, char *, size_t);
   334 extern int zfs_nicestrtonum(const char *, uint64_t *);
   341 extern int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *);
   335 
   342 
   336 /*
   343 /*
   337  * Pool destroy special.  Remove the device information without destroying
   344  * Pool destroy special.  Remove the device information without destroying
   338  * the underlying dataset.
   345  * the underlying dataset.
   339  */
   346  */