xref: /illumos-gate/usr/src/uts/common/sys/fs/zfs.h (revision f67950b21e185934ccabe311516f4dcbdb00ef79)
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,
185*f67950b2SNasf-Fan 	ZFS_PROP_USEROBJUSED,
186*f67950b2SNasf-Fan 	ZFS_PROP_USEROBJQUOTA,
187*f67950b2SNasf-Fan 	ZFS_PROP_GROUPOBJUSED,
188*f67950b2SNasf-Fan 	ZFS_PROP_GROUPOBJQUOTA,
189*f67950b2SNasf-Fan 	ZFS_PROP_PROJECTUSED,
190*f67950b2SNasf-Fan 	ZFS_PROP_PROJECTQUOTA,
191*f67950b2SNasf-Fan 	ZFS_PROP_PROJECTOBJUSED,
192*f67950b2SNasf-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,
236990b4856Slling 	ZPOOL_NUM_PROPS
237990b4856Slling } zpool_prop_t;
238b1b8ab34Slling 
2398704186eSDan McDonald /* Small enough to not hog a whole line of printout in zpool(1M). */
2408704186eSDan McDonald #define	ZPROP_MAX_COMMENT	32
2418704186eSDan McDonald 
242990b4856Slling #define	ZPROP_VALUE		"value"
243990b4856Slling #define	ZPROP_SOURCE		"source"
2447f7322feSeschrock 
245b1b8ab34Slling typedef enum {
246990b4856Slling 	ZPROP_SRC_NONE = 0x1,
247990b4856Slling 	ZPROP_SRC_DEFAULT = 0x2,
248990b4856Slling 	ZPROP_SRC_TEMPORARY = 0x4,
249990b4856Slling 	ZPROP_SRC_LOCAL = 0x8,
25092241e0bSTom Erickson 	ZPROP_SRC_INHERITED = 0x10,
25192241e0bSTom Erickson 	ZPROP_SRC_RECEIVED = 0x20
252990b4856Slling } zprop_source_t;
253990b4856Slling 
25492241e0bSTom Erickson #define	ZPROP_SRC_ALL	0x3f
25592241e0bSTom Erickson 
25692241e0bSTom Erickson #define	ZPROP_SOURCE_VAL_RECVD	"$recvd"
25792241e0bSTom Erickson #define	ZPROP_N_MORE_ERRORS	"N_MORE_ERRORS"
25892241e0bSTom Erickson /*
25992241e0bSTom Erickson  * Dataset flag implemented as a special entry in the props zap object
26092241e0bSTom Erickson  * indicating that the dataset has received properties on or after
26192241e0bSTom Erickson  * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
26292241e0bSTom Erickson  * just as it did in earlier versions, and thereafter, local properties are
26392241e0bSTom Erickson  * preserved.
26492241e0bSTom Erickson  */
26592241e0bSTom Erickson #define	ZPROP_HAS_RECVD		"$hasrecvd"
26692241e0bSTom Erickson 
26792241e0bSTom Erickson typedef enum {
26892241e0bSTom Erickson 	ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */
26992241e0bSTom Erickson 	ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */
27092241e0bSTom Erickson } zprop_errflags_t;
271990b4856Slling 
272990b4856Slling typedef int (*zprop_func)(int, void *);
273990b4856Slling 
2740a48a24eStimh /*
2750a48a24eStimh  * Properties to be set on the root file system of a new pool
2760a48a24eStimh  * are stuffed into their own nvlist, which is then included in
2770a48a24eStimh  * the properties nvlist with the pool properties.
2780a48a24eStimh  */
2790a48a24eStimh #define	ZPOOL_ROOTFS_PROPS	"root-props-nvl"
2800a48a24eStimh 
281dfc11533SChris Williamson /*
282dfc11533SChris Williamson  * Length of 'written@' and 'written#'
283dfc11533SChris Williamson  */
284dfc11533SChris Williamson #define	ZFS_WRITTEN_PROP_PREFIX_LEN	8
285dfc11533SChris Williamson 
286990b4856Slling /*
287990b4856Slling  * Dataset property functions shared between libzfs and kernel.
288990b4856Slling  */
289990b4856Slling const char *zfs_prop_default_string(zfs_prop_t);
290990b4856Slling uint64_t zfs_prop_default_numeric(zfs_prop_t);
291990b4856Slling boolean_t zfs_prop_readonly(zfs_prop_t);
292dfc11533SChris Williamson boolean_t zfs_prop_visible(zfs_prop_t prop);
293990b4856Slling boolean_t zfs_prop_inheritable(zfs_prop_t);
294da6c28aaSamw boolean_t zfs_prop_setonce(zfs_prop_t);
295eb633035STom Caputi boolean_t zfs_prop_encryption_key_param(zfs_prop_t);
296eb633035STom Caputi boolean_t zfs_prop_valid_keylocation(const char *, boolean_t);
297990b4856Slling const char *zfs_prop_to_name(zfs_prop_t);
298990b4856Slling zfs_prop_t zfs_name_to_prop(const char *);
299990b4856Slling boolean_t zfs_prop_user(const char *);
30092241e0bSTom Erickson boolean_t zfs_prop_userquota(const char *);
30119b94df9SMatthew Ahrens boolean_t zfs_prop_written(const char *);
302990b4856Slling int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
303990b4856Slling int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
304b24ab676SJeff Bonwick uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
3054853e976Sgw boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
306b1b8ab34Slling 
307990b4856Slling /*
308990b4856Slling  * Pool property functions shared between libzfs and kernel.
309990b4856Slling  */
310990b4856Slling zpool_prop_t zpool_name_to_prop(const char *);
311990b4856Slling const char *zpool_prop_to_name(zpool_prop_t);
312990b4856Slling const char *zpool_prop_default_string(zpool_prop_t);
313990b4856Slling uint64_t zpool_prop_default_numeric(zpool_prop_t);
314990b4856Slling boolean_t zpool_prop_readonly(zpool_prop_t);
315ad135b5dSChristopher Siden boolean_t zpool_prop_feature(const char *);
316ad135b5dSChristopher Siden boolean_t zpool_prop_unsupported(const char *name);
317990b4856Slling int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
318990b4856Slling int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
319b24ab676SJeff Bonwick uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
320b1b8ab34Slling 
321990b4856Slling /*
322990b4856Slling  * Definitions for the Delegation.
323990b4856Slling  */
324ecd6cf80Smarks typedef enum {
325ecd6cf80Smarks 	ZFS_DELEG_WHO_UNKNOWN = 0,
326ecd6cf80Smarks 	ZFS_DELEG_USER = 'u',
327ecd6cf80Smarks 	ZFS_DELEG_USER_SETS = 'U',
328ecd6cf80Smarks 	ZFS_DELEG_GROUP = 'g',
329ecd6cf80Smarks 	ZFS_DELEG_GROUP_SETS = 'G',
330ecd6cf80Smarks 	ZFS_DELEG_EVERYONE = 'e',
331ecd6cf80Smarks 	ZFS_DELEG_EVERYONE_SETS = 'E',
332ecd6cf80Smarks 	ZFS_DELEG_CREATE = 'c',
333ecd6cf80Smarks 	ZFS_DELEG_CREATE_SETS = 'C',
334ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET = 's',
335ecd6cf80Smarks 	ZFS_DELEG_NAMED_SET_SETS = 'S'
336ecd6cf80Smarks } zfs_deleg_who_type_t;
337ecd6cf80Smarks 
338ecd6cf80Smarks typedef enum {
339ecd6cf80Smarks 	ZFS_DELEG_NONE = 0,
340ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCAL = 1,
341ecd6cf80Smarks 	ZFS_DELEG_PERM_DESCENDENT = 2,
342ecd6cf80Smarks 	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
343ecd6cf80Smarks 	ZFS_DELEG_PERM_CREATE = 4
344ecd6cf80Smarks } zfs_deleg_inherit_t;
345ecd6cf80Smarks 
346ecd6cf80Smarks #define	ZFS_DELEG_PERM_UID	"uid"
347ecd6cf80Smarks #define	ZFS_DELEG_PERM_GID	"gid"
348ecd6cf80Smarks #define	ZFS_DELEG_PERM_GROUPS	"groups"
349ecd6cf80Smarks 
3504201a95eSRic Aleshire #define	ZFS_MLSLABEL_DEFAULT	"none"
3514201a95eSRic Aleshire 
352743a77edSAlan Wright #define	ZFS_SMB_ACL_SRC		"src"
353743a77edSAlan Wright #define	ZFS_SMB_ACL_TARGET	"target"
354743a77edSAlan Wright 
355a227b7f4Shs typedef enum {
356a227b7f4Shs 	ZFS_CANMOUNT_OFF = 0,
357a227b7f4Shs 	ZFS_CANMOUNT_ON = 1,
358a227b7f4Shs 	ZFS_CANMOUNT_NOAUTO = 2
359a227b7f4Shs } zfs_canmount_type_t;
360a227b7f4Shs 
361e09fa4daSNeil Perrin typedef enum {
362e09fa4daSNeil Perrin 	ZFS_LOGBIAS_LATENCY = 0,
363e09fa4daSNeil Perrin 	ZFS_LOGBIAS_THROUGHPUT = 1
364e09fa4daSNeil Perrin } zfs_logbias_op_t;
365e09fa4daSNeil Perrin 
366da6c28aaSamw typedef enum zfs_share_op {
367da6c28aaSamw 	ZFS_SHARE_NFS = 0,
368da6c28aaSamw 	ZFS_UNSHARE_NFS = 1,
369da6c28aaSamw 	ZFS_SHARE_SMB = 2,
370da6c28aaSamw 	ZFS_UNSHARE_SMB = 3
371da6c28aaSamw } zfs_share_op_t;
372da6c28aaSamw 
373743a77edSAlan Wright typedef enum zfs_smb_acl_op {
374743a77edSAlan Wright 	ZFS_SMB_ACL_ADD,
375743a77edSAlan Wright 	ZFS_SMB_ACL_REMOVE,
376743a77edSAlan Wright 	ZFS_SMB_ACL_RENAME,
377743a77edSAlan Wright 	ZFS_SMB_ACL_PURGE
378743a77edSAlan Wright } zfs_smb_acl_op_t;
379743a77edSAlan Wright 
3803baa08fcSek typedef enum zfs_cache_type {
3813baa08fcSek 	ZFS_CACHE_NONE = 0,
3823baa08fcSek 	ZFS_CACHE_METADATA = 1,
3833baa08fcSek 	ZFS_CACHE_ALL = 2
3843baa08fcSek } zfs_cache_type_t;
3853baa08fcSek 
38655da60b9SMark J Musante typedef enum {
38755da60b9SMark J Musante 	ZFS_SYNC_STANDARD = 0,
38855da60b9SMark J Musante 	ZFS_SYNC_ALWAYS = 1,
38955da60b9SMark J Musante 	ZFS_SYNC_DISABLED = 2
39055da60b9SMark J Musante } zfs_sync_type_t;
39155da60b9SMark J Musante 
39254811da5SToomas Soome typedef enum {
39354811da5SToomas Soome 	ZFS_DNSIZE_LEGACY = 0,
39454811da5SToomas Soome 	ZFS_DNSIZE_AUTO = 1,
39554811da5SToomas Soome 	ZFS_DNSIZE_1K = 1024,
39654811da5SToomas Soome 	ZFS_DNSIZE_2K = 2048,
39754811da5SToomas Soome 	ZFS_DNSIZE_4K = 4096,
39854811da5SToomas Soome 	ZFS_DNSIZE_8K = 8192,
39954811da5SToomas Soome 	ZFS_DNSIZE_16K = 16384
40054811da5SToomas Soome } zfs_dnsize_type_t;
40154811da5SToomas Soome 
402edf345e6SMatthew Ahrens typedef enum {
403edf345e6SMatthew Ahrens 	ZFS_REDUNDANT_METADATA_ALL,
404edf345e6SMatthew Ahrens 	ZFS_REDUNDANT_METADATA_MOST
405edf345e6SMatthew Ahrens } zfs_redundant_metadata_type_t;
4063baa08fcSek 
407eb633035STom Caputi typedef enum zfs_keystatus {
408eb633035STom Caputi 	ZFS_KEYSTATUS_NONE = 0,
409eb633035STom Caputi 	ZFS_KEYSTATUS_UNAVAILABLE,
410eb633035STom Caputi 	ZFS_KEYSTATUS_AVAILABLE
411eb633035STom Caputi } zfs_keystatus_t;
412eb633035STom Caputi 
413eb633035STom Caputi typedef enum zfs_keyformat {
414eb633035STom Caputi 	ZFS_KEYFORMAT_NONE = 0,
415eb633035STom Caputi 	ZFS_KEYFORMAT_RAW,
416eb633035STom Caputi 	ZFS_KEYFORMAT_HEX,
417eb633035STom Caputi 	ZFS_KEYFORMAT_PASSPHRASE,
418eb633035STom Caputi 	ZFS_KEYFORMAT_FORMATS
419eb633035STom Caputi } zfs_keyformat_t;
420eb633035STom Caputi 
421eb633035STom Caputi typedef enum zfs_key_location {
422eb633035STom Caputi 	ZFS_KEYLOCATION_NONE = 0,
423eb633035STom Caputi 	ZFS_KEYLOCATION_PROMPT,
424eb633035STom Caputi 	ZFS_KEYLOCATION_URI,
425eb633035STom Caputi 	ZFS_KEYLOCATION_LOCATIONS
426eb633035STom Caputi } zfs_keylocation_t;
427eb633035STom Caputi 
428eb633035STom Caputi #define	DEFAULT_PBKDF2_ITERATIONS 350000
429eb633035STom Caputi #define	MIN_PBKDF2_ITERATIONS 100000
430eb633035STom Caputi 
431eaca9bbdSeschrock /*
43299653d4eSeschrock  * On-disk version number.
433eaca9bbdSeschrock  */
434e7437265Sahrens #define	SPA_VERSION_1			1ULL
435e7437265Sahrens #define	SPA_VERSION_2			2ULL
436e7437265Sahrens #define	SPA_VERSION_3			3ULL
437e7437265Sahrens #define	SPA_VERSION_4			4ULL
438e7437265Sahrens #define	SPA_VERSION_5			5ULL
439e7437265Sahrens #define	SPA_VERSION_6			6ULL
440e7437265Sahrens #define	SPA_VERSION_7			7ULL
441e7437265Sahrens #define	SPA_VERSION_8			8ULL
442da6c28aaSamw #define	SPA_VERSION_9			9ULL
443fa94a07fSbrendan #define	SPA_VERSION_10			10ULL
444088f3894Sahrens #define	SPA_VERSION_11			11ULL
445bb0ade09Sahrens #define	SPA_VERSION_12			12ULL
44674e7dc98SMatthew Ahrens #define	SPA_VERSION_13			13ULL
447d0f3f37eSMark Shellenbaum #define	SPA_VERSION_14			14ULL
44814843421SMatthew Ahrens #define	SPA_VERSION_15			15ULL
449478ed9adSEric Taylor #define	SPA_VERSION_16			16ULL
450f94275ceSAdam Leventhal #define	SPA_VERSION_17			17ULL
451842727c2SChris Kirby #define	SPA_VERSION_18			18ULL
45288ecc943SGeorge Wilson #define	SPA_VERSION_19			19ULL
453b24ab676SJeff Bonwick #define	SPA_VERSION_20			20ULL
454b24ab676SJeff Bonwick #define	SPA_VERSION_21			21ULL
45592241e0bSTom Erickson #define	SPA_VERSION_22			22ULL
4566e1f5caaSNeil Perrin #define	SPA_VERSION_23			23ULL
4570a586ceaSMark Shellenbaum #define	SPA_VERSION_24			24ULL
4583f9d6ad7SLin Ling #define	SPA_VERSION_25			25ULL
459cde58dbcSMatthew Ahrens #define	SPA_VERSION_26			26ULL
4606e0cbcaaSMatthew Ahrens #define	SPA_VERSION_27			27ULL
461cb04b873SMark J Musante #define	SPA_VERSION_28			28ULL
462ad135b5dSChristopher Siden #define	SPA_VERSION_5000		5000ULL
463cb04b873SMark J Musante 
464b1b8ab34Slling /*
465e7cbe64fSgw  * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
466478ed9adSEric Taylor  * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
46714843421SMatthew Ahrens  * and do the appropriate changes.  Also bump the version number in
46814843421SMatthew Ahrens  * usr/src/grub/capability.
469b1b8ab34Slling  */
470ad135b5dSChristopher Siden #define	SPA_VERSION			SPA_VERSION_5000
471ad135b5dSChristopher Siden #define	SPA_VERSION_STRING		"5000"
47244cd46caSbillm 
47344cd46caSbillm /*
474e7437265Sahrens  * Symbolic names for the changes that caused a SPA_VERSION switch.
47544cd46caSbillm  * Used in the code when checking for presence or absence of a feature.
47644cd46caSbillm  * Feel free to define multiple symbolic names for each version if there
47744cd46caSbillm  * were multiple changes to on-disk structures during that version.
47844cd46caSbillm  *
479e7437265Sahrens  * NOTE: When checking the current SPA_VERSION in your code, be sure
48044cd46caSbillm  *       to use spa_version() since it reports the version of the
48144cd46caSbillm  *       last synced uberblock.  Checking the in-flight version can
48244cd46caSbillm  *       be dangerous in some cases.
48344cd46caSbillm  */
484e7437265Sahrens #define	SPA_VERSION_INITIAL		SPA_VERSION_1
485e7437265Sahrens #define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
486e7437265Sahrens #define	SPA_VERSION_SPARES		SPA_VERSION_3
487f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ2		SPA_VERSION_3
488cde58dbcSMatthew Ahrens #define	SPA_VERSION_BPOBJ_ACCOUNT	SPA_VERSION_3
489e7437265Sahrens #define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
490e7437265Sahrens #define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
491e7437265Sahrens #define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
492e7437265Sahrens #define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
493e7437265Sahrens #define	SPA_VERSION_BOOTFS		SPA_VERSION_6
494990b4856Slling #define	SPA_VERSION_SLOGS		SPA_VERSION_7
495990b4856Slling #define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
496da6c28aaSamw #define	SPA_VERSION_FUID		SPA_VERSION_9
497a9799022Sck #define	SPA_VERSION_REFRESERVATION	SPA_VERSION_9
498a9799022Sck #define	SPA_VERSION_REFQUOTA		SPA_VERSION_9
499a9799022Sck #define	SPA_VERSION_UNIQUE_ACCURATE	SPA_VERSION_9
500fa94a07fSbrendan #define	SPA_VERSION_L2CACHE		SPA_VERSION_10
501088f3894Sahrens #define	SPA_VERSION_NEXT_CLONES		SPA_VERSION_11
502088f3894Sahrens #define	SPA_VERSION_ORIGIN		SPA_VERSION_11
503088f3894Sahrens #define	SPA_VERSION_DSL_SCRUB		SPA_VERSION_11
504bb0ade09Sahrens #define	SPA_VERSION_SNAP_PROPS		SPA_VERSION_12
50574e7dc98SMatthew Ahrens #define	SPA_VERSION_USED_BREAKDOWN	SPA_VERSION_13
506d0f3f37eSMark Shellenbaum #define	SPA_VERSION_PASSTHROUGH_X	SPA_VERSION_14
50714843421SMatthew Ahrens #define	SPA_VERSION_USERSPACE		SPA_VERSION_15
508478ed9adSEric Taylor #define	SPA_VERSION_STMF_PROP		SPA_VERSION_16
509f94275ceSAdam Leventhal #define	SPA_VERSION_RAIDZ3		SPA_VERSION_17
510842727c2SChris Kirby #define	SPA_VERSION_USERREFS		SPA_VERSION_18
51188ecc943SGeorge Wilson #define	SPA_VERSION_HOLES		SPA_VERSION_19
512b24ab676SJeff Bonwick #define	SPA_VERSION_ZLE_COMPRESSION	SPA_VERSION_20
513b24ab676SJeff Bonwick #define	SPA_VERSION_DEDUP		SPA_VERSION_21
51492241e0bSTom Erickson #define	SPA_VERSION_RECVD_PROPS		SPA_VERSION_22
5156e1f5caaSNeil Perrin #define	SPA_VERSION_SLIM_ZIL		SPA_VERSION_23
5160a586ceaSMark Shellenbaum #define	SPA_VERSION_SA			SPA_VERSION_24
5173f9d6ad7SLin Ling #define	SPA_VERSION_SCAN		SPA_VERSION_25
518cde58dbcSMatthew Ahrens #define	SPA_VERSION_DIR_CLONES		SPA_VERSION_26
519cde58dbcSMatthew Ahrens #define	SPA_VERSION_DEADLISTS		SPA_VERSION_26
5206e0cbcaaSMatthew Ahrens #define	SPA_VERSION_FAST_SNAP		SPA_VERSION_27
521cb04b873SMark J Musante #define	SPA_VERSION_MULTI_REPLACE	SPA_VERSION_28
522ad135b5dSChristopher Siden #define	SPA_VERSION_BEFORE_FEATURES	SPA_VERSION_28
523ad135b5dSChristopher Siden #define	SPA_VERSION_FEATURES		SPA_VERSION_5000
524ad135b5dSChristopher Siden 
525ad135b5dSChristopher Siden #define	SPA_VERSION_IS_SUPPORTED(v) \
526ad135b5dSChristopher Siden 	(((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
527ad135b5dSChristopher Siden 	((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
528e7437265Sahrens 
529e7437265Sahrens /*
530e7437265Sahrens  * ZPL version - rev'd whenever an incompatible on-disk format change
531e7437265Sahrens  * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
532e7437265Sahrens  * also update the version_table[] and help message in zfs_prop.c.
533e7437265Sahrens  *
534e7437265Sahrens  * When changing, be sure to teach GRUB how to read the new format!
535478ed9adSEric Taylor  * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
536e7437265Sahrens  */
537e7437265Sahrens #define	ZPL_VERSION_1			1ULL
538e7437265Sahrens #define	ZPL_VERSION_2			2ULL
539da6c28aaSamw #define	ZPL_VERSION_3			3ULL
54014843421SMatthew Ahrens #define	ZPL_VERSION_4			4ULL
5410a586ceaSMark Shellenbaum #define	ZPL_VERSION_5			5ULL
5420a586ceaSMark Shellenbaum #define	ZPL_VERSION			ZPL_VERSION_5
5430a586ceaSMark Shellenbaum #define	ZPL_VERSION_STRING		"5"
544e7437265Sahrens 
545e7437265Sahrens #define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
546e7437265Sahrens #define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
547da6c28aaSamw #define	ZPL_VERSION_FUID		ZPL_VERSION_3
548de8267e0Stimh #define	ZPL_VERSION_NORMALIZATION	ZPL_VERSION_3
549da6c28aaSamw #define	ZPL_VERSION_SYSATTR		ZPL_VERSION_3
55014843421SMatthew Ahrens #define	ZPL_VERSION_USERSPACE		ZPL_VERSION_4
5510a586ceaSMark Shellenbaum #define	ZPL_VERSION_SA			ZPL_VERSION_5
552eaca9bbdSeschrock 
5535dafeea3SPavel Zakharov /* Rewind policy information */
554c8ee1847SVictor Latushkin #define	ZPOOL_NO_REWIND		1  /* No policy - default behavior */
555c8ee1847SVictor Latushkin #define	ZPOOL_NEVER_REWIND	2  /* Do not search for best txg or rewind */
556c8ee1847SVictor Latushkin #define	ZPOOL_TRY_REWIND	4  /* Search for best txg, but do not rewind */
557c8ee1847SVictor Latushkin #define	ZPOOL_DO_REWIND		8  /* Rewind to best txg w/in deferred frees */
558c8ee1847SVictor Latushkin #define	ZPOOL_EXTREME_REWIND	16 /* Allow extreme measures to find best txg */
559c8ee1847SVictor Latushkin #define	ZPOOL_REWIND_MASK	28 /* All the possible rewind bits */
560c8ee1847SVictor Latushkin #define	ZPOOL_REWIND_POLICIES	31 /* All the possible policy bits */
561468c413aSTim Haley 
5625dafeea3SPavel Zakharov typedef struct zpool_load_policy {
5635dafeea3SPavel Zakharov 	uint32_t	zlp_rewind;	/* rewind policy requested */
5645dafeea3SPavel Zakharov 	uint64_t	zlp_maxmeta;	/* max acceptable meta-data errors */
5655dafeea3SPavel Zakharov 	uint64_t	zlp_maxdata;	/* max acceptable data errors */
5665dafeea3SPavel Zakharov 	uint64_t	zlp_txg;	/* specific txg to load */
5675dafeea3SPavel Zakharov } zpool_load_policy_t;
568468c413aSTim Haley 
569fa9e4066Sahrens /*
570fa9e4066Sahrens  * The following are configuration names used in the nvlist describing a pool's
5715cabbc6bSPrashanth Sreenivasa  * configuration.  New on-disk names should be prefixed with "<reverse-DNS>:"
5725cabbc6bSPrashanth Sreenivasa  * (e.g. "org.open-zfs:") to avoid conflicting names being developed
5735cabbc6bSPrashanth Sreenivasa  * independently.
574fa9e4066Sahrens  */
575fa9e4066Sahrens #define	ZPOOL_CONFIG_VERSION		"version"
576fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_NAME		"name"
577fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_STATE		"state"
578fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_TXG		"txg"
579fa9e4066Sahrens #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
580fa9e4066Sahrens #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
581fa9e4066Sahrens #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
582fa9e4066Sahrens #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
583fa9e4066Sahrens #define	ZPOOL_CONFIG_TYPE		"type"
584fa9e4066Sahrens #define	ZPOOL_CONFIG_CHILDREN		"children"
585fa9e4066Sahrens #define	ZPOOL_CONFIG_ID			"id"
586fa9e4066Sahrens #define	ZPOOL_CONFIG_GUID		"guid"
5875cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_INDIRECT_OBJECT	"com.delphix:indirect_object"
5885cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_INDIRECT_BIRTHS	"com.delphix:indirect_births"
5895cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_PREV_INDIRECT_VDEV	"com.delphix:prev_indirect_vdev"
590fa9e4066Sahrens #define	ZPOOL_CONFIG_PATH		"path"
591fa9e4066Sahrens #define	ZPOOL_CONFIG_DEVID		"devid"
592fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
593fa9e4066Sahrens #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
594fa9e4066Sahrens #define	ZPOOL_CONFIG_ASHIFT		"ashift"
595fa9e4066Sahrens #define	ZPOOL_CONFIG_ASIZE		"asize"
596fa9e4066Sahrens #define	ZPOOL_CONFIG_DTL		"DTL"
5973f9d6ad7SLin Ling #define	ZPOOL_CONFIG_SCAN_STATS		"scan_stats"	/* not stored on disk */
5985cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_REMOVAL_STATS	"removal_stats"	/* not stored on disk */
59986714001SSerapheim Dimitropoulos #define	ZPOOL_CONFIG_CHECKPOINT_STATS	"checkpoint_stats" /* not on disk */
6003f9d6ad7SLin Ling #define	ZPOOL_CONFIG_VDEV_STATS		"vdev_stats"	/* not stored on disk */
6015cabbc6bSPrashanth Sreenivasa #define	ZPOOL_CONFIG_INDIRECT_SIZE	"indirect_size"	/* not stored on disk */
602afefbcddSeschrock #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
603ea8dc4b6Seschrock #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
604ea8dc4b6Seschrock #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
60599653d4eSeschrock #define	ZPOOL_CONFIG_SPARES		"spares"
60699653d4eSeschrock #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
60799653d4eSeschrock #define	ZPOOL_CONFIG_NPARITY		"nparity"
60895173954Sek #define	ZPOOL_CONFIG_HOSTID		"hostid"
60995173954Sek #define	ZPOOL_CONFIG_HOSTNAME		"hostname"
61011027bc7STim Haley #define	ZPOOL_CONFIG_LOADED_TIME	"initial_load_time"
6113d7072f8Seschrock #define	ZPOOL_CONFIG_UNSPARE		"unspare"
6123d7072f8Seschrock #define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
6138654d025Sperrin #define	ZPOOL_CONFIG_IS_LOG		"is_log"
614fa94a07fSbrendan #define	ZPOOL_CONFIG_L2CACHE		"l2cache"
61588ecc943SGeorge Wilson #define	ZPOOL_CONFIG_HOLE_ARRAY		"hole_array"
61688ecc943SGeorge Wilson #define	ZPOOL_CONFIG_VDEV_CHILDREN	"vdev_children"
61788ecc943SGeorge Wilson #define	ZPOOL_CONFIG_IS_HOLE		"is_hole"
6189eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_HISTOGRAM	"ddt_histogram"
6199eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_OBJ_STATS	"ddt_object_stats"
6209eb19f4dSGeorge Wilson #define	ZPOOL_CONFIG_DDT_STATS		"ddt_stats"
6211195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT		"splitcfg"
6221195e687SMark J Musante #define	ZPOOL_CONFIG_ORIG_GUID		"orig_guid"
6231195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT_GUID		"split_guid"
6241195e687SMark J Musante #define	ZPOOL_CONFIG_SPLIT_LIST		"guid_list"
6253f9d6ad7SLin Ling #define	ZPOOL_CONFIG_REMOVING		"removing"
626b4952e17SGeorge Wilson #define	ZPOOL_CONFIG_RESILVER_TXG	"resilver_txg"
6278704186eSDan McDonald #define	ZPOOL_CONFIG_COMMENT		"comment"
628e14bb325SJeff Bonwick #define	ZPOOL_CONFIG_SUSPENDED		"suspended"	/* not stored on disk */
629e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_SUSPENDED_REASON	"suspended_reason"	/* not stored */
630e7cbe64fSgw #define	ZPOOL_CONFIG_TIMESTAMP		"timestamp"	/* not stored on disk */
631e7cbe64fSgw #define	ZPOOL_CONFIG_BOOTFS		"bootfs"	/* not stored on disk */
6324b964adaSGeorge Wilson #define	ZPOOL_CONFIG_MISSING_DEVICES	"missing_vdevs"	/* not stored on disk */
6334b964adaSGeorge Wilson #define	ZPOOL_CONFIG_LOAD_INFO		"load_info"	/* not stored on disk */
634ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_REWIND_INFO	"rewind_info"	/* not stored on disk */
635ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_UNSUP_FEAT		"unsup_feat"	/* not stored on disk */
63657221772SChristopher Siden #define	ZPOOL_CONFIG_ENABLED_FEAT	"enabled_feat"	/* not stored on disk */
637ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_CAN_RDONLY		"can_rdonly"	/* not stored on disk */
638ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_FEATURES_FOR_READ	"features_for_read"
639ad135b5dSChristopher Siden #define	ZPOOL_CONFIG_FEATURE_STATS	"feature_stats"	/* not stored on disk */
640eb633035STom Caputi #define	ZPOOL_CONFIG_ERRATA		"errata"	/* not stored on disk */
641215198a6SJoe Stein #define	ZPOOL_CONFIG_VDEV_TOP_ZAP	"com.delphix:vdev_zap_top"
642215198a6SJoe Stein #define	ZPOOL_CONFIG_VDEV_LEAF_ZAP	"com.delphix:vdev_zap_leaf"
643215198a6SJoe Stein #define	ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS	"com.delphix:has_per_vdev_zaps"
644e4c795beSTom Caputi #define	ZPOOL_CONFIG_RESILVER_DEFER	"com.datto:resilver_defer"
6456f793812SPavel Zakharov #define	ZPOOL_CONFIG_CACHEFILE		"cachefile"	/* not stored on disk */
646e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_STATE		"mmp_state"	/* not stored on disk */
647e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_TXG		"mmp_txg"	/* not stored on disk */
648e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_HOSTNAME	"mmp_hostname"	/* not stored on disk */
649e0f1c0afSOlaf Faaland #define	ZPOOL_CONFIG_MMP_HOSTID		"mmp_hostid"	/* not stored on disk */
650663207adSDon Brady #define	ZPOOL_CONFIG_ALLOCATION_BIAS	"alloc_bias"	/* not stored on disk */
651663207adSDon Brady 
6523d7072f8Seschrock /*
6533d7072f8Seschrock  * The persistent vdev state is stored as separate values rather than a single
6543d7072f8Seschrock  * 'vdev_state' entry.  This is because a device can be in multiple states, such
6553d7072f8Seschrock  * as offline and degraded.
6563d7072f8Seschrock  */
6573d7072f8Seschrock #define	ZPOOL_CONFIG_OFFLINE		"offline"
6583d7072f8Seschrock #define	ZPOOL_CONFIG_FAULTED		"faulted"
6593d7072f8Seschrock #define	ZPOOL_CONFIG_DEGRADED		"degraded"
6603d7072f8Seschrock #define	ZPOOL_CONFIG_REMOVED		"removed"
6616809eb4eSEric Schrock #define	ZPOOL_CONFIG_FRU		"fru"
662069f55e2SEric Schrock #define	ZPOOL_CONFIG_AUX_STATE		"aux_state"
663fa9e4066Sahrens 
6645dafeea3SPavel Zakharov /* Pool load policy parameters */
6655dafeea3SPavel Zakharov #define	ZPOOL_LOAD_POLICY		"load-policy"
6665dafeea3SPavel Zakharov #define	ZPOOL_LOAD_REWIND_POLICY	"load-rewind-policy"
6675dafeea3SPavel Zakharov #define	ZPOOL_LOAD_REQUEST_TXG		"load-request-txg"
6685dafeea3SPavel Zakharov #define	ZPOOL_LOAD_META_THRESH		"load-meta-thresh"
6695dafeea3SPavel Zakharov #define	ZPOOL_LOAD_DATA_THRESH		"load-data-thresh"
670468c413aSTim Haley 
671468c413aSTim Haley /* Rewind data discovered */
672468c413aSTim Haley #define	ZPOOL_CONFIG_LOAD_TIME		"rewind_txg_ts"
673468c413aSTim Haley #define	ZPOOL_CONFIG_LOAD_DATA_ERRORS	"verify_data_errors"
674468c413aSTim Haley #define	ZPOOL_CONFIG_REWIND_TIME	"seconds_of_rewind"
675468c413aSTim Haley 
676fa9e4066Sahrens #define	VDEV_TYPE_ROOT			"root"
677fa9e4066Sahrens #define	VDEV_TYPE_MIRROR		"mirror"
678fa9e4066Sahrens #define	VDEV_TYPE_REPLACING		"replacing"
679fa9e4066Sahrens #define	VDEV_TYPE_RAIDZ			"raidz"
680fa9e4066Sahrens #define	VDEV_TYPE_DISK			"disk"
681fa9e4066Sahrens #define	VDEV_TYPE_FILE			"file"
682fa9e4066Sahrens #define	VDEV_TYPE_MISSING		"missing"
68388ecc943SGeorge Wilson #define	VDEV_TYPE_HOLE			"hole"
68499653d4eSeschrock #define	VDEV_TYPE_SPARE			"spare"
6858654d025Sperrin #define	VDEV_TYPE_LOG			"log"
686fa94a07fSbrendan #define	VDEV_TYPE_L2CACHE		"l2cache"
6875cabbc6bSPrashanth Sreenivasa #define	VDEV_TYPE_INDIRECT		"indirect"
6885cabbc6bSPrashanth Sreenivasa 
6895cabbc6bSPrashanth Sreenivasa /* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */
6905cabbc6bSPrashanth Sreenivasa #define	VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \
6915cabbc6bSPrashanth Sreenivasa 	"com.delphix:indirect_obsolete_sm"
6925cabbc6bSPrashanth Sreenivasa #define	VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \
6935cabbc6bSPrashanth Sreenivasa 	"com.delphix:obsolete_counts_are_precise"
69486714001SSerapheim Dimitropoulos #define	VDEV_TOP_ZAP_POOL_CHECKPOINT_SM \
69586714001SSerapheim Dimitropoulos 	"com.delphix:pool_checkpoint_sm"
696fa9e4066Sahrens 
697663207adSDon Brady #define	VDEV_TOP_ZAP_ALLOCATION_BIAS \
698663207adSDon Brady 	"org.zfsonlinux:allocation_bias"
699663207adSDon Brady 
700663207adSDon Brady /* vdev metaslab allocation bias */
701663207adSDon Brady #define	VDEV_ALLOC_BIAS_LOG		"log"
702663207adSDon Brady #define	VDEV_ALLOC_BIAS_SPECIAL		"special"
703663207adSDon Brady #define	VDEV_ALLOC_BIAS_DEDUP		"dedup"
704663207adSDon Brady 
705094e47e9SGeorge Wilson #define	VDEV_LEAF_ZAP_INITIALIZE_LAST_OFFSET	\
706094e47e9SGeorge Wilson 	"com.delphix:next_offset_to_initialize"
707094e47e9SGeorge Wilson #define	VDEV_LEAF_ZAP_INITIALIZE_STATE	\
708094e47e9SGeorge Wilson 	"com.delphix:vdev_initialize_state"
709094e47e9SGeorge Wilson #define	VDEV_LEAF_ZAP_INITIALIZE_ACTION_TIME	\
710094e47e9SGeorge Wilson 	"com.delphix:vdev_initialize_action_time"
711094e47e9SGeorge Wilson 
712fa9e4066Sahrens /*
713fa9e4066Sahrens  * This is needed in userland to report the minimum necessary device size.
7144b5c8e93SMatthew Ahrens  *
7154b5c8e93SMatthew Ahrens  * Note that the zfs test suite uses 64MB vdevs.
716fa9e4066Sahrens  */
717fa9e4066Sahrens #define	SPA_MINDEVSIZE		(64ULL << 20)
718fa9e4066Sahrens 
7192e4c9986SGeorge Wilson /*
7202e4c9986SGeorge Wilson  * Set if the fragmentation has not yet been calculated. This can happen
7212e4c9986SGeorge Wilson  * because the space maps have not been upgraded or the histogram feature
7222e4c9986SGeorge Wilson  * is not enabled.
7232e4c9986SGeorge Wilson  */
7242e4c9986SGeorge Wilson #define	ZFS_FRAG_INVALID	UINT64_MAX
7252e4c9986SGeorge Wilson 
726fa9e4066Sahrens /*
727fa9e4066Sahrens  * The location of the pool configuration repository, shared between kernel and
728fa9e4066Sahrens  * userland.
729fa9e4066Sahrens  */
730c5904d13Seschrock #define	ZPOOL_CACHE		"/etc/zfs/zpool.cache"
731fa9e4066Sahrens 
732fa9e4066Sahrens /*
733fa9e4066Sahrens  * vdev states are ordered from least to most healthy.
734fa9e4066Sahrens  * A vdev that's CANT_OPEN or below is considered unusable.
735fa9e4066Sahrens  */
736fa9e4066Sahrens typedef enum vdev_state {
737fa9e4066Sahrens 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
738fa9e4066Sahrens 	VDEV_STATE_CLOSED,	/* Not currently open			*/
739fa9e4066Sahrens 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
7403d7072f8Seschrock 	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
741fa9e4066Sahrens 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
7423d7072f8Seschrock 	VDEV_STATE_FAULTED,	/* External request to fault device	*/
743fa9e4066Sahrens 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
744fa9e4066Sahrens 	VDEV_STATE_HEALTHY	/* Presumed good			*/
745fa9e4066Sahrens } vdev_state_t;
746fa9e4066Sahrens 
7473d7072f8Seschrock #define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
7483d7072f8Seschrock 
749fa9e4066Sahrens /*
750fa9e4066Sahrens  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
751fa9e4066Sahrens  * of the vdev stats structure uses these constants to distinguish why.
752fa9e4066Sahrens  */
753fa9e4066Sahrens typedef enum vdev_aux {
754fa9e4066Sahrens 	VDEV_AUX_NONE,		/* no error				*/
755fa9e4066Sahrens 	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
756fa9e4066Sahrens 	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
757fa9e4066Sahrens 	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
758fa9e4066Sahrens 	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
759fa9e4066Sahrens 	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
760eaca9bbdSeschrock 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
761eaca9bbdSeschrock 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
76299653d4eSeschrock 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
763ad135b5dSChristopher Siden 	VDEV_AUX_UNSUP_FEAT,	/* unsupported features			*/
7643d7072f8Seschrock 	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
76532b87932Sek 	VDEV_AUX_ERR_EXCEEDED,	/* too many errors			*/
766b87f3af3Sperrin 	VDEV_AUX_IO_FAILURE,	/* experienced I/O failure		*/
767069f55e2SEric Schrock 	VDEV_AUX_BAD_LOG,	/* cannot read log chain(s)		*/
7681195e687SMark J Musante 	VDEV_AUX_EXTERNAL,	/* external diagnosis			*/
7696f793812SPavel Zakharov 	VDEV_AUX_SPLIT_POOL,	/* vdev was split off into another pool	*/
770e0f1c0afSOlaf Faaland 	VDEV_AUX_ACTIVE,	/* vdev active on a different host	*/
7716f793812SPavel Zakharov 	VDEV_AUX_CHILDREN_OFFLINE /* all children are offline		*/
772fa9e4066Sahrens } vdev_aux_t;
773fa9e4066Sahrens 
774fa9e4066Sahrens /*
77546a2abf2Seschrock  * pool state.  The following states are written to disk as part of the normal
776fa94a07fSbrendan  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
777fa94a07fSbrendan  * states are software abstractions used at various levels to communicate
778fa94a07fSbrendan  * pool state.
779fa9e4066Sahrens  */
780fa9e4066Sahrens typedef enum pool_state {
781fa9e4066Sahrens 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
782fa9e4066Sahrens 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
783fa9e4066Sahrens 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
78499653d4eSeschrock 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
785fa94a07fSbrendan 	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
786fa9e4066Sahrens 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
78746a2abf2Seschrock 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
78846a2abf2Seschrock 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
789fa9e4066Sahrens } pool_state_t;
790fa9e4066Sahrens 
791e0f1c0afSOlaf Faaland /*
792e0f1c0afSOlaf Faaland  * mmp state. The following states provide additional detail describing
793e0f1c0afSOlaf Faaland  * why a pool couldn't be safely imported.
794e0f1c0afSOlaf Faaland  */
795e0f1c0afSOlaf Faaland typedef enum mmp_state {
796e0f1c0afSOlaf Faaland 	MMP_STATE_ACTIVE = 0,		/* In active use		*/
797e0f1c0afSOlaf Faaland 	MMP_STATE_INACTIVE,		/* Inactive and safe to import	*/
798e0f1c0afSOlaf Faaland 	MMP_STATE_NO_HOSTID		/* System hostid is not set	*/
799e0f1c0afSOlaf Faaland } mmp_state_t;
800e0f1c0afSOlaf Faaland 
801fa9e4066Sahrens /*
8023f9d6ad7SLin Ling  * Scan Functions.
803fa9e4066Sahrens  */
8043f9d6ad7SLin Ling typedef enum pool_scan_func {
8053f9d6ad7SLin Ling 	POOL_SCAN_NONE,
8063f9d6ad7SLin Ling 	POOL_SCAN_SCRUB,
8073f9d6ad7SLin Ling 	POOL_SCAN_RESILVER,
8083f9d6ad7SLin Ling 	POOL_SCAN_FUNCS
8093f9d6ad7SLin Ling } pool_scan_func_t;
810fa9e4066Sahrens 
8111702cce7SAlek Pinchuk /*
8121702cce7SAlek Pinchuk  * Used to control scrub pause and resume.
8131702cce7SAlek Pinchuk  */
8141702cce7SAlek Pinchuk typedef enum pool_scrub_cmd {
8151702cce7SAlek Pinchuk 	POOL_SCRUB_NORMAL = 0,
8161702cce7SAlek Pinchuk 	POOL_SCRUB_PAUSE,
8171702cce7SAlek Pinchuk 	POOL_SCRUB_FLAGS_END
8181702cce7SAlek Pinchuk } pool_scrub_cmd_t;
8191702cce7SAlek Pinchuk 
820094e47e9SGeorge Wilson /*
821094e47e9SGeorge Wilson  * Initialize functions.
822094e47e9SGeorge Wilson  */
823094e47e9SGeorge Wilson typedef enum pool_initialize_func {
824094e47e9SGeorge Wilson 	POOL_INITIALIZE_DO,
825094e47e9SGeorge Wilson 	POOL_INITIALIZE_CANCEL,
826094e47e9SGeorge Wilson 	POOL_INITIALIZE_SUSPEND,
827094e47e9SGeorge Wilson 	POOL_INITIALIZE_FUNCS
828094e47e9SGeorge Wilson } pool_initialize_func_t;
8291702cce7SAlek Pinchuk 
830fa9e4066Sahrens /*
831fa9e4066Sahrens  * ZIO types.  Needed to interpret vdev statistics below.
832fa9e4066Sahrens  */
833fa9e4066Sahrens typedef enum zio_type {
834fa9e4066Sahrens 	ZIO_TYPE_NULL = 0,
835fa9e4066Sahrens 	ZIO_TYPE_READ,
836fa9e4066Sahrens 	ZIO_TYPE_WRITE,
837fa9e4066Sahrens 	ZIO_TYPE_FREE,
838fa9e4066Sahrens 	ZIO_TYPE_CLAIM,
839fa9e4066Sahrens 	ZIO_TYPE_IOCTL,
840fa9e4066Sahrens 	ZIO_TYPES
841fa9e4066Sahrens } zio_type_t;
842fa9e4066Sahrens 
8433f9d6ad7SLin Ling /*
8443f9d6ad7SLin Ling  * Pool statistics.  Note: all fields should be 64-bit because this
8453f9d6ad7SLin Ling  * is passed between kernel and userland as an nvlist uint64 array.
8463f9d6ad7SLin Ling  */
8473f9d6ad7SLin Ling typedef struct pool_scan_stat {
8483f9d6ad7SLin Ling 	/* values stored on disk */
8493f9d6ad7SLin Ling 	uint64_t	pss_func;	/* pool_scan_func_t */
8503f9d6ad7SLin Ling 	uint64_t	pss_state;	/* dsl_scan_state_t */
8513f9d6ad7SLin Ling 	uint64_t	pss_start_time;	/* scan start time */
8523f9d6ad7SLin Ling 	uint64_t	pss_end_time;	/* scan end time */
8533f9d6ad7SLin Ling 	uint64_t	pss_to_examine;	/* total bytes to scan */
854a3874b8bSToomas Soome 	uint64_t	pss_examined;	/* total bytes located by scanner */
8553f9d6ad7SLin Ling 	uint64_t	pss_to_process; /* total bytes to process */
8563f9d6ad7SLin Ling 	uint64_t	pss_processed;	/* total processed bytes */
8573f9d6ad7SLin Ling 	uint64_t	pss_errors;	/* scan errors	*/
8583f9d6ad7SLin Ling 
8593f9d6ad7SLin Ling 	/* values not stored on disk */
8603f9d6ad7SLin Ling 	uint64_t	pss_pass_exam;	/* examined bytes per scan pass */
861a3874b8bSToomas Soome 	uint64_t	pss_pass_issued; /* issued bytes per scan pass */
8623f9d6ad7SLin Ling 	uint64_t	pss_pass_start;	/* start time of a scan pass */
8631702cce7SAlek Pinchuk 	uint64_t	pss_pass_scrub_pause; /* pause time of a scurb pass */
8641702cce7SAlek Pinchuk 	/* cumulative time scrub spent paused, needed for rate calculation */
8651702cce7SAlek Pinchuk 	uint64_t	pss_pass_scrub_spent_paused;
866a3874b8bSToomas Soome 
867a3874b8bSToomas Soome 	/* Sorted scrubbing new fields */
868a3874b8bSToomas Soome 	/* Stored on disk */
869a3874b8bSToomas Soome 	uint64_t	pss_issued;	/* total bytes checked by scanner */
8703f9d6ad7SLin Ling } pool_scan_stat_t;
8713f9d6ad7SLin Ling 
872eb633035STom Caputi /*
873eb633035STom Caputi  * Errata described by http://zfsonlinux.org/msg/ZFS-8000-ER.  The ordering
874eb633035STom Caputi  * of this enum must be maintained to ensure the errata identifiers map to
875eb633035STom Caputi  * the correct documentation.  New errata may only be appended to the list
876eb633035STom Caputi  * and must contain corresponding documentation at the above link.
877eb633035STom Caputi  */
878eb633035STom Caputi typedef enum zpool_errata {
879eb633035STom Caputi 	ZPOOL_ERRATA_NONE,
880eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_2094_SCRUB,
881eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY,
882eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_6845_ENCRYPTION,
883eb633035STom Caputi 	ZPOOL_ERRATA_ZOL_8308_ENCRYPTION,
884eb633035STom Caputi } zpool_errata_t;
885eb633035STom Caputi 
8865cabbc6bSPrashanth Sreenivasa typedef struct pool_removal_stat {
8875cabbc6bSPrashanth Sreenivasa 	uint64_t prs_state; /* dsl_scan_state_t */
8885cabbc6bSPrashanth Sreenivasa 	uint64_t prs_removing_vdev;
8895cabbc6bSPrashanth Sreenivasa 	uint64_t prs_start_time;
8905cabbc6bSPrashanth Sreenivasa 	uint64_t prs_end_time;
8915cabbc6bSPrashanth Sreenivasa 	uint64_t prs_to_copy; /* bytes that need to be copied */
8925cabbc6bSPrashanth Sreenivasa 	uint64_t prs_copied; /* bytes copied so far */
8935cabbc6bSPrashanth Sreenivasa 	/*
8945cabbc6bSPrashanth Sreenivasa 	 * bytes of memory used for indirect mappings.
8955cabbc6bSPrashanth Sreenivasa 	 * This includes all removed vdevs.
8965cabbc6bSPrashanth Sreenivasa 	 */
8975cabbc6bSPrashanth Sreenivasa 	uint64_t prs_mapping_memory;
8985cabbc6bSPrashanth Sreenivasa } pool_removal_stat_t;
8995cabbc6bSPrashanth Sreenivasa 
9003f9d6ad7SLin Ling typedef enum dsl_scan_state {
9013f9d6ad7SLin Ling 	DSS_NONE,
9023f9d6ad7SLin Ling 	DSS_SCANNING,
9033f9d6ad7SLin Ling 	DSS_FINISHED,
9043f9d6ad7SLin Ling 	DSS_CANCELED,
9053f9d6ad7SLin Ling 	DSS_NUM_STATES
9063f9d6ad7SLin Ling } dsl_scan_state_t;
9073f9d6ad7SLin Ling 
90886714001SSerapheim Dimitropoulos typedef enum {
90986714001SSerapheim Dimitropoulos 	CS_NONE,
91086714001SSerapheim Dimitropoulos 	CS_CHECKPOINT_EXISTS,
91186714001SSerapheim Dimitropoulos 	CS_CHECKPOINT_DISCARDING,
91286714001SSerapheim Dimitropoulos 	CS_NUM_STATES
91386714001SSerapheim Dimitropoulos } checkpoint_state_t;
91486714001SSerapheim Dimitropoulos 
91586714001SSerapheim Dimitropoulos typedef struct pool_checkpoint_stat {
91686714001SSerapheim Dimitropoulos 	uint64_t pcs_state;		/* checkpoint_state_t */
91786714001SSerapheim Dimitropoulos 	uint64_t pcs_start_time;	/* time checkpoint/discard started */
91886714001SSerapheim Dimitropoulos 	uint64_t pcs_space;		/* checkpointed space */
91986714001SSerapheim Dimitropoulos } pool_checkpoint_stat_t;
9203f9d6ad7SLin Ling 
921094e47e9SGeorge Wilson typedef enum {
922094e47e9SGeorge Wilson 	VDEV_INITIALIZE_NONE,
923094e47e9SGeorge Wilson 	VDEV_INITIALIZE_ACTIVE,
924094e47e9SGeorge Wilson 	VDEV_INITIALIZE_CANCELED,
925094e47e9SGeorge Wilson 	VDEV_INITIALIZE_SUSPENDED,
926094e47e9SGeorge Wilson 	VDEV_INITIALIZE_COMPLETE
927094e47e9SGeorge Wilson } vdev_initializing_state_t;
928094e47e9SGeorge Wilson 
929fa9e4066Sahrens /*
930fa9e4066Sahrens  * Vdev statistics.  Note: all fields should be 64-bit because this
931fa9e4066Sahrens  * is passed between kernel and userland as an nvlist uint64 array.
932fa9e4066Sahrens  */
933fa9e4066Sahrens typedef struct vdev_stat {
934fa9e4066Sahrens 	hrtime_t	vs_timestamp;		/* time since vdev load	*/
935fa9e4066Sahrens 	uint64_t	vs_state;		/* vdev state		*/
936fa9e4066Sahrens 	uint64_t	vs_aux;			/* see vdev_aux_t	*/
937fa9e4066Sahrens 	uint64_t	vs_alloc;		/* space allocated	*/
938fa9e4066Sahrens 	uint64_t	vs_space;		/* total capacity	*/
93999653d4eSeschrock 	uint64_t	vs_dspace;		/* deflated capacity	*/
9402a79c5feSlling 	uint64_t	vs_rsize;		/* replaceable dev size */
9414263d13fSGeorge Wilson 	uint64_t	vs_esize;		/* expandable dev size */
942fa9e4066Sahrens 	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
943fa9e4066Sahrens 	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
944fa9e4066Sahrens 	uint64_t	vs_read_errors;		/* read errors		*/
945fa9e4066Sahrens 	uint64_t	vs_write_errors;	/* write errors		*/
946fa9e4066Sahrens 	uint64_t	vs_checksum_errors;	/* checksum errors	*/
947094e47e9SGeorge Wilson 	uint64_t	vs_initialize_errors;	/* initializing errors	*/
948fa9e4066Sahrens 	uint64_t	vs_self_healed;		/* self-healed bytes	*/
9493f9d6ad7SLin Ling 	uint64_t	vs_scan_removing;	/* removing?	*/
9503f9d6ad7SLin Ling 	uint64_t	vs_scan_processed;	/* scan processed bytes	*/
9512e4c9986SGeorge Wilson 	uint64_t	vs_fragmentation;	/* device fragmentation */
952094e47e9SGeorge Wilson 	uint64_t	vs_initialize_bytes_done; /* bytes initialized */
953094e47e9SGeorge Wilson 	uint64_t	vs_initialize_bytes_est; /* total bytes to initialize */
954094e47e9SGeorge Wilson 	uint64_t	vs_initialize_state;	/* vdev_initialzing_state_t */
955094e47e9SGeorge Wilson 	uint64_t	vs_initialize_action_time; /* time_t */
95686714001SSerapheim Dimitropoulos 	uint64_t	vs_checkpoint_space;    /* checkpoint-consumed space */
957e4c795beSTom Caputi 	uint64_t	vs_resilver_deferred;	/* resilver deferred	*/
958fa9e4066Sahrens } vdev_stat_t;
959fa9e4066Sahrens 
9609eb19f4dSGeorge Wilson /*
9619eb19f4dSGeorge Wilson  * DDT statistics.  Note: all fields should be 64-bit because this
9629eb19f4dSGeorge Wilson  * is passed between kernel and userland as an nvlist uint64 array.
9639eb19f4dSGeorge Wilson  */
9649eb19f4dSGeorge Wilson typedef struct ddt_object {
96504e56356SAndriy Gapon 	uint64_t	ddo_count;	/* number of elments in ddt	*/
9669eb19f4dSGeorge Wilson 	uint64_t	ddo_dspace;	/* size of ddt on disk		*/
9679eb19f4dSGeorge Wilson 	uint64_t	ddo_mspace;	/* size of ddt in-core		*/
9689eb19f4dSGeorge Wilson } ddt_object_t;
9699eb19f4dSGeorge Wilson 
9709eb19f4dSGeorge Wilson typedef struct ddt_stat {
9719eb19f4dSGeorge Wilson 	uint64_t	dds_blocks;	/* blocks			*/
9729eb19f4dSGeorge Wilson 	uint64_t	dds_lsize;	/* logical size			*/
9739eb19f4dSGeorge Wilson 	uint64_t	dds_psize;	/* physical size		*/
9749eb19f4dSGeorge Wilson 	uint64_t	dds_dsize;	/* deflated allocated size	*/
9759eb19f4dSGeorge Wilson 	uint64_t	dds_ref_blocks;	/* referenced blocks		*/
9769eb19f4dSGeorge Wilson 	uint64_t	dds_ref_lsize;	/* referenced lsize * refcnt	*/
9779eb19f4dSGeorge Wilson 	uint64_t	dds_ref_psize;	/* referenced psize * refcnt	*/
9789eb19f4dSGeorge Wilson 	uint64_t	dds_ref_dsize;	/* referenced dsize * refcnt	*/
9799eb19f4dSGeorge Wilson } ddt_stat_t;
9809eb19f4dSGeorge Wilson 
9819eb19f4dSGeorge Wilson typedef struct ddt_histogram {
9829eb19f4dSGeorge Wilson 	ddt_stat_t	ddh_stat[64];	/* power-of-two histogram buckets */
9839eb19f4dSGeorge Wilson } ddt_histogram_t;
9849eb19f4dSGeorge Wilson 
985e7cbe64fSgw #define	ZVOL_DRIVER	"zvol"
986fa9e4066Sahrens #define	ZFS_DRIVER	"zfs"
987fa9e4066Sahrens #define	ZFS_DEV		"/dev/zfs"
9886401734dSWill Andrews #define	ZFS_DISK_ROOT	"/dev/dsk"
9896401734dSWill Andrews #define	ZFS_DISK_ROOTD	ZFS_DISK_ROOT "/"
9906401734dSWill Andrews #define	ZFS_RDISK_ROOT	"/dev/rdsk"
9916401734dSWill Andrews #define	ZFS_RDISK_ROOTD	ZFS_RDISK_ROOT "/"
992fa9e4066Sahrens 
993681d9761SEric Taylor /* general zvol path */
994681d9761SEric Taylor #define	ZVOL_DIR		"/dev/zvol"
995681d9761SEric Taylor /* expansion */
996573ca77eSGeorge Wilson #define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zfs@0:"
997681d9761SEric Taylor /* for dump and swap */
998681d9761SEric Taylor #define	ZVOL_FULL_DEV_DIR	ZVOL_DIR "/dsk/"
999681d9761SEric Taylor #define	ZVOL_FULL_RDEV_DIR	ZVOL_DIR "/rdsk/"
1000fa9e4066Sahrens 
1001fa9e4066Sahrens #define	ZVOL_PROP_NAME		"name"
1002c1449561SEric Taylor #define	ZVOL_DEFAULT_BLOCKSIZE	8192
1003fa9e4066Sahrens 
1004fa9e4066Sahrens /*
1005fa9e4066Sahrens  * /dev/zfs ioctl numbers.
1006fa9e4066Sahrens  */
1007fa9e4066Sahrens typedef enum zfs_ioc {
10084445fffbSMatthew Ahrens 	ZFS_IOC_FIRST =	('Z' << 8),
10094445fffbSMatthew Ahrens 	ZFS_IOC = ZFS_IOC_FIRST,
10104445fffbSMatthew Ahrens 	ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
1011fa9e4066Sahrens 	ZFS_IOC_POOL_DESTROY,
1012fa9e4066Sahrens 	ZFS_IOC_POOL_IMPORT,
1013fa9e4066Sahrens 	ZFS_IOC_POOL_EXPORT,
1014fa9e4066Sahrens 	ZFS_IOC_POOL_CONFIGS,
1015fa9e4066Sahrens 	ZFS_IOC_POOL_STATS,
1016fa9e4066Sahrens 	ZFS_IOC_POOL_TRYIMPORT,
10173f9d6ad7SLin Ling 	ZFS_IOC_POOL_SCAN,
1018fa9e4066Sahrens 	ZFS_IOC_POOL_FREEZE,
1019eaca9bbdSeschrock 	ZFS_IOC_POOL_UPGRADE,
102006eeb2adSek 	ZFS_IOC_POOL_GET_HISTORY,
1021fa9e4066Sahrens 	ZFS_IOC_VDEV_ADD,
1022fa9e4066Sahrens 	ZFS_IOC_VDEV_REMOVE,
10233d7072f8Seschrock 	ZFS_IOC_VDEV_SET_STATE,
1024fa9e4066Sahrens 	ZFS_IOC_VDEV_ATTACH,
1025fa9e4066Sahrens 	ZFS_IOC_VDEV_DETACH,
1026c67d9675Seschrock 	ZFS_IOC_VDEV_SETPATH,
10276809eb4eSEric Schrock 	ZFS_IOC_VDEV_SETFRU,
1028fa9e4066Sahrens 	ZFS_IOC_OBJSET_STATS,
1029de8267e0Stimh 	ZFS_IOC_OBJSET_ZPLPROPS,
1030fa9e4066Sahrens 	ZFS_IOC_DATASET_LIST_NEXT,
1031fa9e4066Sahrens 	ZFS_IOC_SNAPSHOT_LIST_NEXT,
1032fa9e4066Sahrens 	ZFS_IOC_SET_PROP,
1033fa9e4066Sahrens 	ZFS_IOC_CREATE,
1034fa9e4066Sahrens 	ZFS_IOC_DESTROY,
1035fa9e4066Sahrens 	ZFS_IOC_ROLLBACK,
1036fa9e4066Sahrens 	ZFS_IOC_RENAME,
10373cb34c60Sahrens 	ZFS_IOC_RECV,
10383cb34c60Sahrens 	ZFS_IOC_SEND,
1039ea8dc4b6Seschrock 	ZFS_IOC_INJECT_FAULT,
1040ea8dc4b6Seschrock 	ZFS_IOC_CLEAR_FAULT,
1041ea8dc4b6Seschrock 	ZFS_IOC_INJECT_LIST_NEXT,
1042ea8dc4b6Seschrock 	ZFS_IOC_ERROR_LOG,
1043ea8dc4b6Seschrock 	ZFS_IOC_CLEAR,
10441d452cf5Sahrens 	ZFS_IOC_PROMOTE,
104555434c77Sek 	ZFS_IOC_SNAPSHOT,
104655434c77Sek 	ZFS_IOC_DSOBJ_TO_DSNAME,
1047b1b8ab34Slling 	ZFS_IOC_OBJ_TO_PATH,
1048b1b8ab34Slling 	ZFS_IOC_POOL_SET_PROPS,
1049ecd6cf80Smarks 	ZFS_IOC_POOL_GET_PROPS,
1050ecd6cf80Smarks 	ZFS_IOC_SET_FSACL,
1051ecd6cf80Smarks 	ZFS_IOC_GET_FSACL,
1052e45ce728Sahrens 	ZFS_IOC_SHARE,
1053743a77edSAlan Wright 	ZFS_IOC_INHERIT_PROP,
105414843421SMatthew Ahrens 	ZFS_IOC_SMB_ACL,
105514843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_ONE,
105614843421SMatthew Ahrens 	ZFS_IOC_USERSPACE_MANY,
1057842727c2SChris Kirby 	ZFS_IOC_USERSPACE_UPGRADE,
1058842727c2SChris Kirby 	ZFS_IOC_HOLD,
1059842727c2SChris Kirby 	ZFS_IOC_RELEASE,
106092241e0bSTom Erickson 	ZFS_IOC_GET_HOLDS,
10611195e687SMark J Musante 	ZFS_IOC_OBJSET_RECVD_PROPS,
106299d5e173STim Haley 	ZFS_IOC_VDEV_SPLIT,
106399d5e173STim Haley 	ZFS_IOC_NEXT_OBJ,
106499d5e173STim Haley 	ZFS_IOC_DIFF,
106599d5e173STim Haley 	ZFS_IOC_TMP_SNAPSHOT,
1066e9103aaeSGarrett D'Amore 	ZFS_IOC_OBJ_TO_STATS,
106719b94df9SMatthew Ahrens 	ZFS_IOC_SPACE_WRITTEN,
106819b94df9SMatthew Ahrens 	ZFS_IOC_SPACE_SNAPS,
10694445fffbSMatthew Ahrens 	ZFS_IOC_DESTROY_SNAPS,
10704263d13fSGeorge Wilson 	ZFS_IOC_POOL_REGUID,
10714e3c9f44SBill Pijewski 	ZFS_IOC_POOL_REOPEN,
10724445fffbSMatthew Ahrens 	ZFS_IOC_SEND_PROGRESS,
10734445fffbSMatthew Ahrens 	ZFS_IOC_LOG_HISTORY,
10744445fffbSMatthew Ahrens 	ZFS_IOC_SEND_NEW,
10754445fffbSMatthew Ahrens 	ZFS_IOC_SEND_SPACE,
10764445fffbSMatthew Ahrens 	ZFS_IOC_CLONE,
107778f17100SMatthew Ahrens 	ZFS_IOC_BOOKMARK,
107878f17100SMatthew Ahrens 	ZFS_IOC_GET_BOOKMARKS,
107978f17100SMatthew Ahrens 	ZFS_IOC_DESTROY_BOOKMARKS,
1080dfc11533SChris Williamson 	ZFS_IOC_CHANNEL_PROGRAM,
10815cabbc6bSPrashanth Sreenivasa 	ZFS_IOC_REMAP,
108286714001SSerapheim Dimitropoulos 	ZFS_IOC_POOL_CHECKPOINT,
108386714001SSerapheim Dimitropoulos 	ZFS_IOC_POOL_DISCARD_CHECKPOINT,
1084094e47e9SGeorge Wilson 	ZFS_IOC_POOL_INITIALIZE,
10859c2acf00SAlek Pinchuk 	ZFS_IOC_POOL_SYNC,
1086eb633035STom Caputi 	ZFS_IOC_LOAD_KEY,
1087eb633035STom Caputi 	ZFS_IOC_UNLOAD_KEY,
1088eb633035STom Caputi 	ZFS_IOC_CHANGE_KEY,
10894445fffbSMatthew Ahrens 	ZFS_IOC_LAST
1090fa9e4066Sahrens } zfs_ioc_t;
1091fa9e4066Sahrens 
109286714001SSerapheim Dimitropoulos /*
109386714001SSerapheim Dimitropoulos  * ZFS-specific error codes used for returning descriptive errors
109486714001SSerapheim Dimitropoulos  * to the userland through zfs ioctls.
109586714001SSerapheim Dimitropoulos  *
109686714001SSerapheim Dimitropoulos  * The enum implicitly includes all the error codes from errno.h.
109786714001SSerapheim Dimitropoulos  * New code should use and extend this enum for errors that are
109886714001SSerapheim Dimitropoulos  * not described precisely by generic errno codes.
109986714001SSerapheim Dimitropoulos  */
110086714001SSerapheim Dimitropoulos typedef enum {
110186714001SSerapheim Dimitropoulos 	ZFS_ERR_CHECKPOINT_EXISTS = 1024,
110286714001SSerapheim Dimitropoulos 	ZFS_ERR_DISCARDING_CHECKPOINT,
110386714001SSerapheim Dimitropoulos 	ZFS_ERR_NO_CHECKPOINT,
110486714001SSerapheim Dimitropoulos 	ZFS_ERR_DEVRM_IN_PROGRESS,
1105eb633035STom Caputi 	ZFS_ERR_VDEV_TOO_BIG,
1106eb633035STom Caputi 	ZFS_ERR_FROM_IVSET_GUID_MISSING,
1107eb633035STom Caputi 	ZFS_ERR_FROM_IVSET_GUID_MISMATCH,
1108eb633035STom Caputi 	ZFS_ERR_SPILL_BLOCK_FLAG_MISSING,
110986714001SSerapheim Dimitropoulos } zfs_errno_t;
111086714001SSerapheim Dimitropoulos 
1111ea8dc4b6Seschrock /*
1112ea8dc4b6Seschrock  * Internal SPA load state.  Used by FMA diagnosis engine.
1113ea8dc4b6Seschrock  */
1114ea8dc4b6Seschrock typedef enum {
11159eb19f4dSGeorge Wilson 	SPA_LOAD_NONE,		/* no load in progress	*/
11169eb19f4dSGeorge Wilson 	SPA_LOAD_OPEN,		/* normal open		*/
11179eb19f4dSGeorge Wilson 	SPA_LOAD_IMPORT,	/* import in progress	*/
1118468c413aSTim Haley 	SPA_LOAD_TRYIMPORT,	/* tryimport in progress */
11199eb19f4dSGeorge Wilson 	SPA_LOAD_RECOVER,	/* recovery requested	*/
11200f7643c7SGeorge Wilson 	SPA_LOAD_ERROR,		/* load failed		*/
11210f7643c7SGeorge Wilson 	SPA_LOAD_CREATE		/* creation in progress */
1122ea8dc4b6Seschrock } spa_load_state_t;
1123ea8dc4b6Seschrock 
1124eb633035STom Caputi /* supported encryption algorithms */
1125eb633035STom Caputi enum zio_encrypt {
1126eb633035STom Caputi 	ZIO_CRYPT_INHERIT = 0,
1127eb633035STom Caputi 	ZIO_CRYPT_ON,
1128eb633035STom Caputi 	ZIO_CRYPT_OFF,
1129eb633035STom Caputi 	ZIO_CRYPT_AES_128_CCM,
1130eb633035STom Caputi 	ZIO_CRYPT_AES_192_CCM,
1131eb633035STom Caputi 	ZIO_CRYPT_AES_256_CCM,
1132eb633035STom Caputi 	ZIO_CRYPT_AES_128_GCM,
1133eb633035STom Caputi 	ZIO_CRYPT_AES_192_GCM,
1134eb633035STom Caputi 	ZIO_CRYPT_AES_256_GCM,
1135eb633035STom Caputi 	ZIO_CRYPT_FUNCTIONS
1136eb633035STom Caputi };
1137eb633035STom Caputi 
1138e9dbad6fSeschrock /*
1139e9dbad6fSeschrock  * Bookmark name values.
1140e9dbad6fSeschrock  */
114155434c77Sek #define	ZPOOL_ERR_LIST		"error list"
1142e9dbad6fSeschrock #define	ZPOOL_ERR_DATASET	"dataset"
1143e9dbad6fSeschrock #define	ZPOOL_ERR_OBJECT	"object"
1144e9dbad6fSeschrock 
114506eeb2adSek #define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
114606eeb2adSek 
114706eeb2adSek /*
114806eeb2adSek  * The following are names used in the nvlist describing
114906eeb2adSek  * the pool's history log.
115006eeb2adSek  */
115106eeb2adSek #define	ZPOOL_HIST_RECORD	"history record"
115206eeb2adSek #define	ZPOOL_HIST_TIME		"history time"
115306eeb2adSek #define	ZPOOL_HIST_CMD		"history command"
1154ecd6cf80Smarks #define	ZPOOL_HIST_WHO		"history who"
1155ecd6cf80Smarks #define	ZPOOL_HIST_ZONE		"history zone"
1156ecd6cf80Smarks #define	ZPOOL_HIST_HOST		"history hostname"
1157ecd6cf80Smarks #define	ZPOOL_HIST_TXG		"history txg"
1158ecd6cf80Smarks #define	ZPOOL_HIST_INT_EVENT	"history internal event"
1159ecd6cf80Smarks #define	ZPOOL_HIST_INT_STR	"history internal str"
11604445fffbSMatthew Ahrens #define	ZPOOL_HIST_INT_NAME	"internal_name"
11614445fffbSMatthew Ahrens #define	ZPOOL_HIST_IOCTL	"ioctl"
11624445fffbSMatthew Ahrens #define	ZPOOL_HIST_INPUT_NVL	"in_nvl"
11634445fffbSMatthew Ahrens #define	ZPOOL_HIST_OUTPUT_NVL	"out_nvl"
11644445fffbSMatthew Ahrens #define	ZPOOL_HIST_DSNAME	"dsname"
11654445fffbSMatthew Ahrens #define	ZPOOL_HIST_DSID		"dsid"
1166dfc11533SChris Williamson #define	ZPOOL_HIST_ERRNO	"errno"
116706eeb2adSek 
1168094e47e9SGeorge Wilson /*
1169094e47e9SGeorge Wilson  * The following are names used when invoking ZFS_IOC_POOL_INITIALIZE.
1170094e47e9SGeorge Wilson  */
1171094e47e9SGeorge Wilson #define	ZPOOL_INITIALIZE_COMMAND	"initialize_command"
1172094e47e9SGeorge Wilson #define	ZPOOL_INITIALIZE_VDEVS		"initialize_vdevs"
1173094e47e9SGeorge Wilson 
1174eb633035STom Caputi /*
1175eb633035STom Caputi  * Special nvlist name that will not have its args recorded in the pool's
1176eb633035STom Caputi  * history log.
1177eb633035STom Caputi  */
1178eb633035STom Caputi #define	ZPOOL_HIDDEN_ARGS	"hidden_args"
1179eb633035STom Caputi 
11803d7072f8Seschrock /*
11813d7072f8Seschrock  * Flags for ZFS_IOC_VDEV_SET_STATE
11823d7072f8Seschrock  */
11833d7072f8Seschrock #define	ZFS_ONLINE_CHECKREMOVE	0x1
11843d7072f8Seschrock #define	ZFS_ONLINE_UNSPARE	0x2
11853d7072f8Seschrock #define	ZFS_ONLINE_FORCEFAULT	0x4
1186573ca77eSGeorge Wilson #define	ZFS_ONLINE_EXPAND	0x8
11873d7072f8Seschrock #define	ZFS_OFFLINE_TEMPORARY	0x1
11883d7072f8Seschrock 
11894b964adaSGeorge Wilson /*
11904b964adaSGeorge Wilson  * Flags for ZFS_IOC_POOL_IMPORT
11914b964adaSGeorge Wilson  */
11924b964adaSGeorge Wilson #define	ZFS_IMPORT_NORMAL	0x0
11934b964adaSGeorge Wilson #define	ZFS_IMPORT_VERBATIM	0x1
11944b964adaSGeorge Wilson #define	ZFS_IMPORT_ANY_HOST	0x2
11954b964adaSGeorge Wilson #define	ZFS_IMPORT_MISSING_LOG	0x4
1196f9af39baSGeorge Wilson #define	ZFS_IMPORT_ONLY		0x8
119786714001SSerapheim Dimitropoulos #define	ZFS_IMPORT_CHECKPOINT	0x10
119804e56356SAndriy Gapon #define	ZFS_IMPORT_TEMP_NAME	0x20
1199e0f1c0afSOlaf Faaland #define	ZFS_IMPORT_SKIP_MMP	0x40
1200eb633035STom Caputi #define	ZFS_IMPORT_LOAD_KEYS	0x80
12014b964adaSGeorge Wilson 
1202dfc11533SChris Williamson /*
1203dfc11533SChris Williamson  * Channel program argument/return nvlist keys and defaults.
1204dfc11533SChris Williamson  */
1205dfc11533SChris Williamson #define	ZCP_ARG_PROGRAM		"program"
1206dfc11533SChris Williamson #define	ZCP_ARG_ARGLIST		"arg"
1207a3b28680SSerapheim Dimitropoulos #define	ZCP_ARG_SYNC		"sync"
1208dfc11533SChris Williamson #define	ZCP_ARG_INSTRLIMIT	"instrlimit"
1209dfc11533SChris Williamson #define	ZCP_ARG_MEMLIMIT	"memlimit"
1210dfc11533SChris Williamson 
1211dfc11533SChris Williamson #define	ZCP_ARG_CLIARGV		"argv"
1212dfc11533SChris Williamson 
1213dfc11533SChris Williamson #define	ZCP_RET_ERROR		"error"
1214dfc11533SChris Williamson #define	ZCP_RET_RETURN		"return"
1215dfc11533SChris Williamson 
1216dfc11533SChris Williamson #define	ZCP_DEFAULT_INSTRLIMIT	(10 * 1000 * 1000)
1217dfc11533SChris Williamson #define	ZCP_MAX_INSTRLIMIT	(10 * ZCP_DEFAULT_INSTRLIMIT)
1218dfc11533SChris Williamson #define	ZCP_DEFAULT_MEMLIMIT	(10 * 1024 * 1024)
1219dfc11533SChris Williamson #define	ZCP_MAX_MEMLIMIT	(10 * ZCP_DEFAULT_MEMLIMIT)
1220dfc11533SChris Williamson 
12213d7072f8Seschrock /*
12223d7072f8Seschrock  * Sysevent payload members.  ZFS will generate the following sysevents with the
12233d7072f8Seschrock  * given payloads:
12243d7072f8Seschrock  *
12253d7072f8Seschrock  *	ESC_ZFS_RESILVER_START
12263d7072f8Seschrock  *	ESC_ZFS_RESILVER_END
12273d7072f8Seschrock  *	ESC_ZFS_POOL_DESTROY
1228e9103aaeSGarrett D'Amore  *	ESC_ZFS_POOL_REGUID
12293d7072f8Seschrock  *
12303d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
12313d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
12323d7072f8Seschrock  *
12333d7072f8Seschrock  *	ESC_ZFS_VDEV_REMOVE
12343d7072f8Seschrock  *	ESC_ZFS_VDEV_CLEAR
12353d7072f8Seschrock  *	ESC_ZFS_VDEV_CHECK
12363d7072f8Seschrock  *
12373d7072f8Seschrock  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
12383d7072f8Seschrock  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
12393d7072f8Seschrock  *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
12403d7072f8Seschrock  *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
1241ce1577b0SDave Eddy  *
1242ce1577b0SDave Eddy  *	ESC_ZFS_HISTORY_EVENT
1243ce1577b0SDave Eddy  *
1244ce1577b0SDave Eddy  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
1245ce1577b0SDave Eddy  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
1246ce1577b0SDave Eddy  *		ZFS_EV_HIST_TIME	DATA_TYPE_UINT64	(optional)
1247ce1577b0SDave Eddy  *		ZFS_EV_HIST_CMD		DATA_TYPE_STRING	(optional)
1248ce1577b0SDave Eddy  *		ZFS_EV_HIST_WHO		DATA_TYPE_UINT64	(optional)
1249ce1577b0SDave Eddy  *		ZFS_EV_HIST_ZONE	DATA_TYPE_STRING	(optional)
1250ce1577b0SDave Eddy  *		ZFS_EV_HIST_HOST	DATA_TYPE_STRING	(optional)
1251ce1577b0SDave Eddy  *		ZFS_EV_HIST_TXG		DATA_TYPE_UINT64	(optional)
1252ce1577b0SDave Eddy  *		ZFS_EV_HIST_INT_EVENT	DATA_TYPE_UINT64	(optional)
1253ce1577b0SDave Eddy  *		ZFS_EV_HIST_INT_STR	DATA_TYPE_STRING	(optional)
1254ce1577b0SDave Eddy  *		ZFS_EV_HIST_INT_NAME	DATA_TYPE_STRING	(optional)
1255ce1577b0SDave Eddy  *		ZFS_EV_HIST_IOCTL	DATA_TYPE_STRING	(optional)
1256ce1577b0SDave Eddy  *		ZFS_EV_HIST_DSNAME	DATA_TYPE_STRING	(optional)
1257ce1577b0SDave Eddy  *		ZFS_EV_HIST_DSID	DATA_TYPE_UINT64	(optional)
1258ce1577b0SDave Eddy  *
1259ce1577b0SDave Eddy  * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the
1260ce1577b0SDave Eddy  * history log nvlist.  The keynames will be free of any spaces or other
1261ce1577b0SDave Eddy  * characters that could be potentially unexpected to consumers of the
1262ce1577b0SDave Eddy  * sysevents.
12633d7072f8Seschrock  */
12643d7072f8Seschrock #define	ZFS_EV_POOL_NAME	"pool_name"
12653d7072f8Seschrock #define	ZFS_EV_POOL_GUID	"pool_guid"
12663d7072f8Seschrock #define	ZFS_EV_VDEV_PATH	"vdev_path"
12673d7072f8Seschrock #define	ZFS_EV_VDEV_GUID	"vdev_guid"
1268ce1577b0SDave Eddy #define	ZFS_EV_HIST_TIME	"history_time"
1269ce1577b0SDave Eddy #define	ZFS_EV_HIST_CMD		"history_command"
1270ce1577b0SDave Eddy #define	ZFS_EV_HIST_WHO		"history_who"
1271ce1577b0SDave Eddy #define	ZFS_EV_HIST_ZONE	"history_zone"
1272ce1577b0SDave Eddy #define	ZFS_EV_HIST_HOST	"history_hostname"
1273ce1577b0SDave Eddy #define	ZFS_EV_HIST_TXG		"history_txg"
1274ce1577b0SDave Eddy #define	ZFS_EV_HIST_INT_EVENT	"history_internal_event"
1275ce1577b0SDave Eddy #define	ZFS_EV_HIST_INT_STR	"history_internal_str"
1276ce1577b0SDave Eddy #define	ZFS_EV_HIST_INT_NAME	"history_internal_name"
1277ce1577b0SDave Eddy #define	ZFS_EV_HIST_IOCTL	"history_ioctl"
1278ce1577b0SDave Eddy #define	ZFS_EV_HIST_DSNAME	"history_dsname"
1279ce1577b0SDave Eddy #define	ZFS_EV_HIST_DSID	"history_dsid"
12803d7072f8Seschrock 
1281fa9e4066Sahrens #ifdef	__cplusplus
1282fa9e4066Sahrens }
1283fa9e4066Sahrens #endif
1284fa9e4066Sahrens 
1285fa9e4066Sahrens #endif	/* _SYS_FS_ZFS_H */
1286