xref: /titanic_50/usr/src/uts/common/sys/fs/zfs.h (revision 1a4cea1bca45d5775aeb88646a63db027947246f)
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 /*
2327dd1e87SMark Shellenbaum  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24edf345e6SMatthew Ahrens  * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
25a2afb611SJerry Jelinek  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
26c3d26abcSMatthew Ahrens  * Copyright (c) 2014 Integros [integros.com]
27c9e5c7a7SSaso Kiselkov  * Copyright (c) 2013, Saso Kiselkov. All rights reserved.
28c9e5c7a7SSaso Kiselkov  * Copyright 2011, 2015 Nexenta Systems, Inc.  All rights reserved.
29fa9e4066Sahrens  */
30fa9e4066Sahrens 
3155da60b9SMark J Musante /* Portions Copyright 2010 Robert Milkowski */
3255da60b9SMark J Musante 
33fa9e4066Sahrens #ifndef	_SYS_FS_ZFS_H
34fa9e4066Sahrens #define	_SYS_FS_ZFS_H
35fa9e4066Sahrens 
36842727c2SChris Kirby #include <sys/time.h>
37842727c2SChris Kirby 
38fa9e4066Sahrens #ifdef	__cplusplus
39fa9e4066Sahrens extern "C" {
40fa9e4066Sahrens #endif
41fa9e4066Sahrens 
42fa9e4066Sahrens /*
43fa9e4066Sahrens  * Types and constants shared between userland and the kernel.
44fa9e4066Sahrens  */
45fa9e4066Sahrens 
46fa9e4066Sahrens /*
47fa9e4066Sahrens  * Each dataset can be one of the following types.  These constants can be
48fa9e4066Sahrens  * combined into masks that can be passed to various functions.
49fa9e4066Sahrens  */
50fa9e4066Sahrens typedef enum {
5178f17100SMatthew Ahrens 	ZFS_TYPE_FILESYSTEM	= (1 << 0),
5278f17100SMatthew Ahrens 	ZFS_TYPE_SNAPSHOT	= (1 << 1),
5378f17100SMatthew Ahrens 	ZFS_TYPE_VOLUME		= (1 << 2),
5478f17100SMatthew Ahrens 	ZFS_TYPE_POOL		= (1 << 3),
5578f17100SMatthew Ahrens 	ZFS_TYPE_BOOKMARK	= (1 << 4)
56fa9e4066Sahrens } zfs_type_t;
57fa9e4066Sahrens 
584445fffbSMatthew Ahrens typedef enum dmu_objset_type {
594445fffbSMatthew Ahrens 	DMU_OST_NONE,
604445fffbSMatthew Ahrens 	DMU_OST_META,
614445fffbSMatthew Ahrens 	DMU_OST_ZFS,
624445fffbSMatthew Ahrens 	DMU_OST_ZVOL,
634445fffbSMatthew Ahrens 	DMU_OST_OTHER,			/* For testing only! */
644445fffbSMatthew Ahrens 	DMU_OST_ANY,			/* Be careful! */
654445fffbSMatthew Ahrens 	DMU_OST_NUMTYPES
664445fffbSMatthew Ahrens } dmu_objset_type_t;
674445fffbSMatthew Ahrens 
68990b4856Slling #define	ZFS_TYPE_DATASET	\
69fa9e4066Sahrens 	(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
70fa9e4066Sahrens 
71fbc66171SMarcel Telka /*
72fbc66171SMarcel Telka  * All of these include the terminating NUL byte.
73fbc66171SMarcel Telka  */
74478ed9adSEric Taylor #define	ZAP_MAXNAMELEN 256
75478ed9adSEric Taylor #define	ZAP_MAXVALUELEN (1024 * 8)
76478ed9adSEric Taylor #define	ZAP_OLDMAXVALUELEN 1024
77fbc66171SMarcel Telka #define	ZFS_MAX_DATASET_NAME_LEN 256
78478ed9adSEric Taylor 
79fa9e4066Sahrens /*
80990b4856Slling  * Dataset properties are identified by these constants and must be added to
81990b4856Slling  * the end of this list to ensure that external consumers are not affected
82990b4856Slling  * by the change. If you make any changes to this list, be sure to update
8366e2aaccSgw25295  * the property table in usr/src/common/zfs/zfs_prop.c.
84fa9e4066Sahrens  */
85fa9e4066Sahrens typedef enum {
86c16bcc45SIgor Kozhukhov 	ZFS_PROP_BAD = -1,
87c16bcc45SIgor Kozhukhov 	ZFS_PROP_TYPE = 0,
88fa9e4066Sahrens 	ZFS_PROP_CREATION,
89fa9e4066Sahrens 	ZFS_PROP_USED,
90fa9e4066Sahrens 	ZFS_PROP_AVAILABLE,
91fa9e4066Sahrens 	ZFS_PROP_REFERENCED,
92fa9e4066Sahrens 	ZFS_PROP_COMPRESSRATIO,
93fa9e4066Sahrens 	ZFS_PROP_MOUNTED,
94fa9e4066Sahrens 	ZFS_PROP_ORIGIN,
95fa9e4066Sahrens 	ZFS_PROP_QUOTA,
96fa9e4066Sahrens 	ZFS_PROP_RESERVATION,
97fa9e4066Sahrens 	ZFS_PROP_VOLSIZE,
98fa9e4066Sahrens 	ZFS_PROP_VOLBLOCKSIZE,
99fa9e4066Sahrens 	ZFS_PROP_RECORDSIZE,
100fa9e4066Sahrens 	ZFS_PROP_MOUNTPOINT,
101fa9e4066Sahrens 	ZFS_PROP_SHARENFS,
102fa9e4066Sahrens 	ZFS_PROP_CHECKSUM,
103fa9e4066Sahrens 	ZFS_PROP_COMPRESSION,
104fa9e4066Sahrens 	ZFS_PROP_ATIME,
105fa9e4066Sahrens 	ZFS_PROP_DEVICES,
106fa9e4066Sahrens 	ZFS_PROP_EXEC,
107fa9e4066Sahrens 	ZFS_PROP_SETUID,
108fa9e4066Sahrens 	ZFS_PROP_READONLY,
109fa9e4066Sahrens 	ZFS_PROP_ZONED,
110fa9e4066Sahrens 	ZFS_PROP_SNAPDIR,
111a3c49ce1SAlbert Lee 	ZFS_PROP_ACLMODE,
112fa9e4066Sahrens 	ZFS_PROP_ACLINHERIT,
11366e2aaccSgw25295 	ZFS_PROP_CREATETXG,		/* not exposed to the user */
11466e2aaccSgw25295 	ZFS_PROP_NAME,			/* not exposed to the user */
115e9dbad6fSeschrock 	ZFS_PROP_CANMOUNT,
11666e2aaccSgw25295 	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
1177b55fa8eSck153898 	ZFS_PROP_XATTR,
118d0ad202dSahrens 	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
119b1b8ab34Slling 	ZFS_PROP_COPIES,
120e7437265Sahrens 	ZFS_PROP_VERSION,
121da6c28aaSamw 	ZFS_PROP_UTF8ONLY,
122da6c28aaSamw 	ZFS_PROP_NORMALIZE,
123da6c28aaSamw 	ZFS_PROP_CASE,
124da6c28aaSamw 	ZFS_PROP_VSCAN,
125da6c28aaSamw 	ZFS_PROP_NBMAND,
126da6c28aaSamw 	ZFS_PROP_SHARESMB,
127a9799022Sck153898 	ZFS_PROP_REFQUOTA,
128a9799022Sck153898 	ZFS_PROP_REFRESERVATION,
129c5904d13Seschrock 	ZFS_PROP_GUID,
1303baa08fcSek110237 	ZFS_PROP_PRIMARYCACHE,
1313baa08fcSek110237 	ZFS_PROP_SECONDARYCACHE,
13274e7dc98SMatthew Ahrens 	ZFS_PROP_USEDSNAP,
13374e7dc98SMatthew Ahrens 	ZFS_PROP_USEDDS,
13474e7dc98SMatthew Ahrens 	ZFS_PROP_USEDCHILD,
13574e7dc98SMatthew Ahrens 	ZFS_PROP_USEDREFRESERV,
13614843421SMatthew Ahrens 	ZFS_PROP_USERACCOUNTING,	/* not exposed to the user */
137478ed9adSEric Taylor 	ZFS_PROP_STMF_SHAREINFO,	/* not exposed to the user */
138842727c2SChris Kirby 	ZFS_PROP_DEFER_DESTROY,
139842727c2SChris Kirby 	ZFS_PROP_USERREFS,
140e09fa4daSNeil Perrin 	ZFS_PROP_LOGBIAS,
1411d713200SEric Schrock 	ZFS_PROP_UNIQUE,		/* not exposed to the user */
1421d713200SEric Schrock 	ZFS_PROP_OBJSETID,		/* not exposed to the user */
143b24ab676SJeff Bonwick 	ZFS_PROP_DEDUP,
1444201a95eSRic Aleshire 	ZFS_PROP_MLSLABEL,
14555da60b9SMark J Musante 	ZFS_PROP_SYNC,
146187d6ac0SMatt Ahrens 	ZFS_PROP_REFRATIO,
14719b94df9SMatthew Ahrens 	ZFS_PROP_WRITTEN,
14819b94df9SMatthew Ahrens 	ZFS_PROP_CLONES,
14977372cb0SMatthew Ahrens 	ZFS_PROP_LOGICALUSED,
15077372cb0SMatthew Ahrens 	ZFS_PROP_LOGICALREFERENCED,
151ca48f36fSKeith M Wesolowski 	ZFS_PROP_INCONSISTENT,		/* not exposed to the user */
152a2afb611SJerry Jelinek 	ZFS_PROP_FILESYSTEM_LIMIT,
153a2afb611SJerry Jelinek 	ZFS_PROP_SNAPSHOT_LIMIT,
154a2afb611SJerry Jelinek 	ZFS_PROP_FILESYSTEM_COUNT,
155a2afb611SJerry Jelinek 	ZFS_PROP_SNAPSHOT_COUNT,
156edf345e6SMatthew Ahrens 	ZFS_PROP_REDUNDANT_METADATA,
157b461c746SMatthew Ahrens 	ZFS_PROP_PREV_SNAP,
1589c3fd121SMatthew Ahrens 	ZFS_PROP_RECEIVE_RESUME_TOKEN,
159*1a4cea1bSArne Jansen 	ZFS_PROP_FOLLOW,
16091ebeef5Sahrens 	ZFS_NUM_PROPS
161fa9e4066Sahrens } zfs_prop_t;
162fa9e4066Sahrens 
16314843421SMatthew Ahrens typedef enum {
16414843421SMatthew Ahrens 	ZFS_PROP_USERUSED,
16514843421SMatthew Ahrens 	ZFS_PROP_USERQUOTA,
16614843421SMatthew Ahrens 	ZFS_PROP_GROUPUSED,
16714843421SMatthew Ahrens 	ZFS_PROP_GROUPQUOTA,
16814843421SMatthew Ahrens 	ZFS_NUM_USERQUOTA_PROPS
16914843421SMatthew Ahrens } zfs_userquota_prop_t;
17014843421SMatthew Ahrens 
17114843421SMatthew Ahrens extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
17214843421SMatthew Ahrens 
173990b4856Slling /*
174990b4856Slling  * Pool properties are identified by these constants and must be added to the
175b87f3af3Sperrin  * end of this list to ensure that external consumers are not affected
176990b4856Slling  * by the change. If you make any changes to this list, be sure to update
177990b4856Slling  * the property table in usr/src/common/zfs/zpool_prop.c.
178990b4856Slling  */
179990b4856Slling typedef enum {
180990b4856Slling 	ZPOOL_PROP_NAME,
181990b4856Slling 	ZPOOL_PROP_SIZE,
182990b4856Slling 	ZPOOL_PROP_CAPACITY,
183990b4856Slling 	ZPOOL_PROP_ALTROOT,
184990b4856Slling 	ZPOOL_PROP_HEALTH,
185990b4856Slling 	ZPOOL_PROP_GUID,
186990b4856Slling 	ZPOOL_PROP_VERSION,
187990b4856Slling 	ZPOOL_PROP_BOOTFS,
188990b4856Slling 	ZPOOL_PROP_DELEGATION,
189990b4856Slling 	ZPOOL_PROP_AUTOREPLACE,
1902f8aaab3Seschrock 	ZPOOL_PROP_CACHEFILE,
1910a4e9518Sgw25295 	ZPOOL_PROP_FAILUREMODE,
192d5b5bb25SRich Morris 	ZPOOL_PROP_LISTSNAPS,
193573ca77eSGeorge Wilson 	ZPOOL_PROP_AUTOEXPAND,
194b24ab676SJeff Bonwick 	ZPOOL_PROP_DEDUPDITTO,
195b24ab676SJeff Bonwick 	ZPOOL_PROP_DEDUPRATIO,
196485bbbf5SGeorge Wilson 	ZPOOL_PROP_FREE,
197485bbbf5SGeorge Wilson 	ZPOOL_PROP_ALLOCATED,
198f9af39baSGeorge Wilson 	ZPOOL_PROP_READONLY,
1998704186eSDan McDonald 	ZPOOL_PROP_COMMENT,
2004263d13fSGeorge Wilson 	ZPOOL_PROP_EXPANDSZ,
201ad135b5dSChristopher Siden 	ZPOOL_PROP_FREEING,
2022e4c9986SGeorge Wilson 	ZPOOL_PROP_FRAGMENTATION,
2037fd05ac4SMatthew Ahrens 	ZPOOL_PROP_LEAKED,
204b5152584SMatthew Ahrens 	ZPOOL_PROP_MAXBLOCKSIZE,
205990b4856Slling 	ZPOOL_NUM_PROPS
206990b4856Slling } zpool_prop_t;
207b1b8ab34Slling 
2088704186eSDan McDonald /* Small enough to not hog a whole line of printout in zpool(1M). */
2098704186eSDan McDonald #define	ZPROP_MAX_COMMENT	32
2108704186eSDan McDonald 
211990b4856Slling #define	ZPROP_CONT		-2
212990b4856Slling #define	ZPROP_INVAL		-1
2133d7072f8Seschrock 
214990b4856Slling #define	ZPROP_VALUE		"value"
215990b4856Slling #define	ZPROP_SOURCE		"source"
2167f7322feSeschrock 
217b1b8ab34Slling typedef enum {
218990b4856Slling 	ZPROP_SRC_NONE = 0x1,
219990b4856Slling 	ZPROP_SRC_DEFAULT = 0x2,
220990b4856Slling 	ZPROP_SRC_TEMPORARY = 0x4,
221990b4856Slling 	ZPROP_SRC_LOCAL = 0x8,
22292241e0bSTom Erickson 	ZPROP_SRC_INHERITED = 0x10,
22392241e0bSTom Erickson 	ZPROP_SRC_RECEIVED = 0x20
224990b4856Slling } zprop_source_t;
225b1b8ab34Slling 
22692241e0bSTom Erickson #define	ZPROP_SRC_ALL	0x3f
22792241e0bSTom Erickson 
22892241e0bSTom Erickson #define	ZPROP_SOURCE_VAL_RECVD	"$recvd"
22992241e0bSTom Erickson #define	ZPROP_N_MORE_ERRORS	"N_MORE_ERRORS"
23092241e0bSTom Erickson /*
23192241e0bSTom Erickson  * Dataset flag implemented as a special entry in the props zap object
23292241e0bSTom Erickson  * indicating that the dataset has received properties on or after
23392241e0bSTom Erickson  * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
23492241e0bSTom Erickson  * just as it did in earlier versions, and thereafter, local properties are
23592241e0bSTom Erickson  * preserved.
23692241e0bSTom Erickson  */
23792241e0bSTom Erickson #define	ZPROP_HAS_RECVD		"$hasrecvd"
23892241e0bSTom Erickson 
23992241e0bSTom Erickson typedef enum {
24092241e0bSTom Erickson 	ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */
24192241e0bSTom Erickson 	ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */
24292241e0bSTom Erickson } zprop_errflags_t;
243b1b8ab34Slling 
244990b4856Slling typedef int (*zprop_func)(int, void *);
245990b4856Slling 
246990b4856Slling /*
2470a48a24eStimh  * Properties to be set on the root file system of a new pool
2480a48a24eStimh  * are stuffed into their own nvlist, which is then included in
2490a48a24eStimh  * the properties nvlist with the pool properties.
2500a48a24eStimh  */
2510a48a24eStimh #define	ZPOOL_ROOTFS_PROPS	"root-props-nvl"
2520a48a24eStimh 
2530a48a24eStimh /*
254990b4856Slling  * Dataset property functions shared between libzfs and kernel.
255990b4856Slling  */
256990b4856Slling const char *zfs_prop_default_string(zfs_prop_t);
257990b4856Slling uint64_t zfs_prop_default_numeric(zfs_prop_t);
258990b4856Slling boolean_t zfs_prop_readonly(zfs_prop_t);
259990b4856Slling boolean_t zfs_prop_inheritable(zfs_prop_t);
260da6c28aaSamw boolean_t zfs_prop_setonce(zfs_prop_t);
261990b4856Slling const char *zfs_prop_to_name(zfs_prop_t);
262990b4856Slling zfs_prop_t zfs_name_to_prop(const char *);
263990b4856Slling boolean_t zfs_prop_user(const char *);
26492241e0bSTom Erickson boolean_t zfs_prop_userquota(const char *);
26519b94df9SMatthew Ahrens boolean_t zfs_prop_written(const char *);
266990b4856Slling int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
267990b4856Slling int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
268b24ab676SJeff Bonwick uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
2694853e976Sgw25295 boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
270990b4856Slling 
271990b4856Slling /*
272990b4856Slling  * Pool property functions shared between libzfs and kernel.
273990b4856Slling  */
274990b4856Slling zpool_prop_t zpool_name_to_prop(const char *);
275990b4856Slling const char *zpool_prop_to_name(zpool_prop_t);
276990b4856Slling const char *zpool_prop_default_string(zpool_prop_t);
277990b4856Slling uint64_t zpool_prop_default_numeric(zpool_prop_t);
278990b4856Slling boolean_t zpool_prop_readonly(zpool_prop_t);
279ad135b5dSChristopher Siden boolean_t zpool_prop_feature(const char *);
280ad135b5dSChristopher Siden boolean_t zpool_prop_unsupported(const char *name);
281990b4856Slling int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
282990b4856Slling int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
283b24ab676SJeff Bonwick uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
284990b4856Slling 
285990b4856Slling /*
286990b4856Slling  * Definitions for the Delegation.
287990b4856Slling  */
288ecd6cf80Smarks typedef enum {
289ecd6cf80Smarks 	ZFS_DELEG_WHO_UNKNOWN = 0,
290ecd6cf80Smarks 	ZFS_DELEG_USER = 'u',
291ecd6cf80Smarks 	ZFS_DELEG_USER_SETS = 'U',
292ecd6cf80Smarks 	ZFS_DELEG_GROUP = 'g',
293ecd6cf80Smarks 	ZFS_DELEG_GROUP_SETS = 'G',
294ecd6cf80Smarks 	ZFS_DELEG_EVERYONE = 'e',
295ecd6cf80Smarks 	ZFS_DELEG_EVERYONE_SETS = 'E',
296ecd6cf80Smarks 	ZFS_DELEG_CREATE = 'c',
297ecd6cf80Smarks 	ZFS_DELEG_CREATE_SETS = 'C',
298ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET = 's',
299ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET_SETS = 'S'
300ecd6cf80Smarks } zfs_deleg_who_type_t;
301ecd6cf80Smarks 
302ecd6cf80Smarks typedef enum {
303ecd6cf80Smarks 	ZFS_DELEG_NONE = 0,
304ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCAL = 1,
305ecd6cf80Smarks 	ZFS_DELEG_PERM_DESCENDENT = 2,
306ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
307ecd6cf80Smarks 	ZFS_DELEG_PERM_CREATE = 4
308ecd6cf80Smarks } zfs_deleg_inherit_t;
309ecd6cf80Smarks 
310ecd6cf80Smarks #define	ZFS_DELEG_PERM_UID	"uid"
311ecd6cf80Smarks #define	ZFS_DELEG_PERM_GID	"gid"
312ecd6cf80Smarks #define	ZFS_DELEG_PERM_GROUPS	"groups"
313ecd6cf80Smarks 
3144201a95eSRic Aleshire #define	ZFS_MLSLABEL_DEFAULT	"none"
3154201a95eSRic Aleshire 
316743a77edSAlan Wright #define	ZFS_SMB_ACL_SRC		"src"
317743a77edSAlan Wright #define	ZFS_SMB_ACL_TARGET	"target"
318743a77edSAlan Wright 
319a227b7f4Shs24103 typedef enum {
320a227b7f4Shs24103 	ZFS_CANMOUNT_OFF = 0,
321a227b7f4Shs24103 	ZFS_CANMOUNT_ON = 1,
322a227b7f4Shs24103 	ZFS_CANMOUNT_NOAUTO = 2
323a227b7f4Shs24103 } zfs_canmount_type_t;
324a227b7f4Shs24103 
325e09fa4daSNeil Perrin typedef enum {
326e09fa4daSNeil Perrin 	ZFS_LOGBIAS_LATENCY = 0,
327e09fa4daSNeil Perrin 	ZFS_LOGBIAS_THROUGHPUT = 1
328e09fa4daSNeil Perrin } zfs_logbias_op_t;
329e09fa4daSNeil Perrin 
330da6c28aaSamw typedef enum zfs_share_op {
331da6c28aaSamw 	ZFS_SHARE_NFS = 0,
332da6c28aaSamw 	ZFS_UNSHARE_NFS = 1,
333da6c28aaSamw 	ZFS_SHARE_SMB = 2,
334da6c28aaSamw 	ZFS_UNSHARE_SMB = 3
335da6c28aaSamw } zfs_share_op_t;
336da6c28aaSamw 
337743a77edSAlan Wright typedef enum zfs_smb_acl_op {
338743a77edSAlan Wright 	ZFS_SMB_ACL_ADD,
339743a77edSAlan Wright 	ZFS_SMB_ACL_REMOVE,
340743a77edSAlan Wright 	ZFS_SMB_ACL_RENAME,
341743a77edSAlan Wright 	ZFS_SMB_ACL_PURGE
342743a77edSAlan Wright } zfs_smb_acl_op_t;
343743a77edSAlan Wright 
3443baa08fcSek110237 typedef enum zfs_cache_type {
3453baa08fcSek110237 	ZFS_CACHE_NONE = 0,
3463baa08fcSek110237 	ZFS_CACHE_METADATA = 1,
3473baa08fcSek110237 	ZFS_CACHE_ALL = 2
3483baa08fcSek110237 } zfs_cache_type_t;
3493baa08fcSek110237 
35055da60b9SMark J Musante typedef enum {
35155da60b9SMark J Musante 	ZFS_SYNC_STANDARD = 0,
35255da60b9SMark J Musante 	ZFS_SYNC_ALWAYS = 1,
35355da60b9SMark J Musante 	ZFS_SYNC_DISABLED = 2
35455da60b9SMark J Musante } zfs_sync_type_t;
35555da60b9SMark J Musante 
356edf345e6SMatthew Ahrens typedef enum {
357edf345e6SMatthew Ahrens 	ZFS_REDUNDANT_METADATA_ALL,
358edf345e6SMatthew Ahrens 	ZFS_REDUNDANT_METADATA_MOST
359edf345e6SMatthew Ahrens } zfs_redundant_metadata_type_t;
3603baa08fcSek110237 
361fa9e4066Sahrens /*
36299653d4eSeschrock  * On-disk version number.
363eaca9bbdSeschrock  */
364e7437265Sahrens #define	SPA_VERSION_1			1ULL
365e7437265Sahrens #define	SPA_VERSION_2			2ULL
366e7437265Sahrens #define	SPA_VERSION_3			3ULL
367e7437265Sahrens #define	SPA_VERSION_4			4ULL
368e7437265Sahrens #define	SPA_VERSION_5			5ULL
369e7437265Sahrens #define	SPA_VERSION_6			6ULL
370e7437265Sahrens #define	SPA_VERSION_7			7ULL
371e7437265Sahrens #define	SPA_VERSION_8			8ULL
372da6c28aaSamw #define	SPA_VERSION_9			9ULL
373fa94a07fSbrendan #define	SPA_VERSION_10			10ULL
374088f3894Sahrens #define	SPA_VERSION_11			11ULL
375bb0ade09Sahrens #define	SPA_VERSION_12			12ULL
37674e7dc98SMatthew Ahrens #define	SPA_VERSION_13			13ULL
377d0f3f37eSMark Shellenbaum #define	SPA_VERSION_14			14ULL
37814843421SMatthew Ahrens #define	SPA_VERSION_15			15ULL
379478ed9adSEric Taylor #define	SPA_VERSION_16			16ULL
380f94275ceSAdam Leventhal #define	SPA_VERSION_17			17ULL
381842727c2SChris Kirby #define	SPA_VERSION_18			18ULL
38288ecc943SGeorge Wilson #define	SPA_VERSION_19			19ULL
383b24ab676SJeff Bonwick #define	SPA_VERSION_20			20ULL
384b24ab676SJeff Bonwick #define	SPA_VERSION_21			21ULL
38592241e0bSTom Erickson #define	SPA_VERSION_22			22ULL
3866e1f5caaSNeil Perrin #define	SPA_VERSION_23			23ULL
3870a586ceaSMark Shellenbaum #define	SPA_VERSION_24			24ULL
3883f9d6ad7SLin Ling #define	SPA_VERSION_25			25ULL
389cde58dbcSMatthew Ahrens #define	SPA_VERSION_26			26ULL
3906e0cbcaaSMatthew Ahrens #define	SPA_VERSION_27			27ULL
391cb04b873SMark J Musante #define	SPA_VERSION_28			28ULL
392ad135b5dSChristopher Siden #define	SPA_VERSION_5000		5000ULL
393cb04b873SMark J Musante 
394b1b8ab34Slling /*
395e7cbe64fSgw25295  * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
396478ed9adSEric Taylor  * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
39714843421SMatthew Ahrens  * and do the appropriate changes.  Also bump the version number in
39814843421SMatthew Ahrens  * usr/src/grub/capability.
399b1b8ab34Slling  */
400ad135b5dSChristopher Siden #define	SPA_VERSION			SPA_VERSION_5000
401ad135b5dSChristopher Siden #define	SPA_VERSION_STRING		"5000"
40244cd46caSbillm 
40344cd46caSbillm /*
404e7437265Sahrens  * Symbolic names for the changes that caused a SPA_VERSION switch.
40544cd46caSbillm  * Used in the code when checking for presence or absence of a feature.
40644cd46caSbillm  * Feel free to define multiple symbolic names for each version if there
40744cd46caSbillm  * were multiple changes to on-disk structures during that version.
40844cd46caSbillm  *
409e7437265Sahrens  * NOTE: When checking the current SPA_VERSION in your code, be sure
41044cd46caSbillm  *       to use spa_version() since it reports the version of the
41144cd46caSbillm  *       last synced uberblock.  Checking the in-flight version can
41244cd46caSbillm  *       be dangerous in some cases.
41344cd46caSbillm  */
414e7437265Sahrens #define	SPA_VERSION_INITIAL		SPA_VERSION_1
415e7437265Sahrens #define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
416e7437265Sahrens #define	SPA_VERSION_SPARES		SPA_VERSION_3
417f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ2		SPA_VERSION_3
418cde58dbcSMatthew Ahrens #define	SPA_VERSION_BPOBJ_ACCOUNT	SPA_VERSION_3
419e7437265Sahrens #define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
420e7437265Sahrens #define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
421e7437265Sahrens #define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
422e7437265Sahrens #define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
423e7437265Sahrens #define	SPA_VERSION_BOOTFS		SPA_VERSION_6
424990b4856Slling #define	SPA_VERSION_SLOGS		SPA_VERSION_7
425990b4856Slling #define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
426da6c28aaSamw #define	SPA_VERSION_FUID		SPA_VERSION_9
427a9799022Sck153898 #define	SPA_VERSION_REFRESERVATION	SPA_VERSION_9
428a9799022Sck153898 #define	SPA_VERSION_REFQUOTA		SPA_VERSION_9
429a9799022Sck153898 #define	SPA_VERSION_UNIQUE_ACCURATE	SPA_VERSION_9
430fa94a07fSbrendan #define	SPA_VERSION_L2CACHE		SPA_VERSION_10
431088f3894Sahrens #define	SPA_VERSION_NEXT_CLONES		SPA_VERSION_11
432088f3894Sahrens #define	SPA_VERSION_ORIGIN		SPA_VERSION_11
433088f3894Sahrens #define	SPA_VERSION_DSL_SCRUB		SPA_VERSION_11
434bb0ade09Sahrens #define	SPA_VERSION_SNAP_PROPS		SPA_VERSION_12
43574e7dc98SMatthew Ahrens #define	SPA_VERSION_USED_BREAKDOWN	SPA_VERSION_13
436d0f3f37eSMark Shellenbaum #define	SPA_VERSION_PASSTHROUGH_X	SPA_VERSION_14
43714843421SMatthew Ahrens #define	SPA_VERSION_USERSPACE		SPA_VERSION_15
438478ed9adSEric Taylor #define	SPA_VERSION_STMF_PROP		SPA_VERSION_16
439f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ3		SPA_VERSION_17
440842727c2SChris Kirby #define	SPA_VERSION_USERREFS		SPA_VERSION_18
44188ecc943SGeorge Wilson #define	SPA_VERSION_HOLES		SPA_VERSION_19
442b24ab676SJeff Bonwick #define	SPA_VERSION_ZLE_COMPRESSION	SPA_VERSION_20
443b24ab676SJeff Bonwick #define	SPA_VERSION_DEDUP		SPA_VERSION_21
44492241e0bSTom Erickson #define	SPA_VERSION_RECVD_PROPS		SPA_VERSION_22
4456e1f5caaSNeil Perrin #define	SPA_VERSION_SLIM_ZIL		SPA_VERSION_23
4460a586ceaSMark Shellenbaum #define	SPA_VERSION_SA			SPA_VERSION_24
4473f9d6ad7SLin Ling #define	SPA_VERSION_SCAN		SPA_VERSION_25
448cde58dbcSMatthew Ahrens #define	SPA_VERSION_DIR_CLONES		SPA_VERSION_26
449cde58dbcSMatthew Ahrens #define	SPA_VERSION_DEADLISTS		SPA_VERSION_26
4506e0cbcaaSMatthew Ahrens #define	SPA_VERSION_FAST_SNAP		SPA_VERSION_27
451cb04b873SMark J Musante #define	SPA_VERSION_MULTI_REPLACE	SPA_VERSION_28
452ad135b5dSChristopher Siden #define	SPA_VERSION_BEFORE_FEATURES	SPA_VERSION_28
453ad135b5dSChristopher Siden #define	SPA_VERSION_FEATURES		SPA_VERSION_5000
454ad135b5dSChristopher Siden 
455ad135b5dSChristopher Siden #define	SPA_VERSION_IS_SUPPORTED(v) \
456ad135b5dSChristopher Siden 	(((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
457ad135b5dSChristopher Siden 	((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
458e7437265Sahrens 
459e7437265Sahrens /*
460e7437265Sahrens  * ZPL version - rev'd whenever an incompatible on-disk format change
461e7437265Sahrens  * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
462e7437265Sahrens  * also update the version_table[] and help message in zfs_prop.c.
463e7437265Sahrens  *
464e7437265Sahrens  * When changing, be sure to teach GRUB how to read the new format!
465478ed9adSEric Taylor  * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
466e7437265Sahrens  */
467e7437265Sahrens #define	ZPL_VERSION_1			1ULL
468e7437265Sahrens #define	ZPL_VERSION_2			2ULL
469da6c28aaSamw #define	ZPL_VERSION_3			3ULL
47014843421SMatthew Ahrens #define	ZPL_VERSION_4			4ULL
4710a586ceaSMark Shellenbaum #define	ZPL_VERSION_5			5ULL
4720a586ceaSMark Shellenbaum #define	ZPL_VERSION			ZPL_VERSION_5
4730a586ceaSMark Shellenbaum #define	ZPL_VERSION_STRING		"5"
474e7437265Sahrens 
475e7437265Sahrens #define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
476e7437265Sahrens #define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
477da6c28aaSamw #define	ZPL_VERSION_FUID		ZPL_VERSION_3
478de8267e0Stimh #define	ZPL_VERSION_NORMALIZATION	ZPL_VERSION_3
479da6c28aaSamw #define	ZPL_VERSION_SYSATTR		ZPL_VERSION_3
48014843421SMatthew Ahrens #define	ZPL_VERSION_USERSPACE		ZPL_VERSION_4
4810a586ceaSMark Shellenbaum #define	ZPL_VERSION_SA			ZPL_VERSION_5
482eaca9bbdSeschrock 
483468c413aSTim Haley /* Rewind request information */
484c8ee1847SVictor Latushkin #define	ZPOOL_NO_REWIND		1  /* No policy - default behavior */
485c8ee1847SVictor Latushkin #define	ZPOOL_NEVER_REWIND	2  /* Do not search for best txg or rewind */
486c8ee1847SVictor Latushkin #define	ZPOOL_TRY_REWIND	4  /* Search for best txg, but do not rewind */
487c8ee1847SVictor Latushkin #define	ZPOOL_DO_REWIND		8  /* Rewind to best txg w/in deferred frees */
488c8ee1847SVictor Latushkin #define	ZPOOL_EXTREME_REWIND	16 /* Allow extreme measures to find best txg */
489c8ee1847SVictor Latushkin #define	ZPOOL_REWIND_MASK	28 /* All the possible rewind bits */
490c8ee1847SVictor Latushkin #define	ZPOOL_REWIND_POLICIES	31 /* All the possible policy bits */
491468c413aSTim Haley 
492468c413aSTim Haley typedef struct zpool_rewind_policy {
493468c413aSTim Haley 	uint32_t	zrp_request;	/* rewind behavior requested */
494c8ee1847SVictor Latushkin 	uint64_t	zrp_maxmeta;	/* max acceptable meta-data errors */
495c8ee1847SVictor Latushkin 	uint64_t	zrp_maxdata;	/* max acceptable data errors */
496468c413aSTim Haley 	uint64_t	zrp_txg;	/* specific txg to load */
497468c413aSTim Haley } zpool_rewind_policy_t;
498468c413aSTim Haley 
499eaca9bbdSeschrock /*
500fa9e4066Sahrens  * The following are configuration names used in the nvlist describing a pool's
501fa9e4066Sahrens  * configuration.
502fa9e4066Sahrens  */
503fa9e4066Sahrens #define	ZPOOL_CONFIG_VERSION		"version"
504fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_NAME		"name"
505fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_STATE		"state"
506fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_TXG		"txg"
507fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
508fa9e4066Sahrens #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
509fa9e4066Sahrens #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
510fa9e4066Sahrens #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
511fa9e4066Sahrens #define	ZPOOL_CONFIG_TYPE		"type"
512fa9e4066Sahrens #define	ZPOOL_CONFIG_CHILDREN		"children"
513fa9e4066Sahrens #define	ZPOOL_CONFIG_ID			"id"
514fa9e4066Sahrens #define	ZPOOL_CONFIG_GUID		"guid"
515fa9e4066Sahrens #define	ZPOOL_CONFIG_PATH		"path"
516fa9e4066Sahrens #define	ZPOOL_CONFIG_DEVID		"devid"
517fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
518fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
519fa9e4066Sahrens #define	ZPOOL_CONFIG_ASHIFT		"ashift"
520fa9e4066Sahrens #define	ZPOOL_CONFIG_ASIZE		"asize"
521fa9e4066Sahrens #define	ZPOOL_CONFIG_DTL		"DTL"
5223f9d6ad7SLin Ling #define	ZPOOL_CONFIG_SCAN_STATS		"scan_stats"	/* not stored on disk */
5233f9d6ad7SLin Ling #define	ZPOOL_CONFIG_VDEV_STATS		"vdev_stats"	/* not stored on disk */
524afefbcddSeschrock #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
525ea8dc4b6Seschrock #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
526ea8dc4b6Seschrock #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
52799653d4eSeschrock #define	ZPOOL_CONFIG_SPARES		"spares"
52899653d4eSeschrock #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
52999653d4eSeschrock #define	ZPOOL_CONFIG_NPARITY		"nparity"
53095173954Sek110237 #define	ZPOOL_CONFIG_HOSTID		"hostid"
53195173954Sek110237 #define	ZPOOL_CONFIG_HOSTNAME		"hostname"
53211027bc7STim Haley #define	ZPOOL_CONFIG_LOADED_TIME	"initial_load_time"
5333d7072f8Seschrock #define	ZPOOL_CONFIG_UNSPARE		"unspare"
5343d7072f8Seschrock #define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
5358654d025Sperrin #define	ZPOOL_CONFIG_IS_LOG		"is_log"
536fa94a07fSbrendan #define	ZPOOL_CONFIG_L2CACHE		"l2cache"
537c9e5c7a7SSaso Kiselkov #define	ZPOOL_CONFIG_L2CACHE_PERSISTENT	"l2cache_persistent"
53888ecc943SGeorge Wilson #define	ZPOOL_CONFIG_HOLE_ARRAY		"hole_array"
53988ecc943SGeorge Wilson #define	ZPOOL_CONFIG_VDEV_CHILDREN	"vdev_children"
54088ecc943SGeorge Wilson #define	ZPOOL_CONFIG_IS_HOLE		"is_hole"
5419eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_HISTOGRAM	"ddt_histogram"
5429eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_OBJ_STATS	"ddt_object_stats"
5439eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_STATS		"ddt_stats"
5441195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT		"splitcfg"
5451195e687SMark J Musante #define	ZPOOL_CONFIG_ORIG_GUID		"orig_guid"
5461195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT_GUID		"split_guid"
5471195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT_LIST		"guid_list"
5483f9d6ad7SLin Ling #define	ZPOOL_CONFIG_REMOVING		"removing"
549b4952e17SGeorge Wilson #define	ZPOOL_CONFIG_RESILVER_TXG	"resilver_txg"
5508704186eSDan McDonald #define	ZPOOL_CONFIG_COMMENT		"comment"
551e14bb325SJeff Bonwick #define	ZPOOL_CONFIG_SUSPENDED		"suspended"	/* not stored on disk */
552e7cbe64fSgw25295 #define	ZPOOL_CONFIG_TIMESTAMP		"timestamp"	/* not stored on disk */
553e7cbe64fSgw25295 #define	ZPOOL_CONFIG_BOOTFS		"bootfs"	/* not stored on disk */
5544b964adaSGeorge Wilson #define	ZPOOL_CONFIG_MISSING_DEVICES	"missing_vdevs"	/* not stored on disk */
5554b964adaSGeorge Wilson #define	ZPOOL_CONFIG_LOAD_INFO		"load_info"	/* not stored on disk */
556ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_REWIND_INFO	"rewind_info"	/* not stored on disk */
557ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_UNSUP_FEAT		"unsup_feat"	/* not stored on disk */
55857221772SChristopher Siden #define	ZPOOL_CONFIG_ENABLED_FEAT	"enabled_feat"	/* not stored on disk */
559ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_CAN_RDONLY		"can_rdonly"	/* not stored on disk */
560ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_FEATURES_FOR_READ	"features_for_read"
561ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_FEATURE_STATS	"feature_stats"	/* not stored on disk */
5623d7072f8Seschrock /*
5633d7072f8Seschrock  * The persistent vdev state is stored as separate values rather than a single
5643d7072f8Seschrock  * 'vdev_state' entry.  This is because a device can be in multiple states, such
5653d7072f8Seschrock  * as offline and degraded.
5663d7072f8Seschrock  */
5673d7072f8Seschrock #define	ZPOOL_CONFIG_OFFLINE		"offline"
5683d7072f8Seschrock #define	ZPOOL_CONFIG_FAULTED		"faulted"
5693d7072f8Seschrock #define	ZPOOL_CONFIG_DEGRADED		"degraded"
5703d7072f8Seschrock #define	ZPOOL_CONFIG_REMOVED		"removed"
5716809eb4eSEric Schrock #define	ZPOOL_CONFIG_FRU		"fru"
572069f55e2SEric Schrock #define	ZPOOL_CONFIG_AUX_STATE		"aux_state"
573fa9e4066Sahrens 
574468c413aSTim Haley /* Rewind policy parameters */
575468c413aSTim Haley #define	ZPOOL_REWIND_POLICY		"rewind-policy"
576468c413aSTim Haley #define	ZPOOL_REWIND_REQUEST		"rewind-request"
577468c413aSTim Haley #define	ZPOOL_REWIND_REQUEST_TXG	"rewind-request-txg"
578468c413aSTim Haley #define	ZPOOL_REWIND_META_THRESH	"rewind-meta-thresh"
579468c413aSTim Haley #define	ZPOOL_REWIND_DATA_THRESH	"rewind-data-thresh"
580468c413aSTim Haley 
581468c413aSTim Haley /* Rewind data discovered */
582468c413aSTim Haley #define	ZPOOL_CONFIG_LOAD_TIME		"rewind_txg_ts"
583468c413aSTim Haley #define	ZPOOL_CONFIG_LOAD_DATA_ERRORS	"verify_data_errors"
584468c413aSTim Haley #define	ZPOOL_CONFIG_REWIND_TIME	"seconds_of_rewind"
585468c413aSTim Haley 
586fa9e4066Sahrens #define	VDEV_TYPE_ROOT			"root"
587fa9e4066Sahrens #define	VDEV_TYPE_MIRROR		"mirror"
588fa9e4066Sahrens #define	VDEV_TYPE_REPLACING		"replacing"
589fa9e4066Sahrens #define	VDEV_TYPE_RAIDZ			"raidz"
590fa9e4066Sahrens #define	VDEV_TYPE_DISK			"disk"
591fa9e4066Sahrens #define	VDEV_TYPE_FILE			"file"
592fa9e4066Sahrens #define	VDEV_TYPE_MISSING		"missing"
59388ecc943SGeorge Wilson #define	VDEV_TYPE_HOLE			"hole"
59499653d4eSeschrock #define	VDEV_TYPE_SPARE			"spare"
5958654d025Sperrin #define	VDEV_TYPE_LOG			"log"
596fa94a07fSbrendan #define	VDEV_TYPE_L2CACHE		"l2cache"
597fa9e4066Sahrens 
598fa9e4066Sahrens /*
599fa9e4066Sahrens  * This is needed in userland to report the minimum necessary device size.
600fa9e4066Sahrens  */
601fa9e4066Sahrens #define	SPA_MINDEVSIZE		(64ULL << 20)
602fa9e4066Sahrens 
603fa9e4066Sahrens /*
6042e4c9986SGeorge Wilson  * Set if the fragmentation has not yet been calculated. This can happen
6052e4c9986SGeorge Wilson  * because the space maps have not been upgraded or the histogram feature
6062e4c9986SGeorge Wilson  * is not enabled.
6072e4c9986SGeorge Wilson  */
6082e4c9986SGeorge Wilson #define	ZFS_FRAG_INVALID	UINT64_MAX
6092e4c9986SGeorge Wilson 
6102e4c9986SGeorge Wilson /*
611fa9e4066Sahrens  * The location of the pool configuration repository, shared between kernel and
612fa9e4066Sahrens  * userland.
613fa9e4066Sahrens  */
614c5904d13Seschrock #define	ZPOOL_CACHE		"/etc/zfs/zpool.cache"
615fa9e4066Sahrens 
616fa9e4066Sahrens /*
617fa9e4066Sahrens  * vdev states are ordered from least to most healthy.
618fa9e4066Sahrens  * A vdev that's CANT_OPEN or below is considered unusable.
619fa9e4066Sahrens  */
620fa9e4066Sahrens typedef enum vdev_state {
621fa9e4066Sahrens 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
622fa9e4066Sahrens 	VDEV_STATE_CLOSED,	/* Not currently open			*/
623fa9e4066Sahrens 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
6243d7072f8Seschrock 	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
625fa9e4066Sahrens 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
6263d7072f8Seschrock 	VDEV_STATE_FAULTED,	/* External request to fault device	*/
627fa9e4066Sahrens 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
628fa9e4066Sahrens 	VDEV_STATE_HEALTHY	/* Presumed good			*/
629fa9e4066Sahrens } vdev_state_t;
630fa9e4066Sahrens 
6313d7072f8Seschrock #define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
6323d7072f8Seschrock 
633fa9e4066Sahrens /*
634fa9e4066Sahrens  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
635fa9e4066Sahrens  * of the vdev stats structure uses these constants to distinguish why.
636fa9e4066Sahrens  */
637fa9e4066Sahrens typedef enum vdev_aux {
638fa9e4066Sahrens 	VDEV_AUX_NONE,		/* no error				*/
639fa9e4066Sahrens 	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
640fa9e4066Sahrens 	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
641fa9e4066Sahrens 	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
642fa9e4066Sahrens 	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
643fa9e4066Sahrens 	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
644eaca9bbdSeschrock 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
645eaca9bbdSeschrock 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
64699653d4eSeschrock 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
647ad135b5dSChristopher Siden 	VDEV_AUX_UNSUP_FEAT,	/* unsupported features			*/
6483d7072f8Seschrock 	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
64932b87932Sek110237 	VDEV_AUX_ERR_EXCEEDED,	/* too many errors			*/
650b87f3af3Sperrin 	VDEV_AUX_IO_FAILURE,	/* experienced I/O failure		*/
651069f55e2SEric Schrock 	VDEV_AUX_BAD_LOG,	/* cannot read log chain(s)		*/
6521195e687SMark J Musante 	VDEV_AUX_EXTERNAL,	/* external diagnosis			*/
6531195e687SMark J Musante 	VDEV_AUX_SPLIT_POOL	/* vdev was split off into another pool	*/
654fa9e4066Sahrens } vdev_aux_t;
655fa9e4066Sahrens 
656fa9e4066Sahrens /*
65746a2abf2Seschrock  * pool state.  The following states are written to disk as part of the normal
658fa94a07fSbrendan  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
659fa94a07fSbrendan  * states are software abstractions used at various levels to communicate
660fa94a07fSbrendan  * pool state.
661fa9e4066Sahrens  */
662fa9e4066Sahrens typedef enum pool_state {
663fa9e4066Sahrens 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
664fa9e4066Sahrens 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
665fa9e4066Sahrens 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
66699653d4eSeschrock 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
667fa94a07fSbrendan 	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
668fa9e4066Sahrens 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
66946a2abf2Seschrock 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
67046a2abf2Seschrock 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
671fa9e4066Sahrens } pool_state_t;
672fa9e4066Sahrens 
673fa9e4066Sahrens /*
6743f9d6ad7SLin Ling  * Scan Functions.
675fa9e4066Sahrens  */
6763f9d6ad7SLin Ling typedef enum pool_scan_func {
6773f9d6ad7SLin Ling 	POOL_SCAN_NONE,
6783f9d6ad7SLin Ling 	POOL_SCAN_SCRUB,
6793f9d6ad7SLin Ling 	POOL_SCAN_RESILVER,
6803f9d6ad7SLin Ling 	POOL_SCAN_FUNCS
6813f9d6ad7SLin Ling } pool_scan_func_t;
682fa9e4066Sahrens 
683fa9e4066Sahrens /*
684fa9e4066Sahrens  * ZIO types.  Needed to interpret vdev statistics below.
685fa9e4066Sahrens  */
686fa9e4066Sahrens typedef enum zio_type {
687fa9e4066Sahrens 	ZIO_TYPE_NULL = 0,
688fa9e4066Sahrens 	ZIO_TYPE_READ,
689fa9e4066Sahrens 	ZIO_TYPE_WRITE,
690fa9e4066Sahrens 	ZIO_TYPE_FREE,
691fa9e4066Sahrens 	ZIO_TYPE_CLAIM,
692fa9e4066Sahrens 	ZIO_TYPE_IOCTL,
693fa9e4066Sahrens 	ZIO_TYPES
694fa9e4066Sahrens } zio_type_t;
695fa9e4066Sahrens 
696fa9e4066Sahrens /*
6973f9d6ad7SLin Ling  * Pool statistics.  Note: all fields should be 64-bit because this
6983f9d6ad7SLin Ling  * is passed between kernel and userland as an nvlist uint64 array.
6993f9d6ad7SLin Ling  */
7003f9d6ad7SLin Ling typedef struct pool_scan_stat {
7013f9d6ad7SLin Ling 	/* values stored on disk */
7023f9d6ad7SLin Ling 	uint64_t	pss_func;	/* pool_scan_func_t */
7033f9d6ad7SLin Ling 	uint64_t	pss_state;	/* dsl_scan_state_t */
7043f9d6ad7SLin Ling 	uint64_t	pss_start_time;	/* scan start time */
7053f9d6ad7SLin Ling 	uint64_t	pss_end_time;	/* scan end time */
7063f9d6ad7SLin Ling 	uint64_t	pss_to_examine;	/* total bytes to scan */
7073f9d6ad7SLin Ling 	uint64_t	pss_examined;	/* total examined bytes	*/
7083f9d6ad7SLin Ling 	uint64_t	pss_to_process; /* total bytes to process */
7093f9d6ad7SLin Ling 	uint64_t	pss_processed;	/* total processed bytes */
7103f9d6ad7SLin Ling 	uint64_t	pss_errors;	/* scan errors	*/
7113f9d6ad7SLin Ling 
7123f9d6ad7SLin Ling 	/* values not stored on disk */
7133f9d6ad7SLin Ling 	uint64_t	pss_pass_exam;	/* examined bytes per scan pass */
7143f9d6ad7SLin Ling 	uint64_t	pss_pass_start;	/* start time of a scan pass */
7153f9d6ad7SLin Ling } pool_scan_stat_t;
7163f9d6ad7SLin Ling 
7173f9d6ad7SLin Ling typedef enum dsl_scan_state {
7183f9d6ad7SLin Ling 	DSS_NONE,
7193f9d6ad7SLin Ling 	DSS_SCANNING,
7203f9d6ad7SLin Ling 	DSS_FINISHED,
7213f9d6ad7SLin Ling 	DSS_CANCELED,
7223f9d6ad7SLin Ling 	DSS_NUM_STATES
7233f9d6ad7SLin Ling } dsl_scan_state_t;
7243f9d6ad7SLin Ling 
7253f9d6ad7SLin Ling 
7263f9d6ad7SLin Ling /*
727fa9e4066Sahrens  * Vdev statistics.  Note: all fields should be 64-bit because this
728fa9e4066Sahrens  * is passed between kernel and userland as an nvlist uint64 array.
729fa9e4066Sahrens  */
730fa9e4066Sahrens typedef struct vdev_stat {
731fa9e4066Sahrens 	hrtime_t	vs_timestamp;		/* time since vdev load	*/
732fa9e4066Sahrens 	uint64_t	vs_state;		/* vdev state		*/
733fa9e4066Sahrens 	uint64_t	vs_aux;			/* see vdev_aux_t	*/
734fa9e4066Sahrens 	uint64_t	vs_alloc;		/* space allocated	*/
735fa9e4066Sahrens 	uint64_t	vs_space;		/* total capacity	*/
73699653d4eSeschrock 	uint64_t	vs_dspace;		/* deflated capacity	*/
7372a79c5feSlling 	uint64_t	vs_rsize;		/* replaceable dev size */
7384263d13fSGeorge Wilson 	uint64_t	vs_esize;		/* expandable dev size */
739fa9e4066Sahrens 	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
740fa9e4066Sahrens 	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
741fa9e4066Sahrens 	uint64_t	vs_read_errors;		/* read errors		*/
742fa9e4066Sahrens 	uint64_t	vs_write_errors;	/* write errors		*/
743fa9e4066Sahrens 	uint64_t	vs_checksum_errors;	/* checksum errors	*/
744fa9e4066Sahrens 	uint64_t	vs_self_healed;		/* self-healed bytes	*/
7453f9d6ad7SLin Ling 	uint64_t	vs_scan_removing;	/* removing?	*/
7463f9d6ad7SLin Ling 	uint64_t	vs_scan_processed;	/* scan processed bytes	*/
7472e4c9986SGeorge Wilson 	uint64_t	vs_fragmentation;	/* device fragmentation */
748fa9e4066Sahrens } vdev_stat_t;
749fa9e4066Sahrens 
7509eb19f4dSGeorge Wilson /*
7519eb19f4dSGeorge Wilson  * DDT statistics.  Note: all fields should be 64-bit because this
7529eb19f4dSGeorge Wilson  * is passed between kernel and userland as an nvlist uint64 array.
7539eb19f4dSGeorge Wilson  */
7549eb19f4dSGeorge Wilson typedef struct ddt_object {
7559eb19f4dSGeorge Wilson 	uint64_t	ddo_count;	/* number of elments in ddt 	*/
7569eb19f4dSGeorge Wilson 	uint64_t	ddo_dspace;	/* size of ddt on disk		*/
7579eb19f4dSGeorge Wilson 	uint64_t	ddo_mspace;	/* size of ddt in-core		*/
7589eb19f4dSGeorge Wilson } ddt_object_t;
7599eb19f4dSGeorge Wilson 
7609eb19f4dSGeorge Wilson typedef struct ddt_stat {
7619eb19f4dSGeorge Wilson 	uint64_t	dds_blocks;	/* blocks			*/
7629eb19f4dSGeorge Wilson 	uint64_t	dds_lsize;	/* logical size			*/
7639eb19f4dSGeorge Wilson 	uint64_t	dds_psize;	/* physical size		*/
7649eb19f4dSGeorge Wilson 	uint64_t	dds_dsize;	/* deflated allocated size	*/
7659eb19f4dSGeorge Wilson 	uint64_t	dds_ref_blocks;	/* referenced blocks		*/
7669eb19f4dSGeorge Wilson 	uint64_t	dds_ref_lsize;	/* referenced lsize * refcnt	*/
7679eb19f4dSGeorge Wilson 	uint64_t	dds_ref_psize;	/* referenced psize * refcnt	*/
7689eb19f4dSGeorge Wilson 	uint64_t	dds_ref_dsize;	/* referenced dsize * refcnt	*/
7699eb19f4dSGeorge Wilson } ddt_stat_t;
7709eb19f4dSGeorge Wilson 
7719eb19f4dSGeorge Wilson typedef struct ddt_histogram {
7729eb19f4dSGeorge Wilson 	ddt_stat_t	ddh_stat[64];	/* power-of-two histogram buckets */
7739eb19f4dSGeorge Wilson } ddt_histogram_t;
7749eb19f4dSGeorge Wilson 
775e7cbe64fSgw25295 #define	ZVOL_DRIVER	"zvol"
776fa9e4066Sahrens #define	ZFS_DRIVER	"zfs"
777fa9e4066Sahrens #define	ZFS_DEV		"/dev/zfs"
778fa9e4066Sahrens 
779681d9761SEric Taylor /* general zvol path */
780681d9761SEric Taylor #define	ZVOL_DIR		"/dev/zvol"
781681d9761SEric Taylor /* expansion */
782573ca77eSGeorge Wilson #define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zfs@0:"
783681d9761SEric Taylor /* for dump and swap */
784681d9761SEric Taylor #define	ZVOL_FULL_DEV_DIR	ZVOL_DIR "/dsk/"
785681d9761SEric Taylor #define	ZVOL_FULL_RDEV_DIR	ZVOL_DIR "/rdsk/"
786fa9e4066Sahrens 
787fa9e4066Sahrens #define	ZVOL_PROP_NAME		"name"
788c1449561SEric Taylor #define	ZVOL_DEFAULT_BLOCKSIZE	8192
789fa9e4066Sahrens 
790fa9e4066Sahrens /*
791fa9e4066Sahrens  * /dev/zfs ioctl numbers.
792fa9e4066Sahrens  */
793fa9e4066Sahrens typedef enum zfs_ioc {
7944445fffbSMatthew Ahrens 	ZFS_IOC_FIRST =	('Z' << 8),
7954445fffbSMatthew Ahrens 	ZFS_IOC = ZFS_IOC_FIRST,
7964445fffbSMatthew Ahrens 	ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
797fa9e4066Sahrens 	ZFS_IOC_POOL_DESTROY,
798fa9e4066Sahrens 	ZFS_IOC_POOL_IMPORT,
799fa9e4066Sahrens 	ZFS_IOC_POOL_EXPORT,
800fa9e4066Sahrens 	ZFS_IOC_POOL_CONFIGS,
801fa9e4066Sahrens 	ZFS_IOC_POOL_STATS,
802fa9e4066Sahrens 	ZFS_IOC_POOL_TRYIMPORT,
8033f9d6ad7SLin Ling 	ZFS_IOC_POOL_SCAN,
804fa9e4066Sahrens 	ZFS_IOC_POOL_FREEZE,
805eaca9bbdSeschrock 	ZFS_IOC_POOL_UPGRADE,
80606eeb2adSek110237 	ZFS_IOC_POOL_GET_HISTORY,
807fa9e4066Sahrens 	ZFS_IOC_VDEV_ADD,
808fa9e4066Sahrens 	ZFS_IOC_VDEV_REMOVE,
8093d7072f8Seschrock 	ZFS_IOC_VDEV_SET_STATE,
810fa9e4066Sahrens 	ZFS_IOC_VDEV_ATTACH,
811fa9e4066Sahrens 	ZFS_IOC_VDEV_DETACH,
812c67d9675Seschrock 	ZFS_IOC_VDEV_SETPATH,
8136809eb4eSEric Schrock 	ZFS_IOC_VDEV_SETFRU,
814fa9e4066Sahrens 	ZFS_IOC_OBJSET_STATS,
815de8267e0Stimh 	ZFS_IOC_OBJSET_ZPLPROPS,
816fa9e4066Sahrens 	ZFS_IOC_DATASET_LIST_NEXT,
817fa9e4066Sahrens 	ZFS_IOC_SNAPSHOT_LIST_NEXT,
818fa9e4066Sahrens 	ZFS_IOC_SET_PROP,
819fa9e4066Sahrens 	ZFS_IOC_CREATE,
820fa9e4066Sahrens 	ZFS_IOC_DESTROY,
821fa9e4066Sahrens 	ZFS_IOC_ROLLBACK,
822fa9e4066Sahrens 	ZFS_IOC_RENAME,
8233cb34c60Sahrens 	ZFS_IOC_RECV,
8243cb34c60Sahrens 	ZFS_IOC_SEND,
825ea8dc4b6Seschrock 	ZFS_IOC_INJECT_FAULT,
826ea8dc4b6Seschrock 	ZFS_IOC_CLEAR_FAULT,
827ea8dc4b6Seschrock 	ZFS_IOC_INJECT_LIST_NEXT,
828ea8dc4b6Seschrock 	ZFS_IOC_ERROR_LOG,
829ea8dc4b6Seschrock 	ZFS_IOC_CLEAR,
8301d452cf5Sahrens 	ZFS_IOC_PROMOTE,
83155434c77Sek110237 	ZFS_IOC_SNAPSHOT,
83255434c77Sek110237 	ZFS_IOC_DSOBJ_TO_DSNAME,
833b1b8ab34Slling 	ZFS_IOC_OBJ_TO_PATH,
834b1b8ab34Slling 	ZFS_IOC_POOL_SET_PROPS,
835ecd6cf80Smarks 	ZFS_IOC_POOL_GET_PROPS,
836ecd6cf80Smarks 	ZFS_IOC_SET_FSACL,
837ecd6cf80Smarks 	ZFS_IOC_GET_FSACL,
838e45ce728Sahrens 	ZFS_IOC_SHARE,
839743a77edSAlan Wright 	ZFS_IOC_INHERIT_PROP,
84014843421SMatthew Ahrens 	ZFS_IOC_SMB_ACL,
84114843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_ONE,
84214843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_MANY,
843842727c2SChris Kirby 	ZFS_IOC_USERSPACE_UPGRADE,
844842727c2SChris Kirby 	ZFS_IOC_HOLD,
845842727c2SChris Kirby 	ZFS_IOC_RELEASE,
84692241e0bSTom Erickson 	ZFS_IOC_GET_HOLDS,
8471195e687SMark J Musante 	ZFS_IOC_OBJSET_RECVD_PROPS,
84899d5e173STim Haley 	ZFS_IOC_VDEV_SPLIT,
84999d5e173STim Haley 	ZFS_IOC_NEXT_OBJ,
85099d5e173STim Haley 	ZFS_IOC_DIFF,
85199d5e173STim Haley 	ZFS_IOC_TMP_SNAPSHOT,
852e9103aaeSGarrett D'Amore 	ZFS_IOC_OBJ_TO_STATS,
85319b94df9SMatthew Ahrens 	ZFS_IOC_SPACE_WRITTEN,
85419b94df9SMatthew Ahrens 	ZFS_IOC_SPACE_SNAPS,
8554445fffbSMatthew Ahrens 	ZFS_IOC_DESTROY_SNAPS,
8564263d13fSGeorge Wilson 	ZFS_IOC_POOL_REGUID,
8574e3c9f44SBill Pijewski 	ZFS_IOC_POOL_REOPEN,
8584445fffbSMatthew Ahrens 	ZFS_IOC_SEND_PROGRESS,
8594445fffbSMatthew Ahrens 	ZFS_IOC_LOG_HISTORY,
8604445fffbSMatthew Ahrens 	ZFS_IOC_SEND_NEW,
8614445fffbSMatthew Ahrens 	ZFS_IOC_SEND_SPACE,
8624445fffbSMatthew Ahrens 	ZFS_IOC_CLONE,
863d78b796cSAndreas Jaekel 	ZFS_IOC_SET_ZEV_CALLBACKS,
864d78b796cSAndreas Jaekel 	ZFS_IOC_UNSET_ZEV_CALLBACKS,
86578f17100SMatthew Ahrens 	ZFS_IOC_BOOKMARK,
86678f17100SMatthew Ahrens 	ZFS_IOC_GET_BOOKMARKS,
86778f17100SMatthew Ahrens 	ZFS_IOC_DESTROY_BOOKMARKS,
868ce0d9371SArne Jansen 	ZFS_IOC_ARC_INFO,
8694445fffbSMatthew Ahrens 	ZFS_IOC_LAST
870fa9e4066Sahrens } zfs_ioc_t;
871fa9e4066Sahrens 
872ea8dc4b6Seschrock /*
873ea8dc4b6Seschrock  * Internal SPA load state.  Used by FMA diagnosis engine.
874ea8dc4b6Seschrock  */
875ea8dc4b6Seschrock typedef enum {
876ea8dc4b6Seschrock 	SPA_LOAD_NONE,		/* no load in progress	*/
877ea8dc4b6Seschrock 	SPA_LOAD_OPEN,		/* normal open		*/
878ea8dc4b6Seschrock 	SPA_LOAD_IMPORT,	/* import in progress	*/
879468c413aSTim Haley 	SPA_LOAD_TRYIMPORT,	/* tryimport in progress */
8809eb19f4dSGeorge Wilson 	SPA_LOAD_RECOVER,	/* recovery requested	*/
8819eb19f4dSGeorge Wilson 	SPA_LOAD_ERROR		/* load failed		*/
882ea8dc4b6Seschrock } spa_load_state_t;
883ea8dc4b6Seschrock 
884e9dbad6fSeschrock /*
885e9dbad6fSeschrock  * Bookmark name values.
886e9dbad6fSeschrock  */
88755434c77Sek110237 #define	ZPOOL_ERR_LIST		"error list"
888e9dbad6fSeschrock #define	ZPOOL_ERR_DATASET	"dataset"
889e9dbad6fSeschrock #define	ZPOOL_ERR_OBJECT	"object"
890e9dbad6fSeschrock 
89106eeb2adSek110237 #define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
89206eeb2adSek110237 
89306eeb2adSek110237 /*
89406eeb2adSek110237  * The following are names used in the nvlist describing
89506eeb2adSek110237  * the pool's history log.
89606eeb2adSek110237  */
89706eeb2adSek110237 #define	ZPOOL_HIST_RECORD	"history record"
89806eeb2adSek110237 #define	ZPOOL_HIST_TIME		"history time"
89906eeb2adSek110237 #define	ZPOOL_HIST_CMD		"history command"
900ecd6cf80Smarks #define	ZPOOL_HIST_WHO		"history who"
901ecd6cf80Smarks #define	ZPOOL_HIST_ZONE		"history zone"
902ecd6cf80Smarks #define	ZPOOL_HIST_HOST		"history hostname"
903ecd6cf80Smarks #define	ZPOOL_HIST_TXG		"history txg"
904ecd6cf80Smarks #define	ZPOOL_HIST_INT_EVENT	"history internal event"
905ecd6cf80Smarks #define	ZPOOL_HIST_INT_STR	"history internal str"
9064445fffbSMatthew Ahrens #define	ZPOOL_HIST_INT_NAME	"internal_name"
9074445fffbSMatthew Ahrens #define	ZPOOL_HIST_IOCTL	"ioctl"
9084445fffbSMatthew Ahrens #define	ZPOOL_HIST_INPUT_NVL	"in_nvl"
9094445fffbSMatthew Ahrens #define	ZPOOL_HIST_OUTPUT_NVL	"out_nvl"
9104445fffbSMatthew Ahrens #define	ZPOOL_HIST_DSNAME	"dsname"
9114445fffbSMatthew Ahrens #define	ZPOOL_HIST_DSID		"dsid"
91206eeb2adSek110237 
9133d7072f8Seschrock /*
9143d7072f8Seschrock  * Flags for ZFS_IOC_VDEV_SET_STATE
9153d7072f8Seschrock  */
9163d7072f8Seschrock #define	ZFS_ONLINE_CHECKREMOVE	0x1
9173d7072f8Seschrock #define	ZFS_ONLINE_UNSPARE	0x2
9183d7072f8Seschrock #define	ZFS_ONLINE_FORCEFAULT	0x4
919573ca77eSGeorge Wilson #define	ZFS_ONLINE_EXPAND	0x8
9203d7072f8Seschrock #define	ZFS_OFFLINE_TEMPORARY	0x1
9213d7072f8Seschrock 
9223d7072f8Seschrock /*
9234b964adaSGeorge Wilson  * Flags for ZFS_IOC_POOL_IMPORT
9244b964adaSGeorge Wilson  */
9254b964adaSGeorge Wilson #define	ZFS_IMPORT_NORMAL	0x0
9264b964adaSGeorge Wilson #define	ZFS_IMPORT_VERBATIM	0x1
9274b964adaSGeorge Wilson #define	ZFS_IMPORT_ANY_HOST	0x2
9284b964adaSGeorge Wilson #define	ZFS_IMPORT_MISSING_LOG	0x4
929f9af39baSGeorge Wilson #define	ZFS_IMPORT_ONLY		0x8
9304b964adaSGeorge Wilson 
9314b964adaSGeorge Wilson /*
9323d7072f8Seschrock  * Sysevent payload members.  ZFS will generate the following sysevents with the
9333d7072f8Seschrock  * given payloads:
9343d7072f8Seschrock  *
9353d7072f8Seschrock  *	ESC_ZFS_RESILVER_START
9363d7072f8Seschrock  *	ESC_ZFS_RESILVER_END
9373d7072f8Seschrock  *	ESC_ZFS_POOL_DESTROY
938e9103aaeSGarrett D'Amore  *	ESC_ZFS_POOL_REGUID
9393d7072f8Seschrock  *
9403d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
9413d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
9423d7072f8Seschrock  *
9433d7072f8Seschrock  *	ESC_ZFS_VDEV_REMOVE
9443d7072f8Seschrock  *	ESC_ZFS_VDEV_CLEAR
9453d7072f8Seschrock  *	ESC_ZFS_VDEV_CHECK
9463d7072f8Seschrock  *
9473d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
9483d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
9493d7072f8Seschrock  *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
9503d7072f8Seschrock  *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
9513d7072f8Seschrock  */
9523d7072f8Seschrock #define	ZFS_EV_POOL_NAME	"pool_name"
9533d7072f8Seschrock #define	ZFS_EV_POOL_GUID	"pool_guid"
9543d7072f8Seschrock #define	ZFS_EV_VDEV_PATH	"vdev_path"
9553d7072f8Seschrock #define	ZFS_EV_VDEV_GUID	"vdev_guid"
9563d7072f8Seschrock 
957fa9e4066Sahrens #ifdef	__cplusplus
958fa9e4066Sahrens }
959fa9e4066Sahrens #endif
960fa9e4066Sahrens 
961fa9e4066Sahrens #endif	/* _SYS_FS_ZFS_H */
962