xref: /illumos-gate/usr/src/uts/common/sys/fs/zfs.h (revision 1d7132005da8d75994a6ad204e6ec05ef5ffaa4b)
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  */
21f94275ceSAdam Leventhal 
22fa9e4066Sahrens /*
23743a77edSAlan Wright  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24fa9e4066Sahrens  * Use is subject to license terms.
25fa9e4066Sahrens  */
26fa9e4066Sahrens 
27fa9e4066Sahrens #ifndef	_SYS_FS_ZFS_H
28fa9e4066Sahrens #define	_SYS_FS_ZFS_H
29fa9e4066Sahrens 
30842727c2SChris Kirby #include <sys/time.h>
31842727c2SChris Kirby 
32fa9e4066Sahrens #ifdef	__cplusplus
33fa9e4066Sahrens extern "C" {
34fa9e4066Sahrens #endif
35fa9e4066Sahrens 
36fa9e4066Sahrens /*
37fa9e4066Sahrens  * Types and constants shared between userland and the kernel.
38fa9e4066Sahrens  */
39fa9e4066Sahrens 
40fa9e4066Sahrens /*
41fa9e4066Sahrens  * Each dataset can be one of the following types.  These constants can be
42fa9e4066Sahrens  * combined into masks that can be passed to various functions.
43fa9e4066Sahrens  */
44fa9e4066Sahrens typedef enum {
45fa9e4066Sahrens 	ZFS_TYPE_FILESYSTEM	= 0x1,
46fa9e4066Sahrens 	ZFS_TYPE_SNAPSHOT	= 0x2,
47b1b8ab34Slling 	ZFS_TYPE_VOLUME		= 0x4,
48b1b8ab34Slling 	ZFS_TYPE_POOL		= 0x8
49fa9e4066Sahrens } zfs_type_t;
50fa9e4066Sahrens 
51990b4856Slling #define	ZFS_TYPE_DATASET	\
52fa9e4066Sahrens 	(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
53fa9e4066Sahrens 
54478ed9adSEric Taylor #define	ZAP_MAXNAMELEN 256
55478ed9adSEric Taylor #define	ZAP_MAXVALUELEN (1024 * 8)
56478ed9adSEric Taylor #define	ZAP_OLDMAXVALUELEN 1024
57478ed9adSEric Taylor 
58fa9e4066Sahrens /*
59990b4856Slling  * Dataset properties are identified by these constants and must be added to
60990b4856Slling  * the end of this list to ensure that external consumers are not affected
61990b4856Slling  * by the change. If you make any changes to this list, be sure to update
6266e2aaccSgw  * the property table in usr/src/common/zfs/zfs_prop.c.
63fa9e4066Sahrens  */
64fa9e4066Sahrens typedef enum {
65fa9e4066Sahrens 	ZFS_PROP_TYPE,
66fa9e4066Sahrens 	ZFS_PROP_CREATION,
67fa9e4066Sahrens 	ZFS_PROP_USED,
68fa9e4066Sahrens 	ZFS_PROP_AVAILABLE,
69fa9e4066Sahrens 	ZFS_PROP_REFERENCED,
70fa9e4066Sahrens 	ZFS_PROP_COMPRESSRATIO,
71fa9e4066Sahrens 	ZFS_PROP_MOUNTED,
72fa9e4066Sahrens 	ZFS_PROP_ORIGIN,
73fa9e4066Sahrens 	ZFS_PROP_QUOTA,
74fa9e4066Sahrens 	ZFS_PROP_RESERVATION,
75fa9e4066Sahrens 	ZFS_PROP_VOLSIZE,
76fa9e4066Sahrens 	ZFS_PROP_VOLBLOCKSIZE,
77fa9e4066Sahrens 	ZFS_PROP_RECORDSIZE,
78fa9e4066Sahrens 	ZFS_PROP_MOUNTPOINT,
79fa9e4066Sahrens 	ZFS_PROP_SHARENFS,
80fa9e4066Sahrens 	ZFS_PROP_CHECKSUM,
81fa9e4066Sahrens 	ZFS_PROP_COMPRESSION,
82fa9e4066Sahrens 	ZFS_PROP_ATIME,
83fa9e4066Sahrens 	ZFS_PROP_DEVICES,
84fa9e4066Sahrens 	ZFS_PROP_EXEC,
85fa9e4066Sahrens 	ZFS_PROP_SETUID,
86fa9e4066Sahrens 	ZFS_PROP_READONLY,
87fa9e4066Sahrens 	ZFS_PROP_ZONED,
88fa9e4066Sahrens 	ZFS_PROP_SNAPDIR,
89fa9e4066Sahrens 	ZFS_PROP_ACLMODE,
90fa9e4066Sahrens 	ZFS_PROP_ACLINHERIT,
9166e2aaccSgw 	ZFS_PROP_CREATETXG,		/* not exposed to the user */
9266e2aaccSgw 	ZFS_PROP_NAME,			/* not exposed to the user */
93e9dbad6fSeschrock 	ZFS_PROP_CANMOUNT,
9466e2aaccSgw 	ZFS_PROP_SHAREISCSI,
9566e2aaccSgw 	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
967b55fa8eSck 	ZFS_PROP_XATTR,
97d0ad202dSahrens 	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
98b1b8ab34Slling 	ZFS_PROP_COPIES,
99e7437265Sahrens 	ZFS_PROP_VERSION,
100da6c28aaSamw 	ZFS_PROP_UTF8ONLY,
101da6c28aaSamw 	ZFS_PROP_NORMALIZE,
102da6c28aaSamw 	ZFS_PROP_CASE,
103da6c28aaSamw 	ZFS_PROP_VSCAN,
104da6c28aaSamw 	ZFS_PROP_NBMAND,
105da6c28aaSamw 	ZFS_PROP_SHARESMB,
106a9799022Sck 	ZFS_PROP_REFQUOTA,
107a9799022Sck 	ZFS_PROP_REFRESERVATION,
108c5904d13Seschrock 	ZFS_PROP_GUID,
1093baa08fcSek 	ZFS_PROP_PRIMARYCACHE,
1103baa08fcSek 	ZFS_PROP_SECONDARYCACHE,
11174e7dc98SMatthew Ahrens 	ZFS_PROP_USEDSNAP,
11274e7dc98SMatthew Ahrens 	ZFS_PROP_USEDDS,
11374e7dc98SMatthew Ahrens 	ZFS_PROP_USEDCHILD,
11474e7dc98SMatthew Ahrens 	ZFS_PROP_USEDREFRESERV,
11514843421SMatthew Ahrens 	ZFS_PROP_USERACCOUNTING,	/* not exposed to the user */
116478ed9adSEric Taylor 	ZFS_PROP_STMF_SHAREINFO,	/* not exposed to the user */
117842727c2SChris Kirby 	ZFS_PROP_DEFER_DESTROY,
118842727c2SChris Kirby 	ZFS_PROP_USERREFS,
119e09fa4daSNeil Perrin 	ZFS_PROP_LOGBIAS,
120*1d713200SEric Schrock 	ZFS_PROP_UNIQUE,		/* not exposed to the user */
121*1d713200SEric Schrock 	ZFS_PROP_OBJSETID,		/* not exposed to the user */
12291ebeef5Sahrens 	ZFS_NUM_PROPS
123fa9e4066Sahrens } zfs_prop_t;
124fa9e4066Sahrens 
12514843421SMatthew Ahrens typedef enum {
12614843421SMatthew Ahrens 	ZFS_PROP_USERUSED,
12714843421SMatthew Ahrens 	ZFS_PROP_USERQUOTA,
12814843421SMatthew Ahrens 	ZFS_PROP_GROUPUSED,
12914843421SMatthew Ahrens 	ZFS_PROP_GROUPQUOTA,
13014843421SMatthew Ahrens 	ZFS_NUM_USERQUOTA_PROPS
13114843421SMatthew Ahrens } zfs_userquota_prop_t;
13214843421SMatthew Ahrens 
13314843421SMatthew Ahrens extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
13414843421SMatthew Ahrens 
135990b4856Slling /*
136990b4856Slling  * Pool properties are identified by these constants and must be added to the
137b87f3af3Sperrin  * end of this list to ensure that external consumers are not affected
138990b4856Slling  * by the change. If you make any changes to this list, be sure to update
139990b4856Slling  * the property table in usr/src/common/zfs/zpool_prop.c.
140990b4856Slling  */
141990b4856Slling typedef enum {
142990b4856Slling 	ZPOOL_PROP_NAME,
143990b4856Slling 	ZPOOL_PROP_SIZE,
144990b4856Slling 	ZPOOL_PROP_USED,
145990b4856Slling 	ZPOOL_PROP_AVAILABLE,
146990b4856Slling 	ZPOOL_PROP_CAPACITY,
147990b4856Slling 	ZPOOL_PROP_ALTROOT,
148990b4856Slling 	ZPOOL_PROP_HEALTH,
149990b4856Slling 	ZPOOL_PROP_GUID,
150990b4856Slling 	ZPOOL_PROP_VERSION,
151990b4856Slling 	ZPOOL_PROP_BOOTFS,
152990b4856Slling 	ZPOOL_PROP_DELEGATION,
153990b4856Slling 	ZPOOL_PROP_AUTOREPLACE,
1542f8aaab3Seschrock 	ZPOOL_PROP_CACHEFILE,
1550a4e9518Sgw 	ZPOOL_PROP_FAILUREMODE,
156d5b5bb25SRich Morris 	ZPOOL_PROP_LISTSNAPS,
157573ca77eSGeorge Wilson 	ZPOOL_PROP_AUTOEXPAND,
158990b4856Slling 	ZPOOL_NUM_PROPS
159990b4856Slling } zpool_prop_t;
160b1b8ab34Slling 
161990b4856Slling #define	ZPROP_CONT		-2
162990b4856Slling #define	ZPROP_INVAL		-1
1633d7072f8Seschrock 
164990b4856Slling #define	ZPROP_VALUE		"value"
165990b4856Slling #define	ZPROP_SOURCE		"source"
1667f7322feSeschrock 
167b1b8ab34Slling typedef enum {
168990b4856Slling 	ZPROP_SRC_NONE = 0x1,
169990b4856Slling 	ZPROP_SRC_DEFAULT = 0x2,
170990b4856Slling 	ZPROP_SRC_TEMPORARY = 0x4,
171990b4856Slling 	ZPROP_SRC_LOCAL = 0x8,
172990b4856Slling 	ZPROP_SRC_INHERITED = 0x10
173990b4856Slling } zprop_source_t;
174990b4856Slling 
175990b4856Slling #define	ZPROP_SRC_ALL	0x1f
176990b4856Slling 
177990b4856Slling typedef int (*zprop_func)(int, void *);
178990b4856Slling 
1790a48a24eStimh /*
1800a48a24eStimh  * Properties to be set on the root file system of a new pool
1810a48a24eStimh  * are stuffed into their own nvlist, which is then included in
1820a48a24eStimh  * the properties nvlist with the pool properties.
1830a48a24eStimh  */
1840a48a24eStimh #define	ZPOOL_ROOTFS_PROPS	"root-props-nvl"
1850a48a24eStimh 
186990b4856Slling /*
187990b4856Slling  * Dataset property functions shared between libzfs and kernel.
188990b4856Slling  */
189990b4856Slling const char *zfs_prop_default_string(zfs_prop_t);
190990b4856Slling uint64_t zfs_prop_default_numeric(zfs_prop_t);
191990b4856Slling boolean_t zfs_prop_readonly(zfs_prop_t);
192990b4856Slling boolean_t zfs_prop_inheritable(zfs_prop_t);
193da6c28aaSamw boolean_t zfs_prop_setonce(zfs_prop_t);
194990b4856Slling const char *zfs_prop_to_name(zfs_prop_t);
195990b4856Slling zfs_prop_t zfs_name_to_prop(const char *);
196990b4856Slling boolean_t zfs_prop_user(const char *);
19714843421SMatthew Ahrens boolean_t zfs_prop_userquota(const char *name);
198990b4856Slling int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
199990b4856Slling int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
2004853e976Sgw boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
201b1b8ab34Slling 
202990b4856Slling /*
203990b4856Slling  * Pool property functions shared between libzfs and kernel.
204990b4856Slling  */
205990b4856Slling zpool_prop_t zpool_name_to_prop(const char *);
206990b4856Slling const char *zpool_prop_to_name(zpool_prop_t);
207990b4856Slling const char *zpool_prop_default_string(zpool_prop_t);
208990b4856Slling uint64_t zpool_prop_default_numeric(zpool_prop_t);
209990b4856Slling boolean_t zpool_prop_readonly(zpool_prop_t);
210990b4856Slling int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
211990b4856Slling int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
212b1b8ab34Slling 
213990b4856Slling /*
214990b4856Slling  * Definitions for the Delegation.
215990b4856Slling  */
216ecd6cf80Smarks typedef enum {
217ecd6cf80Smarks 	ZFS_DELEG_WHO_UNKNOWN = 0,
218ecd6cf80Smarks 	ZFS_DELEG_USER = 'u',
219ecd6cf80Smarks 	ZFS_DELEG_USER_SETS = 'U',
220ecd6cf80Smarks 	ZFS_DELEG_GROUP = 'g',
221ecd6cf80Smarks 	ZFS_DELEG_GROUP_SETS = 'G',
222ecd6cf80Smarks 	ZFS_DELEG_EVERYONE = 'e',
223ecd6cf80Smarks 	ZFS_DELEG_EVERYONE_SETS = 'E',
224ecd6cf80Smarks 	ZFS_DELEG_CREATE = 'c',
225ecd6cf80Smarks 	ZFS_DELEG_CREATE_SETS = 'C',
226ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET = 's',
227ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET_SETS = 'S'
228ecd6cf80Smarks } zfs_deleg_who_type_t;
229ecd6cf80Smarks 
230ecd6cf80Smarks typedef enum {
231ecd6cf80Smarks 	ZFS_DELEG_NONE = 0,
232ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCAL = 1,
233ecd6cf80Smarks 	ZFS_DELEG_PERM_DESCENDENT = 2,
234ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
235ecd6cf80Smarks 	ZFS_DELEG_PERM_CREATE = 4
236ecd6cf80Smarks } zfs_deleg_inherit_t;
237ecd6cf80Smarks 
238ecd6cf80Smarks #define	ZFS_DELEG_PERM_UID	"uid"
239ecd6cf80Smarks #define	ZFS_DELEG_PERM_GID	"gid"
240ecd6cf80Smarks #define	ZFS_DELEG_PERM_GROUPS	"groups"
241ecd6cf80Smarks 
242743a77edSAlan Wright #define	ZFS_SMB_ACL_SRC		"src"
243743a77edSAlan Wright #define	ZFS_SMB_ACL_TARGET	"target"
244743a77edSAlan Wright 
245a227b7f4Shs typedef enum {
246a227b7f4Shs 	ZFS_CANMOUNT_OFF = 0,
247a227b7f4Shs 	ZFS_CANMOUNT_ON = 1,
248a227b7f4Shs 	ZFS_CANMOUNT_NOAUTO = 2
249a227b7f4Shs } zfs_canmount_type_t;
250a227b7f4Shs 
251e09fa4daSNeil Perrin typedef enum {
252e09fa4daSNeil Perrin 	ZFS_LOGBIAS_LATENCY = 0,
253e09fa4daSNeil Perrin 	ZFS_LOGBIAS_THROUGHPUT = 1
254e09fa4daSNeil Perrin } zfs_logbias_op_t;
255e09fa4daSNeil Perrin 
256da6c28aaSamw typedef enum zfs_share_op {
257da6c28aaSamw 	ZFS_SHARE_NFS = 0,
258da6c28aaSamw 	ZFS_UNSHARE_NFS = 1,
259da6c28aaSamw 	ZFS_SHARE_SMB = 2,
260da6c28aaSamw 	ZFS_UNSHARE_SMB = 3
261da6c28aaSamw } zfs_share_op_t;
262da6c28aaSamw 
263743a77edSAlan Wright typedef enum zfs_smb_acl_op {
264743a77edSAlan Wright 	ZFS_SMB_ACL_ADD,
265743a77edSAlan Wright 	ZFS_SMB_ACL_REMOVE,
266743a77edSAlan Wright 	ZFS_SMB_ACL_RENAME,
267743a77edSAlan Wright 	ZFS_SMB_ACL_PURGE
268743a77edSAlan Wright } zfs_smb_acl_op_t;
269743a77edSAlan Wright 
2703baa08fcSek typedef enum zfs_cache_type {
2713baa08fcSek 	ZFS_CACHE_NONE = 0,
2723baa08fcSek 	ZFS_CACHE_METADATA = 1,
2733baa08fcSek 	ZFS_CACHE_ALL = 2
2743baa08fcSek } zfs_cache_type_t;
2753baa08fcSek 
2763baa08fcSek 
277eaca9bbdSeschrock /*
27899653d4eSeschrock  * On-disk version number.
279eaca9bbdSeschrock  */
280e7437265Sahrens #define	SPA_VERSION_1			1ULL
281e7437265Sahrens #define	SPA_VERSION_2			2ULL
282e7437265Sahrens #define	SPA_VERSION_3			3ULL
283e7437265Sahrens #define	SPA_VERSION_4			4ULL
284e7437265Sahrens #define	SPA_VERSION_5			5ULL
285e7437265Sahrens #define	SPA_VERSION_6			6ULL
286e7437265Sahrens #define	SPA_VERSION_7			7ULL
287e7437265Sahrens #define	SPA_VERSION_8			8ULL
288da6c28aaSamw #define	SPA_VERSION_9			9ULL
289fa94a07fSbrendan #define	SPA_VERSION_10			10ULL
290088f3894Sahrens #define	SPA_VERSION_11			11ULL
291bb0ade09Sahrens #define	SPA_VERSION_12			12ULL
29274e7dc98SMatthew Ahrens #define	SPA_VERSION_13			13ULL
293d0f3f37eSMark Shellenbaum #define	SPA_VERSION_14			14ULL
29414843421SMatthew Ahrens #define	SPA_VERSION_15			15ULL
295478ed9adSEric Taylor #define	SPA_VERSION_16			16ULL
296f94275ceSAdam Leventhal #define	SPA_VERSION_17			17ULL
297842727c2SChris Kirby #define	SPA_VERSION_18			18ULL
298b1b8ab34Slling /*
299e7cbe64fSgw  * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
300478ed9adSEric Taylor  * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
30114843421SMatthew Ahrens  * and do the appropriate changes.  Also bump the version number in
30214843421SMatthew Ahrens  * usr/src/grub/capability.
303b1b8ab34Slling  */
304842727c2SChris Kirby #define	SPA_VERSION			SPA_VERSION_18
305842727c2SChris Kirby #define	SPA_VERSION_STRING		"18"
30644cd46caSbillm 
30744cd46caSbillm /*
308e7437265Sahrens  * Symbolic names for the changes that caused a SPA_VERSION switch.
30944cd46caSbillm  * Used in the code when checking for presence or absence of a feature.
31044cd46caSbillm  * Feel free to define multiple symbolic names for each version if there
31144cd46caSbillm  * were multiple changes to on-disk structures during that version.
31244cd46caSbillm  *
313e7437265Sahrens  * NOTE: When checking the current SPA_VERSION in your code, be sure
31444cd46caSbillm  *       to use spa_version() since it reports the version of the
31544cd46caSbillm  *       last synced uberblock.  Checking the in-flight version can
31644cd46caSbillm  *       be dangerous in some cases.
31744cd46caSbillm  */
318e7437265Sahrens #define	SPA_VERSION_INITIAL		SPA_VERSION_1
319e7437265Sahrens #define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
320e7437265Sahrens #define	SPA_VERSION_SPARES		SPA_VERSION_3
321f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ2		SPA_VERSION_3
322e7437265Sahrens #define	SPA_VERSION_BPLIST_ACCOUNT	SPA_VERSION_3
323e7437265Sahrens #define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
324e7437265Sahrens #define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
325e7437265Sahrens #define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
326e7437265Sahrens #define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
327e7437265Sahrens #define	SPA_VERSION_BOOTFS		SPA_VERSION_6
328990b4856Slling #define	SPA_VERSION_SLOGS		SPA_VERSION_7
329990b4856Slling #define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
330da6c28aaSamw #define	SPA_VERSION_FUID		SPA_VERSION_9
331a9799022Sck #define	SPA_VERSION_REFRESERVATION	SPA_VERSION_9
332a9799022Sck #define	SPA_VERSION_REFQUOTA		SPA_VERSION_9
333a9799022Sck #define	SPA_VERSION_UNIQUE_ACCURATE	SPA_VERSION_9
334fa94a07fSbrendan #define	SPA_VERSION_L2CACHE		SPA_VERSION_10
335088f3894Sahrens #define	SPA_VERSION_NEXT_CLONES		SPA_VERSION_11
336088f3894Sahrens #define	SPA_VERSION_ORIGIN		SPA_VERSION_11
337088f3894Sahrens #define	SPA_VERSION_DSL_SCRUB		SPA_VERSION_11
338bb0ade09Sahrens #define	SPA_VERSION_SNAP_PROPS		SPA_VERSION_12
33974e7dc98SMatthew Ahrens #define	SPA_VERSION_USED_BREAKDOWN	SPA_VERSION_13
340d0f3f37eSMark Shellenbaum #define	SPA_VERSION_PASSTHROUGH_X	SPA_VERSION_14
34114843421SMatthew Ahrens #define	SPA_VERSION_USERSPACE		SPA_VERSION_15
342478ed9adSEric Taylor #define	SPA_VERSION_STMF_PROP		SPA_VERSION_16
343f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ3		SPA_VERSION_17
344842727c2SChris Kirby #define	SPA_VERSION_USERREFS		SPA_VERSION_18
345e7437265Sahrens 
346e7437265Sahrens /*
347e7437265Sahrens  * ZPL version - rev'd whenever an incompatible on-disk format change
348e7437265Sahrens  * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
349e7437265Sahrens  * also update the version_table[] and help message in zfs_prop.c.
350e7437265Sahrens  *
351e7437265Sahrens  * When changing, be sure to teach GRUB how to read the new format!
352478ed9adSEric Taylor  * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
353e7437265Sahrens  */
354e7437265Sahrens #define	ZPL_VERSION_1			1ULL
355e7437265Sahrens #define	ZPL_VERSION_2			2ULL
356da6c28aaSamw #define	ZPL_VERSION_3			3ULL
35714843421SMatthew Ahrens #define	ZPL_VERSION_4			4ULL
35814843421SMatthew Ahrens #define	ZPL_VERSION			ZPL_VERSION_4
35914843421SMatthew Ahrens #define	ZPL_VERSION_STRING		"4"
360e7437265Sahrens 
361e7437265Sahrens #define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
362e7437265Sahrens #define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
363da6c28aaSamw #define	ZPL_VERSION_FUID		ZPL_VERSION_3
364de8267e0Stimh #define	ZPL_VERSION_NORMALIZATION	ZPL_VERSION_3
365da6c28aaSamw #define	ZPL_VERSION_SYSATTR		ZPL_VERSION_3
36614843421SMatthew Ahrens #define	ZPL_VERSION_USERSPACE		ZPL_VERSION_4
367eaca9bbdSeschrock 
368fa9e4066Sahrens /*
369fa9e4066Sahrens  * The following are configuration names used in the nvlist describing a pool's
370fa9e4066Sahrens  * configuration.
371fa9e4066Sahrens  */
372fa9e4066Sahrens #define	ZPOOL_CONFIG_VERSION		"version"
373fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_NAME		"name"
374fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_STATE		"state"
375fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_TXG		"txg"
376fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
377fa9e4066Sahrens #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
378fa9e4066Sahrens #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
379fa9e4066Sahrens #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
380fa9e4066Sahrens #define	ZPOOL_CONFIG_TYPE		"type"
381fa9e4066Sahrens #define	ZPOOL_CONFIG_CHILDREN		"children"
382fa9e4066Sahrens #define	ZPOOL_CONFIG_ID			"id"
383fa9e4066Sahrens #define	ZPOOL_CONFIG_GUID		"guid"
384fa9e4066Sahrens #define	ZPOOL_CONFIG_PATH		"path"
385fa9e4066Sahrens #define	ZPOOL_CONFIG_DEVID		"devid"
386fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
387fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
388fa9e4066Sahrens #define	ZPOOL_CONFIG_ASHIFT		"ashift"
389fa9e4066Sahrens #define	ZPOOL_CONFIG_ASIZE		"asize"
390fa9e4066Sahrens #define	ZPOOL_CONFIG_DTL		"DTL"
391fa9e4066Sahrens #define	ZPOOL_CONFIG_STATS		"stats"
392afefbcddSeschrock #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
393ea8dc4b6Seschrock #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
394ea8dc4b6Seschrock #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
39599653d4eSeschrock #define	ZPOOL_CONFIG_SPARES		"spares"
39699653d4eSeschrock #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
39799653d4eSeschrock #define	ZPOOL_CONFIG_NPARITY		"nparity"
39895173954Sek #define	ZPOOL_CONFIG_HOSTID		"hostid"
39995173954Sek #define	ZPOOL_CONFIG_HOSTNAME		"hostname"
4003d7072f8Seschrock #define	ZPOOL_CONFIG_UNSPARE		"unspare"
4013d7072f8Seschrock #define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
4028654d025Sperrin #define	ZPOOL_CONFIG_IS_LOG		"is_log"
403fa94a07fSbrendan #define	ZPOOL_CONFIG_L2CACHE		"l2cache"
404e14bb325SJeff Bonwick #define	ZPOOL_CONFIG_SUSPENDED		"suspended"	/* not stored on disk */
405e7cbe64fSgw #define	ZPOOL_CONFIG_TIMESTAMP		"timestamp"	/* not stored on disk */
406e7cbe64fSgw #define	ZPOOL_CONFIG_BOOTFS		"bootfs"	/* not stored on disk */
4073d7072f8Seschrock /*
4083d7072f8Seschrock  * The persistent vdev state is stored as separate values rather than a single
4093d7072f8Seschrock  * 'vdev_state' entry.  This is because a device can be in multiple states, such
4103d7072f8Seschrock  * as offline and degraded.
4113d7072f8Seschrock  */
4123d7072f8Seschrock #define	ZPOOL_CONFIG_OFFLINE		"offline"
4133d7072f8Seschrock #define	ZPOOL_CONFIG_FAULTED		"faulted"
4143d7072f8Seschrock #define	ZPOOL_CONFIG_DEGRADED		"degraded"
4153d7072f8Seschrock #define	ZPOOL_CONFIG_REMOVED		"removed"
4166809eb4eSEric Schrock #define	ZPOOL_CONFIG_FRU		"fru"
417fa9e4066Sahrens 
418fa9e4066Sahrens #define	VDEV_TYPE_ROOT			"root"
419fa9e4066Sahrens #define	VDEV_TYPE_MIRROR		"mirror"
420fa9e4066Sahrens #define	VDEV_TYPE_REPLACING		"replacing"
421fa9e4066Sahrens #define	VDEV_TYPE_RAIDZ			"raidz"
422fa9e4066Sahrens #define	VDEV_TYPE_DISK			"disk"
423fa9e4066Sahrens #define	VDEV_TYPE_FILE			"file"
424fa9e4066Sahrens #define	VDEV_TYPE_MISSING		"missing"
42599653d4eSeschrock #define	VDEV_TYPE_SPARE			"spare"
4268654d025Sperrin #define	VDEV_TYPE_LOG			"log"
427fa94a07fSbrendan #define	VDEV_TYPE_L2CACHE		"l2cache"
428fa9e4066Sahrens 
429fa9e4066Sahrens /*
430fa9e4066Sahrens  * This is needed in userland to report the minimum necessary device size.
431fa9e4066Sahrens  */
432fa9e4066Sahrens #define	SPA_MINDEVSIZE		(64ULL << 20)
433fa9e4066Sahrens 
434fa9e4066Sahrens /*
435fa9e4066Sahrens  * The location of the pool configuration repository, shared between kernel and
436fa9e4066Sahrens  * userland.
437fa9e4066Sahrens  */
438c5904d13Seschrock #define	ZPOOL_CACHE		"/etc/zfs/zpool.cache"
439fa9e4066Sahrens 
440fa9e4066Sahrens /*
441fa9e4066Sahrens  * vdev states are ordered from least to most healthy.
442fa9e4066Sahrens  * A vdev that's CANT_OPEN or below is considered unusable.
443fa9e4066Sahrens  */
444fa9e4066Sahrens typedef enum vdev_state {
445fa9e4066Sahrens 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
446fa9e4066Sahrens 	VDEV_STATE_CLOSED,	/* Not currently open			*/
447fa9e4066Sahrens 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
4483d7072f8Seschrock 	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
449fa9e4066Sahrens 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
4503d7072f8Seschrock 	VDEV_STATE_FAULTED,	/* External request to fault device	*/
451fa9e4066Sahrens 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
452fa9e4066Sahrens 	VDEV_STATE_HEALTHY	/* Presumed good			*/
453fa9e4066Sahrens } vdev_state_t;
454fa9e4066Sahrens 
4553d7072f8Seschrock #define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
4563d7072f8Seschrock 
457fa9e4066Sahrens /*
458fa9e4066Sahrens  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
459fa9e4066Sahrens  * of the vdev stats structure uses these constants to distinguish why.
460fa9e4066Sahrens  */
461fa9e4066Sahrens typedef enum vdev_aux {
462fa9e4066Sahrens 	VDEV_AUX_NONE,		/* no error				*/
463fa9e4066Sahrens 	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
464fa9e4066Sahrens 	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
465fa9e4066Sahrens 	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
466fa9e4066Sahrens 	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
467fa9e4066Sahrens 	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
468eaca9bbdSeschrock 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
469eaca9bbdSeschrock 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
47099653d4eSeschrock 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
4713d7072f8Seschrock 	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
47232b87932Sek 	VDEV_AUX_ERR_EXCEEDED,	/* too many errors			*/
473b87f3af3Sperrin 	VDEV_AUX_IO_FAILURE,	/* experienced I/O failure		*/
474b87f3af3Sperrin 	VDEV_AUX_BAD_LOG	/* cannot read log chain(s)		*/
475fa9e4066Sahrens } vdev_aux_t;
476fa9e4066Sahrens 
477fa9e4066Sahrens /*
47846a2abf2Seschrock  * pool state.  The following states are written to disk as part of the normal
479fa94a07fSbrendan  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
480fa94a07fSbrendan  * states are software abstractions used at various levels to communicate
481fa94a07fSbrendan  * pool state.
482fa9e4066Sahrens  */
483fa9e4066Sahrens typedef enum pool_state {
484fa9e4066Sahrens 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
485fa9e4066Sahrens 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
486fa9e4066Sahrens 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
48799653d4eSeschrock 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
488fa94a07fSbrendan 	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
489fa9e4066Sahrens 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
49046a2abf2Seschrock 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
49146a2abf2Seschrock 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
492fa9e4066Sahrens } pool_state_t;
493fa9e4066Sahrens 
494fa9e4066Sahrens /*
495fa9e4066Sahrens  * Scrub types.
496fa9e4066Sahrens  */
497fa9e4066Sahrens typedef enum pool_scrub_type {
498fa9e4066Sahrens 	POOL_SCRUB_NONE,
499fa9e4066Sahrens 	POOL_SCRUB_RESILVER,
500fa9e4066Sahrens 	POOL_SCRUB_EVERYTHING,
501fa9e4066Sahrens 	POOL_SCRUB_TYPES
502fa9e4066Sahrens } pool_scrub_type_t;
503fa9e4066Sahrens 
504fa9e4066Sahrens /*
505fa9e4066Sahrens  * ZIO types.  Needed to interpret vdev statistics below.
506fa9e4066Sahrens  */
507fa9e4066Sahrens typedef enum zio_type {
508fa9e4066Sahrens 	ZIO_TYPE_NULL = 0,
509fa9e4066Sahrens 	ZIO_TYPE_READ,
510fa9e4066Sahrens 	ZIO_TYPE_WRITE,
511fa9e4066Sahrens 	ZIO_TYPE_FREE,
512fa9e4066Sahrens 	ZIO_TYPE_CLAIM,
513fa9e4066Sahrens 	ZIO_TYPE_IOCTL,
514fa9e4066Sahrens 	ZIO_TYPES
515fa9e4066Sahrens } zio_type_t;
516fa9e4066Sahrens 
517fa9e4066Sahrens /*
518fa9e4066Sahrens  * Vdev statistics.  Note: all fields should be 64-bit because this
519fa9e4066Sahrens  * is passed between kernel and userland as an nvlist uint64 array.
520fa9e4066Sahrens  */
521fa9e4066Sahrens typedef struct vdev_stat {
522fa9e4066Sahrens 	hrtime_t	vs_timestamp;		/* time since vdev load	*/
523fa9e4066Sahrens 	uint64_t	vs_state;		/* vdev state		*/
524fa9e4066Sahrens 	uint64_t	vs_aux;			/* see vdev_aux_t	*/
525fa9e4066Sahrens 	uint64_t	vs_alloc;		/* space allocated	*/
526fa9e4066Sahrens 	uint64_t	vs_space;		/* total capacity	*/
52799653d4eSeschrock 	uint64_t	vs_dspace;		/* deflated capacity	*/
5282a79c5feSlling 	uint64_t	vs_rsize;		/* replaceable dev size */
529fa9e4066Sahrens 	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
530fa9e4066Sahrens 	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
531fa9e4066Sahrens 	uint64_t	vs_read_errors;		/* read errors		*/
532fa9e4066Sahrens 	uint64_t	vs_write_errors;	/* write errors		*/
533fa9e4066Sahrens 	uint64_t	vs_checksum_errors;	/* checksum errors	*/
534fa9e4066Sahrens 	uint64_t	vs_self_healed;		/* self-healed bytes	*/
535fa9e4066Sahrens 	uint64_t	vs_scrub_type;		/* pool_scrub_type_t	*/
536fa9e4066Sahrens 	uint64_t	vs_scrub_complete;	/* completed?		*/
537fa9e4066Sahrens 	uint64_t	vs_scrub_examined;	/* bytes examined; top	*/
538fa9e4066Sahrens 	uint64_t	vs_scrub_repaired;	/* bytes repaired; leaf	*/
539fa9e4066Sahrens 	uint64_t	vs_scrub_errors;	/* errors during scrub	*/
540fa9e4066Sahrens 	uint64_t	vs_scrub_start;		/* UTC scrub start time	*/
541fa9e4066Sahrens 	uint64_t	vs_scrub_end;		/* UTC scrub end time	*/
542fa9e4066Sahrens } vdev_stat_t;
543fa9e4066Sahrens 
544e7cbe64fSgw #define	ZVOL_DRIVER	"zvol"
545fa9e4066Sahrens #define	ZFS_DRIVER	"zfs"
546fa9e4066Sahrens #define	ZFS_DEV		"/dev/zfs"
547fa9e4066Sahrens 
548fa9e4066Sahrens /*
549fa9e4066Sahrens  * zvol paths.  Irritatingly, the devfsadm interfaces want all these
550fa9e4066Sahrens  * paths without the /dev prefix, but for some things, we want the
551fa9e4066Sahrens  * /dev prefix.  Below are the names without /dev.
552fa9e4066Sahrens  */
553fa9e4066Sahrens #define	ZVOL_DEV_DIR	"zvol/dsk"
554fa9e4066Sahrens #define	ZVOL_RDEV_DIR	"zvol/rdsk"
555fa9e4066Sahrens 
556fa9e4066Sahrens /*
557fa9e4066Sahrens  * And here are the things we need with /dev, etc. in front of them.
558fa9e4066Sahrens  */
559573ca77eSGeorge Wilson #define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zfs@0:"
560e7cbe64fSgw #define	ZVOL_FULL_DEV_DIR	"/dev/" ZVOL_DEV_DIR "/"
561fa9e4066Sahrens 
562fa9e4066Sahrens #define	ZVOL_PROP_NAME		"name"
563fa9e4066Sahrens 
564fa9e4066Sahrens /*
565fa9e4066Sahrens  * /dev/zfs ioctl numbers.
566fa9e4066Sahrens  */
567fa9e4066Sahrens #define	ZFS_IOC		('Z' << 8)
568fa9e4066Sahrens 
569fa9e4066Sahrens typedef enum zfs_ioc {
570fa9e4066Sahrens 	ZFS_IOC_POOL_CREATE = ZFS_IOC,
571fa9e4066Sahrens 	ZFS_IOC_POOL_DESTROY,
572fa9e4066Sahrens 	ZFS_IOC_POOL_IMPORT,
573fa9e4066Sahrens 	ZFS_IOC_POOL_EXPORT,
574fa9e4066Sahrens 	ZFS_IOC_POOL_CONFIGS,
575fa9e4066Sahrens 	ZFS_IOC_POOL_STATS,
576fa9e4066Sahrens 	ZFS_IOC_POOL_TRYIMPORT,
577fa9e4066Sahrens 	ZFS_IOC_POOL_SCRUB,
578fa9e4066Sahrens 	ZFS_IOC_POOL_FREEZE,
579eaca9bbdSeschrock 	ZFS_IOC_POOL_UPGRADE,
58006eeb2adSek 	ZFS_IOC_POOL_GET_HISTORY,
581fa9e4066Sahrens 	ZFS_IOC_VDEV_ADD,
582fa9e4066Sahrens 	ZFS_IOC_VDEV_REMOVE,
5833d7072f8Seschrock 	ZFS_IOC_VDEV_SET_STATE,
584fa9e4066Sahrens 	ZFS_IOC_VDEV_ATTACH,
585fa9e4066Sahrens 	ZFS_IOC_VDEV_DETACH,
586c67d9675Seschrock 	ZFS_IOC_VDEV_SETPATH,
5876809eb4eSEric Schrock 	ZFS_IOC_VDEV_SETFRU,
588fa9e4066Sahrens 	ZFS_IOC_OBJSET_STATS,
589de8267e0Stimh 	ZFS_IOC_OBJSET_ZPLPROPS,
590fa9e4066Sahrens 	ZFS_IOC_DATASET_LIST_NEXT,
591fa9e4066Sahrens 	ZFS_IOC_SNAPSHOT_LIST_NEXT,
592fa9e4066Sahrens 	ZFS_IOC_SET_PROP,
593fa9e4066Sahrens 	ZFS_IOC_CREATE_MINOR,
594fa9e4066Sahrens 	ZFS_IOC_REMOVE_MINOR,
595fa9e4066Sahrens 	ZFS_IOC_CREATE,
596fa9e4066Sahrens 	ZFS_IOC_DESTROY,
597fa9e4066Sahrens 	ZFS_IOC_ROLLBACK,
598fa9e4066Sahrens 	ZFS_IOC_RENAME,
5993cb34c60Sahrens 	ZFS_IOC_RECV,
6003cb34c60Sahrens 	ZFS_IOC_SEND,
601ea8dc4b6Seschrock 	ZFS_IOC_INJECT_FAULT,
602ea8dc4b6Seschrock 	ZFS_IOC_CLEAR_FAULT,
603ea8dc4b6Seschrock 	ZFS_IOC_INJECT_LIST_NEXT,
604ea8dc4b6Seschrock 	ZFS_IOC_ERROR_LOG,
605ea8dc4b6Seschrock 	ZFS_IOC_CLEAR,
6061d452cf5Sahrens 	ZFS_IOC_PROMOTE,
6071d452cf5Sahrens 	ZFS_IOC_DESTROY_SNAPS,
60855434c77Sek 	ZFS_IOC_SNAPSHOT,
60955434c77Sek 	ZFS_IOC_DSOBJ_TO_DSNAME,
610b1b8ab34Slling 	ZFS_IOC_OBJ_TO_PATH,
611b1b8ab34Slling 	ZFS_IOC_POOL_SET_PROPS,
612ecd6cf80Smarks 	ZFS_IOC_POOL_GET_PROPS,
613ecd6cf80Smarks 	ZFS_IOC_SET_FSACL,
614ecd6cf80Smarks 	ZFS_IOC_GET_FSACL,
615ecd6cf80Smarks 	ZFS_IOC_ISCSI_PERM_CHECK,
616e45ce728Sahrens 	ZFS_IOC_SHARE,
617743a77edSAlan Wright 	ZFS_IOC_INHERIT_PROP,
61814843421SMatthew Ahrens 	ZFS_IOC_SMB_ACL,
61914843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_ONE,
62014843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_MANY,
621842727c2SChris Kirby 	ZFS_IOC_USERSPACE_UPGRADE,
622842727c2SChris Kirby 	ZFS_IOC_HOLD,
623842727c2SChris Kirby 	ZFS_IOC_RELEASE,
624842727c2SChris Kirby 	ZFS_IOC_GET_HOLDS
625fa9e4066Sahrens } zfs_ioc_t;
626fa9e4066Sahrens 
627ea8dc4b6Seschrock /*
628ea8dc4b6Seschrock  * Internal SPA load state.  Used by FMA diagnosis engine.
629ea8dc4b6Seschrock  */
630ea8dc4b6Seschrock typedef enum {
631ea8dc4b6Seschrock 	SPA_LOAD_NONE,		/* no load in progress */
632ea8dc4b6Seschrock 	SPA_LOAD_OPEN,		/* normal open */
633ea8dc4b6Seschrock 	SPA_LOAD_IMPORT,	/* import in progress */
634ea8dc4b6Seschrock 	SPA_LOAD_TRYIMPORT	/* tryimport in progress */
635ea8dc4b6Seschrock } spa_load_state_t;
636ea8dc4b6Seschrock 
637e9dbad6fSeschrock /*
638e9dbad6fSeschrock  * Bookmark name values.
639e9dbad6fSeschrock  */
64055434c77Sek #define	ZPOOL_ERR_LIST		"error list"
641e9dbad6fSeschrock #define	ZPOOL_ERR_DATASET	"dataset"
642e9dbad6fSeschrock #define	ZPOOL_ERR_OBJECT	"object"
643e9dbad6fSeschrock 
64406eeb2adSek #define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
64506eeb2adSek 
64606eeb2adSek /*
64706eeb2adSek  * The following are names used in the nvlist describing
64806eeb2adSek  * the pool's history log.
64906eeb2adSek  */
65006eeb2adSek #define	ZPOOL_HIST_RECORD	"history record"
65106eeb2adSek #define	ZPOOL_HIST_TIME		"history time"
65206eeb2adSek #define	ZPOOL_HIST_CMD		"history command"
653ecd6cf80Smarks #define	ZPOOL_HIST_WHO		"history who"
654ecd6cf80Smarks #define	ZPOOL_HIST_ZONE		"history zone"
655ecd6cf80Smarks #define	ZPOOL_HIST_HOST		"history hostname"
656ecd6cf80Smarks #define	ZPOOL_HIST_TXG		"history txg"
657ecd6cf80Smarks #define	ZPOOL_HIST_INT_EVENT	"history internal event"
658ecd6cf80Smarks #define	ZPOOL_HIST_INT_STR	"history internal str"
65906eeb2adSek 
6603d7072f8Seschrock /*
6613d7072f8Seschrock  * Flags for ZFS_IOC_VDEV_SET_STATE
6623d7072f8Seschrock  */
6633d7072f8Seschrock #define	ZFS_ONLINE_CHECKREMOVE	0x1
6643d7072f8Seschrock #define	ZFS_ONLINE_UNSPARE	0x2
6653d7072f8Seschrock #define	ZFS_ONLINE_FORCEFAULT	0x4
666573ca77eSGeorge Wilson #define	ZFS_ONLINE_EXPAND	0x8
6673d7072f8Seschrock #define	ZFS_OFFLINE_TEMPORARY	0x1
6683d7072f8Seschrock 
6693d7072f8Seschrock /*
6703d7072f8Seschrock  * Sysevent payload members.  ZFS will generate the following sysevents with the
6713d7072f8Seschrock  * given payloads:
6723d7072f8Seschrock  *
6733d7072f8Seschrock  *	ESC_ZFS_RESILVER_START
6743d7072f8Seschrock  *	ESC_ZFS_RESILVER_END
6753d7072f8Seschrock  *	ESC_ZFS_POOL_DESTROY
6763d7072f8Seschrock  *
6773d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
6783d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
6793d7072f8Seschrock  *
6803d7072f8Seschrock  *	ESC_ZFS_VDEV_REMOVE
6813d7072f8Seschrock  *	ESC_ZFS_VDEV_CLEAR
6823d7072f8Seschrock  *	ESC_ZFS_VDEV_CHECK
6833d7072f8Seschrock  *
6843d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
6853d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
6863d7072f8Seschrock  *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
6873d7072f8Seschrock  *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
6883d7072f8Seschrock  */
6893d7072f8Seschrock #define	ZFS_EV_POOL_NAME	"pool_name"
6903d7072f8Seschrock #define	ZFS_EV_POOL_GUID	"pool_guid"
6913d7072f8Seschrock #define	ZFS_EV_VDEV_PATH	"vdev_path"
6923d7072f8Seschrock #define	ZFS_EV_VDEV_GUID	"vdev_guid"
6933d7072f8Seschrock 
694088f3894Sahrens /*
695088f3894Sahrens  * Note: This is encoded on-disk, so new events must be added to the
696088f3894Sahrens  * end, and unused events can not be removed.  Be sure to edit
697088f3894Sahrens  * zpool_main.c: hist_event_table[].
698088f3894Sahrens  */
699ecd6cf80Smarks typedef enum history_internal_events {
700ecd6cf80Smarks 	LOG_NO_EVENT = 0,
701ecd6cf80Smarks 	LOG_POOL_CREATE,
702ecd6cf80Smarks 	LOG_POOL_VDEV_ADD,
703ecd6cf80Smarks 	LOG_POOL_REMOVE,
704ecd6cf80Smarks 	LOG_POOL_DESTROY,
705ecd6cf80Smarks 	LOG_POOL_EXPORT,
706ecd6cf80Smarks 	LOG_POOL_IMPORT,
707ecd6cf80Smarks 	LOG_POOL_VDEV_ATTACH,
708ecd6cf80Smarks 	LOG_POOL_VDEV_REPLACE,
709ecd6cf80Smarks 	LOG_POOL_VDEV_DETACH,
710ecd6cf80Smarks 	LOG_POOL_VDEV_ONLINE,
711ecd6cf80Smarks 	LOG_POOL_VDEV_OFFLINE,
712ecd6cf80Smarks 	LOG_POOL_UPGRADE,
713ecd6cf80Smarks 	LOG_POOL_CLEAR,
714ecd6cf80Smarks 	LOG_POOL_SCRUB,
715ecd6cf80Smarks 	LOG_POOL_PROPSET,
716ecd6cf80Smarks 	LOG_DS_CREATE,
717ecd6cf80Smarks 	LOG_DS_CLONE,
718ecd6cf80Smarks 	LOG_DS_DESTROY,
719ecd6cf80Smarks 	LOG_DS_DESTROY_BEGIN,
720ecd6cf80Smarks 	LOG_DS_INHERIT,
721ecd6cf80Smarks 	LOG_DS_PROPSET,
722ecd6cf80Smarks 	LOG_DS_QUOTA,
723ecd6cf80Smarks 	LOG_DS_PERM_UPDATE,
724ecd6cf80Smarks 	LOG_DS_PERM_REMOVE,
725ecd6cf80Smarks 	LOG_DS_PERM_WHO_REMOVE,
726ecd6cf80Smarks 	LOG_DS_PROMOTE,
727ecd6cf80Smarks 	LOG_DS_RECEIVE,
728ecd6cf80Smarks 	LOG_DS_RENAME,
729ecd6cf80Smarks 	LOG_DS_RESERVATION,
730ecd6cf80Smarks 	LOG_DS_REPLAY_INC_SYNC,
731ecd6cf80Smarks 	LOG_DS_REPLAY_FULL_SYNC,
732ecd6cf80Smarks 	LOG_DS_ROLLBACK,
733ecd6cf80Smarks 	LOG_DS_SNAPSHOT,
734e7437265Sahrens 	LOG_DS_UPGRADE,
735a9799022Sck 	LOG_DS_REFQUOTA,
736a9799022Sck 	LOG_DS_REFRESERV,
737088f3894Sahrens 	LOG_POOL_SCRUB_DONE,
738842727c2SChris Kirby 	LOG_DS_USER_HOLD,
739842727c2SChris Kirby 	LOG_DS_USER_RELEASE,
740ecd6cf80Smarks 	LOG_END
741ecd6cf80Smarks } history_internal_events_t;
742ecd6cf80Smarks 
743fa9e4066Sahrens #ifdef	__cplusplus
744fa9e4066Sahrens }
745fa9e4066Sahrens #endif
746fa9e4066Sahrens 
747fa9e4066Sahrens #endif	/* _SYS_FS_ZFS_H */
748