xref: /illumos-gate/usr/src/uts/common/sys/fs/zfs.h (revision 6809eb4e)
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 
51fa9e4066Sahrens /*
52990b4856Slling  * Dataset properties are identified by these constants and must be added to
53990b4856Slling  * the end of this list to ensure that external consumers are not affected
54990b4856Slling  * by the change. If you make any changes to this list, be sure to update
5566e2aaccSgw  * the property table in usr/src/common/zfs/zfs_prop.c.
56fa9e4066Sahrens  */
57fa9e4066Sahrens typedef enum {
58fa9e4066Sahrens 	ZFS_PROP_TYPE,
59fa9e4066Sahrens 	ZFS_PROP_CREATION,
60fa9e4066Sahrens 	ZFS_PROP_USED,
61fa9e4066Sahrens 	ZFS_PROP_AVAILABLE,
62fa9e4066Sahrens 	ZFS_PROP_REFERENCED,
63fa9e4066Sahrens 	ZFS_PROP_COMPRESSRATIO,
64fa9e4066Sahrens 	ZFS_PROP_MOUNTED,
65fa9e4066Sahrens 	ZFS_PROP_ORIGIN,
66fa9e4066Sahrens 	ZFS_PROP_QUOTA,
67fa9e4066Sahrens 	ZFS_PROP_RESERVATION,
68fa9e4066Sahrens 	ZFS_PROP_VOLSIZE,
69fa9e4066Sahrens 	ZFS_PROP_VOLBLOCKSIZE,
70fa9e4066Sahrens 	ZFS_PROP_RECORDSIZE,
71fa9e4066Sahrens 	ZFS_PROP_MOUNTPOINT,
72fa9e4066Sahrens 	ZFS_PROP_SHARENFS,
73fa9e4066Sahrens 	ZFS_PROP_CHECKSUM,
74fa9e4066Sahrens 	ZFS_PROP_COMPRESSION,
75fa9e4066Sahrens 	ZFS_PROP_ATIME,
76fa9e4066Sahrens 	ZFS_PROP_DEVICES,
77fa9e4066Sahrens 	ZFS_PROP_EXEC,
78fa9e4066Sahrens 	ZFS_PROP_SETUID,
79fa9e4066Sahrens 	ZFS_PROP_READONLY,
80fa9e4066Sahrens 	ZFS_PROP_ZONED,
81fa9e4066Sahrens 	ZFS_PROP_SNAPDIR,
82fa9e4066Sahrens 	ZFS_PROP_ACLMODE,
83fa9e4066Sahrens 	ZFS_PROP_ACLINHERIT,
8466e2aaccSgw 	ZFS_PROP_CREATETXG,		/* not exposed to the user */
8566e2aaccSgw 	ZFS_PROP_NAME,			/* not exposed to the user */
86e9dbad6fSeschrock 	ZFS_PROP_CANMOUNT,
8766e2aaccSgw 	ZFS_PROP_SHAREISCSI,
8866e2aaccSgw 	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
897b55fa8eSck 	ZFS_PROP_XATTR,
90d0ad202dSahrens 	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
91b1b8ab34Slling 	ZFS_PROP_COPIES,
92e7437265Sahrens 	ZFS_PROP_VERSION,
93da6c28aaSamw 	ZFS_PROP_UTF8ONLY,
94da6c28aaSamw 	ZFS_PROP_NORMALIZE,
95da6c28aaSamw 	ZFS_PROP_CASE,
96da6c28aaSamw 	ZFS_PROP_VSCAN,
97da6c28aaSamw 	ZFS_PROP_NBMAND,
98da6c28aaSamw 	ZFS_PROP_SHARESMB,
99a9799022Sck 	ZFS_PROP_REFQUOTA,
100a9799022Sck 	ZFS_PROP_REFRESERVATION,
101c5904d13Seschrock 	ZFS_PROP_GUID,
1023baa08fcSek 	ZFS_PROP_PRIMARYCACHE,
1033baa08fcSek 	ZFS_PROP_SECONDARYCACHE,
10474e7dc98SMatthew Ahrens 	ZFS_PROP_USEDSNAP,
10574e7dc98SMatthew Ahrens 	ZFS_PROP_USEDDS,
10674e7dc98SMatthew Ahrens 	ZFS_PROP_USEDCHILD,
10774e7dc98SMatthew Ahrens 	ZFS_PROP_USEDREFRESERV,
10814843421SMatthew Ahrens 	ZFS_PROP_USERACCOUNTING,	/* not exposed to the user */
10991ebeef5Sahrens 	ZFS_NUM_PROPS
110fa9e4066Sahrens } zfs_prop_t;
111fa9e4066Sahrens 
11214843421SMatthew Ahrens typedef enum {
11314843421SMatthew Ahrens 	ZFS_PROP_USERUSED,
11414843421SMatthew Ahrens 	ZFS_PROP_USERQUOTA,
11514843421SMatthew Ahrens 	ZFS_PROP_GROUPUSED,
11614843421SMatthew Ahrens 	ZFS_PROP_GROUPQUOTA,
11714843421SMatthew Ahrens 	ZFS_NUM_USERQUOTA_PROPS
11814843421SMatthew Ahrens } zfs_userquota_prop_t;
11914843421SMatthew Ahrens 
12014843421SMatthew Ahrens extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
12114843421SMatthew Ahrens 
122990b4856Slling /*
123990b4856Slling  * Pool properties are identified by these constants and must be added to the
124b87f3af3Sperrin  * end of this list to ensure that external consumers are not affected
125990b4856Slling  * by the change. If you make any changes to this list, be sure to update
126990b4856Slling  * the property table in usr/src/common/zfs/zpool_prop.c.
127990b4856Slling  */
128990b4856Slling typedef enum {
129990b4856Slling 	ZPOOL_PROP_NAME,
130990b4856Slling 	ZPOOL_PROP_SIZE,
131990b4856Slling 	ZPOOL_PROP_USED,
132990b4856Slling 	ZPOOL_PROP_AVAILABLE,
133990b4856Slling 	ZPOOL_PROP_CAPACITY,
134990b4856Slling 	ZPOOL_PROP_ALTROOT,
135990b4856Slling 	ZPOOL_PROP_HEALTH,
136990b4856Slling 	ZPOOL_PROP_GUID,
137990b4856Slling 	ZPOOL_PROP_VERSION,
138990b4856Slling 	ZPOOL_PROP_BOOTFS,
139990b4856Slling 	ZPOOL_PROP_DELEGATION,
140990b4856Slling 	ZPOOL_PROP_AUTOREPLACE,
1412f8aaab3Seschrock 	ZPOOL_PROP_CACHEFILE,
1420a4e9518Sgw 	ZPOOL_PROP_FAILUREMODE,
143d5b5bb25SRich Morris 	ZPOOL_PROP_LISTSNAPS,
144990b4856Slling 	ZPOOL_NUM_PROPS
145990b4856Slling } zpool_prop_t;
146b1b8ab34Slling 
147990b4856Slling #define	ZPROP_CONT		-2
148990b4856Slling #define	ZPROP_INVAL		-1
1493d7072f8Seschrock 
150990b4856Slling #define	ZPROP_VALUE		"value"
151990b4856Slling #define	ZPROP_SOURCE		"source"
1527f7322feSeschrock 
153b1b8ab34Slling typedef enum {
154990b4856Slling 	ZPROP_SRC_NONE = 0x1,
155990b4856Slling 	ZPROP_SRC_DEFAULT = 0x2,
156990b4856Slling 	ZPROP_SRC_TEMPORARY = 0x4,
157990b4856Slling 	ZPROP_SRC_LOCAL = 0x8,
158990b4856Slling 	ZPROP_SRC_INHERITED = 0x10
159990b4856Slling } zprop_source_t;
160990b4856Slling 
161990b4856Slling #define	ZPROP_SRC_ALL	0x1f
162990b4856Slling 
163990b4856Slling typedef int (*zprop_func)(int, void *);
164990b4856Slling 
1650a48a24eStimh /*
1660a48a24eStimh  * Properties to be set on the root file system of a new pool
1670a48a24eStimh  * are stuffed into their own nvlist, which is then included in
1680a48a24eStimh  * the properties nvlist with the pool properties.
1690a48a24eStimh  */
1700a48a24eStimh #define	ZPOOL_ROOTFS_PROPS	"root-props-nvl"
1710a48a24eStimh 
172990b4856Slling /*
173990b4856Slling  * Dataset property functions shared between libzfs and kernel.
174990b4856Slling  */
175990b4856Slling const char *zfs_prop_default_string(zfs_prop_t);
176990b4856Slling uint64_t zfs_prop_default_numeric(zfs_prop_t);
177990b4856Slling boolean_t zfs_prop_readonly(zfs_prop_t);
178990b4856Slling boolean_t zfs_prop_inheritable(zfs_prop_t);
179da6c28aaSamw boolean_t zfs_prop_setonce(zfs_prop_t);
180990b4856Slling const char *zfs_prop_to_name(zfs_prop_t);
181990b4856Slling zfs_prop_t zfs_name_to_prop(const char *);
182990b4856Slling boolean_t zfs_prop_user(const char *);
18314843421SMatthew Ahrens boolean_t zfs_prop_userquota(const char *name);
184990b4856Slling int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
185990b4856Slling int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
1864853e976Sgw boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
187b1b8ab34Slling 
188990b4856Slling /*
189990b4856Slling  * Pool property functions shared between libzfs and kernel.
190990b4856Slling  */
191990b4856Slling zpool_prop_t zpool_name_to_prop(const char *);
192990b4856Slling const char *zpool_prop_to_name(zpool_prop_t);
193990b4856Slling const char *zpool_prop_default_string(zpool_prop_t);
194990b4856Slling uint64_t zpool_prop_default_numeric(zpool_prop_t);
195990b4856Slling boolean_t zpool_prop_readonly(zpool_prop_t);
196990b4856Slling int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
197990b4856Slling int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
198b1b8ab34Slling 
199990b4856Slling /*
200990b4856Slling  * Definitions for the Delegation.
201990b4856Slling  */
202ecd6cf80Smarks typedef enum {
203ecd6cf80Smarks 	ZFS_DELEG_WHO_UNKNOWN = 0,
204ecd6cf80Smarks 	ZFS_DELEG_USER = 'u',
205ecd6cf80Smarks 	ZFS_DELEG_USER_SETS = 'U',
206ecd6cf80Smarks 	ZFS_DELEG_GROUP = 'g',
207ecd6cf80Smarks 	ZFS_DELEG_GROUP_SETS = 'G',
208ecd6cf80Smarks 	ZFS_DELEG_EVERYONE = 'e',
209ecd6cf80Smarks 	ZFS_DELEG_EVERYONE_SETS = 'E',
210ecd6cf80Smarks 	ZFS_DELEG_CREATE = 'c',
211ecd6cf80Smarks 	ZFS_DELEG_CREATE_SETS = 'C',
212ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET = 's',
213ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET_SETS = 'S'
214ecd6cf80Smarks } zfs_deleg_who_type_t;
215ecd6cf80Smarks 
216ecd6cf80Smarks typedef enum {
217ecd6cf80Smarks 	ZFS_DELEG_NONE = 0,
218ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCAL = 1,
219ecd6cf80Smarks 	ZFS_DELEG_PERM_DESCENDENT = 2,
220ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
221ecd6cf80Smarks 	ZFS_DELEG_PERM_CREATE = 4
222ecd6cf80Smarks } zfs_deleg_inherit_t;
223ecd6cf80Smarks 
224ecd6cf80Smarks #define	ZFS_DELEG_PERM_UID	"uid"
225ecd6cf80Smarks #define	ZFS_DELEG_PERM_GID	"gid"
226ecd6cf80Smarks #define	ZFS_DELEG_PERM_GROUPS	"groups"
227ecd6cf80Smarks 
228743a77edSAlan Wright #define	ZFS_SMB_ACL_SRC		"src"
229743a77edSAlan Wright #define	ZFS_SMB_ACL_TARGET	"target"
230743a77edSAlan Wright 
231a227b7f4Shs typedef enum {
232a227b7f4Shs 	ZFS_CANMOUNT_OFF = 0,
233a227b7f4Shs 	ZFS_CANMOUNT_ON = 1,
234a227b7f4Shs 	ZFS_CANMOUNT_NOAUTO = 2
235a227b7f4Shs } zfs_canmount_type_t;
236a227b7f4Shs 
237da6c28aaSamw typedef enum zfs_share_op {
238da6c28aaSamw 	ZFS_SHARE_NFS = 0,
239da6c28aaSamw 	ZFS_UNSHARE_NFS = 1,
240da6c28aaSamw 	ZFS_SHARE_SMB = 2,
241da6c28aaSamw 	ZFS_UNSHARE_SMB = 3
242da6c28aaSamw } zfs_share_op_t;
243da6c28aaSamw 
244743a77edSAlan Wright typedef enum zfs_smb_acl_op {
245743a77edSAlan Wright 	ZFS_SMB_ACL_ADD,
246743a77edSAlan Wright 	ZFS_SMB_ACL_REMOVE,
247743a77edSAlan Wright 	ZFS_SMB_ACL_RENAME,
248743a77edSAlan Wright 	ZFS_SMB_ACL_PURGE
249743a77edSAlan Wright } zfs_smb_acl_op_t;
250743a77edSAlan Wright 
2513baa08fcSek typedef enum zfs_cache_type {
2523baa08fcSek 	ZFS_CACHE_NONE = 0,
2533baa08fcSek 	ZFS_CACHE_METADATA = 1,
2543baa08fcSek 	ZFS_CACHE_ALL = 2
2553baa08fcSek } zfs_cache_type_t;
2563baa08fcSek 
2573baa08fcSek 
258eaca9bbdSeschrock /*
25999653d4eSeschrock  * On-disk version number.
260eaca9bbdSeschrock  */
261e7437265Sahrens #define	SPA_VERSION_1			1ULL
262e7437265Sahrens #define	SPA_VERSION_2			2ULL
263e7437265Sahrens #define	SPA_VERSION_3			3ULL
264e7437265Sahrens #define	SPA_VERSION_4			4ULL
265e7437265Sahrens #define	SPA_VERSION_5			5ULL
266e7437265Sahrens #define	SPA_VERSION_6			6ULL
267e7437265Sahrens #define	SPA_VERSION_7			7ULL
268e7437265Sahrens #define	SPA_VERSION_8			8ULL
269da6c28aaSamw #define	SPA_VERSION_9			9ULL
270fa94a07fSbrendan #define	SPA_VERSION_10			10ULL
271088f3894Sahrens #define	SPA_VERSION_11			11ULL
272bb0ade09Sahrens #define	SPA_VERSION_12			12ULL
27374e7dc98SMatthew Ahrens #define	SPA_VERSION_13			13ULL
274d0f3f37eSMark Shellenbaum #define	SPA_VERSION_14			14ULL
27514843421SMatthew Ahrens #define	SPA_VERSION_15			15ULL
276b1b8ab34Slling /*
277e7cbe64fSgw  * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
278b1b8ab34Slling  * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*},
27914843421SMatthew Ahrens  * and do the appropriate changes.  Also bump the version number in
28014843421SMatthew Ahrens  * usr/src/grub/capability.
281b1b8ab34Slling  */
28214843421SMatthew Ahrens #define	SPA_VERSION			SPA_VERSION_15
28314843421SMatthew Ahrens #define	SPA_VERSION_STRING		"15"
28444cd46caSbillm 
28544cd46caSbillm /*
286e7437265Sahrens  * Symbolic names for the changes that caused a SPA_VERSION switch.
28744cd46caSbillm  * Used in the code when checking for presence or absence of a feature.
28844cd46caSbillm  * Feel free to define multiple symbolic names for each version if there
28944cd46caSbillm  * were multiple changes to on-disk structures during that version.
29044cd46caSbillm  *
291e7437265Sahrens  * NOTE: When checking the current SPA_VERSION in your code, be sure
29244cd46caSbillm  *       to use spa_version() since it reports the version of the
29344cd46caSbillm  *       last synced uberblock.  Checking the in-flight version can
29444cd46caSbillm  *       be dangerous in some cases.
29544cd46caSbillm  */
296e7437265Sahrens #define	SPA_VERSION_INITIAL		SPA_VERSION_1
297e7437265Sahrens #define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
298e7437265Sahrens #define	SPA_VERSION_SPARES		SPA_VERSION_3
299e7437265Sahrens #define	SPA_VERSION_RAID6		SPA_VERSION_3
300e7437265Sahrens #define	SPA_VERSION_BPLIST_ACCOUNT	SPA_VERSION_3
301e7437265Sahrens #define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
302e7437265Sahrens #define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
303e7437265Sahrens #define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
304e7437265Sahrens #define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
305e7437265Sahrens #define	SPA_VERSION_BOOTFS		SPA_VERSION_6
306990b4856Slling #define	SPA_VERSION_SLOGS		SPA_VERSION_7
307990b4856Slling #define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
308da6c28aaSamw #define	SPA_VERSION_FUID		SPA_VERSION_9
309a9799022Sck #define	SPA_VERSION_REFRESERVATION	SPA_VERSION_9
310a9799022Sck #define	SPA_VERSION_REFQUOTA		SPA_VERSION_9
311a9799022Sck #define	SPA_VERSION_UNIQUE_ACCURATE	SPA_VERSION_9
312fa94a07fSbrendan #define	SPA_VERSION_L2CACHE		SPA_VERSION_10
313088f3894Sahrens #define	SPA_VERSION_NEXT_CLONES		SPA_VERSION_11
314088f3894Sahrens #define	SPA_VERSION_ORIGIN		SPA_VERSION_11
315088f3894Sahrens #define	SPA_VERSION_DSL_SCRUB		SPA_VERSION_11
316bb0ade09Sahrens #define	SPA_VERSION_SNAP_PROPS		SPA_VERSION_12
31774e7dc98SMatthew Ahrens #define	SPA_VERSION_USED_BREAKDOWN	SPA_VERSION_13
318d0f3f37eSMark Shellenbaum #define	SPA_VERSION_PASSTHROUGH_X	SPA_VERSION_14
31914843421SMatthew Ahrens #define	SPA_VERSION_USERSPACE		SPA_VERSION_15
320e7437265Sahrens 
321e7437265Sahrens /*
322e7437265Sahrens  * ZPL version - rev'd whenever an incompatible on-disk format change
323e7437265Sahrens  * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
324e7437265Sahrens  * also update the version_table[] and help message in zfs_prop.c.
325e7437265Sahrens  *
326e7437265Sahrens  * When changing, be sure to teach GRUB how to read the new format!
327e7437265Sahrens  * See usr/src/grub/grub-0.95/stage2/{zfs-include/,fsys_zfs*}
328e7437265Sahrens  */
329e7437265Sahrens #define	ZPL_VERSION_1			1ULL
330e7437265Sahrens #define	ZPL_VERSION_2			2ULL
331da6c28aaSamw #define	ZPL_VERSION_3			3ULL
33214843421SMatthew Ahrens #define	ZPL_VERSION_4			4ULL
33314843421SMatthew Ahrens #define	ZPL_VERSION			ZPL_VERSION_4
33414843421SMatthew Ahrens #define	ZPL_VERSION_STRING		"4"
335e7437265Sahrens 
336e7437265Sahrens #define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
337e7437265Sahrens #define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
338da6c28aaSamw #define	ZPL_VERSION_FUID		ZPL_VERSION_3
339de8267e0Stimh #define	ZPL_VERSION_NORMALIZATION	ZPL_VERSION_3
340da6c28aaSamw #define	ZPL_VERSION_SYSATTR		ZPL_VERSION_3
34114843421SMatthew Ahrens #define	ZPL_VERSION_USERSPACE		ZPL_VERSION_4
342eaca9bbdSeschrock 
343fa9e4066Sahrens /*
344fa9e4066Sahrens  * The following are configuration names used in the nvlist describing a pool's
345fa9e4066Sahrens  * configuration.
346fa9e4066Sahrens  */
347fa9e4066Sahrens #define	ZPOOL_CONFIG_VERSION		"version"
348fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_NAME		"name"
349fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_STATE		"state"
350fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_TXG		"txg"
351fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
352fa9e4066Sahrens #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
353fa9e4066Sahrens #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
354fa9e4066Sahrens #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
355fa9e4066Sahrens #define	ZPOOL_CONFIG_TYPE		"type"
356fa9e4066Sahrens #define	ZPOOL_CONFIG_CHILDREN		"children"
357fa9e4066Sahrens #define	ZPOOL_CONFIG_ID			"id"
358fa9e4066Sahrens #define	ZPOOL_CONFIG_GUID		"guid"
359fa9e4066Sahrens #define	ZPOOL_CONFIG_PATH		"path"
360fa9e4066Sahrens #define	ZPOOL_CONFIG_DEVID		"devid"
361fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
362fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
363fa9e4066Sahrens #define	ZPOOL_CONFIG_ASHIFT		"ashift"
364fa9e4066Sahrens #define	ZPOOL_CONFIG_ASIZE		"asize"
365fa9e4066Sahrens #define	ZPOOL_CONFIG_DTL		"DTL"
366fa9e4066Sahrens #define	ZPOOL_CONFIG_STATS		"stats"
367afefbcddSeschrock #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
368ea8dc4b6Seschrock #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
369ea8dc4b6Seschrock #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
37099653d4eSeschrock #define	ZPOOL_CONFIG_SPARES		"spares"
37199653d4eSeschrock #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
37299653d4eSeschrock #define	ZPOOL_CONFIG_NPARITY		"nparity"
37395173954Sek #define	ZPOOL_CONFIG_HOSTID		"hostid"
37495173954Sek #define	ZPOOL_CONFIG_HOSTNAME		"hostname"
3753d7072f8Seschrock #define	ZPOOL_CONFIG_UNSPARE		"unspare"
3763d7072f8Seschrock #define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
3778654d025Sperrin #define	ZPOOL_CONFIG_IS_LOG		"is_log"
378fa94a07fSbrendan #define	ZPOOL_CONFIG_L2CACHE		"l2cache"
379e14bb325SJeff Bonwick #define	ZPOOL_CONFIG_SUSPENDED		"suspended"	/* not stored on disk */
380e7cbe64fSgw #define	ZPOOL_CONFIG_TIMESTAMP		"timestamp"	/* not stored on disk */
381e7cbe64fSgw #define	ZPOOL_CONFIG_BOOTFS		"bootfs"	/* not stored on disk */
3823d7072f8Seschrock /*
3833d7072f8Seschrock  * The persistent vdev state is stored as separate values rather than a single
3843d7072f8Seschrock  * 'vdev_state' entry.  This is because a device can be in multiple states, such
3853d7072f8Seschrock  * as offline and degraded.
3863d7072f8Seschrock  */
3873d7072f8Seschrock #define	ZPOOL_CONFIG_OFFLINE		"offline"
3883d7072f8Seschrock #define	ZPOOL_CONFIG_FAULTED		"faulted"
3893d7072f8Seschrock #define	ZPOOL_CONFIG_DEGRADED		"degraded"
3903d7072f8Seschrock #define	ZPOOL_CONFIG_REMOVED		"removed"
391*6809eb4eSEric Schrock #define	ZPOOL_CONFIG_FRU		"fru"
392fa9e4066Sahrens 
393fa9e4066Sahrens #define	VDEV_TYPE_ROOT			"root"
394fa9e4066Sahrens #define	VDEV_TYPE_MIRROR		"mirror"
395fa9e4066Sahrens #define	VDEV_TYPE_REPLACING		"replacing"
396fa9e4066Sahrens #define	VDEV_TYPE_RAIDZ			"raidz"
397fa9e4066Sahrens #define	VDEV_TYPE_DISK			"disk"
398fa9e4066Sahrens #define	VDEV_TYPE_FILE			"file"
399fa9e4066Sahrens #define	VDEV_TYPE_MISSING		"missing"
40099653d4eSeschrock #define	VDEV_TYPE_SPARE			"spare"
4018654d025Sperrin #define	VDEV_TYPE_LOG			"log"
402fa94a07fSbrendan #define	VDEV_TYPE_L2CACHE		"l2cache"
403fa9e4066Sahrens 
404fa9e4066Sahrens /*
405fa9e4066Sahrens  * This is needed in userland to report the minimum necessary device size.
406fa9e4066Sahrens  */
407fa9e4066Sahrens #define	SPA_MINDEVSIZE		(64ULL << 20)
408fa9e4066Sahrens 
409fa9e4066Sahrens /*
410fa9e4066Sahrens  * The location of the pool configuration repository, shared between kernel and
411fa9e4066Sahrens  * userland.
412fa9e4066Sahrens  */
413c5904d13Seschrock #define	ZPOOL_CACHE		"/etc/zfs/zpool.cache"
414fa9e4066Sahrens 
415fa9e4066Sahrens /*
416fa9e4066Sahrens  * vdev states are ordered from least to most healthy.
417fa9e4066Sahrens  * A vdev that's CANT_OPEN or below is considered unusable.
418fa9e4066Sahrens  */
419fa9e4066Sahrens typedef enum vdev_state {
420fa9e4066Sahrens 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
421fa9e4066Sahrens 	VDEV_STATE_CLOSED,	/* Not currently open			*/
422fa9e4066Sahrens 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
4233d7072f8Seschrock 	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
424fa9e4066Sahrens 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
4253d7072f8Seschrock 	VDEV_STATE_FAULTED,	/* External request to fault device	*/
426fa9e4066Sahrens 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
427fa9e4066Sahrens 	VDEV_STATE_HEALTHY	/* Presumed good			*/
428fa9e4066Sahrens } vdev_state_t;
429fa9e4066Sahrens 
4303d7072f8Seschrock #define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
4313d7072f8Seschrock 
432fa9e4066Sahrens /*
433fa9e4066Sahrens  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
434fa9e4066Sahrens  * of the vdev stats structure uses these constants to distinguish why.
435fa9e4066Sahrens  */
436fa9e4066Sahrens typedef enum vdev_aux {
437fa9e4066Sahrens 	VDEV_AUX_NONE,		/* no error				*/
438fa9e4066Sahrens 	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
439fa9e4066Sahrens 	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
440fa9e4066Sahrens 	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
441fa9e4066Sahrens 	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
442fa9e4066Sahrens 	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
443eaca9bbdSeschrock 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
444eaca9bbdSeschrock 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
44599653d4eSeschrock 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
4463d7072f8Seschrock 	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
44732b87932Sek 	VDEV_AUX_ERR_EXCEEDED,	/* too many errors			*/
448b87f3af3Sperrin 	VDEV_AUX_IO_FAILURE,	/* experienced I/O failure		*/
449b87f3af3Sperrin 	VDEV_AUX_BAD_LOG	/* cannot read log chain(s)		*/
450fa9e4066Sahrens } vdev_aux_t;
451fa9e4066Sahrens 
452fa9e4066Sahrens /*
45346a2abf2Seschrock  * pool state.  The following states are written to disk as part of the normal
454fa94a07fSbrendan  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
455fa94a07fSbrendan  * states are software abstractions used at various levels to communicate
456fa94a07fSbrendan  * pool state.
457fa9e4066Sahrens  */
458fa9e4066Sahrens typedef enum pool_state {
459fa9e4066Sahrens 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
460fa9e4066Sahrens 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
461fa9e4066Sahrens 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
46299653d4eSeschrock 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
463fa94a07fSbrendan 	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
464fa9e4066Sahrens 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
46546a2abf2Seschrock 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
46646a2abf2Seschrock 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
467fa9e4066Sahrens } pool_state_t;
468fa9e4066Sahrens 
469fa9e4066Sahrens /*
470fa9e4066Sahrens  * Scrub types.
471fa9e4066Sahrens  */
472fa9e4066Sahrens typedef enum pool_scrub_type {
473fa9e4066Sahrens 	POOL_SCRUB_NONE,
474fa9e4066Sahrens 	POOL_SCRUB_RESILVER,
475fa9e4066Sahrens 	POOL_SCRUB_EVERYTHING,
476fa9e4066Sahrens 	POOL_SCRUB_TYPES
477fa9e4066Sahrens } pool_scrub_type_t;
478fa9e4066Sahrens 
479fa9e4066Sahrens /*
480fa9e4066Sahrens  * ZIO types.  Needed to interpret vdev statistics below.
481fa9e4066Sahrens  */
482fa9e4066Sahrens typedef enum zio_type {
483fa9e4066Sahrens 	ZIO_TYPE_NULL = 0,
484fa9e4066Sahrens 	ZIO_TYPE_READ,
485fa9e4066Sahrens 	ZIO_TYPE_WRITE,
486fa9e4066Sahrens 	ZIO_TYPE_FREE,
487fa9e4066Sahrens 	ZIO_TYPE_CLAIM,
488fa9e4066Sahrens 	ZIO_TYPE_IOCTL,
489fa9e4066Sahrens 	ZIO_TYPES
490fa9e4066Sahrens } zio_type_t;
491fa9e4066Sahrens 
492fa9e4066Sahrens /*
493fa9e4066Sahrens  * Vdev statistics.  Note: all fields should be 64-bit because this
494fa9e4066Sahrens  * is passed between kernel and userland as an nvlist uint64 array.
495fa9e4066Sahrens  */
496fa9e4066Sahrens typedef struct vdev_stat {
497fa9e4066Sahrens 	hrtime_t	vs_timestamp;		/* time since vdev load	*/
498fa9e4066Sahrens 	uint64_t	vs_state;		/* vdev state		*/
499fa9e4066Sahrens 	uint64_t	vs_aux;			/* see vdev_aux_t	*/
500fa9e4066Sahrens 	uint64_t	vs_alloc;		/* space allocated	*/
501fa9e4066Sahrens 	uint64_t	vs_space;		/* total capacity	*/
50299653d4eSeschrock 	uint64_t	vs_dspace;		/* deflated capacity	*/
5032a79c5feSlling 	uint64_t	vs_rsize;		/* replaceable dev size */
504fa9e4066Sahrens 	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
505fa9e4066Sahrens 	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
506fa9e4066Sahrens 	uint64_t	vs_read_errors;		/* read errors		*/
507fa9e4066Sahrens 	uint64_t	vs_write_errors;	/* write errors		*/
508fa9e4066Sahrens 	uint64_t	vs_checksum_errors;	/* checksum errors	*/
509fa9e4066Sahrens 	uint64_t	vs_self_healed;		/* self-healed bytes	*/
510fa9e4066Sahrens 	uint64_t	vs_scrub_type;		/* pool_scrub_type_t	*/
511fa9e4066Sahrens 	uint64_t	vs_scrub_complete;	/* completed?		*/
512fa9e4066Sahrens 	uint64_t	vs_scrub_examined;	/* bytes examined; top	*/
513fa9e4066Sahrens 	uint64_t	vs_scrub_repaired;	/* bytes repaired; leaf	*/
514fa9e4066Sahrens 	uint64_t	vs_scrub_errors;	/* errors during scrub	*/
515fa9e4066Sahrens 	uint64_t	vs_scrub_start;		/* UTC scrub start time	*/
516fa9e4066Sahrens 	uint64_t	vs_scrub_end;		/* UTC scrub end time	*/
517fa9e4066Sahrens } vdev_stat_t;
518fa9e4066Sahrens 
519e7cbe64fSgw #define	ZVOL_DRIVER	"zvol"
520fa9e4066Sahrens #define	ZFS_DRIVER	"zfs"
521fa9e4066Sahrens #define	ZFS_DEV		"/dev/zfs"
522fa9e4066Sahrens 
523fa9e4066Sahrens /*
524fa9e4066Sahrens  * zvol paths.  Irritatingly, the devfsadm interfaces want all these
525fa9e4066Sahrens  * paths without the /dev prefix, but for some things, we want the
526fa9e4066Sahrens  * /dev prefix.  Below are the names without /dev.
527fa9e4066Sahrens  */
528fa9e4066Sahrens #define	ZVOL_DEV_DIR	"zvol/dsk"
529fa9e4066Sahrens #define	ZVOL_RDEV_DIR	"zvol/rdsk"
530fa9e4066Sahrens 
531fa9e4066Sahrens /*
532fa9e4066Sahrens  * And here are the things we need with /dev, etc. in front of them.
533fa9e4066Sahrens  */
534fa9e4066Sahrens #define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zvol@0:"
535e7cbe64fSgw #define	ZVOL_FULL_DEV_DIR	"/dev/" ZVOL_DEV_DIR "/"
536fa9e4066Sahrens 
537fa9e4066Sahrens #define	ZVOL_PROP_NAME		"name"
538fa9e4066Sahrens 
539fa9e4066Sahrens /*
540fa9e4066Sahrens  * /dev/zfs ioctl numbers.
541fa9e4066Sahrens  */
542fa9e4066Sahrens #define	ZFS_IOC		('Z' << 8)
543fa9e4066Sahrens 
544fa9e4066Sahrens typedef enum zfs_ioc {
545fa9e4066Sahrens 	ZFS_IOC_POOL_CREATE = ZFS_IOC,
546fa9e4066Sahrens 	ZFS_IOC_POOL_DESTROY,
547fa9e4066Sahrens 	ZFS_IOC_POOL_IMPORT,
548fa9e4066Sahrens 	ZFS_IOC_POOL_EXPORT,
549fa9e4066Sahrens 	ZFS_IOC_POOL_CONFIGS,
550fa9e4066Sahrens 	ZFS_IOC_POOL_STATS,
551fa9e4066Sahrens 	ZFS_IOC_POOL_TRYIMPORT,
552fa9e4066Sahrens 	ZFS_IOC_POOL_SCRUB,
553fa9e4066Sahrens 	ZFS_IOC_POOL_FREEZE,
554eaca9bbdSeschrock 	ZFS_IOC_POOL_UPGRADE,
55506eeb2adSek 	ZFS_IOC_POOL_GET_HISTORY,
556fa9e4066Sahrens 	ZFS_IOC_VDEV_ADD,
557fa9e4066Sahrens 	ZFS_IOC_VDEV_REMOVE,
5583d7072f8Seschrock 	ZFS_IOC_VDEV_SET_STATE,
559fa9e4066Sahrens 	ZFS_IOC_VDEV_ATTACH,
560fa9e4066Sahrens 	ZFS_IOC_VDEV_DETACH,
561c67d9675Seschrock 	ZFS_IOC_VDEV_SETPATH,
562*6809eb4eSEric Schrock 	ZFS_IOC_VDEV_SETFRU,
563fa9e4066Sahrens 	ZFS_IOC_OBJSET_STATS,
564de8267e0Stimh 	ZFS_IOC_OBJSET_ZPLPROPS,
565fa9e4066Sahrens 	ZFS_IOC_DATASET_LIST_NEXT,
566fa9e4066Sahrens 	ZFS_IOC_SNAPSHOT_LIST_NEXT,
567fa9e4066Sahrens 	ZFS_IOC_SET_PROP,
568fa9e4066Sahrens 	ZFS_IOC_CREATE_MINOR,
569fa9e4066Sahrens 	ZFS_IOC_REMOVE_MINOR,
570fa9e4066Sahrens 	ZFS_IOC_CREATE,
571fa9e4066Sahrens 	ZFS_IOC_DESTROY,
572fa9e4066Sahrens 	ZFS_IOC_ROLLBACK,
573fa9e4066Sahrens 	ZFS_IOC_RENAME,
5743cb34c60Sahrens 	ZFS_IOC_RECV,
5753cb34c60Sahrens 	ZFS_IOC_SEND,
576ea8dc4b6Seschrock 	ZFS_IOC_INJECT_FAULT,
577ea8dc4b6Seschrock 	ZFS_IOC_CLEAR_FAULT,
578ea8dc4b6Seschrock 	ZFS_IOC_INJECT_LIST_NEXT,
579ea8dc4b6Seschrock 	ZFS_IOC_ERROR_LOG,
580ea8dc4b6Seschrock 	ZFS_IOC_CLEAR,
5811d452cf5Sahrens 	ZFS_IOC_PROMOTE,
5821d452cf5Sahrens 	ZFS_IOC_DESTROY_SNAPS,
58355434c77Sek 	ZFS_IOC_SNAPSHOT,
58455434c77Sek 	ZFS_IOC_DSOBJ_TO_DSNAME,
585b1b8ab34Slling 	ZFS_IOC_OBJ_TO_PATH,
586b1b8ab34Slling 	ZFS_IOC_POOL_SET_PROPS,
587ecd6cf80Smarks 	ZFS_IOC_POOL_GET_PROPS,
588ecd6cf80Smarks 	ZFS_IOC_SET_FSACL,
589ecd6cf80Smarks 	ZFS_IOC_GET_FSACL,
590ecd6cf80Smarks 	ZFS_IOC_ISCSI_PERM_CHECK,
591e45ce728Sahrens 	ZFS_IOC_SHARE,
592743a77edSAlan Wright 	ZFS_IOC_INHERIT_PROP,
59314843421SMatthew Ahrens 	ZFS_IOC_SMB_ACL,
59414843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_ONE,
59514843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_MANY,
59614843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_UPGRADE
597fa9e4066Sahrens } zfs_ioc_t;
598fa9e4066Sahrens 
599ea8dc4b6Seschrock /*
600ea8dc4b6Seschrock  * Internal SPA load state.  Used by FMA diagnosis engine.
601ea8dc4b6Seschrock  */
602ea8dc4b6Seschrock typedef enum {
603ea8dc4b6Seschrock 	SPA_LOAD_NONE,		/* no load in progress */
604ea8dc4b6Seschrock 	SPA_LOAD_OPEN,		/* normal open */
605ea8dc4b6Seschrock 	SPA_LOAD_IMPORT,	/* import in progress */
606ea8dc4b6Seschrock 	SPA_LOAD_TRYIMPORT	/* tryimport in progress */
607ea8dc4b6Seschrock } spa_load_state_t;
608ea8dc4b6Seschrock 
609e9dbad6fSeschrock /*
610e9dbad6fSeschrock  * Bookmark name values.
611e9dbad6fSeschrock  */
61255434c77Sek #define	ZPOOL_ERR_LIST		"error list"
613e9dbad6fSeschrock #define	ZPOOL_ERR_DATASET	"dataset"
614e9dbad6fSeschrock #define	ZPOOL_ERR_OBJECT	"object"
615e9dbad6fSeschrock 
61606eeb2adSek #define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
61706eeb2adSek 
61806eeb2adSek /*
61906eeb2adSek  * The following are names used in the nvlist describing
62006eeb2adSek  * the pool's history log.
62106eeb2adSek  */
62206eeb2adSek #define	ZPOOL_HIST_RECORD	"history record"
62306eeb2adSek #define	ZPOOL_HIST_TIME		"history time"
62406eeb2adSek #define	ZPOOL_HIST_CMD		"history command"
625ecd6cf80Smarks #define	ZPOOL_HIST_WHO		"history who"
626ecd6cf80Smarks #define	ZPOOL_HIST_ZONE		"history zone"
627ecd6cf80Smarks #define	ZPOOL_HIST_HOST		"history hostname"
628ecd6cf80Smarks #define	ZPOOL_HIST_TXG		"history txg"
629ecd6cf80Smarks #define	ZPOOL_HIST_INT_EVENT	"history internal event"
630ecd6cf80Smarks #define	ZPOOL_HIST_INT_STR	"history internal str"
63106eeb2adSek 
6323d7072f8Seschrock /*
6333d7072f8Seschrock  * Flags for ZFS_IOC_VDEV_SET_STATE
6343d7072f8Seschrock  */
6353d7072f8Seschrock #define	ZFS_ONLINE_CHECKREMOVE	0x1
6363d7072f8Seschrock #define	ZFS_ONLINE_UNSPARE	0x2
6373d7072f8Seschrock #define	ZFS_ONLINE_FORCEFAULT	0x4
6383d7072f8Seschrock #define	ZFS_OFFLINE_TEMPORARY	0x1
6393d7072f8Seschrock 
6403d7072f8Seschrock /*
6413d7072f8Seschrock  * Sysevent payload members.  ZFS will generate the following sysevents with the
6423d7072f8Seschrock  * given payloads:
6433d7072f8Seschrock  *
6443d7072f8Seschrock  *	ESC_ZFS_RESILVER_START
6453d7072f8Seschrock  *	ESC_ZFS_RESILVER_END
6463d7072f8Seschrock  *	ESC_ZFS_POOL_DESTROY
6473d7072f8Seschrock  *
6483d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
6493d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
6503d7072f8Seschrock  *
6513d7072f8Seschrock  *	ESC_ZFS_VDEV_REMOVE
6523d7072f8Seschrock  *	ESC_ZFS_VDEV_CLEAR
6533d7072f8Seschrock  *	ESC_ZFS_VDEV_CHECK
6543d7072f8Seschrock  *
6553d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
6563d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
6573d7072f8Seschrock  *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
6583d7072f8Seschrock  *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
6593d7072f8Seschrock  */
6603d7072f8Seschrock #define	ZFS_EV_POOL_NAME	"pool_name"
6613d7072f8Seschrock #define	ZFS_EV_POOL_GUID	"pool_guid"
6623d7072f8Seschrock #define	ZFS_EV_VDEV_PATH	"vdev_path"
6633d7072f8Seschrock #define	ZFS_EV_VDEV_GUID	"vdev_guid"
6643d7072f8Seschrock 
665088f3894Sahrens /*
666088f3894Sahrens  * Note: This is encoded on-disk, so new events must be added to the
667088f3894Sahrens  * end, and unused events can not be removed.  Be sure to edit
668088f3894Sahrens  * zpool_main.c: hist_event_table[].
669088f3894Sahrens  */
670ecd6cf80Smarks typedef enum history_internal_events {
671ecd6cf80Smarks 	LOG_NO_EVENT = 0,
672ecd6cf80Smarks 	LOG_POOL_CREATE,
673ecd6cf80Smarks 	LOG_POOL_VDEV_ADD,
674ecd6cf80Smarks 	LOG_POOL_REMOVE,
675ecd6cf80Smarks 	LOG_POOL_DESTROY,
676ecd6cf80Smarks 	LOG_POOL_EXPORT,
677ecd6cf80Smarks 	LOG_POOL_IMPORT,
678ecd6cf80Smarks 	LOG_POOL_VDEV_ATTACH,
679ecd6cf80Smarks 	LOG_POOL_VDEV_REPLACE,
680ecd6cf80Smarks 	LOG_POOL_VDEV_DETACH,
681ecd6cf80Smarks 	LOG_POOL_VDEV_ONLINE,
682ecd6cf80Smarks 	LOG_POOL_VDEV_OFFLINE,
683ecd6cf80Smarks 	LOG_POOL_UPGRADE,
684ecd6cf80Smarks 	LOG_POOL_CLEAR,
685ecd6cf80Smarks 	LOG_POOL_SCRUB,
686ecd6cf80Smarks 	LOG_POOL_PROPSET,
687ecd6cf80Smarks 	LOG_DS_CREATE,
688ecd6cf80Smarks 	LOG_DS_CLONE,
689ecd6cf80Smarks 	LOG_DS_DESTROY,
690ecd6cf80Smarks 	LOG_DS_DESTROY_BEGIN,
691ecd6cf80Smarks 	LOG_DS_INHERIT,
692ecd6cf80Smarks 	LOG_DS_PROPSET,
693ecd6cf80Smarks 	LOG_DS_QUOTA,
694ecd6cf80Smarks 	LOG_DS_PERM_UPDATE,
695ecd6cf80Smarks 	LOG_DS_PERM_REMOVE,
696ecd6cf80Smarks 	LOG_DS_PERM_WHO_REMOVE,
697ecd6cf80Smarks 	LOG_DS_PROMOTE,
698ecd6cf80Smarks 	LOG_DS_RECEIVE,
699ecd6cf80Smarks 	LOG_DS_RENAME,
700ecd6cf80Smarks 	LOG_DS_RESERVATION,
701ecd6cf80Smarks 	LOG_DS_REPLAY_INC_SYNC,
702ecd6cf80Smarks 	LOG_DS_REPLAY_FULL_SYNC,
703ecd6cf80Smarks 	LOG_DS_ROLLBACK,
704ecd6cf80Smarks 	LOG_DS_SNAPSHOT,
705e7437265Sahrens 	LOG_DS_UPGRADE,
706a9799022Sck 	LOG_DS_REFQUOTA,
707a9799022Sck 	LOG_DS_REFRESERV,
708088f3894Sahrens 	LOG_POOL_SCRUB_DONE,
709ecd6cf80Smarks 	LOG_END
710ecd6cf80Smarks } history_internal_events_t;
711ecd6cf80Smarks 
712fa9e4066Sahrens #ifdef	__cplusplus
713fa9e4066Sahrens }
714fa9e4066Sahrens #endif
715fa9e4066Sahrens 
716fa9e4066Sahrens #endif	/* _SYS_FS_ZFS_H */
717