xref: /illumos-gate/usr/src/uts/common/sys/fs/zfs.h (revision 5711d3938643272e5ca2aaf5d868e612e7bc97b6)
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.
24dfc11533SChris Williamson  * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
25e9103aaeSGarrett D'Amore  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
26c3d26abcSMatthew Ahrens  * Copyright (c) 2014 Integros [integros.com]
27ce1577b0SDave Eddy  * Copyright 2017 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>
38842727c2SChris Kirby 
39fa9e4066Sahrens #ifdef	__cplusplus
40fa9e4066Sahrens extern "C" {
41fa9e4066Sahrens #endif
42fa9e4066Sahrens 
43fa9e4066Sahrens /*
44fa9e4066Sahrens  * Types and constants shared between userland and the kernel.
45fa9e4066Sahrens  */
46fa9e4066Sahrens 
47fa9e4066Sahrens /*
48fa9e4066Sahrens  * Each dataset can be one of the following types.  These constants can be
49fa9e4066Sahrens  * combined into masks that can be passed to various functions.
50fa9e4066Sahrens  */
51fa9e4066Sahrens typedef enum {
5278f17100SMatthew Ahrens 	ZFS_TYPE_FILESYSTEM	= (1 << 0),
5378f17100SMatthew Ahrens 	ZFS_TYPE_SNAPSHOT	= (1 << 1),
5478f17100SMatthew Ahrens 	ZFS_TYPE_VOLUME		= (1 << 2),
5578f17100SMatthew Ahrens 	ZFS_TYPE_POOL		= (1 << 3),
5678f17100SMatthew Ahrens 	ZFS_TYPE_BOOKMARK	= (1 << 4)
57fa9e4066Sahrens } zfs_type_t;
58fa9e4066Sahrens 
5926455f9eSAndriy Gapon /*
6026455f9eSAndriy Gapon  * NB: lzc_dataset_type should be updated whenever a new objset type is added,
6126455f9eSAndriy Gapon  * if it represents a real type of a dataset that can be created from userland.
6226455f9eSAndriy Gapon  */
634445fffbSMatthew Ahrens typedef enum dmu_objset_type {
644445fffbSMatthew Ahrens 	DMU_OST_NONE,
654445fffbSMatthew Ahrens 	DMU_OST_META,
664445fffbSMatthew Ahrens 	DMU_OST_ZFS,
674445fffbSMatthew Ahrens 	DMU_OST_ZVOL,
684445fffbSMatthew Ahrens 	DMU_OST_OTHER,			/* For testing only! */
694445fffbSMatthew Ahrens 	DMU_OST_ANY,			/* Be careful! */
704445fffbSMatthew Ahrens 	DMU_OST_NUMTYPES
714445fffbSMatthew Ahrens } dmu_objset_type_t;
724445fffbSMatthew Ahrens 
73990b4856Slling #define	ZFS_TYPE_DATASET	\
74fa9e4066Sahrens 	(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
75fa9e4066Sahrens 
769adfa60dSMatthew Ahrens /*
779adfa60dSMatthew Ahrens  * All of these include the terminating NUL byte.
789adfa60dSMatthew Ahrens  */
79478ed9adSEric Taylor #define	ZAP_MAXNAMELEN 256
80478ed9adSEric Taylor #define	ZAP_MAXVALUELEN (1024 * 8)
81478ed9adSEric Taylor #define	ZAP_OLDMAXVALUELEN 1024
829adfa60dSMatthew Ahrens #define	ZFS_MAX_DATASET_NAME_LEN 256
83478ed9adSEric Taylor 
84fa9e4066Sahrens /*
85990b4856Slling  * Dataset properties are identified by these constants and must be added to
86990b4856Slling  * the end of this list to ensure that external consumers are not affected
87990b4856Slling  * by the change. If you make any changes to this list, be sure to update
8866e2aaccSgw  * the property table in usr/src/common/zfs/zfs_prop.c.
89fa9e4066Sahrens  */
90fa9e4066Sahrens typedef enum {
914ae5f5f0SAlan Somers 	ZPROP_CONT = -2,
924ae5f5f0SAlan Somers 	ZPROP_INVAL = -1,
93c16bcc45SIgor Kozhukhov 	ZFS_PROP_TYPE = 0,
94fa9e4066Sahrens 	ZFS_PROP_CREATION,
95fa9e4066Sahrens 	ZFS_PROP_USED,
96fa9e4066Sahrens 	ZFS_PROP_AVAILABLE,
97fa9e4066Sahrens 	ZFS_PROP_REFERENCED,
98fa9e4066Sahrens 	ZFS_PROP_COMPRESSRATIO,
99fa9e4066Sahrens 	ZFS_PROP_MOUNTED,
100fa9e4066Sahrens 	ZFS_PROP_ORIGIN,
101fa9e4066Sahrens 	ZFS_PROP_QUOTA,
102fa9e4066Sahrens 	ZFS_PROP_RESERVATION,
103fa9e4066Sahrens 	ZFS_PROP_VOLSIZE,
104fa9e4066Sahrens 	ZFS_PROP_VOLBLOCKSIZE,
105fa9e4066Sahrens 	ZFS_PROP_RECORDSIZE,
106fa9e4066Sahrens 	ZFS_PROP_MOUNTPOINT,
107fa9e4066Sahrens 	ZFS_PROP_SHARENFS,
108fa9e4066Sahrens 	ZFS_PROP_CHECKSUM,
109fa9e4066Sahrens 	ZFS_PROP_COMPRESSION,
110fa9e4066Sahrens 	ZFS_PROP_ATIME,
111fa9e4066Sahrens 	ZFS_PROP_DEVICES,
112fa9e4066Sahrens 	ZFS_PROP_EXEC,
113fa9e4066Sahrens 	ZFS_PROP_SETUID,
114fa9e4066Sahrens 	ZFS_PROP_READONLY,
115fa9e4066Sahrens 	ZFS_PROP_ZONED,
116fa9e4066Sahrens 	ZFS_PROP_SNAPDIR,
117a3c49ce1SAlbert Lee 	ZFS_PROP_ACLMODE,
118fa9e4066Sahrens 	ZFS_PROP_ACLINHERIT,
119e8d4a73cSJosh Paetzel 	ZFS_PROP_CREATETXG,
12066e2aaccSgw 	ZFS_PROP_NAME,			/* not exposed to the user */
121e9dbad6fSeschrock 	ZFS_PROP_CANMOUNT,
12266e2aaccSgw 	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
1237b55fa8eSck 	ZFS_PROP_XATTR,
124d0ad202dSahrens 	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
125b1b8ab34Slling 	ZFS_PROP_COPIES,
126e7437265Sahrens 	ZFS_PROP_VERSION,
127da6c28aaSamw 	ZFS_PROP_UTF8ONLY,
128da6c28aaSamw 	ZFS_PROP_NORMALIZE,
129da6c28aaSamw 	ZFS_PROP_CASE,
130da6c28aaSamw 	ZFS_PROP_VSCAN,
131da6c28aaSamw 	ZFS_PROP_NBMAND,
132da6c28aaSamw 	ZFS_PROP_SHARESMB,
133a9799022Sck 	ZFS_PROP_REFQUOTA,
134a9799022Sck 	ZFS_PROP_REFRESERVATION,
135c5904d13Seschrock 	ZFS_PROP_GUID,
1363baa08fcSek 	ZFS_PROP_PRIMARYCACHE,
1373baa08fcSek 	ZFS_PROP_SECONDARYCACHE,
13874e7dc98SMatthew Ahrens 	ZFS_PROP_USEDSNAP,
13974e7dc98SMatthew Ahrens 	ZFS_PROP_USEDDS,
14074e7dc98SMatthew Ahrens 	ZFS_PROP_USEDCHILD,
14174e7dc98SMatthew Ahrens 	ZFS_PROP_USEDREFRESERV,
14214843421SMatthew Ahrens 	ZFS_PROP_USERACCOUNTING,	/* not exposed to the user */
143478ed9adSEric Taylor 	ZFS_PROP_STMF_SHAREINFO,	/* not exposed to the user */
144842727c2SChris Kirby 	ZFS_PROP_DEFER_DESTROY,
145842727c2SChris Kirby 	ZFS_PROP_USERREFS,
146e09fa4daSNeil Perrin 	ZFS_PROP_LOGBIAS,
1471d713200SEric Schrock 	ZFS_PROP_UNIQUE,		/* not exposed to the user */
1481d713200SEric Schrock 	ZFS_PROP_OBJSETID,		/* not exposed to the user */
149b24ab676SJeff Bonwick 	ZFS_PROP_DEDUP,
1504201a95eSRic Aleshire 	ZFS_PROP_MLSLABEL,
15155da60b9SMark J Musante 	ZFS_PROP_SYNC,
15254811da5SToomas Soome 	ZFS_PROP_DNODESIZE,
153187d6ac0SMatt Ahrens 	ZFS_PROP_REFRATIO,
15419b94df9SMatthew Ahrens 	ZFS_PROP_WRITTEN,
15519b94df9SMatthew Ahrens 	ZFS_PROP_CLONES,
15677372cb0SMatthew Ahrens 	ZFS_PROP_LOGICALUSED,
15777372cb0SMatthew Ahrens 	ZFS_PROP_LOGICALREFERENCED,
158ca48f36fSKeith M Wesolowski 	ZFS_PROP_INCONSISTENT,		/* not exposed to the user */
159a2afb611SJerry Jelinek 	ZFS_PROP_FILESYSTEM_LIMIT,
160a2afb611SJerry Jelinek 	ZFS_PROP_SNAPSHOT_LIMIT,
161a2afb611SJerry Jelinek 	ZFS_PROP_FILESYSTEM_COUNT,
162a2afb611SJerry Jelinek 	ZFS_PROP_SNAPSHOT_COUNT,
163edf345e6SMatthew Ahrens 	ZFS_PROP_REDUNDANT_METADATA,
164b461c746SMatthew Ahrens 	ZFS_PROP_PREV_SNAP,
1659c3fd121SMatthew Ahrens 	ZFS_PROP_RECEIVE_RESUME_TOKEN,
1665cabbc6bSPrashanth Sreenivasa 	ZFS_PROP_REMAPTXG,		/* not exposed to the user */
167663207adSDon Brady 	ZFS_PROP_SPECIAL_SMALL_BLOCKS,
168eb633035STom Caputi 	ZFS_PROP_ENCRYPTION,
169eb633035STom Caputi 	ZFS_PROP_KEYLOCATION,
170eb633035STom Caputi 	ZFS_PROP_KEYFORMAT,
171eb633035STom Caputi 	ZFS_PROP_PBKDF2_SALT,
172eb633035STom Caputi 	ZFS_PROP_PBKDF2_ITERS,
173eb633035STom Caputi 	ZFS_PROP_ENCRYPTION_ROOT,
174eb633035STom Caputi 	ZFS_PROP_KEY_GUID,
175eb633035STom Caputi 	ZFS_PROP_KEYSTATUS,
176eb633035STom Caputi 	ZFS_PROP_IVSET_GUID,		/* not exposed to the user */
17791ebeef5Sahrens 	ZFS_NUM_PROPS
178fa9e4066Sahrens } zfs_prop_t;
179fa9e4066Sahrens 
18014843421SMatthew Ahrens typedef enum {
18114843421SMatthew Ahrens 	ZFS_PROP_USERUSED,
18214843421SMatthew Ahrens 	ZFS_PROP_USERQUOTA,
18314843421SMatthew Ahrens 	ZFS_PROP_GROUPUSED,
18414843421SMatthew Ahrens 	ZFS_PROP_GROUPQUOTA,
185f67950b2SNasf-Fan 	ZFS_PROP_USEROBJUSED,
186f67950b2SNasf-Fan 	ZFS_PROP_USEROBJQUOTA,
187f67950b2SNasf-Fan 	ZFS_PROP_GROUPOBJUSED,
188f67950b2SNasf-Fan 	ZFS_PROP_GROUPOBJQUOTA,
189f67950b2SNasf-Fan 	ZFS_PROP_PROJECTUSED,
190f67950b2SNasf-Fan 	ZFS_PROP_PROJECTQUOTA,
191f67950b2SNasf-Fan 	ZFS_PROP_PROJECTOBJUSED,
192f67950b2SNasf-Fan 	ZFS_PROP_PROJECTOBJQUOTA,
19314843421SMatthew Ahrens 	ZFS_NUM_USERQUOTA_PROPS
19414843421SMatthew Ahrens } zfs_userquota_prop_t;
19514843421SMatthew Ahrens 
19614843421SMatthew Ahrens extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
19714843421SMatthew Ahrens 
198990b4856Slling /*
199990b4856Slling  * Pool properties are identified by these constants and must be added to the
200b87f3af3Sperrin  * end of this list to ensure that external consumers are not affected
201990b4856Slling  * by the change. If you make any changes to this list, be sure to update
202990b4856Slling  * the property table in usr/src/common/zfs/zpool_prop.c.
203990b4856Slling  */
204990b4856Slling typedef enum {
2054ae5f5f0SAlan Somers 	ZPOOL_PROP_INVAL = -1,
206990b4856Slling 	ZPOOL_PROP_NAME,
207990b4856Slling 	ZPOOL_PROP_SIZE,
208990b4856Slling 	ZPOOL_PROP_CAPACITY,
209990b4856Slling 	ZPOOL_PROP_ALTROOT,
210990b4856Slling 	ZPOOL_PROP_HEALTH,
211990b4856Slling 	ZPOOL_PROP_GUID,
212990b4856Slling 	ZPOOL_PROP_VERSION,
213990b4856Slling 	ZPOOL_PROP_BOOTFS,
214990b4856Slling 	ZPOOL_PROP_DELEGATION,
215990b4856Slling 	ZPOOL_PROP_AUTOREPLACE,
2162f8aaab3Seschrock 	ZPOOL_PROP_CACHEFILE,
2170a4e9518Sgw 	ZPOOL_PROP_FAILUREMODE,
218d5b5bb25SRich Morris 	ZPOOL_PROP_LISTSNAPS,
219573ca77eSGeorge Wilson 	ZPOOL_PROP_AUTOEXPAND,
220b24ab676SJeff Bonwick 	ZPOOL_PROP_DEDUPDITTO,
221b24ab676SJeff Bonwick 	ZPOOL_PROP_DEDUPRATIO,
222485bbbf5SGeorge Wilson 	ZPOOL_PROP_FREE,
223485bbbf5SGeorge Wilson 	ZPOOL_PROP_ALLOCATED,
224f9af39baSGeorge Wilson 	ZPOOL_PROP_READONLY,
2258704186eSDan McDonald 	ZPOOL_PROP_COMMENT,
2264263d13fSGeorge Wilson 	ZPOOL_PROP_EXPANDSZ,
227ad135b5dSChristopher Siden 	ZPOOL_PROP_FREEING,
2282e4c9986SGeorge Wilson 	ZPOOL_PROP_FRAGMENTATION,
2297fd05ac4SMatthew Ahrens 	ZPOOL_PROP_LEAKED,
230b5152584SMatthew Ahrens 	ZPOOL_PROP_MAXBLOCKSIZE,
2317855d95bSToomas Soome 	ZPOOL_PROP_BOOTSIZE,
23286714001SSerapheim Dimitropoulos 	ZPOOL_PROP_CHECKPOINT,
23304e56356SAndriy Gapon 	ZPOOL_PROP_TNAME,
23454811da5SToomas Soome 	ZPOOL_PROP_MAXDNODESIZE,
235e0f1c0afSOlaf Faaland 	ZPOOL_PROP_MULTIHOST,
236*5711d393Sloli 	ZPOOL_PROP_ASHIFT,
237990b4856Slling 	ZPOOL_NUM_PROPS
238990b4856Slling } zpool_prop_t;
239b1b8ab34Slling 
2408704186eSDan McDonald /* Small enough to not hog a whole line of printout in zpool(1M). */
2418704186eSDan McDonald #define	ZPROP_MAX_COMMENT	32
2428704186eSDan McDonald 
243990b4856Slling #define	ZPROP_VALUE		"value"
244990b4856Slling #define	ZPROP_SOURCE		"source"
2457f7322feSeschrock 
246b1b8ab34Slling typedef enum {
247990b4856Slling 	ZPROP_SRC_NONE = 0x1,
248990b4856Slling 	ZPROP_SRC_DEFAULT = 0x2,
249990b4856Slling 	ZPROP_SRC_TEMPORARY = 0x4,
250990b4856Slling 	ZPROP_SRC_LOCAL = 0x8,
25192241e0bSTom Erickson 	ZPROP_SRC_INHERITED = 0x10,
25292241e0bSTom Erickson 	ZPROP_SRC_RECEIVED = 0x20
253990b4856Slling } zprop_source_t;
254990b4856Slling 
25592241e0bSTom Erickson #define	ZPROP_SRC_ALL	0x3f
25692241e0bSTom Erickson 
25792241e0bSTom Erickson #define	ZPROP_SOURCE_VAL_RECVD	"$recvd"
25892241e0bSTom Erickson #define	ZPROP_N_MORE_ERRORS	"N_MORE_ERRORS"
25992241e0bSTom Erickson /*
26092241e0bSTom Erickson  * Dataset flag implemented as a special entry in the props zap object
26192241e0bSTom Erickson  * indicating that the dataset has received properties on or after
26292241e0bSTom Erickson  * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
26392241e0bSTom Erickson  * just as it did in earlier versions, and thereafter, local properties are
26492241e0bSTom Erickson  * preserved.
26592241e0bSTom Erickson  */
26692241e0bSTom Erickson #define	ZPROP_HAS_RECVD		"$hasrecvd"
26792241e0bSTom Erickson 
26892241e0bSTom Erickson typedef enum {
26992241e0bSTom Erickson 	ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */
27092241e0bSTom Erickson 	ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */
27192241e0bSTom Erickson } zprop_errflags_t;
272990b4856Slling 
273990b4856Slling typedef int (*zprop_func)(int, void *);
274990b4856Slling 
2750a48a24eStimh /*
2760a48a24eStimh  * Properties to be set on the root file system of a new pool
2770a48a24eStimh  * are stuffed into their own nvlist, which is then included in
2780a48a24eStimh  * the properties nvlist with the pool properties.
2790a48a24eStimh  */
2800a48a24eStimh #define	ZPOOL_ROOTFS_PROPS	"root-props-nvl"
2810a48a24eStimh 
282dfc11533SChris Williamson /*
283dfc11533SChris Williamson  * Length of 'written@' and 'written#'
284dfc11533SChris Williamson  */
285dfc11533SChris Williamson #define	ZFS_WRITTEN_PROP_PREFIX_LEN	8
286dfc11533SChris Williamson 
287990b4856Slling /*
288990b4856Slling  * Dataset property functions shared between libzfs and kernel.
289990b4856Slling  */
290990b4856Slling const char *zfs_prop_default_string(zfs_prop_t);
291990b4856Slling uint64_t zfs_prop_default_numeric(zfs_prop_t);
292990b4856Slling boolean_t zfs_prop_readonly(zfs_prop_t);
293dfc11533SChris Williamson boolean_t zfs_prop_visible(zfs_prop_t prop);
294990b4856Slling boolean_t zfs_prop_inheritable(zfs_prop_t);
295da6c28aaSamw boolean_t zfs_prop_setonce(zfs_prop_t);
296eb633035STom Caputi boolean_t zfs_prop_encryption_key_param(zfs_prop_t);
297eb633035STom Caputi boolean_t zfs_prop_valid_keylocation(const char *, boolean_t);
298990b4856Slling const char *zfs_prop_to_name(zfs_prop_t);
299990b4856Slling zfs_prop_t zfs_name_to_prop(const char *);
300990b4856Slling boolean_t zfs_prop_user(const char *);
30192241e0bSTom Erickson boolean_t zfs_prop_userquota(const char *);
30219b94df9SMatthew Ahrens boolean_t zfs_prop_written(const char *);
303990b4856Slling int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
304990b4856Slling int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
305b24ab676SJeff Bonwick uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
3064853e976Sgw boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
307b1b8ab34Slling 
308990b4856Slling /*
309990b4856Slling  * Pool property functions shared between libzfs and kernel.
310990b4856Slling  */
311990b4856Slling zpool_prop_t zpool_name_to_prop(const char *);
312990b4856Slling const char *zpool_prop_to_name(zpool_prop_t);
313990b4856Slling const char *zpool_prop_default_string(zpool_prop_t);
314990b4856Slling uint64_t zpool_prop_default_numeric(zpool_prop_t);
315990b4856Slling boolean_t zpool_prop_readonly(zpool_prop_t);
316ad135b5dSChristopher Siden boolean_t zpool_prop_feature(const char *);
317ad135b5dSChristopher Siden boolean_t zpool_prop_unsupported(const char *name);
318990b4856Slling int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
319990b4856Slling int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
320b24ab676SJeff Bonwick uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
321b1b8ab34Slling 
322990b4856Slling /*
323990b4856Slling  * Definitions for the Delegation.
324990b4856Slling  */
325ecd6cf80Smarks typedef enum {
326ecd6cf80Smarks 	ZFS_DELEG_WHO_UNKNOWN = 0,
327ecd6cf80Smarks 	ZFS_DELEG_USER = 'u',
328ecd6cf80Smarks 	ZFS_DELEG_USER_SETS = 'U',
329ecd6cf80Smarks 	ZFS_DELEG_GROUP = 'g',
330ecd6cf80Smarks 	ZFS_DELEG_GROUP_SETS = 'G',
331ecd6cf80Smarks 	ZFS_DELEG_EVERYONE = 'e',
332ecd6cf80Smarks 	ZFS_DELEG_EVERYONE_SETS = 'E',
333ecd6cf80Smarks 	ZFS_DELEG_CREATE = 'c',
334ecd6cf80Smarks 	ZFS_DELEG_CREATE_SETS = 'C',
335ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET = 's',
336ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET_SETS = 'S'
337ecd6cf80Smarks } zfs_deleg_who_type_t;
338ecd6cf80Smarks 
339ecd6cf80Smarks typedef enum {
340ecd6cf80Smarks 	ZFS_DELEG_NONE = 0,
341ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCAL = 1,
342ecd6cf80Smarks 	ZFS_DELEG_PERM_DESCENDENT = 2,
343ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
344ecd6cf80Smarks 	ZFS_DELEG_PERM_CREATE = 4
345ecd6cf80Smarks } zfs_deleg_inherit_t;
346ecd6cf80Smarks 
347ecd6cf80Smarks #define	ZFS_DELEG_PERM_UID	"uid"
348ecd6cf80Smarks #define	ZFS_DELEG_PERM_GID	"gid"
349ecd6cf80Smarks #define	ZFS_DELEG_PERM_GROUPS	"groups"
350ecd6cf80Smarks 
3514201a95eSRic Aleshire #define	ZFS_MLSLABEL_DEFAULT	"none"
3524201a95eSRic Aleshire 
353743a77edSAlan Wright #define	ZFS_SMB_ACL_SRC		"src"
354743a77edSAlan Wright #define	ZFS_SMB_ACL_TARGET	"target"
355743a77edSAlan Wright 
356a227b7f4Shs typedef enum {
357a227b7f4Shs 	ZFS_CANMOUNT_OFF = 0,
358a227b7f4Shs 	ZFS_CANMOUNT_ON = 1,
359a227b7f4Shs 	ZFS_CANMOUNT_NOAUTO = 2
360a227b7f4Shs } zfs_canmount_type_t;
361a227b7f4Shs 
362e09fa4daSNeil Perrin typedef enum {
363e09fa4daSNeil Perrin 	ZFS_LOGBIAS_LATENCY = 0,
364e09fa4daSNeil Perrin 	ZFS_LOGBIAS_THROUGHPUT = 1
365e09fa4daSNeil Perrin } zfs_logbias_op_t;
366e09fa4daSNeil Perrin 
367da6c28aaSamw typedef enum zfs_share_op {
368da6c28aaSamw 	ZFS_SHARE_NFS = 0,
369da6c28aaSamw 	ZFS_UNSHARE_NFS = 1,
370da6c28aaSamw 	ZFS_SHARE_SMB = 2,
371da6c28aaSamw 	ZFS_UNSHARE_SMB = 3
372da6c28aaSamw } zfs_share_op_t;
373da6c28aaSamw 
374743a77edSAlan Wright typedef enum zfs_smb_acl_op {
375743a77edSAlan Wright 	ZFS_SMB_ACL_ADD,
376743a77edSAlan Wright 	ZFS_SMB_ACL_REMOVE,
377743a77edSAlan Wright 	ZFS_SMB_ACL_RENAME,
378743a77edSAlan Wright 	ZFS_SMB_ACL_PURGE
379743a77edSAlan Wright } zfs_smb_acl_op_t;
380743a77edSAlan Wright 
3813baa08fcSek typedef enum zfs_cache_type {
3823baa08fcSek 	ZFS_CACHE_NONE = 0,
3833baa08fcSek 	ZFS_CACHE_METADATA = 1,
3843baa08fcSek 	ZFS_CACHE_ALL = 2
3853baa08fcSek } zfs_cache_type_t;
3863baa08fcSek 
38755da60b9SMark J Musante typedef enum {
38855da60b9SMark J Musante 	ZFS_SYNC_STANDARD = 0,
38955da60b9SMark J Musante 	ZFS_SYNC_ALWAYS = 1,
39055da60b9SMark J Musante 	ZFS_SYNC_DISABLED = 2
39155da60b9SMark J Musante } zfs_sync_type_t;
39255da60b9SMark J Musante 
39354811da5SToomas Soome typedef enum {
39454811da5SToomas Soome 	ZFS_DNSIZE_LEGACY = 0,
39554811da5SToomas Soome 	ZFS_DNSIZE_AUTO = 1,
39654811da5SToomas Soome 	ZFS_DNSIZE_1K = 1024,
39754811da5SToomas Soome 	ZFS_DNSIZE_2K = 2048,
39854811da5SToomas Soome 	ZFS_DNSIZE_4K = 4096,
39954811da5SToomas Soome 	ZFS_DNSIZE_8K = 8192,
40054811da5SToomas Soome 	ZFS_DNSIZE_16K = 16384
40154811da5SToomas Soome } zfs_dnsize_type_t;
40254811da5SToomas Soome 
403edf345e6SMatthew Ahrens typedef enum {
404edf345e6SMatthew Ahrens 	ZFS_REDUNDANT_METADATA_ALL,
405edf345e6SMatthew Ahrens 	ZFS_REDUNDANT_METADATA_MOST
406edf345e6SMatthew Ahrens } zfs_redundant_metadata_type_t;
4073baa08fcSek 
408eb633035STom Caputi typedef enum zfs_keystatus {
409eb633035STom Caputi 	ZFS_KEYSTATUS_NONE = 0,
410eb633035STom Caputi 	ZFS_KEYSTATUS_UNAVAILABLE,
411eb633035STom Caputi 	ZFS_KEYSTATUS_AVAILABLE
412eb633035STom Caputi } zfs_keystatus_t;
413eb633035STom Caputi 
414eb633035STom Caputi typedef enum zfs_keyformat {
415eb633035STom Caputi 	ZFS_KEYFORMAT_NONE = 0,
416eb633035STom Caputi 	ZFS_KEYFORMAT_RAW,
417eb633035STom Caputi 	ZFS_KEYFORMAT_HEX,
418eb633035STom Caputi 	ZFS_KEYFORMAT_PASSPHRASE,
419eb633035STom Caputi 	ZFS_KEYFORMAT_FORMATS
420eb633035STom Caputi } zfs_keyformat_t;
421eb633035STom Caputi 
422eb633035STom Caputi typedef enum zfs_key_location {
423eb633035STom Caputi 	ZFS_KEYLOCATION_NONE = 0,
424eb633035STom Caputi 	ZFS_KEYLOCATION_PROMPT,
425eb633035STom Caputi 	ZFS_KEYLOCATION_URI,
426eb633035STom Caputi 	ZFS_KEYLOCATION_LOCATIONS
427eb633035STom Caputi } zfs_keylocation_t;
428eb633035STom Caputi 
429eb633035STom Caputi #define	DEFAULT_PBKDF2_ITERATIONS 350000
430eb633035STom Caputi #define	MIN_PBKDF2_ITERATIONS 100000
431eb633035STom Caputi 
432eaca9bbdSeschrock /*
43399653d4eSeschrock  * On-disk version number.
434eaca9bbdSeschrock  */
435e7437265Sahrens #define	SPA_VERSION_1			1ULL
436e7437265Sahrens #define	SPA_VERSION_2			2ULL
437e7437265Sahrens #define	SPA_VERSION_3			3ULL
438e7437265Sahrens #define	SPA_VERSION_4			4ULL
439e7437265Sahrens #define	SPA_VERSION_5			5ULL
440e7437265Sahrens #define	SPA_VERSION_6			6ULL
441e7437265Sahrens #define	SPA_VERSION_7			7ULL
442e7437265Sahrens #define	SPA_VERSION_8			8ULL
443da6c28aaSamw #define	SPA_VERSION_9			9ULL
444fa94a07fSbrendan #define	SPA_VERSION_10			10ULL
445088f3894Sahrens #define	SPA_VERSION_11			11ULL
446bb0ade09Sahrens #define	SPA_VERSION_12			12ULL
44774e7dc98SMatthew Ahrens #define	SPA_VERSION_13			13ULL
448d0f3f37eSMark Shellenbaum #define	SPA_VERSION_14			14ULL
44914843421SMatthew Ahrens #define	SPA_VERSION_15			15ULL
450478ed9adSEric Taylor #define	SPA_VERSION_16			16ULL
451f94275ceSAdam Leventhal #define	SPA_VERSION_17			17ULL
452842727c2SChris Kirby #define	SPA_VERSION_18			18ULL
45388ecc943SGeorge Wilson #define	SPA_VERSION_19			19ULL
454b24ab676SJeff Bonwick #define	SPA_VERSION_20			20ULL
455b24ab676SJeff Bonwick #define	SPA_VERSION_21			21ULL
45692241e0bSTom Erickson #define	SPA_VERSION_22			22ULL
4576e1f5caaSNeil Perrin #define	SPA_VERSION_23			23ULL
4580a586ceaSMark Shellenbaum #define	SPA_VERSION_24			24ULL
4593f9d6ad7SLin Ling #define	SPA_VERSION_25			25ULL
460cde58dbcSMatthew Ahrens #define	SPA_VERSION_26			26ULL
4616e0cbcaaSMatthew Ahrens #define	SPA_VERSION_27			27ULL
462cb04b873SMark J Musante #define	SPA_VERSION_28			28ULL
463ad135b5dSChristopher Siden #define	SPA_VERSION_5000		5000ULL
464cb04b873SMark J Musante 
465b1b8ab34Slling /*
466e7cbe64fSgw  * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
467478ed9adSEric Taylor  * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
46814843421SMatthew Ahrens  * and do the appropriate changes.  Also bump the version number in
46914843421SMatthew Ahrens  * usr/src/grub/capability.
470b1b8ab34Slling  */
471ad135b5dSChristopher Siden #define	SPA_VERSION			SPA_VERSION_5000
472ad135b5dSChristopher Siden #define	SPA_VERSION_STRING		"5000"
47344cd46caSbillm 
47444cd46caSbillm /*
475e7437265Sahrens  * Symbolic names for the changes that caused a SPA_VERSION switch.
47644cd46caSbillm  * Used in the code when checking for presence or absence of a feature.
47744cd46caSbillm  * Feel free to define multiple symbolic names for each version if there
47844cd46caSbillm  * were multiple changes to on-disk structures during that version.
47944cd46caSbillm  *
480e7437265Sahrens  * NOTE: When checking the current SPA_VERSION in your code, be sure
48144cd46caSbillm  *       to use spa_version() since it reports the version of the
48244cd46caSbillm  *       last synced uberblock.  Checking the in-flight version can
48344cd46caSbillm  *       be dangerous in some cases.
48444cd46caSbillm  */
485e7437265Sahrens #define	SPA_VERSION_INITIAL		SPA_VERSION_1
486e7437265Sahrens #define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
487e7437265Sahrens #define	SPA_VERSION_SPARES		SPA_VERSION_3
488f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ2		SPA_VERSION_3
489cde58dbcSMatthew Ahrens #define	SPA_VERSION_BPOBJ_ACCOUNT	SPA_VERSION_3
490e7437265Sahrens #define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
491e7437265Sahrens #define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
492e7437265Sahrens #define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
493e7437265Sahrens #define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
494e7437265Sahrens #define	SPA_VERSION_BOOTFS		SPA_VERSION_6
495990b4856Slling #define	SPA_VERSION_SLOGS		SPA_VERSION_7
496990b4856Slling #define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
497da6c28aaSamw #define	SPA_VERSION_FUID		SPA_VERSION_9
498a9799022Sck #define	SPA_VERSION_REFRESERVATION	SPA_VERSION_9
499a9799022Sck #define	SPA_VERSION_REFQUOTA		SPA_VERSION_9
500a9799022Sck #define	SPA_VERSION_UNIQUE_ACCURATE	SPA_VERSION_9
501fa94a07fSbrendan #define	SPA_VERSION_L2CACHE		SPA_VERSION_10
502088f3894Sahrens #define	SPA_VERSION_NEXT_CLONES		SPA_VERSION_11
503088f3894Sahrens #define	SPA_VERSION_ORIGIN		SPA_VERSION_11
504088f3894Sahrens #define	SPA_VERSION_DSL_SCRUB		SPA_VERSION_11
505bb0ade09Sahrens #define	SPA_VERSION_SNAP_PROPS		SPA_VERSION_12
50674e7dc98SMatthew Ahrens #define	SPA_VERSION_USED_BREAKDOWN	SPA_VERSION_13
507d0f3f37eSMark Shellenbaum #define	SPA_VERSION_PASSTHROUGH_X	SPA_VERSION_14
50814843421SMatthew Ahrens #define	SPA_VERSION_USERSPACE		SPA_VERSION_15
509478ed9adSEric Taylor #define	SPA_VERSION_STMF_PROP		SPA_VERSION_16
510f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ3		SPA_VERSION_17
511842727c2SChris Kirby #define	SPA_VERSION_USERREFS		SPA_VERSION_18
51288ecc943SGeorge Wilson #define	SPA_VERSION_HOLES		SPA_VERSION_19
513b24ab676SJeff Bonwick #define	SPA_VERSION_ZLE_COMPRESSION	SPA_VERSION_20
514b24ab676SJeff Bonwick #define	SPA_VERSION_DEDUP		SPA_VERSION_21
51592241e0bSTom Erickson #define	SPA_VERSION_RECVD_PROPS		SPA_VERSION_22
5166e1f5caaSNeil Perrin #define	SPA_VERSION_SLIM_ZIL		SPA_VERSION_23
5170a586ceaSMark Shellenbaum #define	SPA_VERSION_SA			SPA_VERSION_24
5183f9d6ad7SLin Ling #define	SPA_VERSION_SCAN		SPA_VERSION_25
519cde58dbcSMatthew Ahrens #define	SPA_VERSION_DIR_CLONES		SPA_VERSION_26
520cde58dbcSMatthew Ahrens #define	SPA_VERSION_DEADLISTS		SPA_VERSION_26
5216e0cbcaaSMatthew Ahrens #define	SPA_VERSION_FAST_SNAP		SPA_VERSION_27
522cb04b873SMark J Musante #define	SPA_VERSION_MULTI_REPLACE	SPA_VERSION_28
523ad135b5dSChristopher Siden #define	SPA_VERSION_BEFORE_FEATURES	SPA_VERSION_28
524ad135b5dSChristopher Siden #define	SPA_VERSION_FEATURES		SPA_VERSION_5000
525ad135b5dSChristopher Siden 
526ad135b5dSChristopher Siden #define	SPA_VERSION_IS_SUPPORTED(v) \
527ad135b5dSChristopher Siden 	(((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
528ad135b5dSChristopher Siden 	((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
529e7437265Sahrens 
530e7437265Sahrens /*
531e7437265Sahrens  * ZPL version - rev'd whenever an incompatible on-disk format change
532e7437265Sahrens  * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
533e7437265Sahrens  * also update the version_table[] and help message in zfs_prop.c.
534e7437265Sahrens  *
535e7437265Sahrens  * When changing, be sure to teach GRUB how to read the new format!
536478ed9adSEric Taylor  * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
537e7437265Sahrens  */
538e7437265Sahrens #define	ZPL_VERSION_1			1ULL
539e7437265Sahrens #define	ZPL_VERSION_2			2ULL
540da6c28aaSamw #define	ZPL_VERSION_3			3ULL
54114843421SMatthew Ahrens #define	ZPL_VERSION_4			4ULL
5420a586ceaSMark Shellenbaum #define	ZPL_VERSION_5			5ULL
5430a586ceaSMark Shellenbaum #define	ZPL_VERSION			ZPL_VERSION_5
5440a586ceaSMark Shellenbaum #define	ZPL_VERSION_STRING		"5"
545e7437265Sahrens 
546e7437265Sahrens #define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
547e7437265Sahrens #define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
548da6c28aaSamw #define	ZPL_VERSION_FUID		ZPL_VERSION_3
549de8267e0Stimh #define	ZPL_VERSION_NORMALIZATION	ZPL_VERSION_3
550da6c28aaSamw #define	ZPL_VERSION_SYSATTR		ZPL_VERSION_3
55114843421SMatthew Ahrens #define	ZPL_VERSION_USERSPACE		ZPL_VERSION_4
5520a586ceaSMark Shellenbaum #define	ZPL_VERSION_SA			ZPL_VERSION_5
553eaca9bbdSeschrock 
5545dafeea3SPavel Zakharov /* Rewind policy information */
555c8ee1847SVictor Latushkin #define	ZPOOL_NO_REWIND		1  /* No policy - default behavior */
556c8ee1847SVictor Latushkin #define	ZPOOL_NEVER_REWIND	2  /* Do not search for best txg or rewind */
557c8ee1847SVictor Latushkin #define	ZPOOL_TRY_REWIND	4  /* Search for best txg, but do not rewind */
558c8ee1847SVictor Latushkin #define	ZPOOL_DO_REWIND		8  /* Rewind to best txg w/in deferred frees */
559c8ee1847SVictor Latushkin #define	ZPOOL_EXTREME_REWIND	16 /* Allow extreme measures to find best txg */
560c8ee1847SVictor Latushkin #define	ZPOOL_REWIND_MASK	28 /* All the possible rewind bits */
561c8ee1847SVictor Latushkin #define	ZPOOL_REWIND_POLICIES	31 /* All the possible policy bits */
562468c413aSTim Haley 
5635dafeea3SPavel Zakharov typedef struct zpool_load_policy {
5645dafeea3SPavel Zakharov 	uint32_t	zlp_rewind;	/* rewind policy requested */
5655dafeea3SPavel Zakharov 	uint64_t	zlp_maxmeta;	/* max acceptable meta-data errors */
5665dafeea3SPavel Zakharov 	uint64_t	zlp_maxdata;	/* max acceptable data errors */
5675dafeea3SPavel Zakharov 	uint64_t	zlp_txg;	/* specific txg to load */
5685dafeea3SPavel Zakharov } zpool_load_policy_t;
569468c413aSTim Haley 
570fa9e4066Sahrens /*
571fa9e4066Sahrens  * The following are configuration names used in the nvlist describing a pool's
5725cabbc6bSPrashanth Sreenivasa  * configuration.  New on-disk names should be prefixed with "<reverse-DNS>:"
5735cabbc6bSPrashanth Sreenivasa  * (e.g. "org.open-zfs:") to avoid conflicting names being developed
5745cabbc6bSPrashanth Sreenivasa  * independently.
575fa9e4066Sahrens  */
576fa9e4066Sahrens #define	ZPOOL_CONFIG_VERSION		"version"
577fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_NAME		"name"
578fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_STATE		"state"
579fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_TXG		"txg"
580fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
581fa9e4066Sahrens #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
582fa9e4066Sahrens #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
583fa9e4066Sahrens #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
584fa9e4066Sahrens #define	ZPOOL_CONFIG_TYPE		"type"
585fa9e4066Sahrens #define	ZPOOL_CONFIG_CHILDREN		"children"
586fa9e4066Sahrens #define	ZPOOL_CONFIG_ID			"id"
587fa9e4066Sahrens #define	ZPOOL_CONFIG_GUID		"guid"
5885cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_INDIRECT_OBJECT	"com.delphix:indirect_object"
5895cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_INDIRECT_BIRTHS	"com.delphix:indirect_births"
5905cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_PREV_INDIRECT_VDEV	"com.delphix:prev_indirect_vdev"
591fa9e4066Sahrens #define	ZPOOL_CONFIG_PATH		"path"
592fa9e4066Sahrens #define	ZPOOL_CONFIG_DEVID		"devid"
593fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
594fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
595fa9e4066Sahrens #define	ZPOOL_CONFIG_ASHIFT		"ashift"
596fa9e4066Sahrens #define	ZPOOL_CONFIG_ASIZE		"asize"
597fa9e4066Sahrens #define	ZPOOL_CONFIG_DTL		"DTL"
5983f9d6ad7SLin Ling #define	ZPOOL_CONFIG_SCAN_STATS		"scan_stats"	/* not stored on disk */
5995cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_REMOVAL_STATS	"removal_stats"	/* not stored on disk */
60086714001SSerapheim Dimitropoulos #define	ZPOOL_CONFIG_CHECKPOINT_STATS	"checkpoint_stats" /* not on disk */
6013f9d6ad7SLin Ling #define	ZPOOL_CONFIG_VDEV_STATS		"vdev_stats"	/* not stored on disk */
6025cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_INDIRECT_SIZE	"indirect_size"	/* not stored on disk */
603afefbcddSeschrock #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
604ea8dc4b6Seschrock #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
605ea8dc4b6Seschrock #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
60699653d4eSeschrock #define	ZPOOL_CONFIG_SPARES		"spares"
60799653d4eSeschrock #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
60899653d4eSeschrock #define	ZPOOL_CONFIG_NPARITY		"nparity"
60995173954Sek #define	ZPOOL_CONFIG_HOSTID		"hostid"
61095173954Sek #define	ZPOOL_CONFIG_HOSTNAME		"hostname"
61111027bc7STim Haley #define	ZPOOL_CONFIG_LOADED_TIME	"initial_load_time"
6123d7072f8Seschrock #define	ZPOOL_CONFIG_UNSPARE		"unspare"
6133d7072f8Seschrock #define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
6148654d025Sperrin #define	ZPOOL_CONFIG_IS_LOG		"is_log"
615fa94a07fSbrendan #define	ZPOOL_CONFIG_L2CACHE		"l2cache"
61688ecc943SGeorge Wilson #define	ZPOOL_CONFIG_HOLE_ARRAY		"hole_array"
61788ecc943SGeorge Wilson #define	ZPOOL_CONFIG_VDEV_CHILDREN	"vdev_children"
61888ecc943SGeorge Wilson #define	ZPOOL_CONFIG_IS_HOLE		"is_hole"
6199eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_HISTOGRAM	"ddt_histogram"
6209eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_OBJ_STATS	"ddt_object_stats"
6219eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_STATS		"ddt_stats"
6221195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT		"splitcfg"
6231195e687SMark J Musante #define	ZPOOL_CONFIG_ORIG_GUID		"orig_guid"
6241195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT_GUID		"split_guid"
6251195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT_LIST		"guid_list"
6263f9d6ad7SLin Ling #define	ZPOOL_CONFIG_REMOVING		"removing"
627b4952e17SGeorge Wilson #define	ZPOOL_CONFIG_RESILVER_TXG	"resilver_txg"
6288704186eSDan McDonald #define	ZPOOL_CONFIG_COMMENT		"comment"
629e14bb325SJeff Bonwick #define	ZPOOL_CONFIG_SUSPENDED		"suspended"	/* not stored on disk */
630e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_SUSPENDED_REASON	"suspended_reason"	/* not stored */
631e7cbe64fSgw #define	ZPOOL_CONFIG_TIMESTAMP		"timestamp"	/* not stored on disk */
632e7cbe64fSgw #define	ZPOOL_CONFIG_BOOTFS		"bootfs"	/* not stored on disk */
6334b964adaSGeorge Wilson #define	ZPOOL_CONFIG_MISSING_DEVICES	"missing_vdevs"	/* not stored on disk */
6344b964adaSGeorge Wilson #define	ZPOOL_CONFIG_LOAD_INFO		"load_info"	/* not stored on disk */
635ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_REWIND_INFO	"rewind_info"	/* not stored on disk */
636ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_UNSUP_FEAT		"unsup_feat"	/* not stored on disk */
63757221772SChristopher Siden #define	ZPOOL_CONFIG_ENABLED_FEAT	"enabled_feat"	/* not stored on disk */
638ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_CAN_RDONLY		"can_rdonly"	/* not stored on disk */
639ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_FEATURES_FOR_READ	"features_for_read"
640ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_FEATURE_STATS	"feature_stats"	/* not stored on disk */
641eb633035STom Caputi #define	ZPOOL_CONFIG_ERRATA		"errata"	/* not stored on disk */
642215198a6SJoe Stein #define	ZPOOL_CONFIG_VDEV_TOP_ZAP	"com.delphix:vdev_zap_top"
643215198a6SJoe Stein #define	ZPOOL_CONFIG_VDEV_LEAF_ZAP	"com.delphix:vdev_zap_leaf"
644215198a6SJoe Stein #define	ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS	"com.delphix:has_per_vdev_zaps"
645e4c795beSTom Caputi #define	ZPOOL_CONFIG_RESILVER_DEFER	"com.datto:resilver_defer"
6466f793812SPavel Zakharov #define	ZPOOL_CONFIG_CACHEFILE		"cachefile"	/* not stored on disk */
647e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_STATE		"mmp_state"	/* not stored on disk */
648e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_TXG		"mmp_txg"	/* not stored on disk */
649e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_HOSTNAME	"mmp_hostname"	/* not stored on disk */
650e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_HOSTID		"mmp_hostid"	/* not stored on disk */
651663207adSDon Brady #define	ZPOOL_CONFIG_ALLOCATION_BIAS	"alloc_bias"	/* not stored on disk */
652663207adSDon Brady 
6533d7072f8Seschrock /*
6543d7072f8Seschrock  * The persistent vdev state is stored as separate values rather than a single
6553d7072f8Seschrock  * 'vdev_state' entry.  This is because a device can be in multiple states, such
6563d7072f8Seschrock  * as offline and degraded.
6573d7072f8Seschrock  */
6583d7072f8Seschrock #define	ZPOOL_CONFIG_OFFLINE		"offline"
6593d7072f8Seschrock #define	ZPOOL_CONFIG_FAULTED		"faulted"
6603d7072f8Seschrock #define	ZPOOL_CONFIG_DEGRADED		"degraded"
6613d7072f8Seschrock #define	ZPOOL_CONFIG_REMOVED		"removed"
6626809eb4eSEric Schrock #define	ZPOOL_CONFIG_FRU		"fru"
663069f55e2SEric Schrock #define	ZPOOL_CONFIG_AUX_STATE		"aux_state"
664fa9e4066Sahrens 
6655dafeea3SPavel Zakharov /* Pool load policy parameters */
6665dafeea3SPavel Zakharov #define	ZPOOL_LOAD_POLICY		"load-policy"
6675dafeea3SPavel Zakharov #define	ZPOOL_LOAD_REWIND_POLICY	"load-rewind-policy"
6685dafeea3SPavel Zakharov #define	ZPOOL_LOAD_REQUEST_TXG		"load-request-txg"
6695dafeea3SPavel Zakharov #define	ZPOOL_LOAD_META_THRESH		"load-meta-thresh"
6705dafeea3SPavel Zakharov #define	ZPOOL_LOAD_DATA_THRESH		"load-data-thresh"
671468c413aSTim Haley 
672468c413aSTim Haley /* Rewind data discovered */
673468c413aSTim Haley #define	ZPOOL_CONFIG_LOAD_TIME		"rewind_txg_ts"
674468c413aSTim Haley #define	ZPOOL_CONFIG_LOAD_DATA_ERRORS	"verify_data_errors"
675468c413aSTim Haley #define	ZPOOL_CONFIG_REWIND_TIME	"seconds_of_rewind"
676468c413aSTim Haley 
677fa9e4066Sahrens #define	VDEV_TYPE_ROOT			"root"
678fa9e4066Sahrens #define	VDEV_TYPE_MIRROR		"mirror"
679fa9e4066Sahrens #define	VDEV_TYPE_REPLACING		"replacing"
680fa9e4066Sahrens #define	VDEV_TYPE_RAIDZ			"raidz"
681fa9e4066Sahrens #define	VDEV_TYPE_DISK			"disk"
682fa9e4066Sahrens #define	VDEV_TYPE_FILE			"file"
683fa9e4066Sahrens #define	VDEV_TYPE_MISSING		"missing"
68488ecc943SGeorge Wilson #define	VDEV_TYPE_HOLE			"hole"
68599653d4eSeschrock #define	VDEV_TYPE_SPARE			"spare"
6868654d025Sperrin #define	VDEV_TYPE_LOG			"log"
687fa94a07fSbrendan #define	VDEV_TYPE_L2CACHE		"l2cache"
6885cabbc6bSPrashanth Sreenivasa #define	VDEV_TYPE_INDIRECT		"indirect"
6895cabbc6bSPrashanth Sreenivasa 
6905cabbc6bSPrashanth Sreenivasa /* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */
6915cabbc6bSPrashanth Sreenivasa #define	VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \
6925cabbc6bSPrashanth Sreenivasa 	"com.delphix:indirect_obsolete_sm"
6935cabbc6bSPrashanth Sreenivasa #define	VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \
6945cabbc6bSPrashanth Sreenivasa 	"com.delphix:obsolete_counts_are_precise"
69586714001SSerapheim Dimitropoulos #define	VDEV_TOP_ZAP_POOL_CHECKPOINT_SM \
69686714001SSerapheim Dimitropoulos 	"com.delphix:pool_checkpoint_sm"
697fa9e4066Sahrens 
698663207adSDon Brady #define	VDEV_TOP_ZAP_ALLOCATION_BIAS \
699663207adSDon Brady 	"org.zfsonlinux:allocation_bias"
700663207adSDon Brady 
701663207adSDon Brady /* vdev metaslab allocation bias */
702663207adSDon Brady #define	VDEV_ALLOC_BIAS_LOG		"log"
703663207adSDon Brady #define	VDEV_ALLOC_BIAS_SPECIAL		"special"
704663207adSDon Brady #define	VDEV_ALLOC_BIAS_DEDUP		"dedup"
705663207adSDon Brady 
706094e47e9SGeorge Wilson #define	VDEV_LEAF_ZAP_INITIALIZE_LAST_OFFSET	\
707094e47e9SGeorge Wilson 	"com.delphix:next_offset_to_initialize"
708094e47e9SGeorge Wilson #define	VDEV_LEAF_ZAP_INITIALIZE_STATE	\
709094e47e9SGeorge Wilson 	"com.delphix:vdev_initialize_state"
710094e47e9SGeorge Wilson #define	VDEV_LEAF_ZAP_INITIALIZE_ACTION_TIME	\
711094e47e9SGeorge Wilson 	"com.delphix:vdev_initialize_action_time"
712094e47e9SGeorge Wilson 
713fa9e4066Sahrens /*
714fa9e4066Sahrens  * This is needed in userland to report the minimum necessary device size.
7154b5c8e93SMatthew Ahrens  *
7164b5c8e93SMatthew Ahrens  * Note that the zfs test suite uses 64MB vdevs.
717fa9e4066Sahrens  */
718fa9e4066Sahrens #define	SPA_MINDEVSIZE		(64ULL << 20)
719fa9e4066Sahrens 
7202e4c9986SGeorge Wilson /*
7212e4c9986SGeorge Wilson  * Set if the fragmentation has not yet been calculated. This can happen
7222e4c9986SGeorge Wilson  * because the space maps have not been upgraded or the histogram feature
7232e4c9986SGeorge Wilson  * is not enabled.
7242e4c9986SGeorge Wilson  */
7252e4c9986SGeorge Wilson #define	ZFS_FRAG_INVALID	UINT64_MAX
7262e4c9986SGeorge Wilson 
727fa9e4066Sahrens /*
728fa9e4066Sahrens  * The location of the pool configuration repository, shared between kernel and
729fa9e4066Sahrens  * userland.
730fa9e4066Sahrens  */
731c5904d13Seschrock #define	ZPOOL_CACHE		"/etc/zfs/zpool.cache"
732fa9e4066Sahrens 
733fa9e4066Sahrens /*
734fa9e4066Sahrens  * vdev states are ordered from least to most healthy.
735fa9e4066Sahrens  * A vdev that's CANT_OPEN or below is considered unusable.
736fa9e4066Sahrens  */
737fa9e4066Sahrens typedef enum vdev_state {
738fa9e4066Sahrens 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
739fa9e4066Sahrens 	VDEV_STATE_CLOSED,	/* Not currently open			*/
740fa9e4066Sahrens 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
7413d7072f8Seschrock 	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
742fa9e4066Sahrens 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
7433d7072f8Seschrock 	VDEV_STATE_FAULTED,	/* External request to fault device	*/
744fa9e4066Sahrens 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
745fa9e4066Sahrens 	VDEV_STATE_HEALTHY	/* Presumed good			*/
746fa9e4066Sahrens } vdev_state_t;
747fa9e4066Sahrens 
7483d7072f8Seschrock #define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
7493d7072f8Seschrock 
750fa9e4066Sahrens /*
751fa9e4066Sahrens  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
752fa9e4066Sahrens  * of the vdev stats structure uses these constants to distinguish why.
753fa9e4066Sahrens  */
754fa9e4066Sahrens typedef enum vdev_aux {
755fa9e4066Sahrens 	VDEV_AUX_NONE,		/* no error				*/
756fa9e4066Sahrens 	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
757fa9e4066Sahrens 	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
758fa9e4066Sahrens 	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
759fa9e4066Sahrens 	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
760fa9e4066Sahrens 	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
761eaca9bbdSeschrock 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
762eaca9bbdSeschrock 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
76399653d4eSeschrock 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
764ad135b5dSChristopher Siden 	VDEV_AUX_UNSUP_FEAT,	/* unsupported features			*/
7653d7072f8Seschrock 	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
76632b87932Sek 	VDEV_AUX_ERR_EXCEEDED,	/* too many errors			*/
767b87f3af3Sperrin 	VDEV_AUX_IO_FAILURE,	/* experienced I/O failure		*/
768069f55e2SEric Schrock 	VDEV_AUX_BAD_LOG,	/* cannot read log chain(s)		*/
7691195e687SMark J Musante 	VDEV_AUX_EXTERNAL,	/* external diagnosis			*/
7706f793812SPavel Zakharov 	VDEV_AUX_SPLIT_POOL,	/* vdev was split off into another pool	*/
771e0f1c0afSOlaf Faaland 	VDEV_AUX_ACTIVE,	/* vdev active on a different host	*/
772*5711d393Sloli 	VDEV_AUX_CHILDREN_OFFLINE, /* all children are offline		*/
773*5711d393Sloli 	VDEV_AUX_BAD_ASHIFT	/* vdev ashift is invalid		*/
774fa9e4066Sahrens } vdev_aux_t;
775fa9e4066Sahrens 
776fa9e4066Sahrens /*
77746a2abf2Seschrock  * pool state.  The following states are written to disk as part of the normal
778fa94a07fSbrendan  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
779fa94a07fSbrendan  * states are software abstractions used at various levels to communicate
780fa94a07fSbrendan  * pool state.
781fa9e4066Sahrens  */
782fa9e4066Sahrens typedef enum pool_state {
783fa9e4066Sahrens 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
784fa9e4066Sahrens 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
785fa9e4066Sahrens 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
78699653d4eSeschrock 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
787fa94a07fSbrendan 	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
788fa9e4066Sahrens 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
78946a2abf2Seschrock 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
79046a2abf2Seschrock 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
791fa9e4066Sahrens } pool_state_t;
792fa9e4066Sahrens 
793e0f1c0afSOlaf Faaland /*
794e0f1c0afSOlaf Faaland  * mmp state. The following states provide additional detail describing
795e0f1c0afSOlaf Faaland  * why a pool couldn't be safely imported.
796e0f1c0afSOlaf Faaland  */
797e0f1c0afSOlaf Faaland typedef enum mmp_state {
798e0f1c0afSOlaf Faaland 	MMP_STATE_ACTIVE = 0,		/* In active use		*/
799e0f1c0afSOlaf Faaland 	MMP_STATE_INACTIVE,		/* Inactive and safe to import	*/
800e0f1c0afSOlaf Faaland 	MMP_STATE_NO_HOSTID		/* System hostid is not set	*/
801e0f1c0afSOlaf Faaland } mmp_state_t;
802e0f1c0afSOlaf Faaland 
803fa9e4066Sahrens /*
8043f9d6ad7SLin Ling  * Scan Functions.
805fa9e4066Sahrens  */
8063f9d6ad7SLin Ling typedef enum pool_scan_func {
8073f9d6ad7SLin Ling 	POOL_SCAN_NONE,
8083f9d6ad7SLin Ling 	POOL_SCAN_SCRUB,
8093f9d6ad7SLin Ling 	POOL_SCAN_RESILVER,
8103f9d6ad7SLin Ling 	POOL_SCAN_FUNCS
8113f9d6ad7SLin Ling } pool_scan_func_t;
812fa9e4066Sahrens 
8131702cce7SAlek Pinchuk /*
8141702cce7SAlek Pinchuk  * Used to control scrub pause and resume.
8151702cce7SAlek Pinchuk  */
8161702cce7SAlek Pinchuk typedef enum pool_scrub_cmd {
8171702cce7SAlek Pinchuk 	POOL_SCRUB_NORMAL = 0,
8181702cce7SAlek Pinchuk 	POOL_SCRUB_PAUSE,
8191702cce7SAlek Pinchuk 	POOL_SCRUB_FLAGS_END
8201702cce7SAlek Pinchuk } pool_scrub_cmd_t;
8211702cce7SAlek Pinchuk 
822094e47e9SGeorge Wilson /*
823094e47e9SGeorge Wilson  * Initialize functions.
824094e47e9SGeorge Wilson  */
825094e47e9SGeorge Wilson typedef enum pool_initialize_func {
826094e47e9SGeorge Wilson 	POOL_INITIALIZE_DO,
827094e47e9SGeorge Wilson 	POOL_INITIALIZE_CANCEL,
828094e47e9SGeorge Wilson 	POOL_INITIALIZE_SUSPEND,
829094e47e9SGeorge Wilson 	POOL_INITIALIZE_FUNCS
830094e47e9SGeorge Wilson } pool_initialize_func_t;
8311702cce7SAlek Pinchuk 
832fa9e4066Sahrens /*
833fa9e4066Sahrens  * ZIO types.  Needed to interpret vdev statistics below.
834fa9e4066Sahrens  */
835fa9e4066Sahrens typedef enum zio_type {
836fa9e4066Sahrens 	ZIO_TYPE_NULL = 0,
837fa9e4066Sahrens 	ZIO_TYPE_READ,
838fa9e4066Sahrens 	ZIO_TYPE_WRITE,
839fa9e4066Sahrens 	ZIO_TYPE_FREE,
840fa9e4066Sahrens 	ZIO_TYPE_CLAIM,
841fa9e4066Sahrens 	ZIO_TYPE_IOCTL,
842fa9e4066Sahrens 	ZIO_TYPES
843fa9e4066Sahrens } zio_type_t;
844fa9e4066Sahrens 
8453f9d6ad7SLin Ling /*
8463f9d6ad7SLin Ling  * Pool statistics.  Note: all fields should be 64-bit because this
8473f9d6ad7SLin Ling  * is passed between kernel and userland as an nvlist uint64 array.
8483f9d6ad7SLin Ling  */
8493f9d6ad7SLin Ling typedef struct pool_scan_stat {
8503f9d6ad7SLin Ling 	/* values stored on disk */
8513f9d6ad7SLin Ling 	uint64_t	pss_func;	/* pool_scan_func_t */
8523f9d6ad7SLin Ling 	uint64_t	pss_state;	/* dsl_scan_state_t */
8533f9d6ad7SLin Ling 	uint64_t	pss_start_time;	/* scan start time */
8543f9d6ad7SLin Ling 	uint64_t	pss_end_time;	/* scan end time */
8553f9d6ad7SLin Ling 	uint64_t	pss_to_examine;	/* total bytes to scan */
856a3874b8bSToomas Soome 	uint64_t	pss_examined;	/* total bytes located by scanner */
8573f9d6ad7SLin Ling 	uint64_t	pss_to_process; /* total bytes to process */
8583f9d6ad7SLin Ling 	uint64_t	pss_processed;	/* total processed bytes */
8593f9d6ad7SLin Ling 	uint64_t	pss_errors;	/* scan errors	*/
8603f9d6ad7SLin Ling 
8613f9d6ad7SLin Ling 	/* values not stored on disk */
8623f9d6ad7SLin Ling 	uint64_t	pss_pass_exam;	/* examined bytes per scan pass */
863a3874b8bSToomas Soome 	uint64_t	pss_pass_issued; /* issued bytes per scan pass */
8643f9d6ad7SLin Ling 	uint64_t	pss_pass_start;	/* start time of a scan pass */
8651702cce7SAlek Pinchuk 	uint64_t	pss_pass_scrub_pause; /* pause time of a scurb pass */
8661702cce7SAlek Pinchuk 	/* cumulative time scrub spent paused, needed for rate calculation */
8671702cce7SAlek Pinchuk 	uint64_t	pss_pass_scrub_spent_paused;
868a3874b8bSToomas Soome 
869a3874b8bSToomas Soome 	/* Sorted scrubbing new fields */
870a3874b8bSToomas Soome 	/* Stored on disk */
871a3874b8bSToomas Soome 	uint64_t	pss_issued;	/* total bytes checked by scanner */
8723f9d6ad7SLin Ling } pool_scan_stat_t;
8733f9d6ad7SLin Ling 
874eb633035STom Caputi /*
875eb633035STom Caputi  * Errata described by http://zfsonlinux.org/msg/ZFS-8000-ER.  The ordering
876eb633035STom Caputi  * of this enum must be maintained to ensure the errata identifiers map to
877eb633035STom Caputi  * the correct documentation.  New errata may only be appended to the list
878eb633035STom Caputi  * and must contain corresponding documentation at the above link.
879eb633035STom Caputi  */
880eb633035STom Caputi typedef enum zpool_errata {
881eb633035STom Caputi 	ZPOOL_ERRATA_NONE,
882eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_2094_SCRUB,
883eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY,
884eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_6845_ENCRYPTION,
885eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_8308_ENCRYPTION,
886eb633035STom Caputi } zpool_errata_t;
887eb633035STom Caputi 
8885cabbc6bSPrashanth Sreenivasa typedef struct pool_removal_stat {
8895cabbc6bSPrashanth Sreenivasa 	uint64_t prs_state; /* dsl_scan_state_t */
8905cabbc6bSPrashanth Sreenivasa 	uint64_t prs_removing_vdev;
8915cabbc6bSPrashanth Sreenivasa 	uint64_t prs_start_time;
8925cabbc6bSPrashanth Sreenivasa 	uint64_t prs_end_time;
8935cabbc6bSPrashanth Sreenivasa 	uint64_t prs_to_copy; /* bytes that need to be copied */
8945cabbc6bSPrashanth Sreenivasa 	uint64_t prs_copied; /* bytes copied so far */
8955cabbc6bSPrashanth Sreenivasa 	/*
8965cabbc6bSPrashanth Sreenivasa 	 * bytes of memory used for indirect mappings.
8975cabbc6bSPrashanth Sreenivasa 	 * This includes all removed vdevs.
8985cabbc6bSPrashanth Sreenivasa 	 */
8995cabbc6bSPrashanth Sreenivasa 	uint64_t prs_mapping_memory;
9005cabbc6bSPrashanth Sreenivasa } pool_removal_stat_t;
9015cabbc6bSPrashanth Sreenivasa 
9023f9d6ad7SLin Ling typedef enum dsl_scan_state {
9033f9d6ad7SLin Ling 	DSS_NONE,
9043f9d6ad7SLin Ling 	DSS_SCANNING,
9053f9d6ad7SLin Ling 	DSS_FINISHED,
9063f9d6ad7SLin Ling 	DSS_CANCELED,
9073f9d6ad7SLin Ling 	DSS_NUM_STATES
9083f9d6ad7SLin Ling } dsl_scan_state_t;
9093f9d6ad7SLin Ling 
91086714001SSerapheim Dimitropoulos typedef enum {
91186714001SSerapheim Dimitropoulos 	CS_NONE,
91286714001SSerapheim Dimitropoulos 	CS_CHECKPOINT_EXISTS,
91386714001SSerapheim Dimitropoulos 	CS_CHECKPOINT_DISCARDING,
91486714001SSerapheim Dimitropoulos 	CS_NUM_STATES
91586714001SSerapheim Dimitropoulos } checkpoint_state_t;
91686714001SSerapheim Dimitropoulos 
91786714001SSerapheim Dimitropoulos typedef struct pool_checkpoint_stat {
91886714001SSerapheim Dimitropoulos 	uint64_t pcs_state;		/* checkpoint_state_t */
91986714001SSerapheim Dimitropoulos 	uint64_t pcs_start_time;	/* time checkpoint/discard started */
92086714001SSerapheim Dimitropoulos 	uint64_t pcs_space;		/* checkpointed space */
92186714001SSerapheim Dimitropoulos } pool_checkpoint_stat_t;
9223f9d6ad7SLin Ling 
923094e47e9SGeorge Wilson typedef enum {
924094e47e9SGeorge Wilson 	VDEV_INITIALIZE_NONE,
925094e47e9SGeorge Wilson 	VDEV_INITIALIZE_ACTIVE,
926094e47e9SGeorge Wilson 	VDEV_INITIALIZE_CANCELED,
927094e47e9SGeorge Wilson 	VDEV_INITIALIZE_SUSPENDED,
928094e47e9SGeorge Wilson 	VDEV_INITIALIZE_COMPLETE
929094e47e9SGeorge Wilson } vdev_initializing_state_t;
930094e47e9SGeorge Wilson 
931fa9e4066Sahrens /*
932fa9e4066Sahrens  * Vdev statistics.  Note: all fields should be 64-bit because this
933fa9e4066Sahrens  * is passed between kernel and userland as an nvlist uint64 array.
934fa9e4066Sahrens  */
935fa9e4066Sahrens typedef struct vdev_stat {
936fa9e4066Sahrens 	hrtime_t	vs_timestamp;		/* time since vdev load	*/
937fa9e4066Sahrens 	uint64_t	vs_state;		/* vdev state		*/
938fa9e4066Sahrens 	uint64_t	vs_aux;			/* see vdev_aux_t	*/
939fa9e4066Sahrens 	uint64_t	vs_alloc;		/* space allocated	*/
940fa9e4066Sahrens 	uint64_t	vs_space;		/* total capacity	*/
94199653d4eSeschrock 	uint64_t	vs_dspace;		/* deflated capacity	*/
9422a79c5feSlling 	uint64_t	vs_rsize;		/* replaceable dev size */
9434263d13fSGeorge Wilson 	uint64_t	vs_esize;		/* expandable dev size */
944fa9e4066Sahrens 	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
945fa9e4066Sahrens 	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
946fa9e4066Sahrens 	uint64_t	vs_read_errors;		/* read errors		*/
947fa9e4066Sahrens 	uint64_t	vs_write_errors;	/* write errors		*/
948fa9e4066Sahrens 	uint64_t	vs_checksum_errors;	/* checksum errors	*/
949094e47e9SGeorge Wilson 	uint64_t	vs_initialize_errors;	/* initializing errors	*/
950fa9e4066Sahrens 	uint64_t	vs_self_healed;		/* self-healed bytes	*/
9513f9d6ad7SLin Ling 	uint64_t	vs_scan_removing;	/* removing?	*/
9523f9d6ad7SLin Ling 	uint64_t	vs_scan_processed;	/* scan processed bytes	*/
9532e4c9986SGeorge Wilson 	uint64_t	vs_fragmentation;	/* device fragmentation */
954094e47e9SGeorge Wilson 	uint64_t	vs_initialize_bytes_done; /* bytes initialized */
955094e47e9SGeorge Wilson 	uint64_t	vs_initialize_bytes_est; /* total bytes to initialize */
956094e47e9SGeorge Wilson 	uint64_t	vs_initialize_state;	/* vdev_initialzing_state_t */
957094e47e9SGeorge Wilson 	uint64_t	vs_initialize_action_time; /* time_t */
95886714001SSerapheim Dimitropoulos 	uint64_t	vs_checkpoint_space;    /* checkpoint-consumed space */
959e4c795beSTom Caputi 	uint64_t	vs_resilver_deferred;	/* resilver deferred	*/
960fa9e4066Sahrens } vdev_stat_t;
961fa9e4066Sahrens 
9629eb19f4dSGeorge Wilson /*
9639eb19f4dSGeorge Wilson  * DDT statistics.  Note: all fields should be 64-bit because this
9649eb19f4dSGeorge Wilson  * is passed between kernel and userland as an nvlist uint64 array.
9659eb19f4dSGeorge Wilson  */
9669eb19f4dSGeorge Wilson typedef struct ddt_object {
96704e56356SAndriy Gapon 	uint64_t	ddo_count;	/* number of elments in ddt	*/
9689eb19f4dSGeorge Wilson 	uint64_t	ddo_dspace;	/* size of ddt on disk		*/
9699eb19f4dSGeorge Wilson 	uint64_t	ddo_mspace;	/* size of ddt in-core		*/
9709eb19f4dSGeorge Wilson } ddt_object_t;
9719eb19f4dSGeorge Wilson 
9729eb19f4dSGeorge Wilson typedef struct ddt_stat {
9739eb19f4dSGeorge Wilson 	uint64_t	dds_blocks;	/* blocks			*/
9749eb19f4dSGeorge Wilson 	uint64_t	dds_lsize;	/* logical size			*/
9759eb19f4dSGeorge Wilson 	uint64_t	dds_psize;	/* physical size		*/
9769eb19f4dSGeorge Wilson 	uint64_t	dds_dsize;	/* deflated allocated size	*/
9779eb19f4dSGeorge Wilson 	uint64_t	dds_ref_blocks;	/* referenced blocks		*/
9789eb19f4dSGeorge Wilson 	uint64_t	dds_ref_lsize;	/* referenced lsize * refcnt	*/
9799eb19f4dSGeorge Wilson 	uint64_t	dds_ref_psize;	/* referenced psize * refcnt	*/
9809eb19f4dSGeorge Wilson 	uint64_t	dds_ref_dsize;	/* referenced dsize * refcnt	*/
9819eb19f4dSGeorge Wilson } ddt_stat_t;
9829eb19f4dSGeorge Wilson 
9839eb19f4dSGeorge Wilson typedef struct ddt_histogram {
9849eb19f4dSGeorge Wilson 	ddt_stat_t	ddh_stat[64];	/* power-of-two histogram buckets */
9859eb19f4dSGeorge Wilson } ddt_histogram_t;
9869eb19f4dSGeorge Wilson 
987e7cbe64fSgw #define	ZVOL_DRIVER	"zvol"
988fa9e4066Sahrens #define	ZFS_DRIVER	"zfs"
989fa9e4066Sahrens #define	ZFS_DEV		"/dev/zfs"
9906401734dSWill Andrews #define	ZFS_DISK_ROOT	"/dev/dsk"
9916401734dSWill Andrews #define	ZFS_DISK_ROOTD	ZFS_DISK_ROOT "/"
9926401734dSWill Andrews #define	ZFS_RDISK_ROOT	"/dev/rdsk"
9936401734dSWill Andrews #define	ZFS_RDISK_ROOTD	ZFS_RDISK_ROOT "/"
994fa9e4066Sahrens 
995681d9761SEric Taylor /* general zvol path */
996681d9761SEric Taylor #define	ZVOL_DIR		"/dev/zvol"
997681d9761SEric Taylor /* expansion */
998573ca77eSGeorge Wilson #define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zfs@0:"
999681d9761SEric Taylor /* for dump and swap */
1000681d9761SEric Taylor #define	ZVOL_FULL_DEV_DIR	ZVOL_DIR "/dsk/"
1001681d9761SEric Taylor #define	ZVOL_FULL_RDEV_DIR	ZVOL_DIR "/rdsk/"
1002fa9e4066Sahrens 
1003fa9e4066Sahrens #define	ZVOL_PROP_NAME		"name"
1004c1449561SEric Taylor #define	ZVOL_DEFAULT_BLOCKSIZE	8192
1005fa9e4066Sahrens 
1006fa9e4066Sahrens /*
1007fa9e4066Sahrens  * /dev/zfs ioctl numbers.
1008fa9e4066Sahrens  */
1009fa9e4066Sahrens typedef enum zfs_ioc {
10104445fffbSMatthew Ahrens 	ZFS_IOC_FIRST =	('Z' << 8),
10114445fffbSMatthew Ahrens 	ZFS_IOC = ZFS_IOC_FIRST,
10124445fffbSMatthew Ahrens 	ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
1013fa9e4066Sahrens 	ZFS_IOC_POOL_DESTROY,
1014fa9e4066Sahrens 	ZFS_IOC_POOL_IMPORT,
1015fa9e4066Sahrens 	ZFS_IOC_POOL_EXPORT,
1016fa9e4066Sahrens 	ZFS_IOC_POOL_CONFIGS,
1017fa9e4066Sahrens 	ZFS_IOC_POOL_STATS,
1018fa9e4066Sahrens 	ZFS_IOC_POOL_TRYIMPORT,
10193f9d6ad7SLin Ling 	ZFS_IOC_POOL_SCAN,
1020fa9e4066Sahrens 	ZFS_IOC_POOL_FREEZE,
1021eaca9bbdSeschrock 	ZFS_IOC_POOL_UPGRADE,
102206eeb2adSek 	ZFS_IOC_POOL_GET_HISTORY,
1023fa9e4066Sahrens 	ZFS_IOC_VDEV_ADD,
1024fa9e4066Sahrens 	ZFS_IOC_VDEV_REMOVE,
10253d7072f8Seschrock 	ZFS_IOC_VDEV_SET_STATE,
1026fa9e4066Sahrens 	ZFS_IOC_VDEV_ATTACH,
1027fa9e4066Sahrens 	ZFS_IOC_VDEV_DETACH,
1028c67d9675Seschrock 	ZFS_IOC_VDEV_SETPATH,
10296809eb4eSEric Schrock 	ZFS_IOC_VDEV_SETFRU,
1030fa9e4066Sahrens 	ZFS_IOC_OBJSET_STATS,
1031de8267e0Stimh 	ZFS_IOC_OBJSET_ZPLPROPS,
1032fa9e4066Sahrens 	ZFS_IOC_DATASET_LIST_NEXT,
1033fa9e4066Sahrens 	ZFS_IOC_SNAPSHOT_LIST_NEXT,
1034fa9e4066Sahrens 	ZFS_IOC_SET_PROP,
1035fa9e4066Sahrens 	ZFS_IOC_CREATE,
1036fa9e4066Sahrens 	ZFS_IOC_DESTROY,
1037fa9e4066Sahrens 	ZFS_IOC_ROLLBACK,
1038fa9e4066Sahrens 	ZFS_IOC_RENAME,
10393cb34c60Sahrens 	ZFS_IOC_RECV,
10403cb34c60Sahrens 	ZFS_IOC_SEND,
1041ea8dc4b6Seschrock 	ZFS_IOC_INJECT_FAULT,
1042ea8dc4b6Seschrock 	ZFS_IOC_CLEAR_FAULT,
1043ea8dc4b6Seschrock 	ZFS_IOC_INJECT_LIST_NEXT,
1044ea8dc4b6Seschrock 	ZFS_IOC_ERROR_LOG,
1045ea8dc4b6Seschrock 	ZFS_IOC_CLEAR,
10461d452cf5Sahrens 	ZFS_IOC_PROMOTE,
104755434c77Sek 	ZFS_IOC_SNAPSHOT,
104855434c77Sek 	ZFS_IOC_DSOBJ_TO_DSNAME,
1049b1b8ab34Slling 	ZFS_IOC_OBJ_TO_PATH,
1050b1b8ab34Slling 	ZFS_IOC_POOL_SET_PROPS,
1051ecd6cf80Smarks 	ZFS_IOC_POOL_GET_PROPS,
1052ecd6cf80Smarks 	ZFS_IOC_SET_FSACL,
1053ecd6cf80Smarks 	ZFS_IOC_GET_FSACL,
1054e45ce728Sahrens 	ZFS_IOC_SHARE,
1055743a77edSAlan Wright 	ZFS_IOC_INHERIT_PROP,
105614843421SMatthew Ahrens 	ZFS_IOC_SMB_ACL,
105714843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_ONE,
105814843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_MANY,
1059842727c2SChris Kirby 	ZFS_IOC_USERSPACE_UPGRADE,
1060842727c2SChris Kirby 	ZFS_IOC_HOLD,
1061842727c2SChris Kirby 	ZFS_IOC_RELEASE,
106292241e0bSTom Erickson 	ZFS_IOC_GET_HOLDS,
10631195e687SMark J Musante 	ZFS_IOC_OBJSET_RECVD_PROPS,
106499d5e173STim Haley 	ZFS_IOC_VDEV_SPLIT,
106599d5e173STim Haley 	ZFS_IOC_NEXT_OBJ,
106699d5e173STim Haley 	ZFS_IOC_DIFF,
106799d5e173STim Haley 	ZFS_IOC_TMP_SNAPSHOT,
1068e9103aaeSGarrett D'Amore 	ZFS_IOC_OBJ_TO_STATS,
106919b94df9SMatthew Ahrens 	ZFS_IOC_SPACE_WRITTEN,
107019b94df9SMatthew Ahrens 	ZFS_IOC_SPACE_SNAPS,
10714445fffbSMatthew Ahrens 	ZFS_IOC_DESTROY_SNAPS,
10724263d13fSGeorge Wilson 	ZFS_IOC_POOL_REGUID,
10734e3c9f44SBill Pijewski 	ZFS_IOC_POOL_REOPEN,
10744445fffbSMatthew Ahrens 	ZFS_IOC_SEND_PROGRESS,
10754445fffbSMatthew Ahrens 	ZFS_IOC_LOG_HISTORY,
10764445fffbSMatthew Ahrens 	ZFS_IOC_SEND_NEW,
10774445fffbSMatthew Ahrens 	ZFS_IOC_SEND_SPACE,
10784445fffbSMatthew Ahrens 	ZFS_IOC_CLONE,
107978f17100SMatthew Ahrens 	ZFS_IOC_BOOKMARK,
108078f17100SMatthew Ahrens 	ZFS_IOC_GET_BOOKMARKS,
108178f17100SMatthew Ahrens 	ZFS_IOC_DESTROY_BOOKMARKS,
1082dfc11533SChris Williamson 	ZFS_IOC_CHANNEL_PROGRAM,
10835cabbc6bSPrashanth Sreenivasa 	ZFS_IOC_REMAP,
108486714001SSerapheim Dimitropoulos 	ZFS_IOC_POOL_CHECKPOINT,
108586714001SSerapheim Dimitropoulos 	ZFS_IOC_POOL_DISCARD_CHECKPOINT,
1086094e47e9SGeorge Wilson 	ZFS_IOC_POOL_INITIALIZE,
10879c2acf00SAlek Pinchuk 	ZFS_IOC_POOL_SYNC,
1088eb633035STom Caputi 	ZFS_IOC_LOAD_KEY,
1089eb633035STom Caputi 	ZFS_IOC_UNLOAD_KEY,
1090eb633035STom Caputi 	ZFS_IOC_CHANGE_KEY,
10914445fffbSMatthew Ahrens 	ZFS_IOC_LAST
1092fa9e4066Sahrens } zfs_ioc_t;
1093fa9e4066Sahrens 
109486714001SSerapheim Dimitropoulos /*
109586714001SSerapheim Dimitropoulos  * ZFS-specific error codes used for returning descriptive errors
109686714001SSerapheim Dimitropoulos  * to the userland through zfs ioctls.
109786714001SSerapheim Dimitropoulos  *
109886714001SSerapheim Dimitropoulos  * The enum implicitly includes all the error codes from errno.h.
109986714001SSerapheim Dimitropoulos  * New code should use and extend this enum for errors that are
110086714001SSerapheim Dimitropoulos  * not described precisely by generic errno codes.
110186714001SSerapheim Dimitropoulos  */
110286714001SSerapheim Dimitropoulos typedef enum {
110386714001SSerapheim Dimitropoulos 	ZFS_ERR_CHECKPOINT_EXISTS = 1024,
110486714001SSerapheim Dimitropoulos 	ZFS_ERR_DISCARDING_CHECKPOINT,
110586714001SSerapheim Dimitropoulos 	ZFS_ERR_NO_CHECKPOINT,
110686714001SSerapheim Dimitropoulos 	ZFS_ERR_DEVRM_IN_PROGRESS,
1107eb633035STom Caputi 	ZFS_ERR_VDEV_TOO_BIG,
1108eb633035STom Caputi 	ZFS_ERR_FROM_IVSET_GUID_MISSING,
1109eb633035STom Caputi 	ZFS_ERR_FROM_IVSET_GUID_MISMATCH,
1110eb633035STom Caputi 	ZFS_ERR_SPILL_BLOCK_FLAG_MISSING,
111186714001SSerapheim Dimitropoulos } zfs_errno_t;
111286714001SSerapheim Dimitropoulos 
1113ea8dc4b6Seschrock /*
1114ea8dc4b6Seschrock  * Internal SPA load state.  Used by FMA diagnosis engine.
1115ea8dc4b6Seschrock  */
1116ea8dc4b6Seschrock typedef enum {
11179eb19f4dSGeorge Wilson 	SPA_LOAD_NONE,		/* no load in progress	*/
11189eb19f4dSGeorge Wilson 	SPA_LOAD_OPEN,		/* normal open		*/
11199eb19f4dSGeorge Wilson 	SPA_LOAD_IMPORT,	/* import in progress	*/
1120468c413aSTim Haley 	SPA_LOAD_TRYIMPORT,	/* tryimport in progress */
11219eb19f4dSGeorge Wilson 	SPA_LOAD_RECOVER,	/* recovery requested	*/
11220f7643c7SGeorge Wilson 	SPA_LOAD_ERROR,		/* load failed		*/
11230f7643c7SGeorge Wilson 	SPA_LOAD_CREATE		/* creation in progress */
1124ea8dc4b6Seschrock } spa_load_state_t;
1125ea8dc4b6Seschrock 
1126eb633035STom Caputi /* supported encryption algorithms */
1127eb633035STom Caputi enum zio_encrypt {
1128eb633035STom Caputi 	ZIO_CRYPT_INHERIT = 0,
1129eb633035STom Caputi 	ZIO_CRYPT_ON,
1130eb633035STom Caputi 	ZIO_CRYPT_OFF,
1131eb633035STom Caputi 	ZIO_CRYPT_AES_128_CCM,
1132eb633035STom Caputi 	ZIO_CRYPT_AES_192_CCM,
1133eb633035STom Caputi 	ZIO_CRYPT_AES_256_CCM,
1134eb633035STom Caputi 	ZIO_CRYPT_AES_128_GCM,
1135eb633035STom Caputi 	ZIO_CRYPT_AES_192_GCM,
1136eb633035STom Caputi 	ZIO_CRYPT_AES_256_GCM,
1137eb633035STom Caputi 	ZIO_CRYPT_FUNCTIONS
1138eb633035STom Caputi };
1139eb633035STom Caputi 
1140e9dbad6fSeschrock /*
1141e9dbad6fSeschrock  * Bookmark name values.
1142e9dbad6fSeschrock  */
114355434c77Sek #define	ZPOOL_ERR_LIST		"error list"
1144e9dbad6fSeschrock #define	ZPOOL_ERR_DATASET	"dataset"
1145e9dbad6fSeschrock #define	ZPOOL_ERR_OBJECT	"object"
1146e9dbad6fSeschrock 
114706eeb2adSek #define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
114806eeb2adSek 
114906eeb2adSek /*
115006eeb2adSek  * The following are names used in the nvlist describing
115106eeb2adSek  * the pool's history log.
115206eeb2adSek  */
115306eeb2adSek #define	ZPOOL_HIST_RECORD	"history record"
115406eeb2adSek #define	ZPOOL_HIST_TIME		"history time"
115506eeb2adSek #define	ZPOOL_HIST_CMD		"history command"
1156ecd6cf80Smarks #define	ZPOOL_HIST_WHO		"history who"
1157ecd6cf80Smarks #define	ZPOOL_HIST_ZONE		"history zone"
1158ecd6cf80Smarks #define	ZPOOL_HIST_HOST		"history hostname"
1159ecd6cf80Smarks #define	ZPOOL_HIST_TXG		"history txg"
1160ecd6cf80Smarks #define	ZPOOL_HIST_INT_EVENT	"history internal event"
1161ecd6cf80Smarks #define	ZPOOL_HIST_INT_STR	"history internal str"
11624445fffbSMatthew Ahrens #define	ZPOOL_HIST_INT_NAME	"internal_name"
11634445fffbSMatthew Ahrens #define	ZPOOL_HIST_IOCTL	"ioctl"
11644445fffbSMatthew Ahrens #define	ZPOOL_HIST_INPUT_NVL	"in_nvl"
11654445fffbSMatthew Ahrens #define	ZPOOL_HIST_OUTPUT_NVL	"out_nvl"
11664445fffbSMatthew Ahrens #define	ZPOOL_HIST_DSNAME	"dsname"
11674445fffbSMatthew Ahrens #define	ZPOOL_HIST_DSID		"dsid"
1168dfc11533SChris Williamson #define	ZPOOL_HIST_ERRNO	"errno"
116906eeb2adSek 
1170094e47e9SGeorge Wilson /*
1171094e47e9SGeorge Wilson  * The following are names used when invoking ZFS_IOC_POOL_INITIALIZE.
1172094e47e9SGeorge Wilson  */
1173094e47e9SGeorge Wilson #define	ZPOOL_INITIALIZE_COMMAND	"initialize_command"
1174094e47e9SGeorge Wilson #define	ZPOOL_INITIALIZE_VDEVS		"initialize_vdevs"
1175094e47e9SGeorge Wilson 
1176eb633035STom Caputi /*
1177eb633035STom Caputi  * Special nvlist name that will not have its args recorded in the pool's
1178eb633035STom Caputi  * history log.
1179eb633035STom Caputi  */
1180eb633035STom Caputi #define	ZPOOL_HIDDEN_ARGS	"hidden_args"
1181eb633035STom Caputi 
11823d7072f8Seschrock /*
11833d7072f8Seschrock  * Flags for ZFS_IOC_VDEV_SET_STATE
11843d7072f8Seschrock  */
11853d7072f8Seschrock #define	ZFS_ONLINE_CHECKREMOVE	0x1
11863d7072f8Seschrock #define	ZFS_ONLINE_UNSPARE	0x2
11873d7072f8Seschrock #define	ZFS_ONLINE_FORCEFAULT	0x4
1188573ca77eSGeorge Wilson #define	ZFS_ONLINE_EXPAND	0x8
11893d7072f8Seschrock #define	ZFS_OFFLINE_TEMPORARY	0x1
11903d7072f8Seschrock 
11914b964adaSGeorge Wilson /*
11924b964adaSGeorge Wilson  * Flags for ZFS_IOC_POOL_IMPORT
11934b964adaSGeorge Wilson  */
11944b964adaSGeorge Wilson #define	ZFS_IMPORT_NORMAL	0x0
11954b964adaSGeorge Wilson #define	ZFS_IMPORT_VERBATIM	0x1
11964b964adaSGeorge Wilson #define	ZFS_IMPORT_ANY_HOST	0x2
11974b964adaSGeorge Wilson #define	ZFS_IMPORT_MISSING_LOG	0x4
1198f9af39baSGeorge Wilson #define	ZFS_IMPORT_ONLY		0x8
119986714001SSerapheim Dimitropoulos #define	ZFS_IMPORT_CHECKPOINT	0x10
120004e56356SAndriy Gapon #define	ZFS_IMPORT_TEMP_NAME	0x20
1201e0f1c0afSOlaf Faaland #define	ZFS_IMPORT_SKIP_MMP	0x40
1202eb633035STom Caputi #define	ZFS_IMPORT_LOAD_KEYS	0x80
12034b964adaSGeorge Wilson 
1204dfc11533SChris Williamson /*
1205dfc11533SChris Williamson  * Channel program argument/return nvlist keys and defaults.
1206dfc11533SChris Williamson  */
1207dfc11533SChris Williamson #define	ZCP_ARG_PROGRAM		"program"
1208dfc11533SChris Williamson #define	ZCP_ARG_ARGLIST		"arg"
1209a3b28680SSerapheim Dimitropoulos #define	ZCP_ARG_SYNC		"sync"
1210dfc11533SChris Williamson #define	ZCP_ARG_INSTRLIMIT	"instrlimit"
1211dfc11533SChris Williamson #define	ZCP_ARG_MEMLIMIT	"memlimit"
1212dfc11533SChris Williamson 
1213dfc11533SChris Williamson #define	ZCP_ARG_CLIARGV		"argv"
1214dfc11533SChris Williamson 
1215dfc11533SChris Williamson #define	ZCP_RET_ERROR		"error"
1216dfc11533SChris Williamson #define	ZCP_RET_RETURN		"return"
1217dfc11533SChris Williamson 
1218dfc11533SChris Williamson #define	ZCP_DEFAULT_INSTRLIMIT	(10 * 1000 * 1000)
1219dfc11533SChris Williamson #define	ZCP_MAX_INSTRLIMIT	(10 * ZCP_DEFAULT_INSTRLIMIT)
1220dfc11533SChris Williamson #define	ZCP_DEFAULT_MEMLIMIT	(10 * 1024 * 1024)
1221dfc11533SChris Williamson #define	ZCP_MAX_MEMLIMIT	(10 * ZCP_DEFAULT_MEMLIMIT)
1222dfc11533SChris Williamson 
12233d7072f8Seschrock /*
12243d7072f8Seschrock  * Sysevent payload members.  ZFS will generate the following sysevents with the
12253d7072f8Seschrock  * given payloads:
12263d7072f8Seschrock  *
12273d7072f8Seschrock  *	ESC_ZFS_RESILVER_START
12283d7072f8Seschrock  *	ESC_ZFS_RESILVER_END
12293d7072f8Seschrock  *	ESC_ZFS_POOL_DESTROY
1230e9103aaeSGarrett D'Amore  *	ESC_ZFS_POOL_REGUID
12313d7072f8Seschrock  *
12323d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
12333d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
12343d7072f8Seschrock  *
12353d7072f8Seschrock  *	ESC_ZFS_VDEV_REMOVE
12363d7072f8Seschrock  *	ESC_ZFS_VDEV_CLEAR
12373d7072f8Seschrock  *	ESC_ZFS_VDEV_CHECK
12383d7072f8Seschrock  *
12393d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
12403d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
12413d7072f8Seschrock  *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
12423d7072f8Seschrock  *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
1243ce1577b0SDave Eddy  *
1244ce1577b0SDave Eddy  *	ESC_ZFS_HISTORY_EVENT
1245ce1577b0SDave Eddy  *
1246ce1577b0SDave Eddy  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
1247ce1577b0SDave Eddy  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
1248ce1577b0SDave Eddy  *		ZFS_EV_HIST_TIME	DATA_TYPE_UINT64	(optional)
1249ce1577b0SDave Eddy  *		ZFS_EV_HIST_CMD		DATA_TYPE_STRING	(optional)
1250ce1577b0SDave Eddy  *		ZFS_EV_HIST_WHO		DATA_TYPE_UINT64	(optional)
1251ce1577b0SDave Eddy  *		ZFS_EV_HIST_ZONE	DATA_TYPE_STRING	(optional)
1252ce1577b0SDave Eddy  *		ZFS_EV_HIST_HOST	DATA_TYPE_STRING	(optional)
1253ce1577b0SDave Eddy  *		ZFS_EV_HIST_TXG		DATA_TYPE_UINT64	(optional)
1254ce1577b0SDave Eddy  *		ZFS_EV_HIST_INT_EVENT	DATA_TYPE_UINT64	(optional)
1255ce1577b0SDave Eddy  *		ZFS_EV_HIST_INT_STR	DATA_TYPE_STRING	(optional)
1256ce1577b0SDave Eddy  *		ZFS_EV_HIST_INT_NAME	DATA_TYPE_STRING	(optional)
1257ce1577b0SDave Eddy  *		ZFS_EV_HIST_IOCTL	DATA_TYPE_STRING	(optional)
1258ce1577b0SDave Eddy  *		ZFS_EV_HIST_DSNAME	DATA_TYPE_STRING	(optional)
1259ce1577b0SDave Eddy  *		ZFS_EV_HIST_DSID	DATA_TYPE_UINT64	(optional)
1260ce1577b0SDave Eddy  *
1261ce1577b0SDave Eddy  * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the
1262ce1577b0SDave Eddy  * history log nvlist.  The keynames will be free of any spaces or other
1263ce1577b0SDave Eddy  * characters that could be potentially unexpected to consumers of the
1264ce1577b0SDave Eddy  * sysevents.
12653d7072f8Seschrock  */
12663d7072f8Seschrock #define	ZFS_EV_POOL_NAME	"pool_name"
12673d7072f8Seschrock #define	ZFS_EV_POOL_GUID	"pool_guid"
12683d7072f8Seschrock #define	ZFS_EV_VDEV_PATH	"vdev_path"
12693d7072f8Seschrock #define	ZFS_EV_VDEV_GUID	"vdev_guid"
1270ce1577b0SDave Eddy #define	ZFS_EV_HIST_TIME	"history_time"
1271ce1577b0SDave Eddy #define	ZFS_EV_HIST_CMD		"history_command"
1272ce1577b0SDave Eddy #define	ZFS_EV_HIST_WHO		"history_who"
1273ce1577b0SDave Eddy #define	ZFS_EV_HIST_ZONE	"history_zone"
1274ce1577b0SDave Eddy #define	ZFS_EV_HIST_HOST	"history_hostname"
1275ce1577b0SDave Eddy #define	ZFS_EV_HIST_TXG		"history_txg"
1276ce1577b0SDave Eddy #define	ZFS_EV_HIST_INT_EVENT	"history_internal_event"
1277ce1577b0SDave Eddy #define	ZFS_EV_HIST_INT_STR	"history_internal_str"
1278ce1577b0SDave Eddy #define	ZFS_EV_HIST_INT_NAME	"history_internal_name"
1279ce1577b0SDave Eddy #define	ZFS_EV_HIST_IOCTL	"history_ioctl"
1280ce1577b0SDave Eddy #define	ZFS_EV_HIST_DSNAME	"history_dsname"
1281ce1577b0SDave Eddy #define	ZFS_EV_HIST_DSID	"history_dsid"
12823d7072f8Seschrock 
1283fa9e4066Sahrens #ifdef	__cplusplus
1284fa9e4066Sahrens }
1285fa9e4066Sahrens #endif
1286fa9e4066Sahrens 
1287fa9e4066Sahrens #endif	/* _SYS_FS_ZFS_H */
1288