xref: /illumos-gate/usr/src/uts/common/sys/fs/zfs.h (revision 4c2bdae2)
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.
24c4ecba8aSPaul Dagnelie  * Copyright (c) 2011, 2020 by Delphix. All rights reserved.
25e9103aaeSGarrett D'Amore  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
26c3d26abcSMatthew Ahrens  * Copyright (c) 2014 Integros [integros.com]
27dd50e0ccSTony Hutter  * Copyright 2020 Joyent, Inc.
281702cce7SAlek Pinchuk  * Copyright (c) 2017 Datto Inc.
29663207adSDon Brady  * Copyright (c) 2017, Intel Corporation.
30fa9e4066Sahrens  */
31fa9e4066Sahrens 
3255da60b9SMark J Musante /* Portions Copyright 2010 Robert Milkowski */
3355da60b9SMark J Musante 
34fa9e4066Sahrens #ifndef	_SYS_FS_ZFS_H
35fa9e4066Sahrens #define	_SYS_FS_ZFS_H
36fa9e4066Sahrens 
37842727c2SChris Kirby #include <sys/time.h>
38dd50e0ccSTony Hutter /*
39dd50e0ccSTony Hutter  * In OpenZFS we include sys/zio_priority.h to get the enum value of
40dd50e0ccSTony Hutter  * ZIO_PRIORITY_NUM_QUEUEABLE, which is used for the various array sizes in
41dd50e0ccSTony Hutter  * the structure definitions below. However, in illumos zio_priority.h is not
42dd50e0ccSTony Hutter  * readily available to the userland code where we have a very large number of
43dd50e0ccSTony Hutter  * files including sys/zfs.h. Thus, we define ZIO_PRIORITY_N_QUEUEABLE here and
44dd50e0ccSTony Hutter  * this should be kept in sync if ZIO_PRIORITY_NUM_QUEUEABLE changes.
45dd50e0ccSTony Hutter  */
46dd50e0ccSTony Hutter #define	ZIO_PRIORITY_N_QUEUEABLE	8
47842727c2SChris Kirby 
48fa9e4066Sahrens #ifdef	__cplusplus
49fa9e4066Sahrens extern "C" {
50fa9e4066Sahrens #endif
51fa9e4066Sahrens 
52fa9e4066Sahrens /*
53fa9e4066Sahrens  * Types and constants shared between userland and the kernel.
54fa9e4066Sahrens  */
55fa9e4066Sahrens 
56fa9e4066Sahrens /*
57fa9e4066Sahrens  * Each dataset can be one of the following types.  These constants can be
58fa9e4066Sahrens  * combined into masks that can be passed to various functions.
59fa9e4066Sahrens  */
60fa9e4066Sahrens typedef enum {
6178f17100SMatthew Ahrens 	ZFS_TYPE_FILESYSTEM	= (1 << 0),
6278f17100SMatthew Ahrens 	ZFS_TYPE_SNAPSHOT	= (1 << 1),
6378f17100SMatthew Ahrens 	ZFS_TYPE_VOLUME		= (1 << 2),
6478f17100SMatthew Ahrens 	ZFS_TYPE_POOL		= (1 << 3),
6578f17100SMatthew Ahrens 	ZFS_TYPE_BOOKMARK	= (1 << 4)
66fa9e4066Sahrens } zfs_type_t;
67fa9e4066Sahrens 
6826455f9eSAndriy Gapon /*
6926455f9eSAndriy Gapon  * NB: lzc_dataset_type should be updated whenever a new objset type is added,
7026455f9eSAndriy Gapon  * if it represents a real type of a dataset that can be created from userland.
7126455f9eSAndriy Gapon  */
724445fffbSMatthew Ahrens typedef enum dmu_objset_type {
734445fffbSMatthew Ahrens 	DMU_OST_NONE,
744445fffbSMatthew Ahrens 	DMU_OST_META,
754445fffbSMatthew Ahrens 	DMU_OST_ZFS,
764445fffbSMatthew Ahrens 	DMU_OST_ZVOL,
774445fffbSMatthew Ahrens 	DMU_OST_OTHER,			/* For testing only! */
784445fffbSMatthew Ahrens 	DMU_OST_ANY,			/* Be careful! */
794445fffbSMatthew Ahrens 	DMU_OST_NUMTYPES
804445fffbSMatthew Ahrens } dmu_objset_type_t;
814445fffbSMatthew Ahrens 
82990b4856Slling #define	ZFS_TYPE_DATASET	\
83fa9e4066Sahrens 	(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
84fa9e4066Sahrens 
859adfa60dSMatthew Ahrens /*
869adfa60dSMatthew Ahrens  * All of these include the terminating NUL byte.
879adfa60dSMatthew Ahrens  */
88478ed9adSEric Taylor #define	ZAP_MAXNAMELEN 256
89478ed9adSEric Taylor #define	ZAP_MAXVALUELEN (1024 * 8)
90478ed9adSEric Taylor #define	ZAP_OLDMAXVALUELEN 1024
919adfa60dSMatthew Ahrens #define	ZFS_MAX_DATASET_NAME_LEN 256
92478ed9adSEric Taylor 
93fa9e4066Sahrens /*
94990b4856Slling  * Dataset properties are identified by these constants and must be added to
95990b4856Slling  * the end of this list to ensure that external consumers are not affected
96990b4856Slling  * by the change. If you make any changes to this list, be sure to update
9766e2aaccSgw  * the property table in usr/src/common/zfs/zfs_prop.c.
98fa9e4066Sahrens  */
99fa9e4066Sahrens typedef enum {
1004ae5f5f0SAlan Somers 	ZPROP_CONT = -2,
1014ae5f5f0SAlan Somers 	ZPROP_INVAL = -1,
102c16bcc45SIgor Kozhukhov 	ZFS_PROP_TYPE = 0,
103fa9e4066Sahrens 	ZFS_PROP_CREATION,
104fa9e4066Sahrens 	ZFS_PROP_USED,
105fa9e4066Sahrens 	ZFS_PROP_AVAILABLE,
106fa9e4066Sahrens 	ZFS_PROP_REFERENCED,
107fa9e4066Sahrens 	ZFS_PROP_COMPRESSRATIO,
108fa9e4066Sahrens 	ZFS_PROP_MOUNTED,
109fa9e4066Sahrens 	ZFS_PROP_ORIGIN,
110fa9e4066Sahrens 	ZFS_PROP_QUOTA,
111fa9e4066Sahrens 	ZFS_PROP_RESERVATION,
112fa9e4066Sahrens 	ZFS_PROP_VOLSIZE,
113fa9e4066Sahrens 	ZFS_PROP_VOLBLOCKSIZE,
114fa9e4066Sahrens 	ZFS_PROP_RECORDSIZE,
115fa9e4066Sahrens 	ZFS_PROP_MOUNTPOINT,
116fa9e4066Sahrens 	ZFS_PROP_SHARENFS,
117fa9e4066Sahrens 	ZFS_PROP_CHECKSUM,
118fa9e4066Sahrens 	ZFS_PROP_COMPRESSION,
119fa9e4066Sahrens 	ZFS_PROP_ATIME,
120fa9e4066Sahrens 	ZFS_PROP_DEVICES,
121fa9e4066Sahrens 	ZFS_PROP_EXEC,
122fa9e4066Sahrens 	ZFS_PROP_SETUID,
123fa9e4066Sahrens 	ZFS_PROP_READONLY,
124fa9e4066Sahrens 	ZFS_PROP_ZONED,
125fa9e4066Sahrens 	ZFS_PROP_SNAPDIR,
126a3c49ce1SAlbert Lee 	ZFS_PROP_ACLMODE,
127fa9e4066Sahrens 	ZFS_PROP_ACLINHERIT,
12870561057SGordon Ross 	ZFS_PROP_ACLIMPLICIT,	/* ACL Implicit Owner Rights (RackTop) */
129e8d4a73cSJosh Paetzel 	ZFS_PROP_CREATETXG,
13066e2aaccSgw 	ZFS_PROP_NAME,			/* not exposed to the user */
131e9dbad6fSeschrock 	ZFS_PROP_CANMOUNT,
13266e2aaccSgw 	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
1337b55fa8eSck 	ZFS_PROP_XATTR,
134d0ad202dSahrens 	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
135b1b8ab34Slling 	ZFS_PROP_COPIES,
136e7437265Sahrens 	ZFS_PROP_VERSION,
137da6c28aaSamw 	ZFS_PROP_UTF8ONLY,
138da6c28aaSamw 	ZFS_PROP_NORMALIZE,
139da6c28aaSamw 	ZFS_PROP_CASE,
140da6c28aaSamw 	ZFS_PROP_VSCAN,
141da6c28aaSamw 	ZFS_PROP_NBMAND,
142da6c28aaSamw 	ZFS_PROP_SHARESMB,
143a9799022Sck 	ZFS_PROP_REFQUOTA,
144a9799022Sck 	ZFS_PROP_REFRESERVATION,
145c5904d13Seschrock 	ZFS_PROP_GUID,
1463baa08fcSek 	ZFS_PROP_PRIMARYCACHE,
1473baa08fcSek 	ZFS_PROP_SECONDARYCACHE,
14874e7dc98SMatthew Ahrens 	ZFS_PROP_USEDSNAP,
14974e7dc98SMatthew Ahrens 	ZFS_PROP_USEDDS,
15074e7dc98SMatthew Ahrens 	ZFS_PROP_USEDCHILD,
15174e7dc98SMatthew Ahrens 	ZFS_PROP_USEDREFRESERV,
15214843421SMatthew Ahrens 	ZFS_PROP_USERACCOUNTING,	/* not exposed to the user */
153478ed9adSEric Taylor 	ZFS_PROP_STMF_SHAREINFO,	/* not exposed to the user */
154842727c2SChris Kirby 	ZFS_PROP_DEFER_DESTROY,
155842727c2SChris Kirby 	ZFS_PROP_USERREFS,
156e09fa4daSNeil Perrin 	ZFS_PROP_LOGBIAS,
1571d713200SEric Schrock 	ZFS_PROP_UNIQUE,		/* not exposed to the user */
1581d713200SEric Schrock 	ZFS_PROP_OBJSETID,		/* not exposed to the user */
159b24ab676SJeff Bonwick 	ZFS_PROP_DEDUP,
1604201a95eSRic Aleshire 	ZFS_PROP_MLSLABEL,
16155da60b9SMark J Musante 	ZFS_PROP_SYNC,
16254811da5SToomas Soome 	ZFS_PROP_DNODESIZE,
163187d6ac0SMatt Ahrens 	ZFS_PROP_REFRATIO,
16419b94df9SMatthew Ahrens 	ZFS_PROP_WRITTEN,
16519b94df9SMatthew Ahrens 	ZFS_PROP_CLONES,
16677372cb0SMatthew Ahrens 	ZFS_PROP_LOGICALUSED,
16777372cb0SMatthew Ahrens 	ZFS_PROP_LOGICALREFERENCED,
168ca48f36fSKeith M Wesolowski 	ZFS_PROP_INCONSISTENT,		/* not exposed to the user */
169a2afb611SJerry Jelinek 	ZFS_PROP_FILESYSTEM_LIMIT,
170a2afb611SJerry Jelinek 	ZFS_PROP_SNAPSHOT_LIMIT,
171a2afb611SJerry Jelinek 	ZFS_PROP_FILESYSTEM_COUNT,
172a2afb611SJerry Jelinek 	ZFS_PROP_SNAPSHOT_COUNT,
173edf345e6SMatthew Ahrens 	ZFS_PROP_REDUNDANT_METADATA,
174b461c746SMatthew Ahrens 	ZFS_PROP_PREV_SNAP,
1759c3fd121SMatthew Ahrens 	ZFS_PROP_RECEIVE_RESUME_TOKEN,
1765cabbc6bSPrashanth Sreenivasa 	ZFS_PROP_REMAPTXG,		/* not exposed to the user */
177663207adSDon Brady 	ZFS_PROP_SPECIAL_SMALL_BLOCKS,
178eb633035STom Caputi 	ZFS_PROP_ENCRYPTION,
179eb633035STom Caputi 	ZFS_PROP_KEYLOCATION,
180eb633035STom Caputi 	ZFS_PROP_KEYFORMAT,
181eb633035STom Caputi 	ZFS_PROP_PBKDF2_SALT,
182eb633035STom Caputi 	ZFS_PROP_PBKDF2_ITERS,
183eb633035STom Caputi 	ZFS_PROP_ENCRYPTION_ROOT,
184eb633035STom Caputi 	ZFS_PROP_KEY_GUID,
185eb633035STom Caputi 	ZFS_PROP_KEYSTATUS,
186eb633035STom Caputi 	ZFS_PROP_IVSET_GUID,		/* not exposed to the user */
18791ebeef5Sahrens 	ZFS_NUM_PROPS
188fa9e4066Sahrens } zfs_prop_t;
189fa9e4066Sahrens 
19014843421SMatthew Ahrens typedef enum {
19114843421SMatthew Ahrens 	ZFS_PROP_USERUSED,
19214843421SMatthew Ahrens 	ZFS_PROP_USERQUOTA,
19314843421SMatthew Ahrens 	ZFS_PROP_GROUPUSED,
19414843421SMatthew Ahrens 	ZFS_PROP_GROUPQUOTA,
195f67950b2SNasf-Fan 	ZFS_PROP_USEROBJUSED,
196f67950b2SNasf-Fan 	ZFS_PROP_USEROBJQUOTA,
197f67950b2SNasf-Fan 	ZFS_PROP_GROUPOBJUSED,
198f67950b2SNasf-Fan 	ZFS_PROP_GROUPOBJQUOTA,
199f67950b2SNasf-Fan 	ZFS_PROP_PROJECTUSED,
200f67950b2SNasf-Fan 	ZFS_PROP_PROJECTQUOTA,
201f67950b2SNasf-Fan 	ZFS_PROP_PROJECTOBJUSED,
202f67950b2SNasf-Fan 	ZFS_PROP_PROJECTOBJQUOTA,
20314843421SMatthew Ahrens 	ZFS_NUM_USERQUOTA_PROPS
20414843421SMatthew Ahrens } zfs_userquota_prop_t;
20514843421SMatthew Ahrens 
20614843421SMatthew Ahrens extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
20714843421SMatthew Ahrens 
208990b4856Slling /*
209990b4856Slling  * Pool properties are identified by these constants and must be added to the
210b87f3af3Sperrin  * end of this list to ensure that external consumers are not affected
211990b4856Slling  * by the change. If you make any changes to this list, be sure to update
212990b4856Slling  * the property table in usr/src/common/zfs/zpool_prop.c.
213990b4856Slling  */
214990b4856Slling typedef enum {
2154ae5f5f0SAlan Somers 	ZPOOL_PROP_INVAL = -1,
216990b4856Slling 	ZPOOL_PROP_NAME,
217990b4856Slling 	ZPOOL_PROP_SIZE,
218990b4856Slling 	ZPOOL_PROP_CAPACITY,
219990b4856Slling 	ZPOOL_PROP_ALTROOT,
220990b4856Slling 	ZPOOL_PROP_HEALTH,
221990b4856Slling 	ZPOOL_PROP_GUID,
222990b4856Slling 	ZPOOL_PROP_VERSION,
223990b4856Slling 	ZPOOL_PROP_BOOTFS,
224990b4856Slling 	ZPOOL_PROP_DELEGATION,
225990b4856Slling 	ZPOOL_PROP_AUTOREPLACE,
2262f8aaab3Seschrock 	ZPOOL_PROP_CACHEFILE,
2270a4e9518Sgw 	ZPOOL_PROP_FAILUREMODE,
228d5b5bb25SRich Morris 	ZPOOL_PROP_LISTSNAPS,
229573ca77eSGeorge Wilson 	ZPOOL_PROP_AUTOEXPAND,
230b24ab676SJeff Bonwick 	ZPOOL_PROP_DEDUPDITTO,
231b24ab676SJeff Bonwick 	ZPOOL_PROP_DEDUPRATIO,
232485bbbf5SGeorge Wilson 	ZPOOL_PROP_FREE,
233485bbbf5SGeorge Wilson 	ZPOOL_PROP_ALLOCATED,
234f9af39baSGeorge Wilson 	ZPOOL_PROP_READONLY,
2358704186eSDan McDonald 	ZPOOL_PROP_COMMENT,
2364263d13fSGeorge Wilson 	ZPOOL_PROP_EXPANDSZ,
237ad135b5dSChristopher Siden 	ZPOOL_PROP_FREEING,
2382e4c9986SGeorge Wilson 	ZPOOL_PROP_FRAGMENTATION,
2397fd05ac4SMatthew Ahrens 	ZPOOL_PROP_LEAKED,
240b5152584SMatthew Ahrens 	ZPOOL_PROP_MAXBLOCKSIZE,
2417855d95bSToomas Soome 	ZPOOL_PROP_BOOTSIZE,
24286714001SSerapheim Dimitropoulos 	ZPOOL_PROP_CHECKPOINT,
24304e56356SAndriy Gapon 	ZPOOL_PROP_TNAME,
24454811da5SToomas Soome 	ZPOOL_PROP_MAXDNODESIZE,
245e0f1c0afSOlaf Faaland 	ZPOOL_PROP_MULTIHOST,
2465711d393Sloli 	ZPOOL_PROP_ASHIFT,
247084fd14fSBrian Behlendorf 	ZPOOL_PROP_AUTOTRIM,
248990b4856Slling 	ZPOOL_NUM_PROPS
249990b4856Slling } zpool_prop_t;
250b1b8ab34Slling 
251bbf21555SRichard Lowe /* Small enough to not hog a whole line of printout in zpool(8). */
2528704186eSDan McDonald #define	ZPROP_MAX_COMMENT	32
2538704186eSDan McDonald 
254990b4856Slling #define	ZPROP_VALUE		"value"
255990b4856Slling #define	ZPROP_SOURCE		"source"
2567f7322feSeschrock 
257b1b8ab34Slling typedef enum {
258990b4856Slling 	ZPROP_SRC_NONE = 0x1,
259990b4856Slling 	ZPROP_SRC_DEFAULT = 0x2,
260990b4856Slling 	ZPROP_SRC_TEMPORARY = 0x4,
261990b4856Slling 	ZPROP_SRC_LOCAL = 0x8,
26292241e0bSTom Erickson 	ZPROP_SRC_INHERITED = 0x10,
26392241e0bSTom Erickson 	ZPROP_SRC_RECEIVED = 0x20
264990b4856Slling } zprop_source_t;
265990b4856Slling 
26692241e0bSTom Erickson #define	ZPROP_SRC_ALL	0x3f
26792241e0bSTom Erickson 
26892241e0bSTom Erickson #define	ZPROP_SOURCE_VAL_RECVD	"$recvd"
26992241e0bSTom Erickson #define	ZPROP_N_MORE_ERRORS	"N_MORE_ERRORS"
27092241e0bSTom Erickson /*
27192241e0bSTom Erickson  * Dataset flag implemented as a special entry in the props zap object
27292241e0bSTom Erickson  * indicating that the dataset has received properties on or after
27392241e0bSTom Erickson  * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
27492241e0bSTom Erickson  * just as it did in earlier versions, and thereafter, local properties are
27592241e0bSTom Erickson  * preserved.
27692241e0bSTom Erickson  */
27792241e0bSTom Erickson #define	ZPROP_HAS_RECVD		"$hasrecvd"
27892241e0bSTom Erickson 
27992241e0bSTom Erickson typedef enum {
28092241e0bSTom Erickson 	ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */
28192241e0bSTom Erickson 	ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */
28292241e0bSTom Erickson } zprop_errflags_t;
283990b4856Slling 
284990b4856Slling typedef int (*zprop_func)(int, void *);
285990b4856Slling 
2860a48a24eStimh /*
2870a48a24eStimh  * Properties to be set on the root file system of a new pool
2880a48a24eStimh  * are stuffed into their own nvlist, which is then included in
2890a48a24eStimh  * the properties nvlist with the pool properties.
2900a48a24eStimh  */
2910a48a24eStimh #define	ZPOOL_ROOTFS_PROPS	"root-props-nvl"
2920a48a24eStimh 
293dfc11533SChris Williamson /*
294dfc11533SChris Williamson  * Length of 'written@' and 'written#'
295dfc11533SChris Williamson  */
296dfc11533SChris Williamson #define	ZFS_WRITTEN_PROP_PREFIX_LEN	8
297dfc11533SChris Williamson 
298990b4856Slling /*
299990b4856Slling  * Dataset property functions shared between libzfs and kernel.
300990b4856Slling  */
301990b4856Slling const char *zfs_prop_default_string(zfs_prop_t);
302990b4856Slling uint64_t zfs_prop_default_numeric(zfs_prop_t);
303990b4856Slling boolean_t zfs_prop_readonly(zfs_prop_t);
304dfc11533SChris Williamson boolean_t zfs_prop_visible(zfs_prop_t prop);
305990b4856Slling boolean_t zfs_prop_inheritable(zfs_prop_t);
306da6c28aaSamw boolean_t zfs_prop_setonce(zfs_prop_t);
307eb633035STom Caputi boolean_t zfs_prop_encryption_key_param(zfs_prop_t);
308eb633035STom Caputi boolean_t zfs_prop_valid_keylocation(const char *, boolean_t);
309990b4856Slling const char *zfs_prop_to_name(zfs_prop_t);
310990b4856Slling zfs_prop_t zfs_name_to_prop(const char *);
311990b4856Slling boolean_t zfs_prop_user(const char *);
31292241e0bSTom Erickson boolean_t zfs_prop_userquota(const char *);
31319b94df9SMatthew Ahrens boolean_t zfs_prop_written(const char *);
314990b4856Slling int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
315990b4856Slling int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
316b24ab676SJeff Bonwick uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
317*4c2bdae2STim Chase boolean_t zfs_prop_valid_for_type(int, zfs_type_t, boolean_t);
318b1b8ab34Slling 
319990b4856Slling /*
320990b4856Slling  * Pool property functions shared between libzfs and kernel.
321990b4856Slling  */
322990b4856Slling zpool_prop_t zpool_name_to_prop(const char *);
323990b4856Slling const char *zpool_prop_to_name(zpool_prop_t);
324990b4856Slling const char *zpool_prop_default_string(zpool_prop_t);
325990b4856Slling uint64_t zpool_prop_default_numeric(zpool_prop_t);
326990b4856Slling boolean_t zpool_prop_readonly(zpool_prop_t);
327ad135b5dSChristopher Siden boolean_t zpool_prop_feature(const char *);
328ad135b5dSChristopher Siden boolean_t zpool_prop_unsupported(const char *name);
329990b4856Slling int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
330990b4856Slling int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
331b24ab676SJeff Bonwick uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
332b1b8ab34Slling 
333990b4856Slling /*
334990b4856Slling  * Definitions for the Delegation.
335990b4856Slling  */
336ecd6cf80Smarks typedef enum {
337ecd6cf80Smarks 	ZFS_DELEG_WHO_UNKNOWN = 0,
338ecd6cf80Smarks 	ZFS_DELEG_USER = 'u',
339ecd6cf80Smarks 	ZFS_DELEG_USER_SETS = 'U',
340ecd6cf80Smarks 	ZFS_DELEG_GROUP = 'g',
341ecd6cf80Smarks 	ZFS_DELEG_GROUP_SETS = 'G',
342ecd6cf80Smarks 	ZFS_DELEG_EVERYONE = 'e',
343ecd6cf80Smarks 	ZFS_DELEG_EVERYONE_SETS = 'E',
344ecd6cf80Smarks 	ZFS_DELEG_CREATE = 'c',
345ecd6cf80Smarks 	ZFS_DELEG_CREATE_SETS = 'C',
346ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET = 's',
347ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET_SETS = 'S'
348ecd6cf80Smarks } zfs_deleg_who_type_t;
349ecd6cf80Smarks 
350ecd6cf80Smarks typedef enum {
351ecd6cf80Smarks 	ZFS_DELEG_NONE = 0,
352ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCAL = 1,
353ecd6cf80Smarks 	ZFS_DELEG_PERM_DESCENDENT = 2,
354ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
355ecd6cf80Smarks 	ZFS_DELEG_PERM_CREATE = 4
356ecd6cf80Smarks } zfs_deleg_inherit_t;
357ecd6cf80Smarks 
358ecd6cf80Smarks #define	ZFS_DELEG_PERM_UID	"uid"
359ecd6cf80Smarks #define	ZFS_DELEG_PERM_GID	"gid"
360ecd6cf80Smarks #define	ZFS_DELEG_PERM_GROUPS	"groups"
361ecd6cf80Smarks 
3624201a95eSRic Aleshire #define	ZFS_MLSLABEL_DEFAULT	"none"
3634201a95eSRic Aleshire 
364743a77edSAlan Wright #define	ZFS_SMB_ACL_SRC		"src"
365743a77edSAlan Wright #define	ZFS_SMB_ACL_TARGET	"target"
366743a77edSAlan Wright 
367a227b7f4Shs typedef enum {
368a227b7f4Shs 	ZFS_CANMOUNT_OFF = 0,
369a227b7f4Shs 	ZFS_CANMOUNT_ON = 1,
370a227b7f4Shs 	ZFS_CANMOUNT_NOAUTO = 2
371a227b7f4Shs } zfs_canmount_type_t;
372a227b7f4Shs 
373e09fa4daSNeil Perrin typedef enum {
374e09fa4daSNeil Perrin 	ZFS_LOGBIAS_LATENCY = 0,
375e09fa4daSNeil Perrin 	ZFS_LOGBIAS_THROUGHPUT = 1
376e09fa4daSNeil Perrin } zfs_logbias_op_t;
377e09fa4daSNeil Perrin 
378da6c28aaSamw typedef enum zfs_share_op {
379da6c28aaSamw 	ZFS_SHARE_NFS = 0,
380da6c28aaSamw 	ZFS_UNSHARE_NFS = 1,
381da6c28aaSamw 	ZFS_SHARE_SMB = 2,
382da6c28aaSamw 	ZFS_UNSHARE_SMB = 3
383da6c28aaSamw } zfs_share_op_t;
384da6c28aaSamw 
385743a77edSAlan Wright typedef enum zfs_smb_acl_op {
386743a77edSAlan Wright 	ZFS_SMB_ACL_ADD,
387743a77edSAlan Wright 	ZFS_SMB_ACL_REMOVE,
388743a77edSAlan Wright 	ZFS_SMB_ACL_RENAME,
389743a77edSAlan Wright 	ZFS_SMB_ACL_PURGE
390743a77edSAlan Wright } zfs_smb_acl_op_t;
391743a77edSAlan Wright 
3923baa08fcSek typedef enum zfs_cache_type {
3933baa08fcSek 	ZFS_CACHE_NONE = 0,
3943baa08fcSek 	ZFS_CACHE_METADATA = 1,
3953baa08fcSek 	ZFS_CACHE_ALL = 2
3963baa08fcSek } zfs_cache_type_t;
3973baa08fcSek 
39855da60b9SMark J Musante typedef enum {
39955da60b9SMark J Musante 	ZFS_SYNC_STANDARD = 0,
40055da60b9SMark J Musante 	ZFS_SYNC_ALWAYS = 1,
40155da60b9SMark J Musante 	ZFS_SYNC_DISABLED = 2
40255da60b9SMark J Musante } zfs_sync_type_t;
40355da60b9SMark J Musante 
40454811da5SToomas Soome typedef enum {
40554811da5SToomas Soome 	ZFS_DNSIZE_LEGACY = 0,
40654811da5SToomas Soome 	ZFS_DNSIZE_AUTO = 1,
40754811da5SToomas Soome 	ZFS_DNSIZE_1K = 1024,
40854811da5SToomas Soome 	ZFS_DNSIZE_2K = 2048,
40954811da5SToomas Soome 	ZFS_DNSIZE_4K = 4096,
41054811da5SToomas Soome 	ZFS_DNSIZE_8K = 8192,
41154811da5SToomas Soome 	ZFS_DNSIZE_16K = 16384
41254811da5SToomas Soome } zfs_dnsize_type_t;
41354811da5SToomas Soome 
414edf345e6SMatthew Ahrens typedef enum {
415edf345e6SMatthew Ahrens 	ZFS_REDUNDANT_METADATA_ALL,
416edf345e6SMatthew Ahrens 	ZFS_REDUNDANT_METADATA_MOST
417edf345e6SMatthew Ahrens } zfs_redundant_metadata_type_t;
4183baa08fcSek 
419eb633035STom Caputi typedef enum zfs_keystatus {
420eb633035STom Caputi 	ZFS_KEYSTATUS_NONE = 0,
421eb633035STom Caputi 	ZFS_KEYSTATUS_UNAVAILABLE,
422eb633035STom Caputi 	ZFS_KEYSTATUS_AVAILABLE
423eb633035STom Caputi } zfs_keystatus_t;
424eb633035STom Caputi 
425eb633035STom Caputi typedef enum zfs_keyformat {
426eb633035STom Caputi 	ZFS_KEYFORMAT_NONE = 0,
427eb633035STom Caputi 	ZFS_KEYFORMAT_RAW,
428eb633035STom Caputi 	ZFS_KEYFORMAT_HEX,
429eb633035STom Caputi 	ZFS_KEYFORMAT_PASSPHRASE,
430eb633035STom Caputi 	ZFS_KEYFORMAT_FORMATS
431eb633035STom Caputi } zfs_keyformat_t;
432eb633035STom Caputi 
433eb633035STom Caputi typedef enum zfs_key_location {
434eb633035STom Caputi 	ZFS_KEYLOCATION_NONE = 0,
435eb633035STom Caputi 	ZFS_KEYLOCATION_PROMPT,
436eb633035STom Caputi 	ZFS_KEYLOCATION_URI,
437eb633035STom Caputi 	ZFS_KEYLOCATION_LOCATIONS
438eb633035STom Caputi } zfs_keylocation_t;
439eb633035STom Caputi 
440eb633035STom Caputi #define	DEFAULT_PBKDF2_ITERATIONS 350000
441eb633035STom Caputi #define	MIN_PBKDF2_ITERATIONS 100000
442eb633035STom Caputi 
443eaca9bbdSeschrock /*
44499653d4eSeschrock  * On-disk version number.
445eaca9bbdSeschrock  */
446e7437265Sahrens #define	SPA_VERSION_1			1ULL
447e7437265Sahrens #define	SPA_VERSION_2			2ULL
448e7437265Sahrens #define	SPA_VERSION_3			3ULL
449e7437265Sahrens #define	SPA_VERSION_4			4ULL
450e7437265Sahrens #define	SPA_VERSION_5			5ULL
451e7437265Sahrens #define	SPA_VERSION_6			6ULL
452e7437265Sahrens #define	SPA_VERSION_7			7ULL
453e7437265Sahrens #define	SPA_VERSION_8			8ULL
454da6c28aaSamw #define	SPA_VERSION_9			9ULL
455fa94a07fSbrendan #define	SPA_VERSION_10			10ULL
456088f3894Sahrens #define	SPA_VERSION_11			11ULL
457bb0ade09Sahrens #define	SPA_VERSION_12			12ULL
45874e7dc98SMatthew Ahrens #define	SPA_VERSION_13			13ULL
459d0f3f37eSMark Shellenbaum #define	SPA_VERSION_14			14ULL
46014843421SMatthew Ahrens #define	SPA_VERSION_15			15ULL
461478ed9adSEric Taylor #define	SPA_VERSION_16			16ULL
462f94275ceSAdam Leventhal #define	SPA_VERSION_17			17ULL
463842727c2SChris Kirby #define	SPA_VERSION_18			18ULL
46488ecc943SGeorge Wilson #define	SPA_VERSION_19			19ULL
465b24ab676SJeff Bonwick #define	SPA_VERSION_20			20ULL
466b24ab676SJeff Bonwick #define	SPA_VERSION_21			21ULL
46792241e0bSTom Erickson #define	SPA_VERSION_22			22ULL
4686e1f5caaSNeil Perrin #define	SPA_VERSION_23			23ULL
4690a586ceaSMark Shellenbaum #define	SPA_VERSION_24			24ULL
4703f9d6ad7SLin Ling #define	SPA_VERSION_25			25ULL
471cde58dbcSMatthew Ahrens #define	SPA_VERSION_26			26ULL
4726e0cbcaaSMatthew Ahrens #define	SPA_VERSION_27			27ULL
473cb04b873SMark J Musante #define	SPA_VERSION_28			28ULL
474ad135b5dSChristopher Siden #define	SPA_VERSION_5000		5000ULL
475cb04b873SMark J Musante 
476b1b8ab34Slling /*
477e7cbe64fSgw  * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
478478ed9adSEric Taylor  * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
47914843421SMatthew Ahrens  * and do the appropriate changes.  Also bump the version number in
48014843421SMatthew Ahrens  * usr/src/grub/capability.
481b1b8ab34Slling  */
482ad135b5dSChristopher Siden #define	SPA_VERSION			SPA_VERSION_5000
483ad135b5dSChristopher Siden #define	SPA_VERSION_STRING		"5000"
48444cd46caSbillm 
48544cd46caSbillm /*
486e7437265Sahrens  * Symbolic names for the changes that caused a SPA_VERSION switch.
48744cd46caSbillm  * Used in the code when checking for presence or absence of a feature.
48844cd46caSbillm  * Feel free to define multiple symbolic names for each version if there
48944cd46caSbillm  * were multiple changes to on-disk structures during that version.
49044cd46caSbillm  *
491e7437265Sahrens  * NOTE: When checking the current SPA_VERSION in your code, be sure
49244cd46caSbillm  *       to use spa_version() since it reports the version of the
49344cd46caSbillm  *       last synced uberblock.  Checking the in-flight version can
49444cd46caSbillm  *       be dangerous in some cases.
49544cd46caSbillm  */
496e7437265Sahrens #define	SPA_VERSION_INITIAL		SPA_VERSION_1
497e7437265Sahrens #define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
498e7437265Sahrens #define	SPA_VERSION_SPARES		SPA_VERSION_3
499f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ2		SPA_VERSION_3
500cde58dbcSMatthew Ahrens #define	SPA_VERSION_BPOBJ_ACCOUNT	SPA_VERSION_3
501e7437265Sahrens #define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
502e7437265Sahrens #define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
503e7437265Sahrens #define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
504e7437265Sahrens #define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
505e7437265Sahrens #define	SPA_VERSION_BOOTFS		SPA_VERSION_6
506990b4856Slling #define	SPA_VERSION_SLOGS		SPA_VERSION_7
507990b4856Slling #define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
508da6c28aaSamw #define	SPA_VERSION_FUID		SPA_VERSION_9
509a9799022Sck #define	SPA_VERSION_REFRESERVATION	SPA_VERSION_9
510a9799022Sck #define	SPA_VERSION_REFQUOTA		SPA_VERSION_9
511a9799022Sck #define	SPA_VERSION_UNIQUE_ACCURATE	SPA_VERSION_9
512fa94a07fSbrendan #define	SPA_VERSION_L2CACHE		SPA_VERSION_10
513088f3894Sahrens #define	SPA_VERSION_NEXT_CLONES		SPA_VERSION_11
514088f3894Sahrens #define	SPA_VERSION_ORIGIN		SPA_VERSION_11
515088f3894Sahrens #define	SPA_VERSION_DSL_SCRUB		SPA_VERSION_11
516bb0ade09Sahrens #define	SPA_VERSION_SNAP_PROPS		SPA_VERSION_12
51774e7dc98SMatthew Ahrens #define	SPA_VERSION_USED_BREAKDOWN	SPA_VERSION_13
518d0f3f37eSMark Shellenbaum #define	SPA_VERSION_PASSTHROUGH_X	SPA_VERSION_14
51914843421SMatthew Ahrens #define	SPA_VERSION_USERSPACE		SPA_VERSION_15
520478ed9adSEric Taylor #define	SPA_VERSION_STMF_PROP		SPA_VERSION_16
521f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ3		SPA_VERSION_17
522842727c2SChris Kirby #define	SPA_VERSION_USERREFS		SPA_VERSION_18
52388ecc943SGeorge Wilson #define	SPA_VERSION_HOLES		SPA_VERSION_19
524b24ab676SJeff Bonwick #define	SPA_VERSION_ZLE_COMPRESSION	SPA_VERSION_20
525b24ab676SJeff Bonwick #define	SPA_VERSION_DEDUP		SPA_VERSION_21
52692241e0bSTom Erickson #define	SPA_VERSION_RECVD_PROPS		SPA_VERSION_22
5276e1f5caaSNeil Perrin #define	SPA_VERSION_SLIM_ZIL		SPA_VERSION_23
5280a586ceaSMark Shellenbaum #define	SPA_VERSION_SA			SPA_VERSION_24
5293f9d6ad7SLin Ling #define	SPA_VERSION_SCAN		SPA_VERSION_25
530cde58dbcSMatthew Ahrens #define	SPA_VERSION_DIR_CLONES		SPA_VERSION_26
531cde58dbcSMatthew Ahrens #define	SPA_VERSION_DEADLISTS		SPA_VERSION_26
5326e0cbcaaSMatthew Ahrens #define	SPA_VERSION_FAST_SNAP		SPA_VERSION_27
533cb04b873SMark J Musante #define	SPA_VERSION_MULTI_REPLACE	SPA_VERSION_28
534ad135b5dSChristopher Siden #define	SPA_VERSION_BEFORE_FEATURES	SPA_VERSION_28
535ad135b5dSChristopher Siden #define	SPA_VERSION_FEATURES		SPA_VERSION_5000
536ad135b5dSChristopher Siden 
537ad135b5dSChristopher Siden #define	SPA_VERSION_IS_SUPPORTED(v) \
538ad135b5dSChristopher Siden 	(((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
539ad135b5dSChristopher Siden 	((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
540e7437265Sahrens 
541e7437265Sahrens /*
542e7437265Sahrens  * ZPL version - rev'd whenever an incompatible on-disk format change
543e7437265Sahrens  * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
544e7437265Sahrens  * also update the version_table[] and help message in zfs_prop.c.
545e7437265Sahrens  *
546e7437265Sahrens  * When changing, be sure to teach GRUB how to read the new format!
547478ed9adSEric Taylor  * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
548e7437265Sahrens  */
549e7437265Sahrens #define	ZPL_VERSION_1			1ULL
550e7437265Sahrens #define	ZPL_VERSION_2			2ULL
551da6c28aaSamw #define	ZPL_VERSION_3			3ULL
55214843421SMatthew Ahrens #define	ZPL_VERSION_4			4ULL
5530a586ceaSMark Shellenbaum #define	ZPL_VERSION_5			5ULL
5540a586ceaSMark Shellenbaum #define	ZPL_VERSION			ZPL_VERSION_5
5550a586ceaSMark Shellenbaum #define	ZPL_VERSION_STRING		"5"
556e7437265Sahrens 
557e7437265Sahrens #define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
558e7437265Sahrens #define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
559da6c28aaSamw #define	ZPL_VERSION_FUID		ZPL_VERSION_3
560de8267e0Stimh #define	ZPL_VERSION_NORMALIZATION	ZPL_VERSION_3
561da6c28aaSamw #define	ZPL_VERSION_SYSATTR		ZPL_VERSION_3
56214843421SMatthew Ahrens #define	ZPL_VERSION_USERSPACE		ZPL_VERSION_4
5630a586ceaSMark Shellenbaum #define	ZPL_VERSION_SA			ZPL_VERSION_5
564eaca9bbdSeschrock 
565f0a05239SGeorge Amanakis /* Persistent L2ARC version */
566f0a05239SGeorge Amanakis #define	L2ARC_PERSISTENT_VERSION_1	1ULL
567f0a05239SGeorge Amanakis #define	L2ARC_PERSISTENT_VERSION	L2ARC_PERSISTENT_VERSION_1
568f0a05239SGeorge Amanakis #define	L2ARC_PERSISTENT_VERSION_STRING	"1"
569f0a05239SGeorge Amanakis 
5705dafeea3SPavel Zakharov /* Rewind policy information */
571c8ee1847SVictor Latushkin #define	ZPOOL_NO_REWIND		1  /* No policy - default behavior */
572c8ee1847SVictor Latushkin #define	ZPOOL_NEVER_REWIND	2  /* Do not search for best txg or rewind */
573c8ee1847SVictor Latushkin #define	ZPOOL_TRY_REWIND	4  /* Search for best txg, but do not rewind */
574c8ee1847SVictor Latushkin #define	ZPOOL_DO_REWIND		8  /* Rewind to best txg w/in deferred frees */
575c8ee1847SVictor Latushkin #define	ZPOOL_EXTREME_REWIND	16 /* Allow extreme measures to find best txg */
576c8ee1847SVictor Latushkin #define	ZPOOL_REWIND_MASK	28 /* All the possible rewind bits */
577c8ee1847SVictor Latushkin #define	ZPOOL_REWIND_POLICIES	31 /* All the possible policy bits */
578468c413aSTim Haley 
5795dafeea3SPavel Zakharov typedef struct zpool_load_policy {
5805dafeea3SPavel Zakharov 	uint32_t	zlp_rewind;	/* rewind policy requested */
5815dafeea3SPavel Zakharov 	uint64_t	zlp_maxmeta;	/* max acceptable meta-data errors */
5825dafeea3SPavel Zakharov 	uint64_t	zlp_maxdata;	/* max acceptable data errors */
5835dafeea3SPavel Zakharov 	uint64_t	zlp_txg;	/* specific txg to load */
5845dafeea3SPavel Zakharov } zpool_load_policy_t;
585468c413aSTim Haley 
586fa9e4066Sahrens /*
587fa9e4066Sahrens  * The following are configuration names used in the nvlist describing a pool's
5885cabbc6bSPrashanth Sreenivasa  * configuration.  New on-disk names should be prefixed with "<reverse-DNS>:"
5895cabbc6bSPrashanth Sreenivasa  * (e.g. "org.open-zfs:") to avoid conflicting names being developed
5905cabbc6bSPrashanth Sreenivasa  * independently.
591fa9e4066Sahrens  */
592fa9e4066Sahrens #define	ZPOOL_CONFIG_VERSION		"version"
593fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_NAME		"name"
594fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_STATE		"state"
595fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_TXG		"txg"
596fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
597fa9e4066Sahrens #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
598fa9e4066Sahrens #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
599fa9e4066Sahrens #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
600fa9e4066Sahrens #define	ZPOOL_CONFIG_TYPE		"type"
601fa9e4066Sahrens #define	ZPOOL_CONFIG_CHILDREN		"children"
602fa9e4066Sahrens #define	ZPOOL_CONFIG_ID			"id"
603fa9e4066Sahrens #define	ZPOOL_CONFIG_GUID		"guid"
6045cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_INDIRECT_OBJECT	"com.delphix:indirect_object"
6055cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_INDIRECT_BIRTHS	"com.delphix:indirect_births"
6065cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_PREV_INDIRECT_VDEV	"com.delphix:prev_indirect_vdev"
607fa9e4066Sahrens #define	ZPOOL_CONFIG_PATH		"path"
608fa9e4066Sahrens #define	ZPOOL_CONFIG_DEVID		"devid"
609fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
610fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
611fa9e4066Sahrens #define	ZPOOL_CONFIG_ASHIFT		"ashift"
612fa9e4066Sahrens #define	ZPOOL_CONFIG_ASIZE		"asize"
613fa9e4066Sahrens #define	ZPOOL_CONFIG_DTL		"DTL"
6143f9d6ad7SLin Ling #define	ZPOOL_CONFIG_SCAN_STATS		"scan_stats"	/* not stored on disk */
6155cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_REMOVAL_STATS	"removal_stats"	/* not stored on disk */
61686714001SSerapheim Dimitropoulos #define	ZPOOL_CONFIG_CHECKPOINT_STATS	"checkpoint_stats" /* not on disk */
6173f9d6ad7SLin Ling #define	ZPOOL_CONFIG_VDEV_STATS		"vdev_stats"	/* not stored on disk */
6185cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_INDIRECT_SIZE	"indirect_size"	/* not stored on disk */
619dd50e0ccSTony Hutter 
620dd50e0ccSTony Hutter /* container nvlist of extended stats */
621dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_STATS_EX	"vdev_stats_ex"
622dd50e0ccSTony Hutter 
623dd50e0ccSTony Hutter /* Active queue read/write stats */
624dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_R_ACTIVE_QUEUE	"vdev_sync_r_active_queue"
625dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_W_ACTIVE_QUEUE	"vdev_sync_w_active_queue"
626dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_R_ACTIVE_QUEUE	"vdev_async_r_active_queue"
627dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_W_ACTIVE_QUEUE	"vdev_async_w_active_queue"
628dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SCRUB_ACTIVE_QUEUE	"vdev_async_scrub_active_queue"
629dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_TRIM_ACTIVE_QUEUE	"vdev_async_trim_active_queue"
630dd50e0ccSTony Hutter 
631dd50e0ccSTony Hutter /* Queue sizes */
632dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_R_PEND_QUEUE	"vdev_sync_r_pend_queue"
633dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_W_PEND_QUEUE	"vdev_sync_w_pend_queue"
634dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_R_PEND_QUEUE	"vdev_async_r_pend_queue"
635dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_W_PEND_QUEUE	"vdev_async_w_pend_queue"
636dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SCRUB_PEND_QUEUE	"vdev_async_scrub_pend_queue"
637dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_TRIM_PEND_QUEUE	"vdev_async_trim_pend_queue"
638dd50e0ccSTony Hutter 
639dd50e0ccSTony Hutter /* Latency read/write histogram stats */
640dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_TOT_R_LAT_HISTO	"vdev_tot_r_lat_histo"
641dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_TOT_W_LAT_HISTO	"vdev_tot_w_lat_histo"
642dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_DISK_R_LAT_HISTO	"vdev_disk_r_lat_histo"
643dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_DISK_W_LAT_HISTO	"vdev_disk_w_lat_histo"
644dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_R_LAT_HISTO	"vdev_sync_r_lat_histo"
645dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_W_LAT_HISTO	"vdev_sync_w_lat_histo"
646dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_R_LAT_HISTO	"vdev_async_r_lat_histo"
647dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_W_LAT_HISTO	"vdev_async_w_lat_histo"
648dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SCRUB_LAT_HISTO	"vdev_scrub_histo"
649dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_TRIM_LAT_HISTO	"vdev_trim_histo"
650dd50e0ccSTony Hutter 
651dd50e0ccSTony Hutter /* Request size histograms */
652dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_IND_R_HISTO	"vdev_sync_ind_r_histo"
653dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_IND_W_HISTO	"vdev_sync_ind_w_histo"
654dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_IND_R_HISTO	"vdev_async_ind_r_histo"
655dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_IND_W_HISTO	"vdev_async_ind_w_histo"
656dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_IND_SCRUB_HISTO	"vdev_ind_scrub_histo"
657dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_IND_TRIM_HISTO	"vdev_ind_trim_histo"
658dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_AGG_R_HISTO	"vdev_sync_agg_r_histo"
659dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SYNC_AGG_W_HISTO	"vdev_sync_agg_w_histo"
660dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_AGG_R_HISTO	"vdev_async_agg_r_histo"
661dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_ASYNC_AGG_W_HISTO	"vdev_async_agg_w_histo"
662dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_AGG_SCRUB_HISTO	"vdev_agg_scrub_histo"
663dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_AGG_TRIM_HISTO	"vdev_agg_trim_histo"
664dd50e0ccSTony Hutter 
665dd50e0ccSTony Hutter /* Number of slow IOs */
666dd50e0ccSTony Hutter #define	ZPOOL_CONFIG_VDEV_SLOW_IOS		"vdev_slow_ios"
667dd50e0ccSTony Hutter 
668afefbcddSeschrock #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
669ea8dc4b6Seschrock #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
670ea8dc4b6Seschrock #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
67199653d4eSeschrock #define	ZPOOL_CONFIG_SPARES		"spares"
67299653d4eSeschrock #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
67399653d4eSeschrock #define	ZPOOL_CONFIG_NPARITY		"nparity"
67495173954Sek #define	ZPOOL_CONFIG_HOSTID		"hostid"
67595173954Sek #define	ZPOOL_CONFIG_HOSTNAME		"hostname"
67611027bc7STim Haley #define	ZPOOL_CONFIG_LOADED_TIME	"initial_load_time"
6773d7072f8Seschrock #define	ZPOOL_CONFIG_UNSPARE		"unspare"
6783d7072f8Seschrock #define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
6798654d025Sperrin #define	ZPOOL_CONFIG_IS_LOG		"is_log"
680fa94a07fSbrendan #define	ZPOOL_CONFIG_L2CACHE		"l2cache"
68188ecc943SGeorge Wilson #define	ZPOOL_CONFIG_HOLE_ARRAY		"hole_array"
68288ecc943SGeorge Wilson #define	ZPOOL_CONFIG_VDEV_CHILDREN	"vdev_children"
68388ecc943SGeorge Wilson #define	ZPOOL_CONFIG_IS_HOLE		"is_hole"
6849eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_HISTOGRAM	"ddt_histogram"
6859eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_OBJ_STATS	"ddt_object_stats"
6869eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_STATS		"ddt_stats"
6871195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT		"splitcfg"
6881195e687SMark J Musante #define	ZPOOL_CONFIG_ORIG_GUID		"orig_guid"
6891195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT_GUID		"split_guid"
6901195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT_LIST		"guid_list"
6913f9d6ad7SLin Ling #define	ZPOOL_CONFIG_REMOVING		"removing"
692b4952e17SGeorge Wilson #define	ZPOOL_CONFIG_RESILVER_TXG	"resilver_txg"
6938704186eSDan McDonald #define	ZPOOL_CONFIG_COMMENT		"comment"
694e14bb325SJeff Bonwick #define	ZPOOL_CONFIG_SUSPENDED		"suspended"	/* not stored on disk */
695e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_SUSPENDED_REASON	"suspended_reason"	/* not stored */
696e7cbe64fSgw #define	ZPOOL_CONFIG_TIMESTAMP		"timestamp"	/* not stored on disk */
697e7cbe64fSgw #define	ZPOOL_CONFIG_BOOTFS		"bootfs"	/* not stored on disk */
6984b964adaSGeorge Wilson #define	ZPOOL_CONFIG_MISSING_DEVICES	"missing_vdevs"	/* not stored on disk */
6994b964adaSGeorge Wilson #define	ZPOOL_CONFIG_LOAD_INFO		"load_info"	/* not stored on disk */
700ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_REWIND_INFO	"rewind_info"	/* not stored on disk */
701ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_UNSUP_FEAT		"unsup_feat"	/* not stored on disk */
70257221772SChristopher Siden #define	ZPOOL_CONFIG_ENABLED_FEAT	"enabled_feat"	/* not stored on disk */
703ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_CAN_RDONLY		"can_rdonly"	/* not stored on disk */
704ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_FEATURES_FOR_READ	"features_for_read"
705ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_FEATURE_STATS	"feature_stats"	/* not stored on disk */
706eb633035STom Caputi #define	ZPOOL_CONFIG_ERRATA		"errata"	/* not stored on disk */
707215198a6SJoe Stein #define	ZPOOL_CONFIG_VDEV_TOP_ZAP	"com.delphix:vdev_zap_top"
708215198a6SJoe Stein #define	ZPOOL_CONFIG_VDEV_LEAF_ZAP	"com.delphix:vdev_zap_leaf"
709215198a6SJoe Stein #define	ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS	"com.delphix:has_per_vdev_zaps"
710e4c795beSTom Caputi #define	ZPOOL_CONFIG_RESILVER_DEFER	"com.datto:resilver_defer"
7116f793812SPavel Zakharov #define	ZPOOL_CONFIG_CACHEFILE		"cachefile"	/* not stored on disk */
712e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_STATE		"mmp_state"	/* not stored on disk */
713e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_TXG		"mmp_txg"	/* not stored on disk */
7144348eb90SOlaf Faaland #define	ZPOOL_CONFIG_MMP_SEQ		"mmp_seq"	/* not stored on disk */
715e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_HOSTNAME	"mmp_hostname"	/* not stored on disk */
716e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_HOSTID		"mmp_hostid"	/* not stored on disk */
717663207adSDon Brady #define	ZPOOL_CONFIG_ALLOCATION_BIAS	"alloc_bias"	/* not stored on disk */
718663207adSDon Brady 
7193d7072f8Seschrock /*
7203d7072f8Seschrock  * The persistent vdev state is stored as separate values rather than a single
7213d7072f8Seschrock  * 'vdev_state' entry.  This is because a device can be in multiple states, such
7223d7072f8Seschrock  * as offline and degraded.
7233d7072f8Seschrock  */
7243d7072f8Seschrock #define	ZPOOL_CONFIG_OFFLINE		"offline"
7253d7072f8Seschrock #define	ZPOOL_CONFIG_FAULTED		"faulted"
7263d7072f8Seschrock #define	ZPOOL_CONFIG_DEGRADED		"degraded"
7273d7072f8Seschrock #define	ZPOOL_CONFIG_REMOVED		"removed"
7286809eb4eSEric Schrock #define	ZPOOL_CONFIG_FRU		"fru"
729069f55e2SEric Schrock #define	ZPOOL_CONFIG_AUX_STATE		"aux_state"
730fa9e4066Sahrens 
7315dafeea3SPavel Zakharov /* Pool load policy parameters */
7325dafeea3SPavel Zakharov #define	ZPOOL_LOAD_POLICY		"load-policy"
7335dafeea3SPavel Zakharov #define	ZPOOL_LOAD_REWIND_POLICY	"load-rewind-policy"
7345dafeea3SPavel Zakharov #define	ZPOOL_LOAD_REQUEST_TXG		"load-request-txg"
7355dafeea3SPavel Zakharov #define	ZPOOL_LOAD_META_THRESH		"load-meta-thresh"
7365dafeea3SPavel Zakharov #define	ZPOOL_LOAD_DATA_THRESH		"load-data-thresh"
737468c413aSTim Haley 
738468c413aSTim Haley /* Rewind data discovered */
739468c413aSTim Haley #define	ZPOOL_CONFIG_LOAD_TIME		"rewind_txg_ts"
740468c413aSTim Haley #define	ZPOOL_CONFIG_LOAD_DATA_ERRORS	"verify_data_errors"
741468c413aSTim Haley #define	ZPOOL_CONFIG_REWIND_TIME	"seconds_of_rewind"
742468c413aSTim Haley 
743fa9e4066Sahrens #define	VDEV_TYPE_ROOT			"root"
744fa9e4066Sahrens #define	VDEV_TYPE_MIRROR		"mirror"
745fa9e4066Sahrens #define	VDEV_TYPE_REPLACING		"replacing"
746fa9e4066Sahrens #define	VDEV_TYPE_RAIDZ			"raidz"
747fa9e4066Sahrens #define	VDEV_TYPE_DISK			"disk"
748fa9e4066Sahrens #define	VDEV_TYPE_FILE			"file"
749fa9e4066Sahrens #define	VDEV_TYPE_MISSING		"missing"
75088ecc943SGeorge Wilson #define	VDEV_TYPE_HOLE			"hole"
75199653d4eSeschrock #define	VDEV_TYPE_SPARE			"spare"
7528654d025Sperrin #define	VDEV_TYPE_LOG			"log"
753fa94a07fSbrendan #define	VDEV_TYPE_L2CACHE		"l2cache"
7545cabbc6bSPrashanth Sreenivasa #define	VDEV_TYPE_INDIRECT		"indirect"
7555cabbc6bSPrashanth Sreenivasa 
7565cabbc6bSPrashanth Sreenivasa /* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */
7575cabbc6bSPrashanth Sreenivasa #define	VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \
7585cabbc6bSPrashanth Sreenivasa 	"com.delphix:indirect_obsolete_sm"
7595cabbc6bSPrashanth Sreenivasa #define	VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \
7605cabbc6bSPrashanth Sreenivasa 	"com.delphix:obsolete_counts_are_precise"
76186714001SSerapheim Dimitropoulos #define	VDEV_TOP_ZAP_POOL_CHECKPOINT_SM \
76286714001SSerapheim Dimitropoulos 	"com.delphix:pool_checkpoint_sm"
763814dcd43SSerapheim Dimitropoulos #define	VDEV_TOP_ZAP_MS_UNFLUSHED_PHYS_TXGS \
764814dcd43SSerapheim Dimitropoulos 	"com.delphix:ms_unflushed_phys_txgs"
765fa9e4066Sahrens 
766663207adSDon Brady #define	VDEV_TOP_ZAP_ALLOCATION_BIAS \
767663207adSDon Brady 	"org.zfsonlinux:allocation_bias"
768663207adSDon Brady 
769663207adSDon Brady /* vdev metaslab allocation bias */
770663207adSDon Brady #define	VDEV_ALLOC_BIAS_LOG		"log"
771663207adSDon Brady #define	VDEV_ALLOC_BIAS_SPECIAL		"special"
772663207adSDon Brady #define	VDEV_ALLOC_BIAS_DEDUP		"dedup"
773663207adSDon Brady 
774084fd14fSBrian Behlendorf /* vdev initialize state */
775094e47e9SGeorge Wilson #define	VDEV_LEAF_ZAP_INITIALIZE_LAST_OFFSET	\
776094e47e9SGeorge Wilson 	"com.delphix:next_offset_to_initialize"
777094e47e9SGeorge Wilson #define	VDEV_LEAF_ZAP_INITIALIZE_STATE	\
778094e47e9SGeorge Wilson 	"com.delphix:vdev_initialize_state"
779094e47e9SGeorge Wilson #define	VDEV_LEAF_ZAP_INITIALIZE_ACTION_TIME	\
780094e47e9SGeorge Wilson 	"com.delphix:vdev_initialize_action_time"
781094e47e9SGeorge Wilson 
782084fd14fSBrian Behlendorf /* vdev TRIM state */
783084fd14fSBrian Behlendorf #define	VDEV_LEAF_ZAP_TRIM_LAST_OFFSET	\
784084fd14fSBrian Behlendorf 	"org.zfsonlinux:next_offset_to_trim"
785084fd14fSBrian Behlendorf #define	VDEV_LEAF_ZAP_TRIM_STATE	\
786084fd14fSBrian Behlendorf 	"org.zfsonlinux:vdev_trim_state"
787084fd14fSBrian Behlendorf #define	VDEV_LEAF_ZAP_TRIM_ACTION_TIME	\
788084fd14fSBrian Behlendorf 	"org.zfsonlinux:vdev_trim_action_time"
789084fd14fSBrian Behlendorf #define	VDEV_LEAF_ZAP_TRIM_RATE		\
790084fd14fSBrian Behlendorf 	"org.zfsonlinux:vdev_trim_rate"
791084fd14fSBrian Behlendorf #define	VDEV_LEAF_ZAP_TRIM_PARTIAL	\
792084fd14fSBrian Behlendorf 	"org.zfsonlinux:vdev_trim_partial"
793084fd14fSBrian Behlendorf #define	VDEV_LEAF_ZAP_TRIM_SECURE	\
794084fd14fSBrian Behlendorf 	"org.zfsonlinux:vdev_trim_secure"
795084fd14fSBrian Behlendorf 
796fa9e4066Sahrens /*
797fa9e4066Sahrens  * This is needed in userland to report the minimum necessary device size.
7984b5c8e93SMatthew Ahrens  *
7994b5c8e93SMatthew Ahrens  * Note that the zfs test suite uses 64MB vdevs.
800fa9e4066Sahrens  */
801fa9e4066Sahrens #define	SPA_MINDEVSIZE		(64ULL << 20)
802fa9e4066Sahrens 
8032e4c9986SGeorge Wilson /*
8042e4c9986SGeorge Wilson  * Set if the fragmentation has not yet been calculated. This can happen
8052e4c9986SGeorge Wilson  * because the space maps have not been upgraded or the histogram feature
8062e4c9986SGeorge Wilson  * is not enabled.
8072e4c9986SGeorge Wilson  */
8082e4c9986SGeorge Wilson #define	ZFS_FRAG_INVALID	UINT64_MAX
8092e4c9986SGeorge Wilson 
810fa9e4066Sahrens /*
811fa9e4066Sahrens  * The location of the pool configuration repository, shared between kernel and
812fa9e4066Sahrens  * userland.
813fa9e4066Sahrens  */
814c5904d13Seschrock #define	ZPOOL_CACHE		"/etc/zfs/zpool.cache"
815fa9e4066Sahrens 
816fa9e4066Sahrens /*
817fa9e4066Sahrens  * vdev states are ordered from least to most healthy.
818fa9e4066Sahrens  * A vdev that's CANT_OPEN or below is considered unusable.
819fa9e4066Sahrens  */
820fa9e4066Sahrens typedef enum vdev_state {
821fa9e4066Sahrens 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
822fa9e4066Sahrens 	VDEV_STATE_CLOSED,	/* Not currently open			*/
823fa9e4066Sahrens 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
8243d7072f8Seschrock 	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
825fa9e4066Sahrens 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
8263d7072f8Seschrock 	VDEV_STATE_FAULTED,	/* External request to fault device	*/
827fa9e4066Sahrens 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
828fa9e4066Sahrens 	VDEV_STATE_HEALTHY	/* Presumed good			*/
829fa9e4066Sahrens } vdev_state_t;
830fa9e4066Sahrens 
8313d7072f8Seschrock #define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
8323d7072f8Seschrock 
833fa9e4066Sahrens /*
834fa9e4066Sahrens  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
835fa9e4066Sahrens  * of the vdev stats structure uses these constants to distinguish why.
836fa9e4066Sahrens  */
837fa9e4066Sahrens typedef enum vdev_aux {
838fa9e4066Sahrens 	VDEV_AUX_NONE,		/* no error				*/
839fa9e4066Sahrens 	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
840fa9e4066Sahrens 	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
841fa9e4066Sahrens 	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
842fa9e4066Sahrens 	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
843fa9e4066Sahrens 	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
844eaca9bbdSeschrock 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
845eaca9bbdSeschrock 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
84699653d4eSeschrock 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
847ad135b5dSChristopher Siden 	VDEV_AUX_UNSUP_FEAT,	/* unsupported features			*/
8483d7072f8Seschrock 	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
84932b87932Sek 	VDEV_AUX_ERR_EXCEEDED,	/* too many errors			*/
850b87f3af3Sperrin 	VDEV_AUX_IO_FAILURE,	/* experienced I/O failure		*/
851069f55e2SEric Schrock 	VDEV_AUX_BAD_LOG,	/* cannot read log chain(s)		*/
8521195e687SMark J Musante 	VDEV_AUX_EXTERNAL,	/* external diagnosis			*/
8536f793812SPavel Zakharov 	VDEV_AUX_SPLIT_POOL,	/* vdev was split off into another pool	*/
854e0f1c0afSOlaf Faaland 	VDEV_AUX_ACTIVE,	/* vdev active on a different host	*/
8555711d393Sloli 	VDEV_AUX_CHILDREN_OFFLINE, /* all children are offline		*/
8565711d393Sloli 	VDEV_AUX_BAD_ASHIFT	/* vdev ashift is invalid		*/
857fa9e4066Sahrens } vdev_aux_t;
858fa9e4066Sahrens 
859fa9e4066Sahrens /*
86046a2abf2Seschrock  * pool state.  The following states are written to disk as part of the normal
861fa94a07fSbrendan  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
862fa94a07fSbrendan  * states are software abstractions used at various levels to communicate
863fa94a07fSbrendan  * pool state.
864fa9e4066Sahrens  */
865fa9e4066Sahrens typedef enum pool_state {
866fa9e4066Sahrens 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
867fa9e4066Sahrens 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
868fa9e4066Sahrens 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
86999653d4eSeschrock 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
870fa94a07fSbrendan 	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
871fa9e4066Sahrens 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
87246a2abf2Seschrock 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
87346a2abf2Seschrock 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
874fa9e4066Sahrens } pool_state_t;
875fa9e4066Sahrens 
876e0f1c0afSOlaf Faaland /*
877e0f1c0afSOlaf Faaland  * mmp state. The following states provide additional detail describing
878e0f1c0afSOlaf Faaland  * why a pool couldn't be safely imported.
879e0f1c0afSOlaf Faaland  */
880e0f1c0afSOlaf Faaland typedef enum mmp_state {
881e0f1c0afSOlaf Faaland 	MMP_STATE_ACTIVE = 0,		/* In active use		*/
882e0f1c0afSOlaf Faaland 	MMP_STATE_INACTIVE,		/* Inactive and safe to import	*/
883e0f1c0afSOlaf Faaland 	MMP_STATE_NO_HOSTID		/* System hostid is not set	*/
884e0f1c0afSOlaf Faaland } mmp_state_t;
885e0f1c0afSOlaf Faaland 
886fa9e4066Sahrens /*
8873f9d6ad7SLin Ling  * Scan Functions.
888fa9e4066Sahrens  */
8893f9d6ad7SLin Ling typedef enum pool_scan_func {
8903f9d6ad7SLin Ling 	POOL_SCAN_NONE,
8913f9d6ad7SLin Ling 	POOL_SCAN_SCRUB,
8923f9d6ad7SLin Ling 	POOL_SCAN_RESILVER,
8933f9d6ad7SLin Ling 	POOL_SCAN_FUNCS
8943f9d6ad7SLin Ling } pool_scan_func_t;
895fa9e4066Sahrens 
8961702cce7SAlek Pinchuk /*
8971702cce7SAlek Pinchuk  * Used to control scrub pause and resume.
8981702cce7SAlek Pinchuk  */
8991702cce7SAlek Pinchuk typedef enum pool_scrub_cmd {
9001702cce7SAlek Pinchuk 	POOL_SCRUB_NORMAL = 0,
9011702cce7SAlek Pinchuk 	POOL_SCRUB_PAUSE,
9021702cce7SAlek Pinchuk 	POOL_SCRUB_FLAGS_END
9031702cce7SAlek Pinchuk } pool_scrub_cmd_t;
9041702cce7SAlek Pinchuk 
905094e47e9SGeorge Wilson /*
906094e47e9SGeorge Wilson  * Initialize functions.
907094e47e9SGeorge Wilson  */
908094e47e9SGeorge Wilson typedef enum pool_initialize_func {
909084fd14fSBrian Behlendorf 	POOL_INITIALIZE_START,
910094e47e9SGeorge Wilson 	POOL_INITIALIZE_CANCEL,
911094e47e9SGeorge Wilson 	POOL_INITIALIZE_SUSPEND,
912094e47e9SGeorge Wilson 	POOL_INITIALIZE_FUNCS
913094e47e9SGeorge Wilson } pool_initialize_func_t;
9141702cce7SAlek Pinchuk 
915084fd14fSBrian Behlendorf /*
916084fd14fSBrian Behlendorf  * TRIM functions.
917084fd14fSBrian Behlendorf  */
918084fd14fSBrian Behlendorf typedef enum pool_trim_func {
919084fd14fSBrian Behlendorf 	POOL_TRIM_START,
920084fd14fSBrian Behlendorf 	POOL_TRIM_CANCEL,
921084fd14fSBrian Behlendorf 	POOL_TRIM_SUSPEND,
922084fd14fSBrian Behlendorf 	POOL_TRIM_FUNCS
923084fd14fSBrian Behlendorf } pool_trim_func_t;
924084fd14fSBrian Behlendorf 
925fa9e4066Sahrens /*
926fa9e4066Sahrens  * ZIO types.  Needed to interpret vdev statistics below.
927fa9e4066Sahrens  */
928fa9e4066Sahrens typedef enum zio_type {
929fa9e4066Sahrens 	ZIO_TYPE_NULL = 0,
930fa9e4066Sahrens 	ZIO_TYPE_READ,
931fa9e4066Sahrens 	ZIO_TYPE_WRITE,
932fa9e4066Sahrens 	ZIO_TYPE_FREE,
933fa9e4066Sahrens 	ZIO_TYPE_CLAIM,
934fa9e4066Sahrens 	ZIO_TYPE_IOCTL,
935084fd14fSBrian Behlendorf 	ZIO_TYPE_TRIM,
936fa9e4066Sahrens 	ZIO_TYPES
937fa9e4066Sahrens } zio_type_t;
938fa9e4066Sahrens 
9393f9d6ad7SLin Ling /*
9403f9d6ad7SLin Ling  * Pool statistics.  Note: all fields should be 64-bit because this
9413f9d6ad7SLin Ling  * is passed between kernel and userland as an nvlist uint64 array.
9423f9d6ad7SLin Ling  */
9433f9d6ad7SLin Ling typedef struct pool_scan_stat {
9443f9d6ad7SLin Ling 	/* values stored on disk */
9453f9d6ad7SLin Ling 	uint64_t	pss_func;	/* pool_scan_func_t */
9463f9d6ad7SLin Ling 	uint64_t	pss_state;	/* dsl_scan_state_t */
9473f9d6ad7SLin Ling 	uint64_t	pss_start_time;	/* scan start time */
9483f9d6ad7SLin Ling 	uint64_t	pss_end_time;	/* scan end time */
9493f9d6ad7SLin Ling 	uint64_t	pss_to_examine;	/* total bytes to scan */
950a3874b8bSToomas Soome 	uint64_t	pss_examined;	/* total bytes located by scanner */
9513f9d6ad7SLin Ling 	uint64_t	pss_to_process; /* total bytes to process */
9523f9d6ad7SLin Ling 	uint64_t	pss_processed;	/* total processed bytes */
9533f9d6ad7SLin Ling 	uint64_t	pss_errors;	/* scan errors	*/
9543f9d6ad7SLin Ling 
9553f9d6ad7SLin Ling 	/* values not stored on disk */
9563f9d6ad7SLin Ling 	uint64_t	pss_pass_exam;	/* examined bytes per scan pass */
957a3874b8bSToomas Soome 	uint64_t	pss_pass_issued; /* issued bytes per scan pass */
9583f9d6ad7SLin Ling 	uint64_t	pss_pass_start;	/* start time of a scan pass */
9591702cce7SAlek Pinchuk 	uint64_t	pss_pass_scrub_pause; /* pause time of a scurb pass */
9601702cce7SAlek Pinchuk 	/* cumulative time scrub spent paused, needed for rate calculation */
9611702cce7SAlek Pinchuk 	uint64_t	pss_pass_scrub_spent_paused;
962a3874b8bSToomas Soome 
963a3874b8bSToomas Soome 	/* Sorted scrubbing new fields */
964a3874b8bSToomas Soome 	/* Stored on disk */
965a3874b8bSToomas Soome 	uint64_t	pss_issued;	/* total bytes checked by scanner */
9663f9d6ad7SLin Ling } pool_scan_stat_t;
9673f9d6ad7SLin Ling 
968eb633035STom Caputi /*
969eb633035STom Caputi  * Errata described by http://zfsonlinux.org/msg/ZFS-8000-ER.  The ordering
970eb633035STom Caputi  * of this enum must be maintained to ensure the errata identifiers map to
971eb633035STom Caputi  * the correct documentation.  New errata may only be appended to the list
972eb633035STom Caputi  * and must contain corresponding documentation at the above link.
973eb633035STom Caputi  */
974eb633035STom Caputi typedef enum zpool_errata {
975eb633035STom Caputi 	ZPOOL_ERRATA_NONE,
976eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_2094_SCRUB,
977eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY,
978eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_6845_ENCRYPTION,
979eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_8308_ENCRYPTION,
980eb633035STom Caputi } zpool_errata_t;
981eb633035STom Caputi 
9825cabbc6bSPrashanth Sreenivasa typedef struct pool_removal_stat {
9835cabbc6bSPrashanth Sreenivasa 	uint64_t prs_state; /* dsl_scan_state_t */
9845cabbc6bSPrashanth Sreenivasa 	uint64_t prs_removing_vdev;
9855cabbc6bSPrashanth Sreenivasa 	uint64_t prs_start_time;
9865cabbc6bSPrashanth Sreenivasa 	uint64_t prs_end_time;
9875cabbc6bSPrashanth Sreenivasa 	uint64_t prs_to_copy; /* bytes that need to be copied */
9885cabbc6bSPrashanth Sreenivasa 	uint64_t prs_copied; /* bytes copied so far */
9895cabbc6bSPrashanth Sreenivasa 	/*
9905cabbc6bSPrashanth Sreenivasa 	 * bytes of memory used for indirect mappings.
9915cabbc6bSPrashanth Sreenivasa 	 * This includes all removed vdevs.
9925cabbc6bSPrashanth Sreenivasa 	 */
9935cabbc6bSPrashanth Sreenivasa 	uint64_t prs_mapping_memory;
9945cabbc6bSPrashanth Sreenivasa } pool_removal_stat_t;
9955cabbc6bSPrashanth Sreenivasa 
9963f9d6ad7SLin Ling typedef enum dsl_scan_state {
9973f9d6ad7SLin Ling 	DSS_NONE,
9983f9d6ad7SLin Ling 	DSS_SCANNING,
9993f9d6ad7SLin Ling 	DSS_FINISHED,
10003f9d6ad7SLin Ling 	DSS_CANCELED,
10013f9d6ad7SLin Ling 	DSS_NUM_STATES
10023f9d6ad7SLin Ling } dsl_scan_state_t;
10033f9d6ad7SLin Ling 
100486714001SSerapheim Dimitropoulos typedef enum {
100586714001SSerapheim Dimitropoulos 	CS_NONE,
100686714001SSerapheim Dimitropoulos 	CS_CHECKPOINT_EXISTS,
100786714001SSerapheim Dimitropoulos 	CS_CHECKPOINT_DISCARDING,
100886714001SSerapheim Dimitropoulos 	CS_NUM_STATES
100986714001SSerapheim Dimitropoulos } checkpoint_state_t;
101086714001SSerapheim Dimitropoulos 
101186714001SSerapheim Dimitropoulos typedef struct pool_checkpoint_stat {
101286714001SSerapheim Dimitropoulos 	uint64_t pcs_state;		/* checkpoint_state_t */
101386714001SSerapheim Dimitropoulos 	uint64_t pcs_start_time;	/* time checkpoint/discard started */
101486714001SSerapheim Dimitropoulos 	uint64_t pcs_space;		/* checkpointed space */
101586714001SSerapheim Dimitropoulos } pool_checkpoint_stat_t;
10163f9d6ad7SLin Ling 
1017094e47e9SGeorge Wilson typedef enum {
1018094e47e9SGeorge Wilson 	VDEV_INITIALIZE_NONE,
1019094e47e9SGeorge Wilson 	VDEV_INITIALIZE_ACTIVE,
1020094e47e9SGeorge Wilson 	VDEV_INITIALIZE_CANCELED,
1021094e47e9SGeorge Wilson 	VDEV_INITIALIZE_SUSPENDED,
1022094e47e9SGeorge Wilson 	VDEV_INITIALIZE_COMPLETE
1023094e47e9SGeorge Wilson } vdev_initializing_state_t;
1024094e47e9SGeorge Wilson 
1025084fd14fSBrian Behlendorf typedef enum {
1026084fd14fSBrian Behlendorf 	VDEV_TRIM_NONE,
1027084fd14fSBrian Behlendorf 	VDEV_TRIM_ACTIVE,
1028084fd14fSBrian Behlendorf 	VDEV_TRIM_CANCELED,
1029084fd14fSBrian Behlendorf 	VDEV_TRIM_SUSPENDED,
1030084fd14fSBrian Behlendorf 	VDEV_TRIM_COMPLETE,
1031084fd14fSBrian Behlendorf } vdev_trim_state_t;
1032084fd14fSBrian Behlendorf 
1033fa9e4066Sahrens /*
1034fa9e4066Sahrens  * Vdev statistics.  Note: all fields should be 64-bit because this
1035084fd14fSBrian Behlendorf  * is passed between kernel and user land as an nvlist uint64 array.
1036084fd14fSBrian Behlendorf  *
1037084fd14fSBrian Behlendorf  * The vs_ops[] and vs_bytes[] arrays must always be an array size of 6 in
1038084fd14fSBrian Behlendorf  * order to keep subsequent members at their known fixed offsets.  When
1039084fd14fSBrian Behlendorf  * adding a new field it must be added to the end the structure.
1040fa9e4066Sahrens  */
1041084fd14fSBrian Behlendorf #define	VS_ZIO_TYPES	6
1042084fd14fSBrian Behlendorf 
1043fa9e4066Sahrens typedef struct vdev_stat {
1044fa9e4066Sahrens 	hrtime_t	vs_timestamp;		/* time since vdev load	*/
1045fa9e4066Sahrens 	uint64_t	vs_state;		/* vdev state		*/
1046fa9e4066Sahrens 	uint64_t	vs_aux;			/* see vdev_aux_t	*/
1047fa9e4066Sahrens 	uint64_t	vs_alloc;		/* space allocated	*/
1048fa9e4066Sahrens 	uint64_t	vs_space;		/* total capacity	*/
104999653d4eSeschrock 	uint64_t	vs_dspace;		/* deflated capacity	*/
10502a79c5feSlling 	uint64_t	vs_rsize;		/* replaceable dev size */
10514263d13fSGeorge Wilson 	uint64_t	vs_esize;		/* expandable dev size */
1052084fd14fSBrian Behlendorf 	uint64_t	vs_ops[VS_ZIO_TYPES];	/* operation count	*/
1053084fd14fSBrian Behlendorf 	uint64_t	vs_bytes[VS_ZIO_TYPES];	/* bytes read/written	*/
1054fa9e4066Sahrens 	uint64_t	vs_read_errors;		/* read errors		*/
1055fa9e4066Sahrens 	uint64_t	vs_write_errors;	/* write errors		*/
1056fa9e4066Sahrens 	uint64_t	vs_checksum_errors;	/* checksum errors	*/
1057094e47e9SGeorge Wilson 	uint64_t	vs_initialize_errors;	/* initializing errors	*/
1058fa9e4066Sahrens 	uint64_t	vs_self_healed;		/* self-healed bytes	*/
10593f9d6ad7SLin Ling 	uint64_t	vs_scan_removing;	/* removing?	*/
10603f9d6ad7SLin Ling 	uint64_t	vs_scan_processed;	/* scan processed bytes	*/
10612e4c9986SGeorge Wilson 	uint64_t	vs_fragmentation;	/* device fragmentation */
1062094e47e9SGeorge Wilson 	uint64_t	vs_initialize_bytes_done; /* bytes initialized */
1063094e47e9SGeorge Wilson 	uint64_t	vs_initialize_bytes_est; /* total bytes to initialize */
1064094e47e9SGeorge Wilson 	uint64_t	vs_initialize_state;	/* vdev_initialzing_state_t */
1065094e47e9SGeorge Wilson 	uint64_t	vs_initialize_action_time; /* time_t */
106686714001SSerapheim Dimitropoulos 	uint64_t	vs_checkpoint_space;    /* checkpoint-consumed space */
1067e4c795beSTom Caputi 	uint64_t	vs_resilver_deferred;	/* resilver deferred	*/
1068dd50e0ccSTony Hutter 	uint64_t	vs_slow_ios;		/* slow IOs */
1069084fd14fSBrian Behlendorf 	uint64_t	vs_trim_errors;		/* trimming errors	*/
1070084fd14fSBrian Behlendorf 	uint64_t	vs_trim_notsup;		/* supported by device */
1071084fd14fSBrian Behlendorf 	uint64_t	vs_trim_bytes_done;	/* bytes trimmed */
1072084fd14fSBrian Behlendorf 	uint64_t	vs_trim_bytes_est;	/* total bytes to trim */
1073084fd14fSBrian Behlendorf 	uint64_t	vs_trim_state;		/* vdev_trim_state_t */
1074084fd14fSBrian Behlendorf 	uint64_t	vs_trim_action_time;	/* time_t */
1075fa9e4066Sahrens } vdev_stat_t;
1076fa9e4066Sahrens 
1077dd50e0ccSTony Hutter /*
1078dd50e0ccSTony Hutter  * Extended stats
1079dd50e0ccSTony Hutter  *
1080dd50e0ccSTony Hutter  * These are stats which aren't included in the original iostat output.  For
1081dd50e0ccSTony Hutter  * convenience, they are grouped together in vdev_stat_ex, although each stat
1082dd50e0ccSTony Hutter  * is individually exported as a nvlist.
1083dd50e0ccSTony Hutter  */
1084dd50e0ccSTony Hutter typedef struct vdev_stat_ex {
1085dd50e0ccSTony Hutter 	/* Number of ZIOs issued to disk and waiting to finish */
1086dd50e0ccSTony Hutter 	uint64_t vsx_active_queue[ZIO_PRIORITY_N_QUEUEABLE];
1087dd50e0ccSTony Hutter 
1088dd50e0ccSTony Hutter 	/* Number of ZIOs pending to be issued to disk */
1089dd50e0ccSTony Hutter 	uint64_t vsx_pend_queue[ZIO_PRIORITY_N_QUEUEABLE];
1090dd50e0ccSTony Hutter 
1091dd50e0ccSTony Hutter 	/*
1092dd50e0ccSTony Hutter 	 * Below are the histograms for various latencies. Buckets are in
1093dd50e0ccSTony Hutter 	 * units of nanoseconds.
1094dd50e0ccSTony Hutter 	 */
1095dd50e0ccSTony Hutter 
1096dd50e0ccSTony Hutter 	/*
1097dd50e0ccSTony Hutter 	 * 2^37 nanoseconds = 134s. Timeouts will probably start kicking in
1098dd50e0ccSTony Hutter 	 * before this.
1099dd50e0ccSTony Hutter 	 */
1100dd50e0ccSTony Hutter #define	VDEV_L_HISTO_BUCKETS	37	/* Latency histo buckets */
1101dd50e0ccSTony Hutter #define	VDEV_RQ_HISTO_BUCKETS	25	/* Request size histo buckets */
1102dd50e0ccSTony Hutter 
1103dd50e0ccSTony Hutter 	/* Amount of time in ZIO queue (ns) */
1104dd50e0ccSTony Hutter 	uint64_t vsx_queue_histo[ZIO_PRIORITY_N_QUEUEABLE]
1105dd50e0ccSTony Hutter 	    [VDEV_L_HISTO_BUCKETS];
1106dd50e0ccSTony Hutter 
1107dd50e0ccSTony Hutter 	/* Total ZIO latency (ns).  Includes queuing and disk access time */
1108dd50e0ccSTony Hutter 	uint64_t vsx_total_histo[ZIO_TYPES][VDEV_L_HISTO_BUCKETS];
1109dd50e0ccSTony Hutter 
1110dd50e0ccSTony Hutter 	/* Amount of time to read/write the disk (ns) */
1111dd50e0ccSTony Hutter 	uint64_t vsx_disk_histo[ZIO_TYPES][VDEV_L_HISTO_BUCKETS];
1112dd50e0ccSTony Hutter 
1113dd50e0ccSTony Hutter 	/* "lookup the bucket for a value" macro */
1114dd50e0ccSTony Hutter #define	HISTO(val, buckets)	(val != 0 ? MIN(highbit64(val) - 1, \
1115dd50e0ccSTony Hutter 	    buckets - 1) : 0)
1116dd50e0ccSTony Hutter #define	L_HISTO(a)	HISTO(a, VDEV_L_HISTO_BUCKETS)
1117dd50e0ccSTony Hutter #define	RQ_HISTO(a)	HISTO(a, VDEV_RQ_HISTO_BUCKETS)
1118dd50e0ccSTony Hutter 
1119dd50e0ccSTony Hutter 	/* Physical IO histogram */
1120dd50e0ccSTony Hutter 	uint64_t vsx_ind_histo[ZIO_PRIORITY_N_QUEUEABLE]
1121dd50e0ccSTony Hutter 	    [VDEV_RQ_HISTO_BUCKETS];
1122dd50e0ccSTony Hutter 
1123dd50e0ccSTony Hutter 	/* Delegated (aggregated) physical IO histogram */
1124dd50e0ccSTony Hutter 	uint64_t vsx_agg_histo[ZIO_PRIORITY_N_QUEUEABLE]
1125dd50e0ccSTony Hutter 	    [VDEV_RQ_HISTO_BUCKETS];
1126dd50e0ccSTony Hutter 
1127dd50e0ccSTony Hutter } vdev_stat_ex_t;
1128dd50e0ccSTony Hutter 
11299eb19f4dSGeorge Wilson /*
11309eb19f4dSGeorge Wilson  * DDT statistics.  Note: all fields should be 64-bit because this
11319eb19f4dSGeorge Wilson  * is passed between kernel and userland as an nvlist uint64 array.
11329eb19f4dSGeorge Wilson  */
11339eb19f4dSGeorge Wilson typedef struct ddt_object {
113404e56356SAndriy Gapon 	uint64_t	ddo_count;	/* number of elments in ddt	*/
11359eb19f4dSGeorge Wilson 	uint64_t	ddo_dspace;	/* size of ddt on disk		*/
11369eb19f4dSGeorge Wilson 	uint64_t	ddo_mspace;	/* size of ddt in-core		*/
11379eb19f4dSGeorge Wilson } ddt_object_t;
11389eb19f4dSGeorge Wilson 
11399eb19f4dSGeorge Wilson typedef struct ddt_stat {
11409eb19f4dSGeorge Wilson 	uint64_t	dds_blocks;	/* blocks			*/
11419eb19f4dSGeorge Wilson 	uint64_t	dds_lsize;	/* logical size			*/
11429eb19f4dSGeorge Wilson 	uint64_t	dds_psize;	/* physical size		*/
11439eb19f4dSGeorge Wilson 	uint64_t	dds_dsize;	/* deflated allocated size	*/
11449eb19f4dSGeorge Wilson 	uint64_t	dds_ref_blocks;	/* referenced blocks		*/
11459eb19f4dSGeorge Wilson 	uint64_t	dds_ref_lsize;	/* referenced lsize * refcnt	*/
11469eb19f4dSGeorge Wilson 	uint64_t	dds_ref_psize;	/* referenced psize * refcnt	*/
11479eb19f4dSGeorge Wilson 	uint64_t	dds_ref_dsize;	/* referenced dsize * refcnt	*/
11489eb19f4dSGeorge Wilson } ddt_stat_t;
11499eb19f4dSGeorge Wilson 
11509eb19f4dSGeorge Wilson typedef struct ddt_histogram {
11519eb19f4dSGeorge Wilson 	ddt_stat_t	ddh_stat[64];	/* power-of-two histogram buckets */
11529eb19f4dSGeorge Wilson } ddt_histogram_t;
11539eb19f4dSGeorge Wilson 
1154e7cbe64fSgw #define	ZVOL_DRIVER	"zvol"
1155fa9e4066Sahrens #define	ZFS_DRIVER	"zfs"
1156fa9e4066Sahrens #define	ZFS_DEV		"/dev/zfs"
11576401734dSWill Andrews #define	ZFS_DISK_ROOT	"/dev/dsk"
11586401734dSWill Andrews #define	ZFS_DISK_ROOTD	ZFS_DISK_ROOT "/"
11596401734dSWill Andrews #define	ZFS_RDISK_ROOT	"/dev/rdsk"
11606401734dSWill Andrews #define	ZFS_RDISK_ROOTD	ZFS_RDISK_ROOT "/"
1161fa9e4066Sahrens 
1162681d9761SEric Taylor /* general zvol path */
1163681d9761SEric Taylor #define	ZVOL_DIR		"/dev/zvol"
1164681d9761SEric Taylor /* expansion */
1165573ca77eSGeorge Wilson #define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zfs@0:"
1166681d9761SEric Taylor /* for dump and swap */
1167681d9761SEric Taylor #define	ZVOL_FULL_DEV_DIR	ZVOL_DIR "/dsk/"
1168681d9761SEric Taylor #define	ZVOL_FULL_RDEV_DIR	ZVOL_DIR "/rdsk/"
1169fa9e4066Sahrens 
1170fa9e4066Sahrens #define	ZVOL_PROP_NAME		"name"
1171c1449561SEric Taylor #define	ZVOL_DEFAULT_BLOCKSIZE	8192
1172fa9e4066Sahrens 
1173fa9e4066Sahrens /*
1174fa9e4066Sahrens  * /dev/zfs ioctl numbers.
1175fa9e4066Sahrens  */
1176fa9e4066Sahrens typedef enum zfs_ioc {
1177c4ecba8aSPaul Dagnelie 	/*
1178c4ecba8aSPaul Dagnelie 	 * Core features - 81/128 numbers reserved.
1179c4ecba8aSPaul Dagnelie 	 */
1180c4ecba8aSPaul Dagnelie #ifdef __FreeBSD__
1181c4ecba8aSPaul Dagnelie 	ZFS_IOC_FIRST = 0,
1182c4ecba8aSPaul Dagnelie #else
11834445fffbSMatthew Ahrens 	ZFS_IOC_FIRST =	('Z' << 8),
1184c4ecba8aSPaul Dagnelie #endif
11854445fffbSMatthew Ahrens 	ZFS_IOC = ZFS_IOC_FIRST,
11867ac89354SDon Brady 	ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,	/* 0x5a00 */
11877ac89354SDon Brady 	ZFS_IOC_POOL_DESTROY,			/* 0x5a01 */
11887ac89354SDon Brady 	ZFS_IOC_POOL_IMPORT,			/* 0x5a02 */
11897ac89354SDon Brady 	ZFS_IOC_POOL_EXPORT,			/* 0x5a03 */
11907ac89354SDon Brady 	ZFS_IOC_POOL_CONFIGS,			/* 0x5a04 */
11917ac89354SDon Brady 	ZFS_IOC_POOL_STATS,			/* 0x5a05 */
11927ac89354SDon Brady 	ZFS_IOC_POOL_TRYIMPORT,			/* 0x5a06 */
11937ac89354SDon Brady 	ZFS_IOC_POOL_SCAN,			/* 0x5a07 */
11947ac89354SDon Brady 	ZFS_IOC_POOL_FREEZE,			/* 0x5a08 */
11957ac89354SDon Brady 	ZFS_IOC_POOL_UPGRADE,			/* 0x5a09 */
11967ac89354SDon Brady 	ZFS_IOC_POOL_GET_HISTORY,		/* 0x5a0a */
11977ac89354SDon Brady 	ZFS_IOC_VDEV_ADD,			/* 0x5a0b */
11987ac89354SDon Brady 	ZFS_IOC_VDEV_REMOVE,			/* 0x5a0c */
11997ac89354SDon Brady 	ZFS_IOC_VDEV_SET_STATE,			/* 0x5a0d */
12007ac89354SDon Brady 	ZFS_IOC_VDEV_ATTACH,			/* 0x5a0e */
12017ac89354SDon Brady 	ZFS_IOC_VDEV_DETACH,			/* 0x5a0f */
12027ac89354SDon Brady 	ZFS_IOC_VDEV_SETPATH,			/* 0x5a10 */
12037ac89354SDon Brady 	ZFS_IOC_VDEV_SETFRU,			/* 0x5a11 */
12047ac89354SDon Brady 	ZFS_IOC_OBJSET_STATS,			/* 0x5a12 */
12057ac89354SDon Brady 	ZFS_IOC_OBJSET_ZPLPROPS,		/* 0x5a13 */
12067ac89354SDon Brady 	ZFS_IOC_DATASET_LIST_NEXT,		/* 0x5a14 */
12077ac89354SDon Brady 	ZFS_IOC_SNAPSHOT_LIST_NEXT,		/* 0x5a15 */
12087ac89354SDon Brady 	ZFS_IOC_SET_PROP,			/* 0x5a16 */
12097ac89354SDon Brady 	ZFS_IOC_CREATE,				/* 0x5a17 */
12107ac89354SDon Brady 	ZFS_IOC_DESTROY,			/* 0x5a18 */
12117ac89354SDon Brady 	ZFS_IOC_ROLLBACK,			/* 0x5a19 */
12127ac89354SDon Brady 	ZFS_IOC_RENAME,				/* 0x5a1a */
12137ac89354SDon Brady 	ZFS_IOC_RECV,				/* 0x5a1b */
12147ac89354SDon Brady 	ZFS_IOC_SEND,				/* 0x5a1c */
12157ac89354SDon Brady 	ZFS_IOC_INJECT_FAULT,			/* 0x5a1d */
12167ac89354SDon Brady 	ZFS_IOC_CLEAR_FAULT,			/* 0x5a1e */
12177ac89354SDon Brady 	ZFS_IOC_INJECT_LIST_NEXT,		/* 0x5a1f */
12187ac89354SDon Brady 	ZFS_IOC_ERROR_LOG,			/* 0x5a20 */
12197ac89354SDon Brady 	ZFS_IOC_CLEAR,				/* 0x5a21 */
12207ac89354SDon Brady 	ZFS_IOC_PROMOTE,			/* 0x5a22 */
12217ac89354SDon Brady 	ZFS_IOC_SNAPSHOT,			/* 0x5a23 */
12227ac89354SDon Brady 	ZFS_IOC_DSOBJ_TO_DSNAME,		/* 0x5a24 */
12237ac89354SDon Brady 	ZFS_IOC_OBJ_TO_PATH,			/* 0x5a25 */
12247ac89354SDon Brady 	ZFS_IOC_POOL_SET_PROPS,			/* 0x5a26 */
12257ac89354SDon Brady 	ZFS_IOC_POOL_GET_PROPS,			/* 0x5a27 */
12267ac89354SDon Brady 	ZFS_IOC_SET_FSACL,			/* 0x5a28 */
12277ac89354SDon Brady 	ZFS_IOC_GET_FSACL,			/* 0x5a29 */
12287ac89354SDon Brady 	ZFS_IOC_SHARE,				/* 0x5a2a */
12297ac89354SDon Brady 	ZFS_IOC_INHERIT_PROP,			/* 0x5a2b */
12307ac89354SDon Brady 	ZFS_IOC_SMB_ACL,			/* 0x5a2c */
12317ac89354SDon Brady 	ZFS_IOC_USERSPACE_ONE,			/* 0x5a2d */
12327ac89354SDon Brady 	ZFS_IOC_USERSPACE_MANY,			/* 0x5a2e */
12337ac89354SDon Brady 	ZFS_IOC_USERSPACE_UPGRADE,		/* 0x5a2f */
12347ac89354SDon Brady 	ZFS_IOC_HOLD,				/* 0x5a30 */
12357ac89354SDon Brady 	ZFS_IOC_RELEASE,			/* 0x5a31 */
12367ac89354SDon Brady 	ZFS_IOC_GET_HOLDS,			/* 0x5a32 */
12377ac89354SDon Brady 	ZFS_IOC_OBJSET_RECVD_PROPS,		/* 0x5a33 */
12387ac89354SDon Brady 	ZFS_IOC_VDEV_SPLIT,			/* 0x5a34 */
12397ac89354SDon Brady 	ZFS_IOC_NEXT_OBJ,			/* 0x5a35 */
12407ac89354SDon Brady 	ZFS_IOC_DIFF,				/* 0x5a36 */
12417ac89354SDon Brady 	ZFS_IOC_TMP_SNAPSHOT,			/* 0x5a37 */
12427ac89354SDon Brady 	ZFS_IOC_OBJ_TO_STATS,			/* 0x5a38 */
12437ac89354SDon Brady 	ZFS_IOC_SPACE_WRITTEN,			/* 0x5a39 */
12447ac89354SDon Brady 	ZFS_IOC_SPACE_SNAPS,			/* 0x5a3a */
12457ac89354SDon Brady 	ZFS_IOC_DESTROY_SNAPS,			/* 0x5a3b */
12467ac89354SDon Brady 	ZFS_IOC_POOL_REGUID,			/* 0x5a3c */
12477ac89354SDon Brady 	ZFS_IOC_POOL_REOPEN,			/* 0x5a3d */
12487ac89354SDon Brady 	ZFS_IOC_SEND_PROGRESS,			/* 0x5a3e */
12497ac89354SDon Brady 	ZFS_IOC_LOG_HISTORY,			/* 0x5a3f */
12507ac89354SDon Brady 	ZFS_IOC_SEND_NEW,			/* 0x5a40 */
12517ac89354SDon Brady 	ZFS_IOC_SEND_SPACE,			/* 0x5a41 */
12527ac89354SDon Brady 	ZFS_IOC_CLONE,				/* 0x5a42 */
12537ac89354SDon Brady 	ZFS_IOC_BOOKMARK,			/* 0x5a43 */
12547ac89354SDon Brady 	ZFS_IOC_GET_BOOKMARKS,			/* 0x5a44 */
12557ac89354SDon Brady 	ZFS_IOC_DESTROY_BOOKMARKS,		/* 0x5a45 */
12567ac89354SDon Brady 	ZFS_IOC_POOL_SYNC,			/* 0x5a47 */
12577ac89354SDon Brady 	ZFS_IOC_CHANNEL_PROGRAM,		/* 0x5a48 */
12587ac89354SDon Brady 	ZFS_IOC_LOAD_KEY,			/* 0x5a49 */
12597ac89354SDon Brady 	ZFS_IOC_UNLOAD_KEY,			/* 0x5a4a */
12607ac89354SDon Brady 	ZFS_IOC_CHANGE_KEY,			/* 0x5a4b */
12617ac89354SDon Brady 	ZFS_IOC_REMAP,				/* 0x5a4c */
12627ac89354SDon Brady 	ZFS_IOC_POOL_CHECKPOINT,		/* 0x5a4d */
12637ac89354SDon Brady 	ZFS_IOC_POOL_DISCARD_CHECKPOINT,	/* 0x5a4e */
12647ac89354SDon Brady 	ZFS_IOC_POOL_INITIALIZE,		/* 0x5a4f */
12657ac89354SDon Brady 	ZFS_IOC_POOL_TRIM,			/* 0x5a50 */
12667ac89354SDon Brady 	ZFS_IOC_REDACT,				/* 0x5a51 */
12677ac89354SDon Brady 	ZFS_IOC_GET_BOOKMARK_PROPS,		/* 0x5a52 */
1268c4ecba8aSPaul Dagnelie 
1269c4ecba8aSPaul Dagnelie 	/*
1270c4ecba8aSPaul Dagnelie 	 * Per-platform (Optional) - 8/128 numbers reserved.
1271c4ecba8aSPaul Dagnelie 	 */
1272c4ecba8aSPaul Dagnelie 	ZFS_IOC_PLATFORM = ZFS_IOC_FIRST + 0x80,
1273c4ecba8aSPaul Dagnelie 	ZFS_IOC_EVENTS_NEXT,			/* 0x81 (Linux) */
1274c4ecba8aSPaul Dagnelie 	ZFS_IOC_EVENTS_CLEAR,			/* 0x82 (Linux) */
1275c4ecba8aSPaul Dagnelie 	ZFS_IOC_EVENTS_SEEK,			/* 0x83 (Linux) */
1276c4ecba8aSPaul Dagnelie 	ZFS_IOC_NEXTBOOT,			/* 0x84 (FreeBSD) */
1277c4ecba8aSPaul Dagnelie 	ZFS_IOC_JAIL,				/* 0x85 (FreeBSD) */
1278c4ecba8aSPaul Dagnelie 	ZFS_IOC_UNJAIL,				/* 0x86 (FreeBSD) */
127909fcda9fSToomas Soome 	ZFS_IOC_SET_BOOTENV,			/* 0x87 */
128009fcda9fSToomas Soome 	ZFS_IOC_GET_BOOTENV,			/* 0x88 */
12814445fffbSMatthew Ahrens 	ZFS_IOC_LAST
1282fa9e4066Sahrens } zfs_ioc_t;
1283fa9e4066Sahrens 
128486714001SSerapheim Dimitropoulos /*
128586714001SSerapheim Dimitropoulos  * ZFS-specific error codes used for returning descriptive errors
128686714001SSerapheim Dimitropoulos  * to the userland through zfs ioctls.
128786714001SSerapheim Dimitropoulos  *
128886714001SSerapheim Dimitropoulos  * The enum implicitly includes all the error codes from errno.h.
128986714001SSerapheim Dimitropoulos  * New code should use and extend this enum for errors that are
129086714001SSerapheim Dimitropoulos  * not described precisely by generic errno codes.
129186714001SSerapheim Dimitropoulos  */
129286714001SSerapheim Dimitropoulos typedef enum {
129386714001SSerapheim Dimitropoulos 	ZFS_ERR_CHECKPOINT_EXISTS = 1024,
129486714001SSerapheim Dimitropoulos 	ZFS_ERR_DISCARDING_CHECKPOINT,
129586714001SSerapheim Dimitropoulos 	ZFS_ERR_NO_CHECKPOINT,
129686714001SSerapheim Dimitropoulos 	ZFS_ERR_DEVRM_IN_PROGRESS,
1297eb633035STom Caputi 	ZFS_ERR_VDEV_TOO_BIG,
1298eb633035STom Caputi 	ZFS_ERR_FROM_IVSET_GUID_MISSING,
1299eb633035STom Caputi 	ZFS_ERR_FROM_IVSET_GUID_MISMATCH,
1300eb633035STom Caputi 	ZFS_ERR_SPILL_BLOCK_FLAG_MISSING,
13017ac89354SDon Brady 	ZFS_ERR_UNKNOWN_SEND_STREAM_FEATURE,
13027ac89354SDon Brady 	ZFS_ERR_IOC_CMD_UNAVAIL,
13037ac89354SDon Brady 	ZFS_ERR_IOC_ARG_UNAVAIL,
13047ac89354SDon Brady 	ZFS_ERR_IOC_ARG_REQUIRED,
13057ac89354SDon Brady 	ZFS_ERR_IOC_ARG_BADTYPE,
130686714001SSerapheim Dimitropoulos } zfs_errno_t;
130786714001SSerapheim Dimitropoulos 
1308ea8dc4b6Seschrock /*
1309ea8dc4b6Seschrock  * Internal SPA load state.  Used by FMA diagnosis engine.
1310ea8dc4b6Seschrock  */
1311ea8dc4b6Seschrock typedef enum {
13129eb19f4dSGeorge Wilson 	SPA_LOAD_NONE,		/* no load in progress	*/
13139eb19f4dSGeorge Wilson 	SPA_LOAD_OPEN,		/* normal open		*/
13149eb19f4dSGeorge Wilson 	SPA_LOAD_IMPORT,	/* import in progress	*/
1315468c413aSTim Haley 	SPA_LOAD_TRYIMPORT,	/* tryimport in progress */
13169eb19f4dSGeorge Wilson 	SPA_LOAD_RECOVER,	/* recovery requested	*/
13170f7643c7SGeorge Wilson 	SPA_LOAD_ERROR,		/* load failed		*/
13180f7643c7SGeorge Wilson 	SPA_LOAD_CREATE		/* creation in progress */
1319ea8dc4b6Seschrock } spa_load_state_t;
1320ea8dc4b6Seschrock 
1321eb633035STom Caputi /* supported encryption algorithms */
1322eb633035STom Caputi enum zio_encrypt {
1323eb633035STom Caputi 	ZIO_CRYPT_INHERIT = 0,
1324eb633035STom Caputi 	ZIO_CRYPT_ON,
1325eb633035STom Caputi 	ZIO_CRYPT_OFF,
1326eb633035STom Caputi 	ZIO_CRYPT_AES_128_CCM,
1327eb633035STom Caputi 	ZIO_CRYPT_AES_192_CCM,
1328eb633035STom Caputi 	ZIO_CRYPT_AES_256_CCM,
1329eb633035STom Caputi 	ZIO_CRYPT_AES_128_GCM,
1330eb633035STom Caputi 	ZIO_CRYPT_AES_192_GCM,
1331eb633035STom Caputi 	ZIO_CRYPT_AES_256_GCM,
1332eb633035STom Caputi 	ZIO_CRYPT_FUNCTIONS
1333eb633035STom Caputi };
1334eb633035STom Caputi 
1335e9dbad6fSeschrock /*
1336e9dbad6fSeschrock  * Bookmark name values.
1337e9dbad6fSeschrock  */
133855434c77Sek #define	ZPOOL_ERR_LIST		"error list"
1339e9dbad6fSeschrock #define	ZPOOL_ERR_DATASET	"dataset"
1340e9dbad6fSeschrock #define	ZPOOL_ERR_OBJECT	"object"
1341e9dbad6fSeschrock 
134206eeb2adSek #define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
134306eeb2adSek 
134406eeb2adSek /*
134506eeb2adSek  * The following are names used in the nvlist describing
134606eeb2adSek  * the pool's history log.
134706eeb2adSek  */
134806eeb2adSek #define	ZPOOL_HIST_RECORD	"history record"
134906eeb2adSek #define	ZPOOL_HIST_TIME		"history time"
135006eeb2adSek #define	ZPOOL_HIST_CMD		"history command"
1351ecd6cf80Smarks #define	ZPOOL_HIST_WHO		"history who"
1352ecd6cf80Smarks #define	ZPOOL_HIST_ZONE		"history zone"
1353ecd6cf80Smarks #define	ZPOOL_HIST_HOST		"history hostname"
1354ecd6cf80Smarks #define	ZPOOL_HIST_TXG		"history txg"
1355ecd6cf80Smarks #define	ZPOOL_HIST_INT_EVENT	"history internal event"
1356ecd6cf80Smarks #define	ZPOOL_HIST_INT_STR	"history internal str"
13574445fffbSMatthew Ahrens #define	ZPOOL_HIST_INT_NAME	"internal_name"
13584445fffbSMatthew Ahrens #define	ZPOOL_HIST_IOCTL	"ioctl"
13594445fffbSMatthew Ahrens #define	ZPOOL_HIST_INPUT_NVL	"in_nvl"
13604445fffbSMatthew Ahrens #define	ZPOOL_HIST_OUTPUT_NVL	"out_nvl"
13614445fffbSMatthew Ahrens #define	ZPOOL_HIST_DSNAME	"dsname"
13624445fffbSMatthew Ahrens #define	ZPOOL_HIST_DSID		"dsid"
1363dfc11533SChris Williamson #define	ZPOOL_HIST_ERRNO	"errno"
136406eeb2adSek 
1365094e47e9SGeorge Wilson /*
1366094e47e9SGeorge Wilson  * The following are names used when invoking ZFS_IOC_POOL_INITIALIZE.
1367094e47e9SGeorge Wilson  */
1368094e47e9SGeorge Wilson #define	ZPOOL_INITIALIZE_COMMAND	"initialize_command"
1369094e47e9SGeorge Wilson #define	ZPOOL_INITIALIZE_VDEVS		"initialize_vdevs"
1370094e47e9SGeorge Wilson 
1371eb633035STom Caputi /*
1372eb633035STom Caputi  * Special nvlist name that will not have its args recorded in the pool's
1373eb633035STom Caputi  * history log.
1374eb633035STom Caputi  */
1375eb633035STom Caputi #define	ZPOOL_HIDDEN_ARGS	"hidden_args"
1376eb633035STom Caputi 
1377084fd14fSBrian Behlendorf /*
1378084fd14fSBrian Behlendorf  * The following are names used when invoking ZFS_IOC_POOL_TRIM.
1379084fd14fSBrian Behlendorf  */
1380084fd14fSBrian Behlendorf #define	ZPOOL_TRIM_COMMAND		"trim_command"
1381084fd14fSBrian Behlendorf #define	ZPOOL_TRIM_VDEVS		"trim_vdevs"
1382084fd14fSBrian Behlendorf #define	ZPOOL_TRIM_RATE			"trim_rate"
1383084fd14fSBrian Behlendorf #define	ZPOOL_TRIM_SECURE		"trim_secure"
1384084fd14fSBrian Behlendorf 
13853d7072f8Seschrock /*
13863d7072f8Seschrock  * Flags for ZFS_IOC_VDEV_SET_STATE
13873d7072f8Seschrock  */
13883d7072f8Seschrock #define	ZFS_ONLINE_CHECKREMOVE	0x1
13893d7072f8Seschrock #define	ZFS_ONLINE_UNSPARE	0x2
13903d7072f8Seschrock #define	ZFS_ONLINE_FORCEFAULT	0x4
1391573ca77eSGeorge Wilson #define	ZFS_ONLINE_EXPAND	0x8
13923d7072f8Seschrock #define	ZFS_OFFLINE_TEMPORARY	0x1
13933d7072f8Seschrock 
13944b964adaSGeorge Wilson /*
13954b964adaSGeorge Wilson  * Flags for ZFS_IOC_POOL_IMPORT
13964b964adaSGeorge Wilson  */
13974b964adaSGeorge Wilson #define	ZFS_IMPORT_NORMAL	0x0
13984b964adaSGeorge Wilson #define	ZFS_IMPORT_VERBATIM	0x1
13994b964adaSGeorge Wilson #define	ZFS_IMPORT_ANY_HOST	0x2
14004b964adaSGeorge Wilson #define	ZFS_IMPORT_MISSING_LOG	0x4
1401f9af39baSGeorge Wilson #define	ZFS_IMPORT_ONLY		0x8
140286714001SSerapheim Dimitropoulos #define	ZFS_IMPORT_CHECKPOINT	0x10
140304e56356SAndriy Gapon #define	ZFS_IMPORT_TEMP_NAME	0x20
1404e0f1c0afSOlaf Faaland #define	ZFS_IMPORT_SKIP_MMP	0x40
1405eb633035STom Caputi #define	ZFS_IMPORT_LOAD_KEYS	0x80
14064b964adaSGeorge Wilson 
1407dfc11533SChris Williamson /*
1408dfc11533SChris Williamson  * Channel program argument/return nvlist keys and defaults.
1409dfc11533SChris Williamson  */
1410dfc11533SChris Williamson #define	ZCP_ARG_PROGRAM		"program"
1411dfc11533SChris Williamson #define	ZCP_ARG_ARGLIST		"arg"
1412a3b28680SSerapheim Dimitropoulos #define	ZCP_ARG_SYNC		"sync"
1413dfc11533SChris Williamson #define	ZCP_ARG_INSTRLIMIT	"instrlimit"
1414dfc11533SChris Williamson #define	ZCP_ARG_MEMLIMIT	"memlimit"
1415dfc11533SChris Williamson 
1416dfc11533SChris Williamson #define	ZCP_ARG_CLIARGV		"argv"
1417dfc11533SChris Williamson 
1418dfc11533SChris Williamson #define	ZCP_RET_ERROR		"error"
1419dfc11533SChris Williamson #define	ZCP_RET_RETURN		"return"
1420dfc11533SChris Williamson 
1421dfc11533SChris Williamson #define	ZCP_DEFAULT_INSTRLIMIT	(10 * 1000 * 1000)
1422dfc11533SChris Williamson #define	ZCP_MAX_INSTRLIMIT	(10 * ZCP_DEFAULT_INSTRLIMIT)
1423dfc11533SChris Williamson #define	ZCP_DEFAULT_MEMLIMIT	(10 * 1024 * 1024)
1424dfc11533SChris Williamson #define	ZCP_MAX_MEMLIMIT	(10 * ZCP_DEFAULT_MEMLIMIT)
1425dfc11533SChris Williamson 
14263d7072f8Seschrock /*
14273d7072f8Seschrock  * Sysevent payload members.  ZFS will generate the following sysevents with the
14283d7072f8Seschrock  * given payloads:
14293d7072f8Seschrock  *
14303d7072f8Seschrock  *	ESC_ZFS_RESILVER_START
14313d7072f8Seschrock  *	ESC_ZFS_RESILVER_END
14323d7072f8Seschrock  *	ESC_ZFS_POOL_DESTROY
1433e9103aaeSGarrett D'Amore  *	ESC_ZFS_POOL_REGUID
14343d7072f8Seschrock  *
14353d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
14363d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
14373d7072f8Seschrock  *
14383d7072f8Seschrock  *	ESC_ZFS_VDEV_REMOVE
14393d7072f8Seschrock  *	ESC_ZFS_VDEV_CLEAR
14403d7072f8Seschrock  *	ESC_ZFS_VDEV_CHECK
14413d7072f8Seschrock  *
14423d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
14433d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
14443d7072f8Seschrock  *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
14453d7072f8Seschrock  *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
1446ce1577b0SDave Eddy  *
1447ce1577b0SDave Eddy  *	ESC_ZFS_HISTORY_EVENT
1448ce1577b0SDave Eddy  *
1449ce1577b0SDave Eddy  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
1450ce1577b0SDave Eddy  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
1451ce1577b0SDave Eddy  *		ZFS_EV_HIST_TIME	DATA_TYPE_UINT64	(optional)
1452ce1577b0SDave Eddy  *		ZFS_EV_HIST_CMD		DATA_TYPE_STRING	(optional)
1453ce1577b0SDave Eddy  *		ZFS_EV_HIST_WHO		DATA_TYPE_UINT64	(optional)
1454ce1577b0SDave Eddy  *		ZFS_EV_HIST_ZONE	DATA_TYPE_STRING	(optional)
1455ce1577b0SDave Eddy  *		ZFS_EV_HIST_HOST	DATA_TYPE_STRING	(optional)
1456ce1577b0SDave Eddy  *		ZFS_EV_HIST_TXG		DATA_TYPE_UINT64	(optional)
1457ce1577b0SDave Eddy  *		ZFS_EV_HIST_INT_EVENT	DATA_TYPE_UINT64	(optional)
1458ce1577b0SDave Eddy  *		ZFS_EV_HIST_INT_STR	DATA_TYPE_STRING	(optional)
1459ce1577b0SDave Eddy  *		ZFS_EV_HIST_INT_NAME	DATA_TYPE_STRING	(optional)
1460ce1577b0SDave Eddy  *		ZFS_EV_HIST_IOCTL	DATA_TYPE_STRING	(optional)
1461ce1577b0SDave Eddy  *		ZFS_EV_HIST_DSNAME	DATA_TYPE_STRING	(optional)
1462ce1577b0SDave Eddy  *		ZFS_EV_HIST_DSID	DATA_TYPE_UINT64	(optional)
1463ce1577b0SDave Eddy  *
1464ce1577b0SDave Eddy  * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the
1465ce1577b0SDave Eddy  * history log nvlist.  The keynames will be free of any spaces or other
1466ce1577b0SDave Eddy  * characters that could be potentially unexpected to consumers of the
1467ce1577b0SDave Eddy  * sysevents.
14683d7072f8Seschrock  */
14693d7072f8Seschrock #define	ZFS_EV_POOL_NAME	"pool_name"
14703d7072f8Seschrock #define	ZFS_EV_POOL_GUID	"pool_guid"
14713d7072f8Seschrock #define	ZFS_EV_VDEV_PATH	"vdev_path"
14723d7072f8Seschrock #define	ZFS_EV_VDEV_GUID	"vdev_guid"
1473ce1577b0SDave Eddy #define	ZFS_EV_HIST_TIME	"history_time"
1474ce1577b0SDave Eddy #define	ZFS_EV_HIST_CMD		"history_command"
1475ce1577b0SDave Eddy #define	ZFS_EV_HIST_WHO		"history_who"
1476ce1577b0SDave Eddy #define	ZFS_EV_HIST_ZONE	"history_zone"
1477ce1577b0SDave Eddy #define	ZFS_EV_HIST_HOST	"history_hostname"
1478ce1577b0SDave Eddy #define	ZFS_EV_HIST_TXG		"history_txg"
1479ce1577b0SDave Eddy #define	ZFS_EV_HIST_INT_EVENT	"history_internal_event"
1480ce1577b0SDave Eddy #define	ZFS_EV_HIST_INT_STR	"history_internal_str"
1481ce1577b0SDave Eddy #define	ZFS_EV_HIST_INT_NAME	"history_internal_name"
1482ce1577b0SDave Eddy #define	ZFS_EV_HIST_IOCTL	"history_ioctl"
1483ce1577b0SDave Eddy #define	ZFS_EV_HIST_DSNAME	"history_dsname"
1484ce1577b0SDave Eddy #define	ZFS_EV_HIST_DSID	"history_dsid"
14853d7072f8Seschrock 
1486fa9e4066Sahrens #ifdef	__cplusplus
1487fa9e4066Sahrens }
1488fa9e4066Sahrens #endif
1489fa9e4066Sahrens 
1490fa9e4066Sahrens #endif	/* _SYS_FS_ZFS_H */
1491