xref: /illumos-gate/usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h (revision 98110f08fa182032082d98be2ddb9391fcd62bf1)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
5ea8dc4b6Seschrock  * Common Development and Distribution License (the "License").
6ea8dc4b6Seschrock  * You may not use this file except in compliance with the License.
7fa9e4066Sahrens  *
8fa9e4066Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e4066Sahrens  * or http://www.opensolaris.org/os/licensing.
10fa9e4066Sahrens  * See the License for the specific language governing permissions
11fa9e4066Sahrens  * and limitations under the License.
12fa9e4066Sahrens  *
13fa9e4066Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14fa9e4066Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e4066Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16fa9e4066Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e4066Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e4066Sahrens  *
19fa9e4066Sahrens  * CDDL HEADER END
20fa9e4066Sahrens  */
21fa9e4066Sahrens /*
22c99e4bdcSChris Kirby  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23*98110f08SMatthew Ahrens  * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
24fa9e4066Sahrens  */
25fa9e4066Sahrens 
26fa9e4066Sahrens #ifndef	_SYS_ZFS_IOCTL_H
27fa9e4066Sahrens #define	_SYS_ZFS_IOCTL_H
28fa9e4066Sahrens 
29fa9e4066Sahrens #include <sys/cred.h>
30fa9e4066Sahrens #include <sys/dmu.h>
31ea8dc4b6Seschrock #include <sys/zio.h>
32ecd6cf80Smarks #include <sys/dsl_deleg.h>
339e69d7d0SLori Alt #include <sys/spa.h>
3499d5e173STim Haley #include <sys/zfs_stat.h>
35fa9e4066Sahrens 
36da6c28aaSamw #ifdef _KERNEL
37da6c28aaSamw #include <sys/nvpair.h>
38da6c28aaSamw #endif	/* _KERNEL */
39da6c28aaSamw 
40fa9e4066Sahrens #ifdef	__cplusplus
41fa9e4066Sahrens extern "C" {
42fa9e4066Sahrens #endif
43fa9e4066Sahrens 
444445fffbSMatthew Ahrens /*
454445fffbSMatthew Ahrens  * The structures in this file are passed between userland and the
464445fffbSMatthew Ahrens  * kernel.  Userland may be running a 32-bit process, while the kernel
474445fffbSMatthew Ahrens  * is 64-bit.  Therefore, these structures need to compile the same in
484445fffbSMatthew Ahrens  * 32-bit and 64-bit.  This means not using type "long", and adding
494445fffbSMatthew Ahrens  * explicit padding so that the 32-bit structure will not be packed more
504445fffbSMatthew Ahrens  * tightly than the 64-bit structure (which requires 64-bit alignment).
514445fffbSMatthew Ahrens  */
524445fffbSMatthew Ahrens 
53fa9e4066Sahrens /*
54fa9e4066Sahrens  * Property values for snapdir
55fa9e4066Sahrens  */
56a0965f35Sbonwick #define	ZFS_SNAPDIR_HIDDEN		0
57a0965f35Sbonwick #define	ZFS_SNAPDIR_VISIBLE		1
58fa9e4066Sahrens 
599e69d7d0SLori Alt /*
609e69d7d0SLori Alt  * Field manipulation macros for the drr_versioninfo field of the
619e69d7d0SLori Alt  * send stream header.
629e69d7d0SLori Alt  */
639e69d7d0SLori Alt 
649e69d7d0SLori Alt /*
659e69d7d0SLori Alt  * Header types for zfs send streams.
669e69d7d0SLori Alt  */
679e69d7d0SLori Alt typedef enum drr_headertype {
689e69d7d0SLori Alt 	DMU_SUBSTREAM = 0x1,
699e69d7d0SLori Alt 	DMU_COMPOUNDSTREAM = 0x2
709e69d7d0SLori Alt } drr_headertype_t;
719e69d7d0SLori Alt 
729e69d7d0SLori Alt #define	DMU_GET_STREAM_HDRTYPE(vi)	BF64_GET((vi), 0, 2)
739e69d7d0SLori Alt #define	DMU_SET_STREAM_HDRTYPE(vi, x)	BF64_SET((vi), 0, 2, x)
749e69d7d0SLori Alt 
759e69d7d0SLori Alt #define	DMU_GET_FEATUREFLAGS(vi)	BF64_GET((vi), 2, 30)
769e69d7d0SLori Alt #define	DMU_SET_FEATUREFLAGS(vi, x)	BF64_SET((vi), 2, 30, x)
779e69d7d0SLori Alt 
789e69d7d0SLori Alt /*
799e69d7d0SLori Alt  * Feature flags for zfs send streams (flags in drr_versioninfo)
809e69d7d0SLori Alt  */
819e69d7d0SLori Alt 
825d7b4d43SMatthew Ahrens #define	DMU_BACKUP_FEATURE_DEDUP		(1<<0)
835d7b4d43SMatthew Ahrens #define	DMU_BACKUP_FEATURE_DEDUPPROPS		(1<<1)
845d7b4d43SMatthew Ahrens #define	DMU_BACKUP_FEATURE_SA_SPILL		(1<<2)
855d7b4d43SMatthew Ahrens /* flags #3 - #15 are reserved for incompatible closed-source implementations */
865d7b4d43SMatthew Ahrens #define	DMU_BACKUP_FEATURE_EMBED_DATA		(1<<16)
875d7b4d43SMatthew Ahrens #define	DMU_BACKUP_FEATURE_EMBED_DATA_LZ4	(1<<17)
88b5152584SMatthew Ahrens /* flag #18 is reserved for a Delphix feature */
89b5152584SMatthew Ahrens #define	DMU_BACKUP_FEATURE_LARGE_BLOCKS		(1<<19)
909e69d7d0SLori Alt 
919e69d7d0SLori Alt /*
929e69d7d0SLori Alt  * Mask of all supported backup features
939e69d7d0SLori Alt  */
948e714474SLori Alt #define	DMU_BACKUP_FEATURE_MASK	(DMU_BACKUP_FEATURE_DEDUP | \
955d7b4d43SMatthew Ahrens     DMU_BACKUP_FEATURE_DEDUPPROPS | DMU_BACKUP_FEATURE_SA_SPILL | \
96b5152584SMatthew Ahrens     DMU_BACKUP_FEATURE_EMBED_DATA | DMU_BACKUP_FEATURE_EMBED_DATA_LZ4 | \
97b5152584SMatthew Ahrens     DMU_BACKUP_FEATURE_LARGE_BLOCKS)
989e69d7d0SLori Alt 
999e69d7d0SLori Alt /* Are all features in the given flag word currently supported? */
1009e69d7d0SLori Alt #define	DMU_STREAM_SUPPORTED(x)	(!((x) & ~DMU_BACKUP_FEATURE_MASK))
1019e69d7d0SLori Alt 
1029e69d7d0SLori Alt /*
1039e69d7d0SLori Alt  * The drr_versioninfo field of the dmu_replay_record has the
1049e69d7d0SLori Alt  * following layout:
1059e69d7d0SLori Alt  *
1069e69d7d0SLori Alt  *	64	56	48	40	32	24	16	8	0
1079e69d7d0SLori Alt  *	+-------+-------+-------+-------+-------+-------+-------+-------+
1089e69d7d0SLori Alt  *  	|		reserved	|        feature-flags	    |C|S|
1099e69d7d0SLori Alt  *	+-------+-------+-------+-------+-------+-------+-------+-------+
1109e69d7d0SLori Alt  *
1119e69d7d0SLori Alt  * The low order two bits indicate the header type: SUBSTREAM (0x1)
1129e69d7d0SLori Alt  * or COMPOUNDSTREAM (0x2).  Using two bits for this is historical:
1139e69d7d0SLori Alt  * this field used to be a version number, where the two version types
1149e69d7d0SLori Alt  * were 1 and 2.  Using two bits for this allows earlier versions of
1159e69d7d0SLori Alt  * the code to be able to recognize send streams that don't use any
1169e69d7d0SLori Alt  * of the features indicated by feature flags.
1179e69d7d0SLori Alt  */
1189e69d7d0SLori Alt 
119fa9e4066Sahrens #define	DMU_BACKUP_MAGIC 0x2F5bacbacULL
120fa9e4066Sahrens 
121ab04eb8eStimh #define	DRR_FLAG_CLONE		(1<<0)
122ab04eb8eStimh #define	DRR_FLAG_CI_DATA	(1<<1)
1233cb34c60Sahrens 
1248e714474SLori Alt /*
1258e714474SLori Alt  * flags in the drr_checksumflags field in the DRR_WRITE and
1268e714474SLori Alt  * DRR_WRITE_BYREF blocks
1278e714474SLori Alt  */
1288e714474SLori Alt #define	DRR_CHECKSUM_DEDUP	(1<<0)
1298e714474SLori Alt 
1308e714474SLori Alt #define	DRR_IS_DEDUP_CAPABLE(flags)	((flags) & DRR_CHECKSUM_DEDUP)
1318e714474SLori Alt 
132fa9e4066Sahrens /*
133fa9e4066Sahrens  * zfs ioctl command structure
134fa9e4066Sahrens  */
135fa9e4066Sahrens typedef struct dmu_replay_record {
136fa9e4066Sahrens 	enum {
137fa9e4066Sahrens 		DRR_BEGIN, DRR_OBJECT, DRR_FREEOBJECTS,
1389e69d7d0SLori Alt 		DRR_WRITE, DRR_FREE, DRR_END, DRR_WRITE_BYREF,
1395d7b4d43SMatthew Ahrens 		DRR_SPILL, DRR_WRITE_EMBEDDED, DRR_NUMTYPES
140fa9e4066Sahrens 	} drr_type;
1413cb34c60Sahrens 	uint32_t drr_payloadlen;
142fa9e4066Sahrens 	union {
143fa9e4066Sahrens 		struct drr_begin {
144fa9e4066Sahrens 			uint64_t drr_magic;
1459e69d7d0SLori Alt 			uint64_t drr_versioninfo; /* was drr_version */
146fa9e4066Sahrens 			uint64_t drr_creation_time;
147fa9e4066Sahrens 			dmu_objset_type_t drr_type;
1483cb34c60Sahrens 			uint32_t drr_flags;
149fa9e4066Sahrens 			uint64_t drr_toguid;
150fa9e4066Sahrens 			uint64_t drr_fromguid;
151fa9e4066Sahrens 			char drr_toname[MAXNAMELEN];
152fa9e4066Sahrens 		} drr_begin;
153fa9e4066Sahrens 		struct drr_end {
154ea8dc4b6Seschrock 			zio_cksum_t drr_checksum;
1559e69d7d0SLori Alt 			uint64_t drr_toguid;
156fa9e4066Sahrens 		} drr_end;
157fa9e4066Sahrens 		struct drr_object {
158fa9e4066Sahrens 			uint64_t drr_object;
159fa9e4066Sahrens 			dmu_object_type_t drr_type;
160fa9e4066Sahrens 			dmu_object_type_t drr_bonustype;
161fa9e4066Sahrens 			uint32_t drr_blksz;
162fa9e4066Sahrens 			uint32_t drr_bonuslen;
1639e69d7d0SLori Alt 			uint8_t drr_checksumtype;
164fa9e4066Sahrens 			uint8_t drr_compress;
165fa9e4066Sahrens 			uint8_t drr_pad[6];
1669e69d7d0SLori Alt 			uint64_t drr_toguid;
167a2eea2e1Sahrens 			/* bonus content follows */
168fa9e4066Sahrens 		} drr_object;
169fa9e4066Sahrens 		struct drr_freeobjects {
170fa9e4066Sahrens 			uint64_t drr_firstobj;
171fa9e4066Sahrens 			uint64_t drr_numobjs;
1729e69d7d0SLori Alt 			uint64_t drr_toguid;
173fa9e4066Sahrens 		} drr_freeobjects;
174fa9e4066Sahrens 		struct drr_write {
175fa9e4066Sahrens 			uint64_t drr_object;
176fa9e4066Sahrens 			dmu_object_type_t drr_type;
177fa9e4066Sahrens 			uint32_t drr_pad;
178fa9e4066Sahrens 			uint64_t drr_offset;
179fa9e4066Sahrens 			uint64_t drr_length;
1809e69d7d0SLori Alt 			uint64_t drr_toguid;
1819e69d7d0SLori Alt 			uint8_t drr_checksumtype;
1828e714474SLori Alt 			uint8_t drr_checksumflags;
1838e714474SLori Alt 			uint8_t drr_pad2[6];
1848e714474SLori Alt 			ddt_key_t drr_key; /* deduplication key */
185a2eea2e1Sahrens 			/* content follows */
186fa9e4066Sahrens 		} drr_write;
187fa9e4066Sahrens 		struct drr_free {
188fa9e4066Sahrens 			uint64_t drr_object;
189fa9e4066Sahrens 			uint64_t drr_offset;
190fa9e4066Sahrens 			uint64_t drr_length;
1919e69d7d0SLori Alt 			uint64_t drr_toguid;
192fa9e4066Sahrens 		} drr_free;
1939e69d7d0SLori Alt 		struct drr_write_byref {
1949e69d7d0SLori Alt 			/* where to put the data */
1959e69d7d0SLori Alt 			uint64_t drr_object;
1969e69d7d0SLori Alt 			uint64_t drr_offset;
1979e69d7d0SLori Alt 			uint64_t drr_length;
1989e69d7d0SLori Alt 			uint64_t drr_toguid;
1999e69d7d0SLori Alt 			/* where to find the prior copy of the data */
2009e69d7d0SLori Alt 			uint64_t drr_refguid;
2019e69d7d0SLori Alt 			uint64_t drr_refobject;
2029e69d7d0SLori Alt 			uint64_t drr_refoffset;
2038e714474SLori Alt 			/* properties of the data */
2049e69d7d0SLori Alt 			uint8_t drr_checksumtype;
2058e714474SLori Alt 			uint8_t drr_checksumflags;
2068e714474SLori Alt 			uint8_t drr_pad2[6];
2078e714474SLori Alt 			ddt_key_t drr_key; /* deduplication key */
2089e69d7d0SLori Alt 		} drr_write_byref;
2090a586ceaSMark Shellenbaum 		struct drr_spill {
2100a586ceaSMark Shellenbaum 			uint64_t drr_object;
2110a586ceaSMark Shellenbaum 			uint64_t drr_length;
2120a586ceaSMark Shellenbaum 			uint64_t drr_toguid;
2130a586ceaSMark Shellenbaum 			uint64_t drr_pad[4]; /* needed for crypto */
2140a586ceaSMark Shellenbaum 			/* spill data follows */
2150a586ceaSMark Shellenbaum 		} drr_spill;
2165d7b4d43SMatthew Ahrens 		struct drr_write_embedded {
2175d7b4d43SMatthew Ahrens 			uint64_t drr_object;
2185d7b4d43SMatthew Ahrens 			uint64_t drr_offset;
2195d7b4d43SMatthew Ahrens 			/* logical length, should equal blocksize */
2205d7b4d43SMatthew Ahrens 			uint64_t drr_length;
2215d7b4d43SMatthew Ahrens 			uint64_t drr_toguid;
2225d7b4d43SMatthew Ahrens 			uint8_t drr_compression;
2235d7b4d43SMatthew Ahrens 			uint8_t drr_etype;
2245d7b4d43SMatthew Ahrens 			uint8_t drr_pad[6];
2255d7b4d43SMatthew Ahrens 			uint32_t drr_lsize; /* uncompressed size of payload */
2265d7b4d43SMatthew Ahrens 			uint32_t drr_psize; /* compr. (real) size of payload */
2275d7b4d43SMatthew Ahrens 			/* (possibly compressed) content follows */
2285d7b4d43SMatthew Ahrens 		} drr_write_embedded;
229*98110f08SMatthew Ahrens 
230*98110f08SMatthew Ahrens 		/*
231*98110f08SMatthew Ahrens 		 * Nore: drr_checksum is overlaid with all record types
232*98110f08SMatthew Ahrens 		 * except DRR_BEGIN.  Therefore its (non-pad) members
233*98110f08SMatthew Ahrens 		 * must not overlap with members from the other structs.
234*98110f08SMatthew Ahrens 		 * We accomplish this by putting its members at the very
235*98110f08SMatthew Ahrens 		 * end of the struct.
236*98110f08SMatthew Ahrens 		 */
237*98110f08SMatthew Ahrens 		struct drr_checksum {
238*98110f08SMatthew Ahrens 			uint64_t drr_pad[34];
239*98110f08SMatthew Ahrens 			/*
240*98110f08SMatthew Ahrens 			 * fletcher-4 checksum of everything preceding the
241*98110f08SMatthew Ahrens 			 * checksum.
242*98110f08SMatthew Ahrens 			 */
243*98110f08SMatthew Ahrens 			zio_cksum_t drr_checksum;
244*98110f08SMatthew Ahrens 		} drr_checksum;
245fa9e4066Sahrens 	} drr_u;
246fa9e4066Sahrens } dmu_replay_record_t;
247fa9e4066Sahrens 
24899d5e173STim Haley /* diff record range types */
24999d5e173STim Haley typedef enum diff_type {
25099d5e173STim Haley 	DDR_NONE = 0x1,
25199d5e173STim Haley 	DDR_INUSE = 0x2,
25299d5e173STim Haley 	DDR_FREE = 0x4
25399d5e173STim Haley } diff_type_t;
25499d5e173STim Haley 
25599d5e173STim Haley /*
25699d5e173STim Haley  * The diff reports back ranges of free or in-use objects.
25799d5e173STim Haley  */
25899d5e173STim Haley typedef struct dmu_diff_record {
25999d5e173STim Haley 	uint64_t ddr_type;
26099d5e173STim Haley 	uint64_t ddr_first;
26199d5e173STim Haley 	uint64_t ddr_last;
26299d5e173STim Haley } dmu_diff_record_t;
26399d5e173STim Haley 
264ea8dc4b6Seschrock typedef struct zinject_record {
265ea8dc4b6Seschrock 	uint64_t	zi_objset;
266ea8dc4b6Seschrock 	uint64_t	zi_object;
267ea8dc4b6Seschrock 	uint64_t	zi_start;
268ea8dc4b6Seschrock 	uint64_t	zi_end;
269ea8dc4b6Seschrock 	uint64_t	zi_guid;
270ea8dc4b6Seschrock 	uint32_t	zi_level;
271ea8dc4b6Seschrock 	uint32_t	zi_error;
272ea8dc4b6Seschrock 	uint64_t	zi_type;
273ea8dc4b6Seschrock 	uint32_t	zi_freq;
2748956713aSEric Schrock 	uint32_t	zi_failfast;
27588ecc943SGeorge Wilson 	char		zi_func[MAXNAMELEN];
2768f18d1faSGeorge Wilson 	uint32_t	zi_iotype;
277468c413aSTim Haley 	int32_t		zi_duration;
278468c413aSTim Haley 	uint64_t	zi_timer;
279283b8460SGeorge.Wilson 	uint32_t	zi_cmd;
280283b8460SGeorge.Wilson 	uint32_t	zi_pad;
281ea8dc4b6Seschrock } zinject_record_t;
282ea8dc4b6Seschrock 
283ea8dc4b6Seschrock #define	ZINJECT_NULL		0x1
284ea8dc4b6Seschrock #define	ZINJECT_FLUSH_ARC	0x2
285ea8dc4b6Seschrock #define	ZINJECT_UNLOAD_SPA	0x4
286ea8dc4b6Seschrock 
287283b8460SGeorge.Wilson typedef enum zinject_type {
288283b8460SGeorge.Wilson 	ZINJECT_UNINITIALIZED,
289283b8460SGeorge.Wilson 	ZINJECT_DATA_FAULT,
290283b8460SGeorge.Wilson 	ZINJECT_DEVICE_FAULT,
291283b8460SGeorge.Wilson 	ZINJECT_LABEL_FAULT,
292283b8460SGeorge.Wilson 	ZINJECT_IGNORED_WRITES,
293283b8460SGeorge.Wilson 	ZINJECT_PANIC,
294283b8460SGeorge.Wilson 	ZINJECT_DELAY_IO,
295283b8460SGeorge.Wilson } zinject_type_t;
296283b8460SGeorge.Wilson 
297ecd6cf80Smarks typedef struct zfs_share {
298ecd6cf80Smarks 	uint64_t	z_exportdata;
299ecd6cf80Smarks 	uint64_t	z_sharedata;
300ecd6cf80Smarks 	uint64_t	z_sharetype;	/* 0 = share, 1 = unshare */
301ecd6cf80Smarks 	uint64_t	z_sharemax;  /* max length of share string */
302ecd6cf80Smarks } zfs_share_t;
303ecd6cf80Smarks 
304de8267e0Stimh /*
305de8267e0Stimh  * ZFS file systems may behave the usual, POSIX-compliant way, where
306de8267e0Stimh  * name lookups are case-sensitive.  They may also be set up so that
307de8267e0Stimh  * all the name lookups are case-insensitive, or so that only some
308de8267e0Stimh  * lookups, the ones that set an FIGNORECASE flag, are case-insensitive.
309de8267e0Stimh  */
310de8267e0Stimh typedef enum zfs_case {
311de8267e0Stimh 	ZFS_CASE_SENSITIVE,
312de8267e0Stimh 	ZFS_CASE_INSENSITIVE,
313de8267e0Stimh 	ZFS_CASE_MIXED
314de8267e0Stimh } zfs_case_t;
315de8267e0Stimh 
316fa9e4066Sahrens typedef struct zfs_cmd {
3174445fffbSMatthew Ahrens 	char		zc_name[MAXPATHLEN];	/* name of pool or dataset */
3184445fffbSMatthew Ahrens 	uint64_t	zc_nvlist_src;		/* really (char *) */
3194445fffbSMatthew Ahrens 	uint64_t	zc_nvlist_src_size;
3204445fffbSMatthew Ahrens 	uint64_t	zc_nvlist_dst;		/* really (char *) */
3214445fffbSMatthew Ahrens 	uint64_t	zc_nvlist_dst_size;
3224445fffbSMatthew Ahrens 	boolean_t	zc_nvlist_dst_filled;	/* put an nvlist in dst? */
3234445fffbSMatthew Ahrens 	int		zc_pad2;
3244445fffbSMatthew Ahrens 
3254445fffbSMatthew Ahrens 	/*
3264445fffbSMatthew Ahrens 	 * The following members are for legacy ioctls which haven't been
3274445fffbSMatthew Ahrens 	 * converted to the new method.
3284445fffbSMatthew Ahrens 	 */
3294445fffbSMatthew Ahrens 	uint64_t	zc_history;		/* really (char *) */
33055434c77Sek 	char		zc_value[MAXPATHLEN * 2];
3313cb34c60Sahrens 	char		zc_string[MAXNAMELEN];
332ea8dc4b6Seschrock 	uint64_t	zc_guid;
333990b4856Slling 	uint64_t	zc_nvlist_conf;		/* really (char *) */
334990b4856Slling 	uint64_t	zc_nvlist_conf_size;
335fa9e4066Sahrens 	uint64_t	zc_cookie;
336fa9e4066Sahrens 	uint64_t	zc_objset_type;
337ecd6cf80Smarks 	uint64_t	zc_perm_action;
3384445fffbSMatthew Ahrens 	uint64_t	zc_history_len;
33906eeb2adSek 	uint64_t	zc_history_offset;
34055434c77Sek 	uint64_t	zc_obj;
341478ed9adSEric Taylor 	uint64_t	zc_iflags;		/* internal to zfs(7fs) */
342ecd6cf80Smarks 	zfs_share_t	zc_share;
343fa9e4066Sahrens 	dmu_objset_stats_t zc_objset_stats;
344fa9e4066Sahrens 	struct drr_begin zc_begin_record;
345ea8dc4b6Seschrock 	zinject_record_t zc_inject_record;
3465d7b4d43SMatthew Ahrens 	uint32_t	zc_defer_destroy;
3475d7b4d43SMatthew Ahrens 	uint32_t	zc_flags;
348c99e4bdcSChris Kirby 	uint64_t	zc_action_handle;
349c99e4bdcSChris Kirby 	int		zc_cleanup_fd;
35099d5e173STim Haley 	uint8_t		zc_pad[4];		/* alignment */
351a7f53a56SChris Kirby 	uint64_t	zc_sendobj;
352a7f53a56SChris Kirby 	uint64_t	zc_fromobj;
353a7f53a56SChris Kirby 	uint64_t	zc_createtxg;
35499d5e173STim Haley 	zfs_stat_t	zc_stat;
355fa9e4066Sahrens } zfs_cmd_t;
356fa9e4066Sahrens 
35714843421SMatthew Ahrens typedef struct zfs_useracct {
35814843421SMatthew Ahrens 	char zu_domain[256];
35914843421SMatthew Ahrens 	uid_t zu_rid;
36014843421SMatthew Ahrens 	uint32_t zu_pad;
36114843421SMatthew Ahrens 	uint64_t zu_space;
36214843421SMatthew Ahrens } zfs_useracct_t;
36314843421SMatthew Ahrens 
364c99e4bdcSChris Kirby #define	ZFSDEV_MAX_MINOR	(1 << 16)
365c99e4bdcSChris Kirby #define	ZFS_MIN_MINOR	(ZFSDEV_MAX_MINOR + 1)
366a0965f35Sbonwick 
3671195e687SMark J Musante #define	ZPOOL_EXPORT_AFTER_SPLIT 0x1
3681195e687SMark J Musante 
369fa9e4066Sahrens #ifdef _KERNEL
370fa9e4066Sahrens 
371da6c28aaSamw typedef struct zfs_creat {
372de8267e0Stimh 	nvlist_t	*zct_zplprops;
373da6c28aaSamw 	nvlist_t	*zct_props;
374da6c28aaSamw } zfs_creat_t;
375da6c28aaSamw 
376fa9e4066Sahrens extern dev_info_t *zfs_dip;
377fa9e4066Sahrens 
378ecd6cf80Smarks extern int zfs_secpolicy_snapshot_perms(const char *name, cred_t *cr);
379ecd6cf80Smarks extern int zfs_secpolicy_rename_perms(const char *from,
380ecd6cf80Smarks     const char *to, cred_t *cr);
381ecd6cf80Smarks extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
382fa9e4066Sahrens extern int zfs_busy(void);
383fc7a6e3fSWill Andrews extern int zfs_unmount_snap(const char *);
3843b2aab18SMatthew Ahrens extern void zfs_destroy_unmount_origin(const char *);
385fa9e4066Sahrens 
386c99e4bdcSChris Kirby /*
387c99e4bdcSChris Kirby  * ZFS minor numbers can refer to either a control device instance or
388c99e4bdcSChris Kirby  * a zvol. Depending on the value of zss_type, zss_data points to either
389c99e4bdcSChris Kirby  * a zvol_state_t or a zfs_onexit_t.
390c99e4bdcSChris Kirby  */
391c99e4bdcSChris Kirby enum zfs_soft_state_type {
392c99e4bdcSChris Kirby 	ZSST_ZVOL,
393c99e4bdcSChris Kirby 	ZSST_CTLDEV
394c99e4bdcSChris Kirby };
395c99e4bdcSChris Kirby 
396c99e4bdcSChris Kirby typedef struct zfs_soft_state {
397c99e4bdcSChris Kirby 	enum zfs_soft_state_type zss_type;
398c99e4bdcSChris Kirby 	void *zss_data;
399c99e4bdcSChris Kirby } zfs_soft_state_t;
400c99e4bdcSChris Kirby 
401c99e4bdcSChris Kirby extern void *zfsdev_get_soft_state(minor_t minor,
402c99e4bdcSChris Kirby     enum zfs_soft_state_type which);
403c99e4bdcSChris Kirby extern minor_t zfsdev_minor_alloc(void);
404c99e4bdcSChris Kirby 
405c99e4bdcSChris Kirby extern void *zfsdev_state;
406c99e4bdcSChris Kirby extern kmutex_t zfsdev_state_lock;
407c99e4bdcSChris Kirby 
408fa9e4066Sahrens #endif	/* _KERNEL */
409fa9e4066Sahrens 
410fa9e4066Sahrens #ifdef	__cplusplus
411fa9e4066Sahrens }
412fa9e4066Sahrens #endif
413fa9e4066Sahrens 
414fa9e4066Sahrens #endif	/* _SYS_ZFS_IOCTL_H */
415