xref: /illumos-gate/usr/src/uts/common/sys/fs/zfs.h (revision 478ed9ada0b6efe1318150a700986aa47e6a926d)
1fa9e4066Sahrens /*
2fa9e4066Sahrens  * CDDL HEADER START
3fa9e4066Sahrens  *
4fa9e4066Sahrens  * The contents of this file are subject to the terms of the
5441d80aaSlling  * Common Development and Distribution License (the "License").
6441d80aaSlling  * 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 /*
22743a77edSAlan Wright  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23fa9e4066Sahrens  * Use is subject to license terms.
24fa9e4066Sahrens  */
25fa9e4066Sahrens 
26fa9e4066Sahrens #ifndef	_SYS_FS_ZFS_H
27fa9e4066Sahrens #define	_SYS_FS_ZFS_H
28fa9e4066Sahrens 
29fa9e4066Sahrens #ifdef	__cplusplus
30fa9e4066Sahrens extern "C" {
31fa9e4066Sahrens #endif
32fa9e4066Sahrens 
33fa9e4066Sahrens /*
34fa9e4066Sahrens  * Types and constants shared between userland and the kernel.
35fa9e4066Sahrens  */
36fa9e4066Sahrens 
37fa9e4066Sahrens /*
38fa9e4066Sahrens  * Each dataset can be one of the following types.  These constants can be
39fa9e4066Sahrens  * combined into masks that can be passed to various functions.
40fa9e4066Sahrens  */
41fa9e4066Sahrens typedef enum {
42fa9e4066Sahrens 	ZFS_TYPE_FILESYSTEM	= 0x1,
43fa9e4066Sahrens 	ZFS_TYPE_SNAPSHOT	= 0x2,
44b1b8ab34Slling 	ZFS_TYPE_VOLUME		= 0x4,
45b1b8ab34Slling 	ZFS_TYPE_POOL		= 0x8
46fa9e4066Sahrens } zfs_type_t;
47fa9e4066Sahrens 
48990b4856Slling #define	ZFS_TYPE_DATASET	\
49fa9e4066Sahrens 	(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
50fa9e4066Sahrens 
51*478ed9adSEric Taylor #define	ZAP_MAXNAMELEN 256
52*478ed9adSEric Taylor #define	ZAP_MAXVALUELEN (1024 * 8)
53*478ed9adSEric Taylor #define	ZAP_OLDMAXVALUELEN 1024
54*478ed9adSEric Taylor 
55fa9e4066Sahrens /*
56990b4856Slling  * Dataset properties are identified by these constants and must be added to
57990b4856Slling  * the end of this list to ensure that external consumers are not affected
58990b4856Slling  * by the change. If you make any changes to this list, be sure to update
5966e2aaccSgw  * the property table in usr/src/common/zfs/zfs_prop.c.
60fa9e4066Sahrens  */
61fa9e4066Sahrens typedef enum {
62fa9e4066Sahrens 	ZFS_PROP_TYPE,
63fa9e4066Sahrens 	ZFS_PROP_CREATION,
64fa9e4066Sahrens 	ZFS_PROP_USED,
65fa9e4066Sahrens 	ZFS_PROP_AVAILABLE,
66fa9e4066Sahrens 	ZFS_PROP_REFERENCED,
67fa9e4066Sahrens 	ZFS_PROP_COMPRESSRATIO,
68fa9e4066Sahrens 	ZFS_PROP_MOUNTED,
69fa9e4066Sahrens 	ZFS_PROP_ORIGIN,
70fa9e4066Sahrens 	ZFS_PROP_QUOTA,
71fa9e4066Sahrens 	ZFS_PROP_RESERVATION,
72fa9e4066Sahrens 	ZFS_PROP_VOLSIZE,
73fa9e4066Sahrens 	ZFS_PROP_VOLBLOCKSIZE,
74fa9e4066Sahrens 	ZFS_PROP_RECORDSIZE,
75fa9e4066Sahrens 	ZFS_PROP_MOUNTPOINT,
76fa9e4066Sahrens 	ZFS_PROP_SHARENFS,
77fa9e4066Sahrens 	ZFS_PROP_CHECKSUM,
78fa9e4066Sahrens 	ZFS_PROP_COMPRESSION,
79fa9e4066Sahrens 	ZFS_PROP_ATIME,
80fa9e4066Sahrens 	ZFS_PROP_DEVICES,
81fa9e4066Sahrens 	ZFS_PROP_EXEC,
82fa9e4066Sahrens 	ZFS_PROP_SETUID,
83fa9e4066Sahrens 	ZFS_PROP_READONLY,
84fa9e4066Sahrens 	ZFS_PROP_ZONED,
85fa9e4066Sahrens 	ZFS_PROP_SNAPDIR,
86fa9e4066Sahrens 	ZFS_PROP_ACLMODE,
87fa9e4066Sahrens 	ZFS_PROP_ACLINHERIT,
8866e2aaccSgw 	ZFS_PROP_CREATETXG,		/* not exposed to the user */
8966e2aaccSgw 	ZFS_PROP_NAME,			/* not exposed to the user */
90e9dbad6fSeschrock 	ZFS_PROP_CANMOUNT,
9166e2aaccSgw 	ZFS_PROP_SHAREISCSI,
9266e2aaccSgw 	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
937b55fa8eSck 	ZFS_PROP_XATTR,
94d0ad202dSahrens 	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
95b1b8ab34Slling 	ZFS_PROP_COPIES,
96e7437265Sahrens 	ZFS_PROP_VERSION,
97da6c28aaSamw 	ZFS_PROP_UTF8ONLY,
98da6c28aaSamw 	ZFS_PROP_NORMALIZE,
99da6c28aaSamw 	ZFS_PROP_CASE,
100da6c28aaSamw 	ZFS_PROP_VSCAN,
101da6c28aaSamw 	ZFS_PROP_NBMAND,
102da6c28aaSamw 	ZFS_PROP_SHARESMB,
103a9799022Sck 	ZFS_PROP_REFQUOTA,
104a9799022Sck 	ZFS_PROP_REFRESERVATION,
105c5904d13Seschrock 	ZFS_PROP_GUID,
1063baa08fcSek 	ZFS_PROP_PRIMARYCACHE,
1073baa08fcSek 	ZFS_PROP_SECONDARYCACHE,
10874e7dc98SMatthew Ahrens 	ZFS_PROP_USEDSNAP,
10974e7dc98SMatthew Ahrens 	ZFS_PROP_USEDDS,
11074e7dc98SMatthew Ahrens 	ZFS_PROP_USEDCHILD,
11174e7dc98SMatthew Ahrens 	ZFS_PROP_USEDREFRESERV,
11214843421SMatthew Ahrens 	ZFS_PROP_USERACCOUNTING,	/* not exposed to the user */
113*478ed9adSEric Taylor 	ZFS_PROP_STMF_SHAREINFO,	/* not exposed to the user */
11491ebeef5Sahrens 	ZFS_NUM_PROPS
115fa9e4066Sahrens } zfs_prop_t;
116fa9e4066Sahrens 
11714843421SMatthew Ahrens typedef enum {
11814843421SMatthew Ahrens 	ZFS_PROP_USERUSED,
11914843421SMatthew Ahrens 	ZFS_PROP_USERQUOTA,
12014843421SMatthew Ahrens 	ZFS_PROP_GROUPUSED,
12114843421SMatthew Ahrens 	ZFS_PROP_GROUPQUOTA,
12214843421SMatthew Ahrens 	ZFS_NUM_USERQUOTA_PROPS
12314843421SMatthew Ahrens } zfs_userquota_prop_t;
12414843421SMatthew Ahrens 
12514843421SMatthew Ahrens extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
12614843421SMatthew Ahrens 
127990b4856Slling /*
128990b4856Slling  * Pool properties are identified by these constants and must be added to the
129b87f3af3Sperrin  * end of this list to ensure that external consumers are not affected
130990b4856Slling  * by the change. If you make any changes to this list, be sure to update
131990b4856Slling  * the property table in usr/src/common/zfs/zpool_prop.c.
132990b4856Slling  */
133990b4856Slling typedef enum {
134990b4856Slling 	ZPOOL_PROP_NAME,
135990b4856Slling 	ZPOOL_PROP_SIZE,
136990b4856Slling 	ZPOOL_PROP_USED,
137990b4856Slling 	ZPOOL_PROP_AVAILABLE,
138990b4856Slling 	ZPOOL_PROP_CAPACITY,
139990b4856Slling 	ZPOOL_PROP_ALTROOT,
140990b4856Slling 	ZPOOL_PROP_HEALTH,
141990b4856Slling 	ZPOOL_PROP_GUID,
142990b4856Slling 	ZPOOL_PROP_VERSION,
143990b4856Slling 	ZPOOL_PROP_BOOTFS,
144990b4856Slling 	ZPOOL_PROP_DELEGATION,
145990b4856Slling 	ZPOOL_PROP_AUTOREPLACE,
1462f8aaab3Seschrock 	ZPOOL_PROP_CACHEFILE,
1470a4e9518Sgw 	ZPOOL_PROP_FAILUREMODE,
148d5b5bb25SRich Morris 	ZPOOL_PROP_LISTSNAPS,
149990b4856Slling 	ZPOOL_NUM_PROPS
150990b4856Slling } zpool_prop_t;
151b1b8ab34Slling 
152990b4856Slling #define	ZPROP_CONT		-2
153990b4856Slling #define	ZPROP_INVAL		-1
1543d7072f8Seschrock 
155990b4856Slling #define	ZPROP_VALUE		"value"
156990b4856Slling #define	ZPROP_SOURCE		"source"
1577f7322feSeschrock 
158b1b8ab34Slling typedef enum {
159990b4856Slling 	ZPROP_SRC_NONE = 0x1,
160990b4856Slling 	ZPROP_SRC_DEFAULT = 0x2,
161990b4856Slling 	ZPROP_SRC_TEMPORARY = 0x4,
162990b4856Slling 	ZPROP_SRC_LOCAL = 0x8,
163990b4856Slling 	ZPROP_SRC_INHERITED = 0x10
164990b4856Slling } zprop_source_t;
165990b4856Slling 
166990b4856Slling #define	ZPROP_SRC_ALL	0x1f
167990b4856Slling 
168990b4856Slling typedef int (*zprop_func)(int, void *);
169990b4856Slling 
1700a48a24eStimh /*
1710a48a24eStimh  * Properties to be set on the root file system of a new pool
1720a48a24eStimh  * are stuffed into their own nvlist, which is then included in
1730a48a24eStimh  * the properties nvlist with the pool properties.
1740a48a24eStimh  */
1750a48a24eStimh #define	ZPOOL_ROOTFS_PROPS	"root-props-nvl"
1760a48a24eStimh 
177990b4856Slling /*
178990b4856Slling  * Dataset property functions shared between libzfs and kernel.
179990b4856Slling  */
180990b4856Slling const char *zfs_prop_default_string(zfs_prop_t);
181990b4856Slling uint64_t zfs_prop_default_numeric(zfs_prop_t);
182990b4856Slling boolean_t zfs_prop_readonly(zfs_prop_t);
183990b4856Slling boolean_t zfs_prop_inheritable(zfs_prop_t);
184da6c28aaSamw boolean_t zfs_prop_setonce(zfs_prop_t);
185990b4856Slling const char *zfs_prop_to_name(zfs_prop_t);
186990b4856Slling zfs_prop_t zfs_name_to_prop(const char *);
187990b4856Slling boolean_t zfs_prop_user(const char *);
18814843421SMatthew Ahrens boolean_t zfs_prop_userquota(const char *name);
189990b4856Slling int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
190990b4856Slling int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
1914853e976Sgw boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
192b1b8ab34Slling 
193990b4856Slling /*
194990b4856Slling  * Pool property functions shared between libzfs and kernel.
195990b4856Slling  */
196990b4856Slling zpool_prop_t zpool_name_to_prop(const char *);
197990b4856Slling const char *zpool_prop_to_name(zpool_prop_t);
198990b4856Slling const char *zpool_prop_default_string(zpool_prop_t);
199990b4856Slling uint64_t zpool_prop_default_numeric(zpool_prop_t);
200990b4856Slling boolean_t zpool_prop_readonly(zpool_prop_t);
201990b4856Slling int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
202990b4856Slling int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
203b1b8ab34Slling 
204990b4856Slling /*
205990b4856Slling  * Definitions for the Delegation.
206990b4856Slling  */
207ecd6cf80Smarks typedef enum {
208ecd6cf80Smarks 	ZFS_DELEG_WHO_UNKNOWN = 0,
209ecd6cf80Smarks 	ZFS_DELEG_USER = 'u',
210ecd6cf80Smarks 	ZFS_DELEG_USER_SETS = 'U',
211ecd6cf80Smarks 	ZFS_DELEG_GROUP = 'g',
212ecd6cf80Smarks 	ZFS_DELEG_GROUP_SETS = 'G',
213ecd6cf80Smarks 	ZFS_DELEG_EVERYONE = 'e',
214ecd6cf80Smarks 	ZFS_DELEG_EVERYONE_SETS = 'E',
215ecd6cf80Smarks 	ZFS_DELEG_CREATE = 'c',
216ecd6cf80Smarks 	ZFS_DELEG_CREATE_SETS = 'C',
217ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET = 's',
218ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET_SETS = 'S'
219ecd6cf80Smarks } zfs_deleg_who_type_t;
220ecd6cf80Smarks 
221ecd6cf80Smarks typedef enum {
222ecd6cf80Smarks 	ZFS_DELEG_NONE = 0,
223ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCAL = 1,
224ecd6cf80Smarks 	ZFS_DELEG_PERM_DESCENDENT = 2,
225ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
226ecd6cf80Smarks 	ZFS_DELEG_PERM_CREATE = 4
227ecd6cf80Smarks } zfs_deleg_inherit_t;
228ecd6cf80Smarks 
229ecd6cf80Smarks #define	ZFS_DELEG_PERM_UID	"uid"
230ecd6cf80Smarks #define	ZFS_DELEG_PERM_GID	"gid"
231ecd6cf80Smarks #define	ZFS_DELEG_PERM_GROUPS	"groups"
232ecd6cf80Smarks 
233743a77edSAlan Wright #define	ZFS_SMB_ACL_SRC		"src"
234743a77edSAlan Wright #define	ZFS_SMB_ACL_TARGET	"target"
235743a77edSAlan Wright 
236a227b7f4Shs typedef enum {
237a227b7f4Shs 	ZFS_CANMOUNT_OFF = 0,
238a227b7f4Shs 	ZFS_CANMOUNT_ON = 1,
239a227b7f4Shs 	ZFS_CANMOUNT_NOAUTO = 2
240a227b7f4Shs } zfs_canmount_type_t;
241a227b7f4Shs 
242da6c28aaSamw typedef enum zfs_share_op {
243da6c28aaSamw 	ZFS_SHARE_NFS = 0,
244da6c28aaSamw 	ZFS_UNSHARE_NFS = 1,
245da6c28aaSamw 	ZFS_SHARE_SMB = 2,
246da6c28aaSamw 	ZFS_UNSHARE_SMB = 3
247da6c28aaSamw } zfs_share_op_t;
248da6c28aaSamw 
249743a77edSAlan Wright typedef enum zfs_smb_acl_op {
250743a77edSAlan Wright 	ZFS_SMB_ACL_ADD,
251743a77edSAlan Wright 	ZFS_SMB_ACL_REMOVE,
252743a77edSAlan Wright 	ZFS_SMB_ACL_RENAME,
253743a77edSAlan Wright 	ZFS_SMB_ACL_PURGE
254743a77edSAlan Wright } zfs_smb_acl_op_t;
255743a77edSAlan Wright 
2563baa08fcSek typedef enum zfs_cache_type {
2573baa08fcSek 	ZFS_CACHE_NONE = 0,
2583baa08fcSek 	ZFS_CACHE_METADATA = 1,
2593baa08fcSek 	ZFS_CACHE_ALL = 2
2603baa08fcSek } zfs_cache_type_t;
2613baa08fcSek 
2623baa08fcSek 
263eaca9bbdSeschrock /*
26499653d4eSeschrock  * On-disk version number.
265eaca9bbdSeschrock  */
266e7437265Sahrens #define	SPA_VERSION_1			1ULL
267e7437265Sahrens #define	SPA_VERSION_2			2ULL
268e7437265Sahrens #define	SPA_VERSION_3			3ULL
269e7437265Sahrens #define	SPA_VERSION_4			4ULL
270e7437265Sahrens #define	SPA_VERSION_5			5ULL
271e7437265Sahrens #define	SPA_VERSION_6			6ULL
272e7437265Sahrens #define	SPA_VERSION_7			7ULL
273e7437265Sahrens #define	SPA_VERSION_8			8ULL
274da6c28aaSamw #define	SPA_VERSION_9			9ULL
275fa94a07fSbrendan #define	SPA_VERSION_10			10ULL
276088f3894Sahrens #define	SPA_VERSION_11			11ULL
277bb0ade09Sahrens #define	SPA_VERSION_12			12ULL
27874e7dc98SMatthew Ahrens #define	SPA_VERSION_13			13ULL
279d0f3f37eSMark Shellenbaum #define	SPA_VERSION_14			14ULL
28014843421SMatthew Ahrens #define	SPA_VERSION_15			15ULL
281*478ed9adSEric Taylor #define	SPA_VERSION_16			16ULL
282b1b8ab34Slling /*
283e7cbe64fSgw  * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
284*478ed9adSEric Taylor  * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
28514843421SMatthew Ahrens  * and do the appropriate changes.  Also bump the version number in
28614843421SMatthew Ahrens  * usr/src/grub/capability.
287b1b8ab34Slling  */
288*478ed9adSEric Taylor #define	SPA_VERSION			SPA_VERSION_16
289*478ed9adSEric Taylor #define	SPA_VERSION_STRING		"16"
29044cd46caSbillm 
29144cd46caSbillm /*
292e7437265Sahrens  * Symbolic names for the changes that caused a SPA_VERSION switch.
29344cd46caSbillm  * Used in the code when checking for presence or absence of a feature.
29444cd46caSbillm  * Feel free to define multiple symbolic names for each version if there
29544cd46caSbillm  * were multiple changes to on-disk structures during that version.
29644cd46caSbillm  *
297e7437265Sahrens  * NOTE: When checking the current SPA_VERSION in your code, be sure
29844cd46caSbillm  *       to use spa_version() since it reports the version of the
29944cd46caSbillm  *       last synced uberblock.  Checking the in-flight version can
30044cd46caSbillm  *       be dangerous in some cases.
30144cd46caSbillm  */
302e7437265Sahrens #define	SPA_VERSION_INITIAL		SPA_VERSION_1
303e7437265Sahrens #define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
304e7437265Sahrens #define	SPA_VERSION_SPARES		SPA_VERSION_3
305e7437265Sahrens #define	SPA_VERSION_RAID6		SPA_VERSION_3
306e7437265Sahrens #define	SPA_VERSION_BPLIST_ACCOUNT	SPA_VERSION_3
307e7437265Sahrens #define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
308e7437265Sahrens #define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
309e7437265Sahrens #define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
310e7437265Sahrens #define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
311e7437265Sahrens #define	SPA_VERSION_BOOTFS		SPA_VERSION_6
312990b4856Slling #define	SPA_VERSION_SLOGS		SPA_VERSION_7
313990b4856Slling #define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
314da6c28aaSamw #define	SPA_VERSION_FUID		SPA_VERSION_9
315a9799022Sck #define	SPA_VERSION_REFRESERVATION	SPA_VERSION_9
316a9799022Sck #define	SPA_VERSION_REFQUOTA		SPA_VERSION_9
317a9799022Sck #define	SPA_VERSION_UNIQUE_ACCURATE	SPA_VERSION_9
318fa94a07fSbrendan #define	SPA_VERSION_L2CACHE		SPA_VERSION_10
319088f3894Sahrens #define	SPA_VERSION_NEXT_CLONES		SPA_VERSION_11
320088f3894Sahrens #define	SPA_VERSION_ORIGIN		SPA_VERSION_11
321088f3894Sahrens #define	SPA_VERSION_DSL_SCRUB		SPA_VERSION_11
322bb0ade09Sahrens #define	SPA_VERSION_SNAP_PROPS		SPA_VERSION_12
32374e7dc98SMatthew Ahrens #define	SPA_VERSION_USED_BREAKDOWN	SPA_VERSION_13
324d0f3f37eSMark Shellenbaum #define	SPA_VERSION_PASSTHROUGH_X	SPA_VERSION_14
32514843421SMatthew Ahrens #define	SPA_VERSION_USERSPACE		SPA_VERSION_15
326*478ed9adSEric Taylor #define	SPA_VERSION_STMF_PROP		SPA_VERSION_16
327e7437265Sahrens 
328e7437265Sahrens /*
329e7437265Sahrens  * ZPL version - rev'd whenever an incompatible on-disk format change
330e7437265Sahrens  * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
331e7437265Sahrens  * also update the version_table[] and help message in zfs_prop.c.
332e7437265Sahrens  *
333e7437265Sahrens  * When changing, be sure to teach GRUB how to read the new format!
334*478ed9adSEric Taylor  * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
335e7437265Sahrens  */
336e7437265Sahrens #define	ZPL_VERSION_1			1ULL
337e7437265Sahrens #define	ZPL_VERSION_2			2ULL
338da6c28aaSamw #define	ZPL_VERSION_3			3ULL
33914843421SMatthew Ahrens #define	ZPL_VERSION_4			4ULL
34014843421SMatthew Ahrens #define	ZPL_VERSION			ZPL_VERSION_4
34114843421SMatthew Ahrens #define	ZPL_VERSION_STRING		"4"
342e7437265Sahrens 
343e7437265Sahrens #define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
344e7437265Sahrens #define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
345da6c28aaSamw #define	ZPL_VERSION_FUID		ZPL_VERSION_3
346de8267e0Stimh #define	ZPL_VERSION_NORMALIZATION	ZPL_VERSION_3
347da6c28aaSamw #define	ZPL_VERSION_SYSATTR		ZPL_VERSION_3
34814843421SMatthew Ahrens #define	ZPL_VERSION_USERSPACE		ZPL_VERSION_4
349eaca9bbdSeschrock 
350fa9e4066Sahrens /*
351fa9e4066Sahrens  * The following are configuration names used in the nvlist describing a pool's
352fa9e4066Sahrens  * configuration.
353fa9e4066Sahrens  */
354fa9e4066Sahrens #define	ZPOOL_CONFIG_VERSION		"version"
355fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_NAME		"name"
356fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_STATE		"state"
357fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_TXG		"txg"
358fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
359fa9e4066Sahrens #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
360fa9e4066Sahrens #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
361fa9e4066Sahrens #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
362fa9e4066Sahrens #define	ZPOOL_CONFIG_TYPE		"type"
363fa9e4066Sahrens #define	ZPOOL_CONFIG_CHILDREN		"children"
364fa9e4066Sahrens #define	ZPOOL_CONFIG_ID			"id"
365fa9e4066Sahrens #define	ZPOOL_CONFIG_GUID		"guid"
366fa9e4066Sahrens #define	ZPOOL_CONFIG_PATH		"path"
367fa9e4066Sahrens #define	ZPOOL_CONFIG_DEVID		"devid"
368fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
369fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
370fa9e4066Sahrens #define	ZPOOL_CONFIG_ASHIFT		"ashift"
371fa9e4066Sahrens #define	ZPOOL_CONFIG_ASIZE		"asize"
372fa9e4066Sahrens #define	ZPOOL_CONFIG_DTL		"DTL"
373fa9e4066Sahrens #define	ZPOOL_CONFIG_STATS		"stats"
374afefbcddSeschrock #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
375ea8dc4b6Seschrock #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
376ea8dc4b6Seschrock #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
37799653d4eSeschrock #define	ZPOOL_CONFIG_SPARES		"spares"
37899653d4eSeschrock #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
37999653d4eSeschrock #define	ZPOOL_CONFIG_NPARITY		"nparity"
38095173954Sek #define	ZPOOL_CONFIG_HOSTID		"hostid"
38195173954Sek #define	ZPOOL_CONFIG_HOSTNAME		"hostname"
3823d7072f8Seschrock #define	ZPOOL_CONFIG_UNSPARE		"unspare"
3833d7072f8Seschrock #define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
3848654d025Sperrin #define	ZPOOL_CONFIG_IS_LOG		"is_log"
385fa94a07fSbrendan #define	ZPOOL_CONFIG_L2CACHE		"l2cache"
386e14bb325SJeff Bonwick #define	ZPOOL_CONFIG_SUSPENDED		"suspended"	/* not stored on disk */
387e7cbe64fSgw #define	ZPOOL_CONFIG_TIMESTAMP		"timestamp"	/* not stored on disk */
388e7cbe64fSgw #define	ZPOOL_CONFIG_BOOTFS		"bootfs"	/* not stored on disk */
3893d7072f8Seschrock /*
3903d7072f8Seschrock  * The persistent vdev state is stored as separate values rather than a single
3913d7072f8Seschrock  * 'vdev_state' entry.  This is because a device can be in multiple states, such
3923d7072f8Seschrock  * as offline and degraded.
3933d7072f8Seschrock  */
3943d7072f8Seschrock #define	ZPOOL_CONFIG_OFFLINE		"offline"
3953d7072f8Seschrock #define	ZPOOL_CONFIG_FAULTED		"faulted"
3963d7072f8Seschrock #define	ZPOOL_CONFIG_DEGRADED		"degraded"
3973d7072f8Seschrock #define	ZPOOL_CONFIG_REMOVED		"removed"
3986809eb4eSEric Schrock #define	ZPOOL_CONFIG_FRU		"fru"
399fa9e4066Sahrens 
400fa9e4066Sahrens #define	VDEV_TYPE_ROOT			"root"
401fa9e4066Sahrens #define	VDEV_TYPE_MIRROR		"mirror"
402fa9e4066Sahrens #define	VDEV_TYPE_REPLACING		"replacing"
403fa9e4066Sahrens #define	VDEV_TYPE_RAIDZ			"raidz"
404fa9e4066Sahrens #define	VDEV_TYPE_DISK			"disk"
405fa9e4066Sahrens #define	VDEV_TYPE_FILE			"file"
406fa9e4066Sahrens #define	VDEV_TYPE_MISSING		"missing"
40799653d4eSeschrock #define	VDEV_TYPE_SPARE			"spare"
4088654d025Sperrin #define	VDEV_TYPE_LOG			"log"
409fa94a07fSbrendan #define	VDEV_TYPE_L2CACHE		"l2cache"
410fa9e4066Sahrens 
411fa9e4066Sahrens /*
412fa9e4066Sahrens  * This is needed in userland to report the minimum necessary device size.
413fa9e4066Sahrens  */
414fa9e4066Sahrens #define	SPA_MINDEVSIZE		(64ULL << 20)
415fa9e4066Sahrens 
416fa9e4066Sahrens /*
417fa9e4066Sahrens  * The location of the pool configuration repository, shared between kernel and
418fa9e4066Sahrens  * userland.
419fa9e4066Sahrens  */
420c5904d13Seschrock #define	ZPOOL_CACHE		"/etc/zfs/zpool.cache"
421fa9e4066Sahrens 
422fa9e4066Sahrens /*
423fa9e4066Sahrens  * vdev states are ordered from least to most healthy.
424fa9e4066Sahrens  * A vdev that's CANT_OPEN or below is considered unusable.
425fa9e4066Sahrens  */
426fa9e4066Sahrens typedef enum vdev_state {
427fa9e4066Sahrens 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
428fa9e4066Sahrens 	VDEV_STATE_CLOSED,	/* Not currently open			*/
429fa9e4066Sahrens 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
4303d7072f8Seschrock 	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
431fa9e4066Sahrens 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
4323d7072f8Seschrock 	VDEV_STATE_FAULTED,	/* External request to fault device	*/
433fa9e4066Sahrens 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
434fa9e4066Sahrens 	VDEV_STATE_HEALTHY	/* Presumed good			*/
435fa9e4066Sahrens } vdev_state_t;
436fa9e4066Sahrens 
4373d7072f8Seschrock #define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
4383d7072f8Seschrock 
439fa9e4066Sahrens /*
440fa9e4066Sahrens  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
441fa9e4066Sahrens  * of the vdev stats structure uses these constants to distinguish why.
442fa9e4066Sahrens  */
443fa9e4066Sahrens typedef enum vdev_aux {
444fa9e4066Sahrens 	VDEV_AUX_NONE,		/* no error				*/
445fa9e4066Sahrens 	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
446fa9e4066Sahrens 	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
447fa9e4066Sahrens 	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
448fa9e4066Sahrens 	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
449fa9e4066Sahrens 	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
450eaca9bbdSeschrock 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
451eaca9bbdSeschrock 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
45299653d4eSeschrock 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
4533d7072f8Seschrock 	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
45432b87932Sek 	VDEV_AUX_ERR_EXCEEDED,	/* too many errors			*/
455b87f3af3Sperrin 	VDEV_AUX_IO_FAILURE,	/* experienced I/O failure		*/
456b87f3af3Sperrin 	VDEV_AUX_BAD_LOG	/* cannot read log chain(s)		*/
457fa9e4066Sahrens } vdev_aux_t;
458fa9e4066Sahrens 
459fa9e4066Sahrens /*
46046a2abf2Seschrock  * pool state.  The following states are written to disk as part of the normal
461fa94a07fSbrendan  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
462fa94a07fSbrendan  * states are software abstractions used at various levels to communicate
463fa94a07fSbrendan  * pool state.
464fa9e4066Sahrens  */
465fa9e4066Sahrens typedef enum pool_state {
466fa9e4066Sahrens 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
467fa9e4066Sahrens 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
468fa9e4066Sahrens 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
46999653d4eSeschrock 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
470fa94a07fSbrendan 	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
471fa9e4066Sahrens 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
47246a2abf2Seschrock 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
47346a2abf2Seschrock 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
474fa9e4066Sahrens } pool_state_t;
475fa9e4066Sahrens 
476fa9e4066Sahrens /*
477fa9e4066Sahrens  * Scrub types.
478fa9e4066Sahrens  */
479fa9e4066Sahrens typedef enum pool_scrub_type {
480fa9e4066Sahrens 	POOL_SCRUB_NONE,
481fa9e4066Sahrens 	POOL_SCRUB_RESILVER,
482fa9e4066Sahrens 	POOL_SCRUB_EVERYTHING,
483fa9e4066Sahrens 	POOL_SCRUB_TYPES
484fa9e4066Sahrens } pool_scrub_type_t;
485fa9e4066Sahrens 
486fa9e4066Sahrens /*
487fa9e4066Sahrens  * ZIO types.  Needed to interpret vdev statistics below.
488fa9e4066Sahrens  */
489fa9e4066Sahrens typedef enum zio_type {
490fa9e4066Sahrens 	ZIO_TYPE_NULL = 0,
491fa9e4066Sahrens 	ZIO_TYPE_READ,
492fa9e4066Sahrens 	ZIO_TYPE_WRITE,
493fa9e4066Sahrens 	ZIO_TYPE_FREE,
494fa9e4066Sahrens 	ZIO_TYPE_CLAIM,
495fa9e4066Sahrens 	ZIO_TYPE_IOCTL,
496fa9e4066Sahrens 	ZIO_TYPES
497fa9e4066Sahrens } zio_type_t;
498fa9e4066Sahrens 
499fa9e4066Sahrens /*
500fa9e4066Sahrens  * Vdev statistics.  Note: all fields should be 64-bit because this
501fa9e4066Sahrens  * is passed between kernel and userland as an nvlist uint64 array.
502fa9e4066Sahrens  */
503fa9e4066Sahrens typedef struct vdev_stat {
504fa9e4066Sahrens 	hrtime_t	vs_timestamp;		/* time since vdev load	*/
505fa9e4066Sahrens 	uint64_t	vs_state;		/* vdev state		*/
506fa9e4066Sahrens 	uint64_t	vs_aux;			/* see vdev_aux_t	*/
507fa9e4066Sahrens 	uint64_t	vs_alloc;		/* space allocated	*/
508fa9e4066Sahrens 	uint64_t	vs_space;		/* total capacity	*/
50999653d4eSeschrock 	uint64_t	vs_dspace;		/* deflated capacity	*/
5102a79c5feSlling 	uint64_t	vs_rsize;		/* replaceable dev size */
511fa9e4066Sahrens 	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
512fa9e4066Sahrens 	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
513fa9e4066Sahrens 	uint64_t	vs_read_errors;		/* read errors		*/
514fa9e4066Sahrens 	uint64_t	vs_write_errors;	/* write errors		*/
515fa9e4066Sahrens 	uint64_t	vs_checksum_errors;	/* checksum errors	*/
516fa9e4066Sahrens 	uint64_t	vs_self_healed;		/* self-healed bytes	*/
517fa9e4066Sahrens 	uint64_t	vs_scrub_type;		/* pool_scrub_type_t	*/
518fa9e4066Sahrens 	uint64_t	vs_scrub_complete;	/* completed?		*/
519fa9e4066Sahrens 	uint64_t	vs_scrub_examined;	/* bytes examined; top	*/
520fa9e4066Sahrens 	uint64_t	vs_scrub_repaired;	/* bytes repaired; leaf	*/
521fa9e4066Sahrens 	uint64_t	vs_scrub_errors;	/* errors during scrub	*/
522fa9e4066Sahrens 	uint64_t	vs_scrub_start;		/* UTC scrub start time	*/
523fa9e4066Sahrens 	uint64_t	vs_scrub_end;		/* UTC scrub end time	*/
524fa9e4066Sahrens } vdev_stat_t;
525fa9e4066Sahrens 
526e7cbe64fSgw #define	ZVOL_DRIVER	"zvol"
527fa9e4066Sahrens #define	ZFS_DRIVER	"zfs"
528fa9e4066Sahrens #define	ZFS_DEV		"/dev/zfs"
529fa9e4066Sahrens 
530fa9e4066Sahrens /*
531fa9e4066Sahrens  * zvol paths.  Irritatingly, the devfsadm interfaces want all these
532fa9e4066Sahrens  * paths without the /dev prefix, but for some things, we want the
533fa9e4066Sahrens  * /dev prefix.  Below are the names without /dev.
534fa9e4066Sahrens  */
535fa9e4066Sahrens #define	ZVOL_DEV_DIR	"zvol/dsk"
536fa9e4066Sahrens #define	ZVOL_RDEV_DIR	"zvol/rdsk"
537fa9e4066Sahrens 
538fa9e4066Sahrens /*
539fa9e4066Sahrens  * And here are the things we need with /dev, etc. in front of them.
540fa9e4066Sahrens  */
541fa9e4066Sahrens #define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zvol@0:"
542e7cbe64fSgw #define	ZVOL_FULL_DEV_DIR	"/dev/" ZVOL_DEV_DIR "/"
543fa9e4066Sahrens 
544fa9e4066Sahrens #define	ZVOL_PROP_NAME		"name"
545fa9e4066Sahrens 
546fa9e4066Sahrens /*
547fa9e4066Sahrens  * /dev/zfs ioctl numbers.
548fa9e4066Sahrens  */
549fa9e4066Sahrens #define	ZFS_IOC		('Z' << 8)
550fa9e4066Sahrens 
551fa9e4066Sahrens typedef enum zfs_ioc {
552fa9e4066Sahrens 	ZFS_IOC_POOL_CREATE = ZFS_IOC,
553fa9e4066Sahrens 	ZFS_IOC_POOL_DESTROY,
554fa9e4066Sahrens 	ZFS_IOC_POOL_IMPORT,
555fa9e4066Sahrens 	ZFS_IOC_POOL_EXPORT,
556fa9e4066Sahrens 	ZFS_IOC_POOL_CONFIGS,
557fa9e4066Sahrens 	ZFS_IOC_POOL_STATS,
558fa9e4066Sahrens 	ZFS_IOC_POOL_TRYIMPORT,
559fa9e4066Sahrens 	ZFS_IOC_POOL_SCRUB,
560fa9e4066Sahrens 	ZFS_IOC_POOL_FREEZE,
561eaca9bbdSeschrock 	ZFS_IOC_POOL_UPGRADE,
56206eeb2adSek 	ZFS_IOC_POOL_GET_HISTORY,
563fa9e4066Sahrens 	ZFS_IOC_VDEV_ADD,
564fa9e4066Sahrens 	ZFS_IOC_VDEV_REMOVE,
5653d7072f8Seschrock 	ZFS_IOC_VDEV_SET_STATE,
566fa9e4066Sahrens 	ZFS_IOC_VDEV_ATTACH,
567fa9e4066Sahrens 	ZFS_IOC_VDEV_DETACH,
568c67d9675Seschrock 	ZFS_IOC_VDEV_SETPATH,
5696809eb4eSEric Schrock 	ZFS_IOC_VDEV_SETFRU,
570fa9e4066Sahrens 	ZFS_IOC_OBJSET_STATS,
571de8267e0Stimh 	ZFS_IOC_OBJSET_ZPLPROPS,
572fa9e4066Sahrens 	ZFS_IOC_DATASET_LIST_NEXT,
573fa9e4066Sahrens 	ZFS_IOC_SNAPSHOT_LIST_NEXT,
574fa9e4066Sahrens 	ZFS_IOC_SET_PROP,
575fa9e4066Sahrens 	ZFS_IOC_CREATE_MINOR,
576fa9e4066Sahrens 	ZFS_IOC_REMOVE_MINOR,
577fa9e4066Sahrens 	ZFS_IOC_CREATE,
578fa9e4066Sahrens 	ZFS_IOC_DESTROY,
579fa9e4066Sahrens 	ZFS_IOC_ROLLBACK,
580fa9e4066Sahrens 	ZFS_IOC_RENAME,
5813cb34c60Sahrens 	ZFS_IOC_RECV,
5823cb34c60Sahrens 	ZFS_IOC_SEND,
583ea8dc4b6Seschrock 	ZFS_IOC_INJECT_FAULT,
584ea8dc4b6Seschrock 	ZFS_IOC_CLEAR_FAULT,
585ea8dc4b6Seschrock 	ZFS_IOC_INJECT_LIST_NEXT,
586ea8dc4b6Seschrock 	ZFS_IOC_ERROR_LOG,
587ea8dc4b6Seschrock 	ZFS_IOC_CLEAR,
5881d452cf5Sahrens 	ZFS_IOC_PROMOTE,
5891d452cf5Sahrens 	ZFS_IOC_DESTROY_SNAPS,
59055434c77Sek 	ZFS_IOC_SNAPSHOT,
59155434c77Sek 	ZFS_IOC_DSOBJ_TO_DSNAME,
592b1b8ab34Slling 	ZFS_IOC_OBJ_TO_PATH,
593b1b8ab34Slling 	ZFS_IOC_POOL_SET_PROPS,
594ecd6cf80Smarks 	ZFS_IOC_POOL_GET_PROPS,
595ecd6cf80Smarks 	ZFS_IOC_SET_FSACL,
596ecd6cf80Smarks 	ZFS_IOC_GET_FSACL,
597ecd6cf80Smarks 	ZFS_IOC_ISCSI_PERM_CHECK,
598e45ce728Sahrens 	ZFS_IOC_SHARE,
599743a77edSAlan Wright 	ZFS_IOC_INHERIT_PROP,
60014843421SMatthew Ahrens 	ZFS_IOC_SMB_ACL,
60114843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_ONE,
60214843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_MANY,
60314843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_UPGRADE
604fa9e4066Sahrens } zfs_ioc_t;
605fa9e4066Sahrens 
606ea8dc4b6Seschrock /*
607ea8dc4b6Seschrock  * Internal SPA load state.  Used by FMA diagnosis engine.
608ea8dc4b6Seschrock  */
609ea8dc4b6Seschrock typedef enum {
610ea8dc4b6Seschrock 	SPA_LOAD_NONE,		/* no load in progress */
611ea8dc4b6Seschrock 	SPA_LOAD_OPEN,		/* normal open */
612ea8dc4b6Seschrock 	SPA_LOAD_IMPORT,	/* import in progress */
613ea8dc4b6Seschrock 	SPA_LOAD_TRYIMPORT	/* tryimport in progress */
614ea8dc4b6Seschrock } spa_load_state_t;
615ea8dc4b6Seschrock 
616e9dbad6fSeschrock /*
617e9dbad6fSeschrock  * Bookmark name values.
618e9dbad6fSeschrock  */
61955434c77Sek #define	ZPOOL_ERR_LIST		"error list"
620e9dbad6fSeschrock #define	ZPOOL_ERR_DATASET	"dataset"
621e9dbad6fSeschrock #define	ZPOOL_ERR_OBJECT	"object"
622e9dbad6fSeschrock 
62306eeb2adSek #define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
62406eeb2adSek 
62506eeb2adSek /*
62606eeb2adSek  * The following are names used in the nvlist describing
62706eeb2adSek  * the pool's history log.
62806eeb2adSek  */
62906eeb2adSek #define	ZPOOL_HIST_RECORD	"history record"
63006eeb2adSek #define	ZPOOL_HIST_TIME		"history time"
63106eeb2adSek #define	ZPOOL_HIST_CMD		"history command"
632ecd6cf80Smarks #define	ZPOOL_HIST_WHO		"history who"
633ecd6cf80Smarks #define	ZPOOL_HIST_ZONE		"history zone"
634ecd6cf80Smarks #define	ZPOOL_HIST_HOST		"history hostname"
635ecd6cf80Smarks #define	ZPOOL_HIST_TXG		"history txg"
636ecd6cf80Smarks #define	ZPOOL_HIST_INT_EVENT	"history internal event"
637ecd6cf80Smarks #define	ZPOOL_HIST_INT_STR	"history internal str"
63806eeb2adSek 
6393d7072f8Seschrock /*
6403d7072f8Seschrock  * Flags for ZFS_IOC_VDEV_SET_STATE
6413d7072f8Seschrock  */
6423d7072f8Seschrock #define	ZFS_ONLINE_CHECKREMOVE	0x1
6433d7072f8Seschrock #define	ZFS_ONLINE_UNSPARE	0x2
6443d7072f8Seschrock #define	ZFS_ONLINE_FORCEFAULT	0x4
6453d7072f8Seschrock #define	ZFS_OFFLINE_TEMPORARY	0x1
6463d7072f8Seschrock 
6473d7072f8Seschrock /*
6483d7072f8Seschrock  * Sysevent payload members.  ZFS will generate the following sysevents with the
6493d7072f8Seschrock  * given payloads:
6503d7072f8Seschrock  *
6513d7072f8Seschrock  *	ESC_ZFS_RESILVER_START
6523d7072f8Seschrock  *	ESC_ZFS_RESILVER_END
6533d7072f8Seschrock  *	ESC_ZFS_POOL_DESTROY
6543d7072f8Seschrock  *
6553d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
6563d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
6573d7072f8Seschrock  *
6583d7072f8Seschrock  *	ESC_ZFS_VDEV_REMOVE
6593d7072f8Seschrock  *	ESC_ZFS_VDEV_CLEAR
6603d7072f8Seschrock  *	ESC_ZFS_VDEV_CHECK
6613d7072f8Seschrock  *
6623d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
6633d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
6643d7072f8Seschrock  *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
6653d7072f8Seschrock  *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
6663d7072f8Seschrock  */
6673d7072f8Seschrock #define	ZFS_EV_POOL_NAME	"pool_name"
6683d7072f8Seschrock #define	ZFS_EV_POOL_GUID	"pool_guid"
6693d7072f8Seschrock #define	ZFS_EV_VDEV_PATH	"vdev_path"
6703d7072f8Seschrock #define	ZFS_EV_VDEV_GUID	"vdev_guid"
6713d7072f8Seschrock 
672088f3894Sahrens /*
673088f3894Sahrens  * Note: This is encoded on-disk, so new events must be added to the
674088f3894Sahrens  * end, and unused events can not be removed.  Be sure to edit
675088f3894Sahrens  * zpool_main.c: hist_event_table[].
676088f3894Sahrens  */
677ecd6cf80Smarks typedef enum history_internal_events {
678ecd6cf80Smarks 	LOG_NO_EVENT = 0,
679ecd6cf80Smarks 	LOG_POOL_CREATE,
680ecd6cf80Smarks 	LOG_POOL_VDEV_ADD,
681ecd6cf80Smarks 	LOG_POOL_REMOVE,
682ecd6cf80Smarks 	LOG_POOL_DESTROY,
683ecd6cf80Smarks 	LOG_POOL_EXPORT,
684ecd6cf80Smarks 	LOG_POOL_IMPORT,
685ecd6cf80Smarks 	LOG_POOL_VDEV_ATTACH,
686ecd6cf80Smarks 	LOG_POOL_VDEV_REPLACE,
687ecd6cf80Smarks 	LOG_POOL_VDEV_DETACH,
688ecd6cf80Smarks 	LOG_POOL_VDEV_ONLINE,
689ecd6cf80Smarks 	LOG_POOL_VDEV_OFFLINE,
690ecd6cf80Smarks 	LOG_POOL_UPGRADE,
691ecd6cf80Smarks 	LOG_POOL_CLEAR,
692ecd6cf80Smarks 	LOG_POOL_SCRUB,
693ecd6cf80Smarks 	LOG_POOL_PROPSET,
694ecd6cf80Smarks 	LOG_DS_CREATE,
695ecd6cf80Smarks 	LOG_DS_CLONE,
696ecd6cf80Smarks 	LOG_DS_DESTROY,
697ecd6cf80Smarks 	LOG_DS_DESTROY_BEGIN,
698ecd6cf80Smarks 	LOG_DS_INHERIT,
699ecd6cf80Smarks 	LOG_DS_PROPSET,
700ecd6cf80Smarks 	LOG_DS_QUOTA,
701ecd6cf80Smarks 	LOG_DS_PERM_UPDATE,
702ecd6cf80Smarks 	LOG_DS_PERM_REMOVE,
703ecd6cf80Smarks 	LOG_DS_PERM_WHO_REMOVE,
704ecd6cf80Smarks 	LOG_DS_PROMOTE,
705ecd6cf80Smarks 	LOG_DS_RECEIVE,
706ecd6cf80Smarks 	LOG_DS_RENAME,
707ecd6cf80Smarks 	LOG_DS_RESERVATION,
708ecd6cf80Smarks 	LOG_DS_REPLAY_INC_SYNC,
709ecd6cf80Smarks 	LOG_DS_REPLAY_FULL_SYNC,
710ecd6cf80Smarks 	LOG_DS_ROLLBACK,
711ecd6cf80Smarks 	LOG_DS_SNAPSHOT,
712e7437265Sahrens 	LOG_DS_UPGRADE,
713a9799022Sck 	LOG_DS_REFQUOTA,
714a9799022Sck 	LOG_DS_REFRESERV,
715088f3894Sahrens 	LOG_POOL_SCRUB_DONE,
716ecd6cf80Smarks 	LOG_END
717ecd6cf80Smarks } history_internal_events_t;
718ecd6cf80Smarks 
719fa9e4066Sahrens #ifdef	__cplusplus
720fa9e4066Sahrens }
721fa9e4066Sahrens #endif
722fa9e4066Sahrens 
723fa9e4066Sahrens #endif	/* _SYS_FS_ZFS_H */
724