1789Sahrens /*
2789Sahrens  * CDDL HEADER START
3789Sahrens  *
4789Sahrens  * The contents of this file are subject to the terms of the
51485Slling  * Common Development and Distribution License (the "License").
61485Slling  * You may not use this file except in compliance with the License.
7789Sahrens  *
8789Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9789Sahrens  * or http://www.opensolaris.org/os/licensing.
10789Sahrens  * See the License for the specific language governing permissions
11789Sahrens  * and limitations under the License.
12789Sahrens  *
13789Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14789Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15789Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16789Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17789Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18789Sahrens  *
19789Sahrens  * CDDL HEADER END
20789Sahrens  */
213126Sahl 
22789Sahrens /*
233444Sek110237  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24789Sahrens  * Use is subject to license terms.
25789Sahrens  */
26789Sahrens 
27789Sahrens #ifndef	_LIBZFS_H
28789Sahrens #define	_LIBZFS_H
29789Sahrens 
30789Sahrens #pragma ident	"%Z%%M%	%I%	%E% SMI"
31789Sahrens 
32789Sahrens #include <assert.h>
33789Sahrens #include <libnvpair.h>
34789Sahrens #include <sys/param.h>
35789Sahrens #include <sys/types.h>
36789Sahrens #include <sys/varargs.h>
37789Sahrens #include <sys/fs/zfs.h>
38789Sahrens 
39789Sahrens #ifdef	__cplusplus
40789Sahrens extern "C" {
41789Sahrens #endif
42789Sahrens 
43789Sahrens /*
44789Sahrens  * Miscellaneous ZFS constants
45789Sahrens  */
46789Sahrens #define	ZFS_MAXNAMELEN		MAXNAMELEN
47789Sahrens #define	ZPOOL_MAXNAMELEN	MAXNAMELEN
48789Sahrens #define	ZFS_MAXPROPLEN		MAXPATHLEN
49789Sahrens 
50789Sahrens /*
512082Seschrock  * libzfs errors
522082Seschrock  */
532082Seschrock enum {
542082Seschrock 	EZFS_NOMEM = 2000,	/* out of memory */
552082Seschrock 	EZFS_BADPROP,		/* invalid property value */
562082Seschrock 	EZFS_PROPREADONLY,	/* cannot set readonly property */
572082Seschrock 	EZFS_PROPTYPE,		/* property does not apply to dataset type */
582082Seschrock 	EZFS_PROPNONINHERIT,	/* property is not inheritable */
592082Seschrock 	EZFS_PROPSPACE,		/* bad quota or reservation */
602082Seschrock 	EZFS_BADTYPE,		/* dataset is not of appropriate type */
612082Seschrock 	EZFS_BUSY,		/* pool or dataset is busy */
622082Seschrock 	EZFS_EXISTS,		/* pool or dataset already exists */
632082Seschrock 	EZFS_NOENT,		/* no such pool or dataset */
642082Seschrock 	EZFS_BADSTREAM,		/* bad backup stream */
652082Seschrock 	EZFS_DSREADONLY,	/* dataset is readonly */
662082Seschrock 	EZFS_VOLTOOBIG,		/* volume is too large for 32-bit system */
672082Seschrock 	EZFS_VOLHASDATA,	/* volume already contains data */
682082Seschrock 	EZFS_INVALIDNAME,	/* invalid dataset name */
692082Seschrock 	EZFS_BADRESTORE,	/* unable to restore to destination */
702082Seschrock 	EZFS_BADBACKUP,		/* backup failed */
712082Seschrock 	EZFS_BADTARGET,		/* bad attach/detach/replace target */
722082Seschrock 	EZFS_NODEVICE,		/* no such device in pool */
732082Seschrock 	EZFS_BADDEV,		/* invalid device to add */
742082Seschrock 	EZFS_NOREPLICAS,	/* no valid replicas */
752082Seschrock 	EZFS_RESILVERING,	/* currently resilvering */
762082Seschrock 	EZFS_BADVERSION,	/* unsupported version */
772082Seschrock 	EZFS_POOLUNAVAIL,	/* pool is currently unavailable */
782082Seschrock 	EZFS_DEVOVERFLOW,	/* too many devices in one vdev */
792082Seschrock 	EZFS_BADPATH,		/* must be an absolute path */
802082Seschrock 	EZFS_CROSSTARGET,	/* rename or clone across pool or dataset */
812082Seschrock 	EZFS_ZONED,		/* used improperly in local zone */
822082Seschrock 	EZFS_MOUNTFAILED,	/* failed to mount dataset */
832082Seschrock 	EZFS_UMOUNTFAILED,	/* failed to unmount dataset */
843126Sahl 	EZFS_UNSHARENFSFAILED,	/* unshare(1M) failed */
853126Sahl 	EZFS_SHARENFSFAILED,	/* share(1M) failed */
862082Seschrock 	EZFS_DEVLINKS,		/* failed to create zvol links */
872082Seschrock 	EZFS_PERM,		/* permission denied */
882082Seschrock 	EZFS_NOSPC,		/* out of space */
892082Seschrock 	EZFS_IO,		/* I/O error */
902082Seschrock 	EZFS_INTR,		/* signal received */
912082Seschrock 	EZFS_ISSPARE,		/* device is a hot spare */
922082Seschrock 	EZFS_INVALCONFIG,	/* invalid vdev configuration */
932474Seschrock 	EZFS_RECURSIVE,		/* recursive dependency */
942926Sek110237 	EZFS_NOHISTORY,		/* no history object */
953126Sahl 	EZFS_UNSHAREISCSIFAILED, /* iscsitgtd failed request to unshare */
963126Sahl 	EZFS_SHAREISCSIFAILED,	/* iscsitgtd failed request to share */
973912Slling 	EZFS_POOLPROPS,		/* couldn't retrieve pool props */
983912Slling 	EZFS_POOL_NOTSUP,	/* ops not supported for this type of pool */
993912Slling 	EZFS_POOL_INVALARG,	/* invalid argument for this pool operation */
1003978Smmusante 	EZFS_NAMETOOLONG,	/* dataset name is too long */
101*4276Staylor 	EZFS_OPENFAILED,	/* open of device failed */
102*4276Staylor 	EZFS_NOCAP,		/* couldn't get capacity */
103*4276Staylor 	EZFS_LABELFAILED,	/* write of label failed */
1043912Slling 	EZFS_UNKNOWN
1052082Seschrock };
1062082Seschrock 
1072082Seschrock /*
108789Sahrens  * Basic handle types
109789Sahrens  */
110789Sahrens typedef struct zfs_handle zfs_handle_t;
111789Sahrens typedef struct zpool_handle zpool_handle_t;
1122082Seschrock typedef struct libzfs_handle libzfs_handle_t;
1132082Seschrock 
1142082Seschrock /*
1152082Seschrock  * Library initialization
1162082Seschrock  */
1172082Seschrock extern libzfs_handle_t *libzfs_init(void);
1182082Seschrock extern void libzfs_fini(libzfs_handle_t *);
1192082Seschrock 
1202082Seschrock extern libzfs_handle_t *zpool_get_handle(zpool_handle_t *);
1212082Seschrock extern libzfs_handle_t *zfs_get_handle(zfs_handle_t *);
1222082Seschrock 
1232082Seschrock extern void libzfs_print_on_error(libzfs_handle_t *, boolean_t);
1242082Seschrock 
1252082Seschrock extern int libzfs_errno(libzfs_handle_t *);
1262082Seschrock extern const char *libzfs_error_action(libzfs_handle_t *);
1272082Seschrock extern const char *libzfs_error_description(libzfs_handle_t *);
128789Sahrens 
129789Sahrens /*
130789Sahrens  * Basic handle functions
131789Sahrens  */
1322082Seschrock extern zpool_handle_t *zpool_open(libzfs_handle_t *, const char *);
1332082Seschrock extern zpool_handle_t *zpool_open_canfail(libzfs_handle_t *, const char *);
134789Sahrens extern void zpool_close(zpool_handle_t *);
135789Sahrens extern const char *zpool_get_name(zpool_handle_t *);
136789Sahrens extern uint64_t zpool_get_guid(zpool_handle_t *);
137789Sahrens extern uint64_t zpool_get_space_used(zpool_handle_t *);
138789Sahrens extern uint64_t zpool_get_space_total(zpool_handle_t *);
139789Sahrens extern int zpool_get_root(zpool_handle_t *, char *, size_t);
140789Sahrens extern int zpool_get_state(zpool_handle_t *);
1412082Seschrock extern uint64_t zpool_get_version(zpool_handle_t *);
142789Sahrens 
143789Sahrens /*
144789Sahrens  * Iterate over all active pools in the system.
145789Sahrens  */
146789Sahrens typedef int (*zpool_iter_f)(zpool_handle_t *, void *);
1472082Seschrock extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *);
148789Sahrens 
149789Sahrens /*
150789Sahrens  * Functions to create and destroy pools
151789Sahrens  */
1522082Seschrock extern int zpool_create(libzfs_handle_t *, const char *, nvlist_t *,
1532082Seschrock     const char *);
154789Sahrens extern int zpool_destroy(zpool_handle_t *);
155789Sahrens extern int zpool_add(zpool_handle_t *, nvlist_t *);
156789Sahrens 
157789Sahrens /*
158789Sahrens  * Functions to manipulate pool and vdev state
159789Sahrens  */
160789Sahrens extern int zpool_scrub(zpool_handle_t *, pool_scrub_type_t);
161789Sahrens 
162789Sahrens extern int zpool_vdev_online(zpool_handle_t *, const char *);
1631485Slling extern int zpool_vdev_offline(zpool_handle_t *, const char *, int);
164789Sahrens extern int zpool_vdev_attach(zpool_handle_t *, const char *, const char *,
165789Sahrens     nvlist_t *, int);
166789Sahrens extern int zpool_vdev_detach(zpool_handle_t *, const char *);
1672082Seschrock extern int zpool_vdev_remove(zpool_handle_t *, const char *);
1681544Seschrock extern int zpool_clear(zpool_handle_t *, const char *);
1692082Seschrock extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *);
170*4276Staylor extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *);
171789Sahrens 
172789Sahrens /*
1733912Slling  * Functions to manage pool properties
1743912Slling  */
1753912Slling extern int zpool_set_prop(zpool_handle_t *, const char *, const char *);
1763912Slling extern int zpool_get_prop(zpool_handle_t *, zfs_prop_t, char *,
1773912Slling 	size_t proplen, zfs_source_t *);
1783912Slling extern const char *zpool_prop_to_name(zpool_prop_t);
1793912Slling extern const char *zpool_prop_values(zpool_prop_t);
1803912Slling 
1813912Slling /*
182789Sahrens  * Pool health statistics.
183789Sahrens  */
184789Sahrens typedef enum {
185789Sahrens 	/*
186789Sahrens 	 * The following correspond to faults as defined in the (fault.fs.zfs.*)
1871003Slling 	 * event namespace.  Each is associated with a corresponding message ID.
188789Sahrens 	 */
189789Sahrens 	ZPOOL_STATUS_CORRUPT_CACHE,	/* corrupt /kernel/drv/zpool.cache */
190789Sahrens 	ZPOOL_STATUS_MISSING_DEV_R,	/* missing device with replicas */
191789Sahrens 	ZPOOL_STATUS_MISSING_DEV_NR,	/* missing device with no replicas */
192789Sahrens 	ZPOOL_STATUS_CORRUPT_LABEL_R,	/* bad device label with replicas */
1931003Slling 	ZPOOL_STATUS_CORRUPT_LABEL_NR,	/* bad device label with no replicas */
194789Sahrens 	ZPOOL_STATUS_BAD_GUID_SUM,	/* sum of device guids didn't match */
195789Sahrens 	ZPOOL_STATUS_CORRUPT_POOL,	/* pool metadata is corrupted */
196789Sahrens 	ZPOOL_STATUS_CORRUPT_DATA,	/* data errors in user (meta)data */
197789Sahrens 	ZPOOL_STATUS_FAILING_DEV,	/* device experiencing errors */
1981760Seschrock 	ZPOOL_STATUS_VERSION_NEWER,	/* newer on-disk version */
1993975Sek110237 	ZPOOL_STATUS_HOSTID_MISMATCH,	/* last accessed by another system */
200789Sahrens 
201789Sahrens 	/*
202789Sahrens 	 * The following are not faults per se, but still an error possibly
2031003Slling 	 * requiring administrative attention.  There is no corresponding
204789Sahrens 	 * message ID.
205789Sahrens 	 */
2061760Seschrock 	ZPOOL_STATUS_VERSION_OLDER,	/* older on-disk version */
207789Sahrens 	ZPOOL_STATUS_RESILVERING,	/* device being resilvered */
208789Sahrens 	ZPOOL_STATUS_OFFLINE_DEV,	/* device online */
209789Sahrens 
210789Sahrens 	/*
211789Sahrens 	 * Finally, the following indicates a healthy pool.
212789Sahrens 	 */
213789Sahrens 	ZPOOL_STATUS_OK
214789Sahrens } zpool_status_t;
215789Sahrens 
2161544Seschrock extern zpool_status_t zpool_get_status(zpool_handle_t *, char **);
2171544Seschrock extern zpool_status_t zpool_import_status(nvlist_t *, char **);
218789Sahrens 
219789Sahrens /*
220789Sahrens  * Statistics and configuration functions.
221789Sahrens  */
2221544Seschrock extern nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **);
2232142Seschrock extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *);
2243444Sek110237 extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **);
2251544Seschrock 
226789Sahrens /*
227789Sahrens  * Import and export functions
228789Sahrens  */
229789Sahrens extern int zpool_export(zpool_handle_t *);
2302082Seschrock extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *,
2312082Seschrock     const char *);
232789Sahrens 
233789Sahrens /*
234789Sahrens  * Search for pools to import
235789Sahrens  */
2362082Seschrock extern nvlist_t *zpool_find_import(libzfs_handle_t *, int, char **);
237789Sahrens 
238789Sahrens /*
2391354Seschrock  * Miscellaneous pool functions
2401354Seschrock  */
2412082Seschrock extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *);
2421760Seschrock extern int zpool_upgrade(zpool_handle_t *);
2432926Sek110237 extern int zpool_get_history(zpool_handle_t *, nvlist_t **);
2442926Sek110237 extern void zpool_log_history(libzfs_handle_t *, int, char **, const char *,
2452926Sek110237     boolean_t, boolean_t);
2463444Sek110237 extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *,
2473444Sek110237     size_t len);
2481354Seschrock 
2491354Seschrock /*
250789Sahrens  * Basic handle manipulations.  These functions do not create or destroy the
251789Sahrens  * underlying datasets, only the references to them.
252789Sahrens  */
2532082Seschrock extern zfs_handle_t *zfs_open(libzfs_handle_t *, const char *, int);
254789Sahrens extern void zfs_close(zfs_handle_t *);
255789Sahrens extern zfs_type_t zfs_get_type(const zfs_handle_t *);
256789Sahrens extern const char *zfs_get_name(const zfs_handle_t *);
257789Sahrens 
258789Sahrens /*
259789Sahrens  * Property management functions.  Some functions are shared with the kernel,
2601003Slling  * and are found in sys/fs/zfs.h.
261789Sahrens  */
2622676Seschrock extern const char *zfs_prop_to_name(zfs_prop_t);
2632676Seschrock extern int zfs_prop_set(zfs_handle_t *, const char *, const char *);
2642676Seschrock extern int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t,
2652676Seschrock     zfs_source_t *, char *, size_t, boolean_t);
2662676Seschrock extern int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *,
2672676Seschrock     zfs_source_t *, char *, size_t);
2682676Seschrock extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
2692676Seschrock extern const char *zfs_prop_get_string(zfs_handle_t *, zfs_prop_t);
2702676Seschrock extern int zfs_prop_inherit(zfs_handle_t *, const char *);
2712676Seschrock extern const char *zfs_prop_values(zfs_prop_t);
2722676Seschrock extern int zfs_prop_valid_for_type(zfs_prop_t, int);
2732676Seschrock extern const char *zfs_prop_default_string(zfs_prop_t prop);
2742676Seschrock extern uint64_t zfs_prop_default_numeric(zfs_prop_t);
2752676Seschrock extern int zfs_prop_is_string(zfs_prop_t prop);
2762676Seschrock extern const char *zfs_prop_column_name(zfs_prop_t);
2772676Seschrock extern boolean_t zfs_prop_align_right(zfs_prop_t);
2783912Slling extern void nicebool(int value, char *buf, size_t buflen);
2792676Seschrock 
2802676Seschrock typedef struct zfs_proplist {
2812676Seschrock 	zfs_prop_t	pl_prop;
2822676Seschrock 	char		*pl_user_prop;
2832676Seschrock 	struct zfs_proplist *pl_next;
2842676Seschrock 	boolean_t	pl_all;
2852676Seschrock 	size_t		pl_width;
2862676Seschrock 	boolean_t	pl_fixed;
2872676Seschrock } zfs_proplist_t;
2882676Seschrock 
2893912Slling typedef zfs_proplist_t zpool_proplist_t;
2903912Slling 
2912676Seschrock extern int zfs_get_proplist(libzfs_handle_t *, char *, zfs_proplist_t **);
2923912Slling extern int zpool_get_proplist(libzfs_handle_t *, char *, zpool_proplist_t **);
2933912Slling extern int zfs_expand_proplist(zfs_handle_t *, zfs_proplist_t **);
2943912Slling extern int zpool_expand_proplist(zpool_handle_t *, zpool_proplist_t **);
2952676Seschrock extern void zfs_free_proplist(zfs_proplist_t *);
2962676Seschrock extern nvlist_t *zfs_get_user_props(zfs_handle_t *);
297789Sahrens 
298789Sahrens #define	ZFS_MOUNTPOINT_NONE	"none"
299789Sahrens #define	ZFS_MOUNTPOINT_LEGACY	"legacy"
300789Sahrens 
301789Sahrens /*
3023912Slling  * Functions for printing properties from zfs/zpool
3033912Slling  */
3043912Slling typedef struct libzfs_get_cbdata {
3053912Slling 	int cb_sources;
3063912Slling 	int cb_columns[4];
3073912Slling 	int cb_colwidths[5];
3083912Slling 	boolean_t cb_scripted;
3093912Slling 	boolean_t cb_literal;
3103912Slling 	boolean_t cb_first;
3113912Slling 	zfs_proplist_t *cb_proplist;
3123912Slling } libzfs_get_cbdata_t;
3133912Slling 
3143912Slling void libzfs_print_one_property(const char *, libzfs_get_cbdata_t *,
3153912Slling     const char *, const char *, zfs_source_t, const char *);
3163912Slling 
3173912Slling #define	GET_COL_NAME		1
3183912Slling #define	GET_COL_PROPERTY	2
3193912Slling #define	GET_COL_VALUE		3
3203912Slling #define	GET_COL_SOURCE		4
3213912Slling 
3223912Slling /*
323789Sahrens  * Iterator functions.
324789Sahrens  */
325789Sahrens typedef int (*zfs_iter_f)(zfs_handle_t *, void *);
3262082Seschrock extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f, void *);
327789Sahrens extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *);
3282474Seschrock extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
3291356Seschrock extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);
3301356Seschrock extern int zfs_iter_snapshots(zfs_handle_t *, zfs_iter_f, void *);
331789Sahrens 
332789Sahrens /*
333789Sahrens  * Functions to create and destroy datasets.
334789Sahrens  */
3352082Seschrock extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
3362676Seschrock     nvlist_t *);
337789Sahrens extern int zfs_destroy(zfs_handle_t *);
3382199Sahrens extern int zfs_destroy_snaps(zfs_handle_t *, char *);
3392676Seschrock extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
3402199Sahrens extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t);
3411294Slling extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, int);
3424007Smmusante extern int zfs_rename(zfs_handle_t *, const char *, int);
3433504Sahl extern int zfs_send(zfs_handle_t *, const char *, int);
3442665Snd150628 extern int zfs_receive(libzfs_handle_t *, const char *, int, int, int,
3453504Sahl     boolean_t, int);
3462082Seschrock extern int zfs_promote(zfs_handle_t *);
347789Sahrens 
348789Sahrens /*
349789Sahrens  * Miscellaneous functions.
350789Sahrens  */
351789Sahrens extern const char *zfs_type_to_name(zfs_type_t);
352789Sahrens extern void zfs_refresh_properties(zfs_handle_t *);
353789Sahrens extern int zfs_name_valid(const char *, zfs_type_t);
3543126Sahl extern int zfs_disable(zfs_handle_t *);
3553126Sahl extern int zfs_enable(zfs_handle_t *);
3563635Sck153898 extern zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, char *, zfs_type_t);
357789Sahrens 
358789Sahrens /*
359789Sahrens  * Mount support functions.
360789Sahrens  */
3613444Sek110237 extern boolean_t is_mounted(libzfs_handle_t *, const char *special, char **);
3622082Seschrock extern boolean_t zfs_is_mounted(zfs_handle_t *, char **);
363789Sahrens extern int zfs_mount(zfs_handle_t *, const char *, int);
364789Sahrens extern int zfs_unmount(zfs_handle_t *, const char *, int);
365789Sahrens extern int zfs_unmountall(zfs_handle_t *, int);
366789Sahrens 
367789Sahrens /*
368789Sahrens  * Share support functions.
369789Sahrens  */
3703126Sahl extern boolean_t zfs_is_shared(zfs_handle_t *);
371789Sahrens extern int zfs_share(zfs_handle_t *);
3723126Sahl extern int zfs_unshare(zfs_handle_t *);
3733126Sahl 
3743126Sahl /*
3753126Sahl  * Protocol-specifc share support functions.
3763126Sahl  */
3773126Sahl extern boolean_t zfs_is_shared_nfs(zfs_handle_t *, char **);
3783126Sahl extern int zfs_share_nfs(zfs_handle_t *);
3793126Sahl extern int zfs_unshare_nfs(zfs_handle_t *, const char *);
3803126Sahl extern int zfs_unshareall_nfs(zfs_handle_t *);
3813126Sahl extern boolean_t zfs_is_shared_iscsi(zfs_handle_t *);
3823126Sahl extern int zfs_share_iscsi(zfs_handle_t *);
3833126Sahl extern int zfs_unshare_iscsi(zfs_handle_t *);
384789Sahrens 
385789Sahrens /*
386789Sahrens  * When dealing with nvlists, verify() is extremely useful
387789Sahrens  */
388789Sahrens #ifdef NDEBUG
389789Sahrens #define	verify(EX)	((void)(EX))
390789Sahrens #else
391789Sahrens #define	verify(EX)	assert(EX)
392789Sahrens #endif
393789Sahrens 
394789Sahrens /*
395789Sahrens  * Utility function to convert a number to a human-readable form.
396789Sahrens  */
397789Sahrens extern void zfs_nicenum(uint64_t, char *, size_t);
3982676Seschrock extern int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *);
399789Sahrens 
400789Sahrens /*
401789Sahrens  * Pool destroy special.  Remove the device information without destroying
402789Sahrens  * the underlying dataset.
403789Sahrens  */
404789Sahrens extern int zfs_remove_link(zfs_handle_t *);
405789Sahrens 
406789Sahrens /*
407789Sahrens  * Given a device or file, determine if it is part of a pool.
408789Sahrens  */
4092082Seschrock extern int zpool_in_use(libzfs_handle_t *, int, pool_state_t *, char **,
4102082Seschrock     boolean_t *);
411789Sahrens 
412789Sahrens /*
413789Sahrens  * ftyp special.  Read the label from a given device.
414789Sahrens  */
4152082Seschrock extern int zpool_read_label(int, nvlist_t **);
416789Sahrens 
417789Sahrens /*
4183126Sahl  * Create and remove zvol /dev links.
419789Sahrens  */
420789Sahrens extern int zpool_create_zvol_links(zpool_handle_t *);
421789Sahrens extern int zpool_remove_zvol_links(zpool_handle_t *);
422789Sahrens 
4232474Seschrock /*
4243126Sahl  * Enable and disable datasets within a pool by mounting/unmounting and
4253126Sahl  * sharing/unsharing them.
4262474Seschrock  */
4273126Sahl extern int zpool_enable_datasets(zpool_handle_t *, const char *, int);
4283126Sahl extern int zpool_disable_datasets(zpool_handle_t *, boolean_t);
4292474Seschrock 
430789Sahrens #ifdef	__cplusplus
431789Sahrens }
432789Sahrens #endif
433789Sahrens 
434789Sahrens #endif	/* _LIBZFS_H */
435