1789Sahrens /*
2789Sahrens  * CDDL HEADER START
3789Sahrens  *
4789Sahrens  * The contents of this file are subject to the terms of the
5*1544Seschrock  * Common Development and Distribution License (the "License").
6*1544Seschrock  * 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  */
21789Sahrens /*
221294Slling  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23789Sahrens  * Use is subject to license terms.
24789Sahrens  */
25789Sahrens 
26789Sahrens #ifndef	_LIBFS_IMPL_H
27789Sahrens #define	_LIBFS_IMPL_H
28789Sahrens 
29789Sahrens #pragma ident	"%Z%%M%	%I%	%E% SMI"
30789Sahrens 
31789Sahrens #include <sys/dmu.h>
32789Sahrens #include <sys/fs/zfs.h>
33789Sahrens #include <sys/zfs_ioctl.h>
34789Sahrens #include <sys/zfs_acl.h>
35789Sahrens #include <sys/nvpair.h>
36789Sahrens 
37789Sahrens #include <libzfs.h>
38789Sahrens 
39789Sahrens #ifdef	__cplusplus
40789Sahrens extern "C" {
41789Sahrens #endif
42789Sahrens 
43789Sahrens struct zfs_handle {
44789Sahrens 	char zfs_name[ZFS_MAXNAMELEN];
45789Sahrens 	zfs_type_t zfs_type;
46789Sahrens 	dmu_objset_stats_t zfs_dmustats;
471356Seschrock 	nvlist_t *zfs_props;
48789Sahrens 	uint64_t zfs_volsize;
49789Sahrens 	uint64_t zfs_volblocksize;
50789Sahrens 	char *zfs_mntopts;
51*1544Seschrock 	char zfs_root[MAXPATHLEN];
52789Sahrens };
53789Sahrens 
54789Sahrens struct zpool_handle {
55789Sahrens 	char zpool_name[ZPOOL_MAXNAMELEN];
56789Sahrens 	int zpool_state;
57789Sahrens 	size_t zpool_config_size;
58789Sahrens 	nvlist_t *zpool_config;
59952Seschrock 	nvlist_t *zpool_old_config;
60*1544Seschrock 	nvlist_t **zpool_error_log;
61*1544Seschrock 	size_t zpool_error_count;
62789Sahrens };
63789Sahrens 
64789Sahrens void zfs_error(const char *, ...);
65789Sahrens void zfs_fatal(const char *, ...);
66789Sahrens void *zfs_malloc(size_t);
67789Sahrens char *zfs_strdup(const char *);
68789Sahrens void no_memory(void);
69789Sahrens 
70789Sahrens #define	zfs_baderror(err)						\
71789Sahrens 	(zfs_fatal(dgettext(TEXT_DOMAIN,				\
72789Sahrens 	"internal error: unexpected error %d at line %d of %s"),	\
73789Sahrens 	(err), (__LINE__), (__FILE__)))
74789Sahrens 
75789Sahrens char **get_dependents(const char *, size_t *);
76789Sahrens 
77789Sahrens typedef struct prop_changelist prop_changelist_t;
78789Sahrens 
79789Sahrens int changelist_prefix(prop_changelist_t *);
80789Sahrens int changelist_postfix(prop_changelist_t *);
81789Sahrens void changelist_rename(prop_changelist_t *, const char *, const char *);
821294Slling void changelist_remove(zfs_handle_t *, prop_changelist_t *);
83789Sahrens void changelist_free(prop_changelist_t *);
84789Sahrens prop_changelist_t *changelist_gather(zfs_handle_t *, zfs_prop_t, int);
85789Sahrens int changelist_unshare(prop_changelist_t *);
86789Sahrens int changelist_haszonedchild(prop_changelist_t *);
87789Sahrens 
88789Sahrens void remove_mountpoint(zfs_handle_t *);
89789Sahrens 
90789Sahrens zfs_handle_t *make_dataset_handle(const char *);
91*1544Seschrock void set_pool_health(nvlist_t *);
92*1544Seschrock 
93*1544Seschrock zpool_handle_t *zpool_open_silent(const char *);
94789Sahrens 
95*1544Seschrock int zvol_create_link(const char *);
96*1544Seschrock int zvol_remove_link(const char *);
97789Sahrens 
98*1544Seschrock int zfs_ioctl(int, zfs_cmd_t *);
99*1544Seschrock FILE *zfs_mnttab(void);
100*1544Seschrock FILE *zfs_sharetab(void);
101789Sahrens 
102789Sahrens #ifdef	__cplusplus
103789Sahrens }
104789Sahrens #endif
105789Sahrens 
106789Sahrens #endif	/* _LIBFS_IMPL_H */
107