zfs.h revision 324010
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
25 * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
26 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
27 * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved.
28 * Copyright (c) 2014 Integros [integros.com]
29 * Copyright (c) 2017 Datto Inc.
30 */
31
32/* Portions Copyright 2010 Robert Milkowski */
33
34#ifndef	_SYS_FS_ZFS_H
35#define	_SYS_FS_ZFS_H
36
37#include <sys/types.h>
38#include <sys/ioccom.h>
39#include <sys/time.h>
40
41#ifdef	__cplusplus
42extern "C" {
43#endif
44
45/*
46 * Types and constants shared between userland and the kernel.
47 */
48
49/*
50 * Each dataset can be one of the following types.  These constants can be
51 * combined into masks that can be passed to various functions.
52 */
53typedef enum {
54	ZFS_TYPE_FILESYSTEM	= (1 << 0),
55	ZFS_TYPE_SNAPSHOT	= (1 << 1),
56	ZFS_TYPE_VOLUME		= (1 << 2),
57	ZFS_TYPE_POOL		= (1 << 3),
58	ZFS_TYPE_BOOKMARK	= (1 << 4)
59} zfs_type_t;
60
61/*
62 * NB: lzc_dataset_type should be updated whenever a new objset type is added,
63 * if it represents a real type of a dataset that can be created from userland.
64 */
65typedef enum dmu_objset_type {
66	DMU_OST_NONE,
67	DMU_OST_META,
68	DMU_OST_ZFS,
69	DMU_OST_ZVOL,
70	DMU_OST_OTHER,			/* For testing only! */
71	DMU_OST_ANY,			/* Be careful! */
72	DMU_OST_NUMTYPES
73} dmu_objset_type_t;
74
75#define	ZFS_TYPE_DATASET	\
76	(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
77
78/*
79 * All of these include the terminating NUL byte.
80 */
81#define	ZAP_MAXNAMELEN 256
82#define	ZAP_MAXVALUELEN (1024 * 8)
83#define	ZAP_OLDMAXVALUELEN 1024
84#define	ZFS_MAX_DATASET_NAME_LEN 256
85
86/*
87 * Dataset properties are identified by these constants and must be added to
88 * the end of this list to ensure that external consumers are not affected
89 * by the change. If you make any changes to this list, be sure to update
90 * the property table in usr/src/common/zfs/zfs_prop.c.
91 */
92typedef enum {
93	ZFS_PROP_TYPE,
94	ZFS_PROP_CREATION,
95	ZFS_PROP_USED,
96	ZFS_PROP_AVAILABLE,
97	ZFS_PROP_REFERENCED,
98	ZFS_PROP_COMPRESSRATIO,
99	ZFS_PROP_MOUNTED,
100	ZFS_PROP_ORIGIN,
101	ZFS_PROP_QUOTA,
102	ZFS_PROP_RESERVATION,
103	ZFS_PROP_VOLSIZE,
104	ZFS_PROP_VOLBLOCKSIZE,
105	ZFS_PROP_RECORDSIZE,
106	ZFS_PROP_MOUNTPOINT,
107	ZFS_PROP_SHARENFS,
108	ZFS_PROP_CHECKSUM,
109	ZFS_PROP_COMPRESSION,
110	ZFS_PROP_ATIME,
111	ZFS_PROP_DEVICES,
112	ZFS_PROP_EXEC,
113	ZFS_PROP_SETUID,
114	ZFS_PROP_READONLY,
115	ZFS_PROP_ZONED,
116	ZFS_PROP_SNAPDIR,
117	ZFS_PROP_ACLMODE,
118	ZFS_PROP_ACLINHERIT,
119	ZFS_PROP_CREATETXG,		/* not exposed to the user */
120	ZFS_PROP_NAME,			/* not exposed to the user */
121	ZFS_PROP_CANMOUNT,
122	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
123	ZFS_PROP_XATTR,
124	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
125	ZFS_PROP_COPIES,
126	ZFS_PROP_VERSION,
127	ZFS_PROP_UTF8ONLY,
128	ZFS_PROP_NORMALIZE,
129	ZFS_PROP_CASE,
130	ZFS_PROP_VSCAN,
131	ZFS_PROP_NBMAND,
132	ZFS_PROP_SHARESMB,
133	ZFS_PROP_REFQUOTA,
134	ZFS_PROP_REFRESERVATION,
135	ZFS_PROP_GUID,
136	ZFS_PROP_PRIMARYCACHE,
137	ZFS_PROP_SECONDARYCACHE,
138	ZFS_PROP_USEDSNAP,
139	ZFS_PROP_USEDDS,
140	ZFS_PROP_USEDCHILD,
141	ZFS_PROP_USEDREFRESERV,
142	ZFS_PROP_USERACCOUNTING,	/* not exposed to the user */
143	ZFS_PROP_STMF_SHAREINFO,	/* not exposed to the user */
144	ZFS_PROP_DEFER_DESTROY,
145	ZFS_PROP_USERREFS,
146	ZFS_PROP_LOGBIAS,
147	ZFS_PROP_UNIQUE,		/* not exposed to the user */
148	ZFS_PROP_OBJSETID,		/* not exposed to the user */
149	ZFS_PROP_DEDUP,
150	ZFS_PROP_MLSLABEL,
151	ZFS_PROP_SYNC,
152	ZFS_PROP_REFRATIO,
153	ZFS_PROP_WRITTEN,
154	ZFS_PROP_CLONES,
155	ZFS_PROP_LOGICALUSED,
156	ZFS_PROP_LOGICALREFERENCED,
157	ZFS_PROP_INCONSISTENT,		/* not exposed to the user */
158	ZFS_PROP_VOLMODE,
159	ZFS_PROP_FILESYSTEM_LIMIT,
160	ZFS_PROP_SNAPSHOT_LIMIT,
161	ZFS_PROP_FILESYSTEM_COUNT,
162	ZFS_PROP_SNAPSHOT_COUNT,
163	ZFS_PROP_REDUNDANT_METADATA,
164	ZFS_PROP_PREV_SNAP,
165	ZFS_PROP_RECEIVE_RESUME_TOKEN,
166	ZFS_NUM_PROPS
167} zfs_prop_t;
168
169typedef enum {
170	ZFS_PROP_USERUSED,
171	ZFS_PROP_USERQUOTA,
172	ZFS_PROP_GROUPUSED,
173	ZFS_PROP_GROUPQUOTA,
174	ZFS_NUM_USERQUOTA_PROPS
175} zfs_userquota_prop_t;
176
177extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
178
179/*
180 * Pool properties are identified by these constants and must be added to the
181 * end of this list to ensure that external consumers are not affected
182 * by the change. If you make any changes to this list, be sure to update
183 * the property table in usr/src/common/zfs/zpool_prop.c.
184 */
185typedef enum {
186	ZPOOL_PROP_NAME,
187	ZPOOL_PROP_SIZE,
188	ZPOOL_PROP_CAPACITY,
189	ZPOOL_PROP_ALTROOT,
190	ZPOOL_PROP_HEALTH,
191	ZPOOL_PROP_GUID,
192	ZPOOL_PROP_VERSION,
193	ZPOOL_PROP_BOOTFS,
194	ZPOOL_PROP_DELEGATION,
195	ZPOOL_PROP_AUTOREPLACE,
196	ZPOOL_PROP_CACHEFILE,
197	ZPOOL_PROP_FAILUREMODE,
198	ZPOOL_PROP_LISTSNAPS,
199	ZPOOL_PROP_AUTOEXPAND,
200	ZPOOL_PROP_DEDUPDITTO,
201	ZPOOL_PROP_DEDUPRATIO,
202	ZPOOL_PROP_FREE,
203	ZPOOL_PROP_ALLOCATED,
204	ZPOOL_PROP_READONLY,
205	ZPOOL_PROP_COMMENT,
206	ZPOOL_PROP_EXPANDSZ,
207	ZPOOL_PROP_FREEING,
208	ZPOOL_PROP_FRAGMENTATION,
209	ZPOOL_PROP_LEAKED,
210	ZPOOL_PROP_MAXBLOCKSIZE,
211	ZPOOL_NUM_PROPS
212} zpool_prop_t;
213
214/* Small enough to not hog a whole line of printout in zpool(1M). */
215#define	ZPROP_MAX_COMMENT	32
216
217#define	ZPROP_CONT		-2
218#define	ZPROP_INVAL		-1
219
220#define	ZPROP_VALUE		"value"
221#define	ZPROP_SOURCE		"source"
222
223typedef enum {
224	ZPROP_SRC_NONE = 0x1,
225	ZPROP_SRC_DEFAULT = 0x2,
226	ZPROP_SRC_TEMPORARY = 0x4,
227	ZPROP_SRC_LOCAL = 0x8,
228	ZPROP_SRC_INHERITED = 0x10,
229	ZPROP_SRC_RECEIVED = 0x20
230} zprop_source_t;
231
232#define	ZPROP_SRC_ALL	0x3f
233
234#define	ZPROP_SOURCE_VAL_RECVD	"$recvd"
235#define	ZPROP_N_MORE_ERRORS	"N_MORE_ERRORS"
236/*
237 * Dataset flag implemented as a special entry in the props zap object
238 * indicating that the dataset has received properties on or after
239 * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
240 * just as it did in earlier versions, and thereafter, local properties are
241 * preserved.
242 */
243#define	ZPROP_HAS_RECVD		"$hasrecvd"
244
245typedef enum {
246	ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */
247	ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */
248} zprop_errflags_t;
249
250typedef int (*zprop_func)(int, void *);
251
252/*
253 * Properties to be set on the root file system of a new pool
254 * are stuffed into their own nvlist, which is then included in
255 * the properties nvlist with the pool properties.
256 */
257#define	ZPOOL_ROOTFS_PROPS	"root-props-nvl"
258
259/*
260 * Dataset property functions shared between libzfs and kernel.
261 */
262const char *zfs_prop_default_string(zfs_prop_t);
263uint64_t zfs_prop_default_numeric(zfs_prop_t);
264boolean_t zfs_prop_readonly(zfs_prop_t);
265boolean_t zfs_prop_inheritable(zfs_prop_t);
266boolean_t zfs_prop_setonce(zfs_prop_t);
267const char *zfs_prop_to_name(zfs_prop_t);
268zfs_prop_t zfs_name_to_prop(const char *);
269boolean_t zfs_prop_user(const char *);
270boolean_t zfs_prop_userquota(const char *);
271int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
272int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
273uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
274boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
275
276/*
277 * Pool property functions shared between libzfs and kernel.
278 */
279zpool_prop_t zpool_name_to_prop(const char *);
280const char *zpool_prop_to_name(zpool_prop_t);
281const char *zpool_prop_default_string(zpool_prop_t);
282uint64_t zpool_prop_default_numeric(zpool_prop_t);
283boolean_t zpool_prop_readonly(zpool_prop_t);
284boolean_t zpool_prop_feature(const char *);
285boolean_t zpool_prop_unsupported(const char *name);
286int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
287int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
288uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
289
290/*
291 * Definitions for the Delegation.
292 */
293typedef enum {
294	ZFS_DELEG_WHO_UNKNOWN = 0,
295	ZFS_DELEG_USER = 'u',
296	ZFS_DELEG_USER_SETS = 'U',
297	ZFS_DELEG_GROUP = 'g',
298	ZFS_DELEG_GROUP_SETS = 'G',
299	ZFS_DELEG_EVERYONE = 'e',
300	ZFS_DELEG_EVERYONE_SETS = 'E',
301	ZFS_DELEG_CREATE = 'c',
302	ZFS_DELEG_CREATE_SETS = 'C',
303	ZFS_DELEG_NAMED_SET = 's',
304	ZFS_DELEG_NAMED_SET_SETS = 'S'
305} zfs_deleg_who_type_t;
306
307typedef enum {
308	ZFS_DELEG_NONE = 0,
309	ZFS_DELEG_PERM_LOCAL = 1,
310	ZFS_DELEG_PERM_DESCENDENT = 2,
311	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
312	ZFS_DELEG_PERM_CREATE = 4
313} zfs_deleg_inherit_t;
314
315#define	ZFS_DELEG_PERM_UID	"uid"
316#define	ZFS_DELEG_PERM_GID	"gid"
317#define	ZFS_DELEG_PERM_GROUPS	"groups"
318
319#define	ZFS_MLSLABEL_DEFAULT	"none"
320
321#define	ZFS_SMB_ACL_SRC		"src"
322#define	ZFS_SMB_ACL_TARGET	"target"
323
324typedef enum {
325	ZFS_CANMOUNT_OFF = 0,
326	ZFS_CANMOUNT_ON = 1,
327	ZFS_CANMOUNT_NOAUTO = 2
328} zfs_canmount_type_t;
329
330typedef enum {
331	ZFS_LOGBIAS_LATENCY = 0,
332	ZFS_LOGBIAS_THROUGHPUT = 1
333} zfs_logbias_op_t;
334
335typedef enum zfs_share_op {
336	ZFS_SHARE_NFS = 0,
337	ZFS_UNSHARE_NFS = 1,
338	ZFS_SHARE_SMB = 2,
339	ZFS_UNSHARE_SMB = 3
340} zfs_share_op_t;
341
342typedef enum zfs_smb_acl_op {
343	ZFS_SMB_ACL_ADD,
344	ZFS_SMB_ACL_REMOVE,
345	ZFS_SMB_ACL_RENAME,
346	ZFS_SMB_ACL_PURGE
347} zfs_smb_acl_op_t;
348
349typedef enum zfs_cache_type {
350	ZFS_CACHE_NONE = 0,
351	ZFS_CACHE_METADATA = 1,
352	ZFS_CACHE_ALL = 2
353} zfs_cache_type_t;
354
355typedef enum {
356	ZFS_SYNC_STANDARD = 0,
357	ZFS_SYNC_ALWAYS = 1,
358	ZFS_SYNC_DISABLED = 2
359} zfs_sync_type_t;
360
361typedef enum {
362	ZFS_VOLMODE_DEFAULT = 0,
363	ZFS_VOLMODE_GEOM = 1,
364	ZFS_VOLMODE_DEV = 2,
365	ZFS_VOLMODE_NONE = 3
366} zfs_volmode_t;
367
368typedef enum {
369	ZFS_REDUNDANT_METADATA_ALL,
370	ZFS_REDUNDANT_METADATA_MOST
371} zfs_redundant_metadata_type_t;
372
373/*
374 * On-disk version number.
375 */
376#define	SPA_VERSION_1			1ULL
377#define	SPA_VERSION_2			2ULL
378#define	SPA_VERSION_3			3ULL
379#define	SPA_VERSION_4			4ULL
380#define	SPA_VERSION_5			5ULL
381#define	SPA_VERSION_6			6ULL
382#define	SPA_VERSION_7			7ULL
383#define	SPA_VERSION_8			8ULL
384#define	SPA_VERSION_9			9ULL
385#define	SPA_VERSION_10			10ULL
386#define	SPA_VERSION_11			11ULL
387#define	SPA_VERSION_12			12ULL
388#define	SPA_VERSION_13			13ULL
389#define	SPA_VERSION_14			14ULL
390#define	SPA_VERSION_15			15ULL
391#define	SPA_VERSION_16			16ULL
392#define	SPA_VERSION_17			17ULL
393#define	SPA_VERSION_18			18ULL
394#define	SPA_VERSION_19			19ULL
395#define	SPA_VERSION_20			20ULL
396#define	SPA_VERSION_21			21ULL
397#define	SPA_VERSION_22			22ULL
398#define	SPA_VERSION_23			23ULL
399#define	SPA_VERSION_24			24ULL
400#define	SPA_VERSION_25			25ULL
401#define	SPA_VERSION_26			26ULL
402#define	SPA_VERSION_27			27ULL
403#define	SPA_VERSION_28			28ULL
404#define	SPA_VERSION_5000		5000ULL
405
406/*
407 * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
408 * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
409 * and do the appropriate changes.  Also bump the version number in
410 * usr/src/grub/capability.
411 */
412#define	SPA_VERSION			SPA_VERSION_5000
413#define	SPA_VERSION_STRING		"5000"
414
415/*
416 * Symbolic names for the changes that caused a SPA_VERSION switch.
417 * Used in the code when checking for presence or absence of a feature.
418 * Feel free to define multiple symbolic names for each version if there
419 * were multiple changes to on-disk structures during that version.
420 *
421 * NOTE: When checking the current SPA_VERSION in your code, be sure
422 *       to use spa_version() since it reports the version of the
423 *       last synced uberblock.  Checking the in-flight version can
424 *       be dangerous in some cases.
425 */
426#define	SPA_VERSION_INITIAL		SPA_VERSION_1
427#define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
428#define	SPA_VERSION_SPARES		SPA_VERSION_3
429#define	SPA_VERSION_RAIDZ2		SPA_VERSION_3
430#define	SPA_VERSION_BPOBJ_ACCOUNT	SPA_VERSION_3
431#define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
432#define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
433#define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
434#define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
435#define	SPA_VERSION_BOOTFS		SPA_VERSION_6
436#define	SPA_VERSION_SLOGS		SPA_VERSION_7
437#define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
438#define	SPA_VERSION_FUID		SPA_VERSION_9
439#define	SPA_VERSION_REFRESERVATION	SPA_VERSION_9
440#define	SPA_VERSION_REFQUOTA		SPA_VERSION_9
441#define	SPA_VERSION_UNIQUE_ACCURATE	SPA_VERSION_9
442#define	SPA_VERSION_L2CACHE		SPA_VERSION_10
443#define	SPA_VERSION_NEXT_CLONES		SPA_VERSION_11
444#define	SPA_VERSION_ORIGIN		SPA_VERSION_11
445#define	SPA_VERSION_DSL_SCRUB		SPA_VERSION_11
446#define	SPA_VERSION_SNAP_PROPS		SPA_VERSION_12
447#define	SPA_VERSION_USED_BREAKDOWN	SPA_VERSION_13
448#define	SPA_VERSION_PASSTHROUGH_X	SPA_VERSION_14
449#define	SPA_VERSION_USERSPACE		SPA_VERSION_15
450#define	SPA_VERSION_STMF_PROP		SPA_VERSION_16
451#define	SPA_VERSION_RAIDZ3		SPA_VERSION_17
452#define	SPA_VERSION_USERREFS		SPA_VERSION_18
453#define	SPA_VERSION_HOLES		SPA_VERSION_19
454#define	SPA_VERSION_ZLE_COMPRESSION	SPA_VERSION_20
455#define	SPA_VERSION_DEDUP		SPA_VERSION_21
456#define	SPA_VERSION_RECVD_PROPS		SPA_VERSION_22
457#define	SPA_VERSION_SLIM_ZIL		SPA_VERSION_23
458#define	SPA_VERSION_SA			SPA_VERSION_24
459#define	SPA_VERSION_SCAN		SPA_VERSION_25
460#define	SPA_VERSION_DIR_CLONES		SPA_VERSION_26
461#define	SPA_VERSION_DEADLISTS		SPA_VERSION_26
462#define	SPA_VERSION_FAST_SNAP		SPA_VERSION_27
463#define	SPA_VERSION_MULTI_REPLACE	SPA_VERSION_28
464#define	SPA_VERSION_BEFORE_FEATURES	SPA_VERSION_28
465#define	SPA_VERSION_FEATURES		SPA_VERSION_5000
466
467#define	SPA_VERSION_IS_SUPPORTED(v) \
468	(((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
469	((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
470
471/*
472 * ZPL version - rev'd whenever an incompatible on-disk format change
473 * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
474 * also update the version_table[] and help message in zfs_prop.c.
475 *
476 * When changing, be sure to teach GRUB how to read the new format!
477 * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
478 */
479#define	ZPL_VERSION_1			1ULL
480#define	ZPL_VERSION_2			2ULL
481#define	ZPL_VERSION_3			3ULL
482#define	ZPL_VERSION_4			4ULL
483#define	ZPL_VERSION_5			5ULL
484#define	ZPL_VERSION			ZPL_VERSION_5
485#define	ZPL_VERSION_STRING		"5"
486
487#define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
488#define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
489#define	ZPL_VERSION_FUID		ZPL_VERSION_3
490#define	ZPL_VERSION_NORMALIZATION	ZPL_VERSION_3
491#define	ZPL_VERSION_SYSATTR		ZPL_VERSION_3
492#define	ZPL_VERSION_USERSPACE		ZPL_VERSION_4
493#define	ZPL_VERSION_SA			ZPL_VERSION_5
494
495/* Rewind request information */
496#define	ZPOOL_NO_REWIND		1  /* No policy - default behavior */
497#define	ZPOOL_NEVER_REWIND	2  /* Do not search for best txg or rewind */
498#define	ZPOOL_TRY_REWIND	4  /* Search for best txg, but do not rewind */
499#define	ZPOOL_DO_REWIND		8  /* Rewind to best txg w/in deferred frees */
500#define	ZPOOL_EXTREME_REWIND	16 /* Allow extreme measures to find best txg */
501#define	ZPOOL_REWIND_MASK	28 /* All the possible rewind bits */
502#define	ZPOOL_REWIND_POLICIES	31 /* All the possible policy bits */
503
504typedef struct zpool_rewind_policy {
505	uint32_t	zrp_request;	/* rewind behavior requested */
506	uint64_t	zrp_maxmeta;	/* max acceptable meta-data errors */
507	uint64_t	zrp_maxdata;	/* max acceptable data errors */
508	uint64_t	zrp_txg;	/* specific txg to load */
509} zpool_rewind_policy_t;
510
511/*
512 * The following are configuration names used in the nvlist describing a pool's
513 * configuration.
514 */
515#define	ZPOOL_CONFIG_VERSION		"version"
516#define	ZPOOL_CONFIG_POOL_NAME		"name"
517#define	ZPOOL_CONFIG_POOL_STATE		"state"
518#define	ZPOOL_CONFIG_POOL_TXG		"txg"
519#define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
520#define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
521#define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
522#define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
523#define	ZPOOL_CONFIG_TYPE		"type"
524#define	ZPOOL_CONFIG_CHILDREN		"children"
525#define	ZPOOL_CONFIG_ID			"id"
526#define	ZPOOL_CONFIG_GUID		"guid"
527#define	ZPOOL_CONFIG_PATH		"path"
528#define	ZPOOL_CONFIG_DEVID		"devid"
529#define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
530#define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
531#define	ZPOOL_CONFIG_ASHIFT		"ashift"
532#define	ZPOOL_CONFIG_ASIZE		"asize"
533#define	ZPOOL_CONFIG_DTL		"DTL"
534#define	ZPOOL_CONFIG_SCAN_STATS		"scan_stats"	/* not stored on disk */
535#define	ZPOOL_CONFIG_VDEV_STATS		"vdev_stats"	/* not stored on disk */
536#define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
537#define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
538#define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
539#define	ZPOOL_CONFIG_SPARES		"spares"
540#define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
541#define	ZPOOL_CONFIG_NPARITY		"nparity"
542#define	ZPOOL_CONFIG_HOSTID		"hostid"
543#define	ZPOOL_CONFIG_HOSTNAME		"hostname"
544#define	ZPOOL_CONFIG_LOADED_TIME	"initial_load_time"
545#define	ZPOOL_CONFIG_UNSPARE		"unspare"
546#define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
547#define	ZPOOL_CONFIG_IS_LOG		"is_log"
548#define	ZPOOL_CONFIG_L2CACHE		"l2cache"
549#define	ZPOOL_CONFIG_HOLE_ARRAY		"hole_array"
550#define	ZPOOL_CONFIG_VDEV_CHILDREN	"vdev_children"
551#define	ZPOOL_CONFIG_IS_HOLE		"is_hole"
552#define	ZPOOL_CONFIG_DDT_HISTOGRAM	"ddt_histogram"
553#define	ZPOOL_CONFIG_DDT_OBJ_STATS	"ddt_object_stats"
554#define	ZPOOL_CONFIG_DDT_STATS		"ddt_stats"
555#define	ZPOOL_CONFIG_SPLIT		"splitcfg"
556#define	ZPOOL_CONFIG_ORIG_GUID		"orig_guid"
557#define	ZPOOL_CONFIG_SPLIT_GUID		"split_guid"
558#define	ZPOOL_CONFIG_SPLIT_LIST		"guid_list"
559#define	ZPOOL_CONFIG_REMOVING		"removing"
560#define	ZPOOL_CONFIG_RESILVER_TXG	"resilver_txg"
561#define	ZPOOL_CONFIG_COMMENT		"comment"
562#define	ZPOOL_CONFIG_SUSPENDED		"suspended"	/* not stored on disk */
563#define	ZPOOL_CONFIG_TIMESTAMP		"timestamp"	/* not stored on disk */
564#define	ZPOOL_CONFIG_BOOTFS		"bootfs"	/* not stored on disk */
565#define	ZPOOL_CONFIG_MISSING_DEVICES	"missing_vdevs"	/* not stored on disk */
566#define	ZPOOL_CONFIG_LOAD_INFO		"load_info"	/* not stored on disk */
567#define	ZPOOL_CONFIG_REWIND_INFO	"rewind_info"	/* not stored on disk */
568#define	ZPOOL_CONFIG_UNSUP_FEAT		"unsup_feat"	/* not stored on disk */
569#define	ZPOOL_CONFIG_ENABLED_FEAT	"enabled_feat"	/* not stored on disk */
570#define	ZPOOL_CONFIG_CAN_RDONLY		"can_rdonly"	/* not stored on disk */
571#define	ZPOOL_CONFIG_FEATURES_FOR_READ	"features_for_read"
572#define	ZPOOL_CONFIG_FEATURE_STATS	"feature_stats"	/* not stored on disk */
573#define	ZPOOL_CONFIG_VDEV_TOP_ZAP	"com.delphix:vdev_zap_top"
574#define	ZPOOL_CONFIG_VDEV_LEAF_ZAP	"com.delphix:vdev_zap_leaf"
575#define	ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS	"com.delphix:has_per_vdev_zaps"
576/*
577 * The persistent vdev state is stored as separate values rather than a single
578 * 'vdev_state' entry.  This is because a device can be in multiple states, such
579 * as offline and degraded.
580 */
581#define	ZPOOL_CONFIG_OFFLINE		"offline"
582#define	ZPOOL_CONFIG_FAULTED		"faulted"
583#define	ZPOOL_CONFIG_DEGRADED		"degraded"
584#define	ZPOOL_CONFIG_REMOVED		"removed"
585#define	ZPOOL_CONFIG_FRU		"fru"
586#define	ZPOOL_CONFIG_AUX_STATE		"aux_state"
587
588/* Rewind policy parameters */
589#define	ZPOOL_REWIND_POLICY		"rewind-policy"
590#define	ZPOOL_REWIND_REQUEST		"rewind-request"
591#define	ZPOOL_REWIND_REQUEST_TXG	"rewind-request-txg"
592#define	ZPOOL_REWIND_META_THRESH	"rewind-meta-thresh"
593#define	ZPOOL_REWIND_DATA_THRESH	"rewind-data-thresh"
594
595/* Rewind data discovered */
596#define	ZPOOL_CONFIG_LOAD_TIME		"rewind_txg_ts"
597#define	ZPOOL_CONFIG_LOAD_DATA_ERRORS	"verify_data_errors"
598#define	ZPOOL_CONFIG_REWIND_TIME	"seconds_of_rewind"
599
600#define	VDEV_TYPE_ROOT			"root"
601#define	VDEV_TYPE_MIRROR		"mirror"
602#define	VDEV_TYPE_REPLACING		"replacing"
603#define	VDEV_TYPE_RAIDZ			"raidz"
604#define	VDEV_TYPE_DISK			"disk"
605#define	VDEV_TYPE_FILE			"file"
606#define	VDEV_TYPE_MISSING		"missing"
607#define	VDEV_TYPE_HOLE			"hole"
608#define	VDEV_TYPE_SPARE			"spare"
609#define	VDEV_TYPE_LOG			"log"
610#define	VDEV_TYPE_L2CACHE		"l2cache"
611
612/*
613 * This is needed in userland to report the minimum necessary device size.
614 *
615 * Note that the zfs test suite uses 64MB vdevs.
616 */
617#define	SPA_MINDEVSIZE		(64ULL << 20)
618
619/*
620 * Set if the fragmentation has not yet been calculated. This can happen
621 * because the space maps have not been upgraded or the histogram feature
622 * is not enabled.
623 */
624#define	ZFS_FRAG_INVALID	UINT64_MAX
625
626/*
627 * The location of the pool configuration repository, shared between kernel and
628 * userland.
629 */
630#define	ZPOOL_CACHE		"/boot/zfs/zpool.cache"
631
632/*
633 * vdev states are ordered from least to most healthy.
634 * A vdev that's CANT_OPEN or below is considered unusable.
635 */
636typedef enum vdev_state {
637	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
638	VDEV_STATE_CLOSED,	/* Not currently open			*/
639	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
640	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
641	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
642	VDEV_STATE_FAULTED,	/* External request to fault device	*/
643	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
644	VDEV_STATE_HEALTHY	/* Presumed good			*/
645} vdev_state_t;
646
647#define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
648
649/*
650 * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
651 * of the vdev stats structure uses these constants to distinguish why.
652 */
653typedef enum vdev_aux {
654	VDEV_AUX_NONE,		/* no error				*/
655	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
656	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
657	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
658	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
659	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
660	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
661	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
662	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
663	VDEV_AUX_UNSUP_FEAT,	/* unsupported features			*/
664	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
665	VDEV_AUX_ERR_EXCEEDED,	/* too many errors			*/
666	VDEV_AUX_IO_FAILURE,	/* experienced I/O failure		*/
667	VDEV_AUX_BAD_LOG,	/* cannot read log chain(s)		*/
668	VDEV_AUX_EXTERNAL,	/* external diagnosis			*/
669	VDEV_AUX_SPLIT_POOL,	/* vdev was split off into another pool	*/
670	VDEV_AUX_ASHIFT_TOO_BIG /* vdev's min block size is too large   */
671} vdev_aux_t;
672
673/*
674 * pool state.  The following states are written to disk as part of the normal
675 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
676 * states are software abstractions used at various levels to communicate
677 * pool state.
678 */
679typedef enum pool_state {
680	POOL_STATE_ACTIVE = 0,		/* In active use		*/
681	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
682	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
683	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
684	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
685	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
686	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
687	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
688} pool_state_t;
689
690/*
691 * Scan Functions.
692 */
693typedef enum pool_scan_func {
694	POOL_SCAN_NONE,
695	POOL_SCAN_SCRUB,
696	POOL_SCAN_RESILVER,
697	POOL_SCAN_FUNCS
698} pool_scan_func_t;
699
700/*
701 * Used to control scrub pause and resume.
702 */
703typedef enum pool_scrub_cmd {
704	POOL_SCRUB_NORMAL = 0,
705	POOL_SCRUB_PAUSE,
706	POOL_SCRUB_FLAGS_END
707} pool_scrub_cmd_t;
708
709
710/*
711 * ZIO types.  Needed to interpret vdev statistics below.
712 */
713typedef enum zio_type {
714	ZIO_TYPE_NULL = 0,
715	ZIO_TYPE_READ,
716	ZIO_TYPE_WRITE,
717	ZIO_TYPE_FREE,
718	ZIO_TYPE_CLAIM,
719	ZIO_TYPE_IOCTL,
720	ZIO_TYPES
721} zio_type_t;
722
723/*
724 * Pool statistics.  Note: all fields should be 64-bit because this
725 * is passed between kernel and userland as an nvlist uint64 array.
726 */
727typedef struct pool_scan_stat {
728	/* values stored on disk */
729	uint64_t	pss_func;	/* pool_scan_func_t */
730	uint64_t	pss_state;	/* dsl_scan_state_t */
731	uint64_t	pss_start_time;	/* scan start time */
732	uint64_t	pss_end_time;	/* scan end time */
733	uint64_t	pss_to_examine;	/* total bytes to scan */
734	uint64_t	pss_examined;	/* total examined bytes	*/
735	uint64_t	pss_to_process; /* total bytes to process */
736	uint64_t	pss_processed;	/* total processed bytes */
737	uint64_t	pss_errors;	/* scan errors	*/
738
739	/* values not stored on disk */
740	uint64_t	pss_pass_exam;	/* examined bytes per scan pass */
741	uint64_t	pss_pass_start;	/* start time of a scan pass */
742	uint64_t	pss_pass_scrub_pause; /* pause time of a scurb pass */
743	/* cumulative time scrub spent paused, needed for rate calculation */
744	uint64_t	pss_pass_scrub_spent_paused;
745} pool_scan_stat_t;
746
747typedef enum dsl_scan_state {
748	DSS_NONE,
749	DSS_SCANNING,
750	DSS_FINISHED,
751	DSS_CANCELED,
752	DSS_NUM_STATES
753} dsl_scan_state_t;
754
755
756/*
757 * Vdev statistics.  Note: all fields should be 64-bit because this
758 * is passed between kernel and userland as an nvlist uint64 array.
759 */
760typedef struct vdev_stat {
761	hrtime_t	vs_timestamp;		/* time since vdev load	*/
762	uint64_t	vs_state;		/* vdev state		*/
763	uint64_t	vs_aux;			/* see vdev_aux_t	*/
764	uint64_t	vs_alloc;		/* space allocated	*/
765	uint64_t	vs_space;		/* total capacity	*/
766	uint64_t	vs_dspace;		/* deflated capacity	*/
767	uint64_t	vs_rsize;		/* replaceable dev size */
768	uint64_t	vs_esize;		/* expandable dev size */
769	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
770	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
771	uint64_t	vs_read_errors;		/* read errors		*/
772	uint64_t	vs_write_errors;	/* write errors		*/
773	uint64_t	vs_checksum_errors;	/* checksum errors	*/
774	uint64_t	vs_self_healed;		/* self-healed bytes	*/
775	uint64_t	vs_scan_removing;	/* removing?	*/
776	uint64_t	vs_scan_processed;	/* scan processed bytes	*/
777 	uint64_t	vs_configured_ashift;	/* TLV vdev_ashift      */
778 	uint64_t	vs_logical_ashift;	/* vdev_logical_ashift  */
779 	uint64_t	vs_physical_ashift;	/* vdev_physical_ashift */
780	uint64_t	vs_fragmentation;	/* device fragmentation */
781} vdev_stat_t;
782#define VDEV_STAT_VALID(field, uint64_t_field_count) \
783    ((uint64_t_field_count * sizeof(uint64_t)) >= \
784     (offsetof(vdev_stat_t, field) + sizeof(((vdev_stat_t *)NULL)->field)))
785
786/*
787 * DDT statistics.  Note: all fields should be 64-bit because this
788 * is passed between kernel and userland as an nvlist uint64 array.
789 */
790typedef struct ddt_object {
791	uint64_t	ddo_count;	/* number of elments in ddt 	*/
792	uint64_t	ddo_dspace;	/* size of ddt on disk		*/
793	uint64_t	ddo_mspace;	/* size of ddt in-core		*/
794} ddt_object_t;
795
796typedef struct ddt_stat {
797	uint64_t	dds_blocks;	/* blocks			*/
798	uint64_t	dds_lsize;	/* logical size			*/
799	uint64_t	dds_psize;	/* physical size		*/
800	uint64_t	dds_dsize;	/* deflated allocated size	*/
801	uint64_t	dds_ref_blocks;	/* referenced blocks		*/
802	uint64_t	dds_ref_lsize;	/* referenced lsize * refcnt	*/
803	uint64_t	dds_ref_psize;	/* referenced psize * refcnt	*/
804	uint64_t	dds_ref_dsize;	/* referenced dsize * refcnt	*/
805} ddt_stat_t;
806
807typedef struct ddt_histogram {
808	ddt_stat_t	ddh_stat[64];	/* power-of-two histogram buckets */
809} ddt_histogram_t;
810
811#define	ZVOL_DRIVER	"zvol"
812#define	ZFS_DRIVER	"zfs"
813#define	ZFS_DEV_NAME	"zfs"
814#define	ZFS_DEV		"/dev/" ZFS_DEV_NAME
815#define	ZFS_DISK_ROOT	"/dev/dsk"
816#define	ZFS_DISK_ROOTD	ZFS_DISK_ROOT "/"
817#define	ZFS_RDISK_ROOT	"/dev/rdsk"
818#define	ZFS_RDISK_ROOTD	ZFS_RDISK_ROOT "/"
819
820/* general zvol path */
821#define	ZVOL_DIR		"/dev/zvol"
822/* expansion */
823#define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zfs@0:"
824/* for dump and swap */
825#define	ZVOL_FULL_DEV_DIR	ZVOL_DIR "/dsk/"
826#define	ZVOL_FULL_RDEV_DIR	ZVOL_DIR "/rdsk/"
827
828#define	ZVOL_PROP_NAME		"name"
829#define	ZVOL_DEFAULT_BLOCKSIZE	8192
830
831/*
832 * /dev/zfs ioctl numbers.
833 */
834typedef enum zfs_ioc {
835	ZFS_IOC_FIRST =	0,
836	ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
837	ZFS_IOC_POOL_DESTROY,
838	ZFS_IOC_POOL_IMPORT,
839	ZFS_IOC_POOL_EXPORT,
840	ZFS_IOC_POOL_CONFIGS,
841	ZFS_IOC_POOL_STATS,
842	ZFS_IOC_POOL_TRYIMPORT,
843	ZFS_IOC_POOL_SCAN,
844	ZFS_IOC_POOL_FREEZE,
845	ZFS_IOC_POOL_UPGRADE,
846	ZFS_IOC_POOL_GET_HISTORY,
847	ZFS_IOC_VDEV_ADD,
848	ZFS_IOC_VDEV_REMOVE,
849	ZFS_IOC_VDEV_SET_STATE,
850	ZFS_IOC_VDEV_ATTACH,
851	ZFS_IOC_VDEV_DETACH,
852	ZFS_IOC_VDEV_SETPATH,
853	ZFS_IOC_VDEV_SETFRU,
854	ZFS_IOC_OBJSET_STATS,
855	ZFS_IOC_OBJSET_ZPLPROPS,
856	ZFS_IOC_DATASET_LIST_NEXT,
857	ZFS_IOC_SNAPSHOT_LIST_NEXT,
858	ZFS_IOC_SET_PROP,
859	ZFS_IOC_CREATE,
860	ZFS_IOC_DESTROY,
861	ZFS_IOC_ROLLBACK,
862	ZFS_IOC_RENAME,
863	ZFS_IOC_RECV,
864	ZFS_IOC_SEND,
865	ZFS_IOC_INJECT_FAULT,
866	ZFS_IOC_CLEAR_FAULT,
867	ZFS_IOC_INJECT_LIST_NEXT,
868	ZFS_IOC_ERROR_LOG,
869	ZFS_IOC_CLEAR,
870	ZFS_IOC_PROMOTE,
871	ZFS_IOC_DESTROY_SNAPS,
872	ZFS_IOC_SNAPSHOT,
873	ZFS_IOC_DSOBJ_TO_DSNAME,
874	ZFS_IOC_OBJ_TO_PATH,
875	ZFS_IOC_POOL_SET_PROPS,
876	ZFS_IOC_POOL_GET_PROPS,
877	ZFS_IOC_SET_FSACL,
878	ZFS_IOC_GET_FSACL,
879	ZFS_IOC_SHARE,
880	ZFS_IOC_INHERIT_PROP,
881	ZFS_IOC_SMB_ACL,
882	ZFS_IOC_USERSPACE_ONE,
883	ZFS_IOC_USERSPACE_MANY,
884	ZFS_IOC_USERSPACE_UPGRADE,
885	ZFS_IOC_HOLD,
886	ZFS_IOC_RELEASE,
887	ZFS_IOC_GET_HOLDS,
888	ZFS_IOC_OBJSET_RECVD_PROPS,
889	ZFS_IOC_VDEV_SPLIT,
890	ZFS_IOC_NEXT_OBJ,
891	ZFS_IOC_DIFF,
892	ZFS_IOC_TMP_SNAPSHOT,
893	ZFS_IOC_OBJ_TO_STATS,
894	ZFS_IOC_JAIL,
895	ZFS_IOC_UNJAIL,
896	ZFS_IOC_POOL_REGUID,
897	ZFS_IOC_SPACE_WRITTEN,
898	ZFS_IOC_SPACE_SNAPS,
899	ZFS_IOC_SEND_PROGRESS,
900	ZFS_IOC_POOL_REOPEN,
901	ZFS_IOC_LOG_HISTORY,
902	ZFS_IOC_SEND_NEW,
903	ZFS_IOC_SEND_SPACE,
904	ZFS_IOC_CLONE,
905	ZFS_IOC_BOOKMARK,
906	ZFS_IOC_GET_BOOKMARKS,
907	ZFS_IOC_DESTROY_BOOKMARKS,
908	ZFS_IOC_NEXTBOOT,
909	ZFS_IOC_LAST
910} zfs_ioc_t;
911
912/*
913 * Internal SPA load state.  Used by FMA diagnosis engine.
914 */
915typedef enum {
916	SPA_LOAD_NONE,		/* no load in progress	*/
917	SPA_LOAD_OPEN,		/* normal open		*/
918	SPA_LOAD_IMPORT,	/* import in progress	*/
919	SPA_LOAD_TRYIMPORT,	/* tryimport in progress */
920	SPA_LOAD_RECOVER,	/* recovery requested	*/
921	SPA_LOAD_ERROR,		/* load failed		*/
922	SPA_LOAD_CREATE		/* creation in progress */
923} spa_load_state_t;
924
925/*
926 * Bookmark name values.
927 */
928#define	ZPOOL_ERR_LIST		"error list"
929#define	ZPOOL_ERR_DATASET	"dataset"
930#define	ZPOOL_ERR_OBJECT	"object"
931
932#define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
933
934/*
935 * The following are names used in the nvlist describing
936 * the pool's history log.
937 */
938#define	ZPOOL_HIST_RECORD	"history record"
939#define	ZPOOL_HIST_TIME		"history time"
940#define	ZPOOL_HIST_CMD		"history command"
941#define	ZPOOL_HIST_WHO		"history who"
942#define	ZPOOL_HIST_ZONE		"history zone"
943#define	ZPOOL_HIST_HOST		"history hostname"
944#define	ZPOOL_HIST_TXG		"history txg"
945#define	ZPOOL_HIST_INT_EVENT	"history internal event"
946#define	ZPOOL_HIST_INT_STR	"history internal str"
947#define	ZPOOL_HIST_INT_NAME	"internal_name"
948#define	ZPOOL_HIST_IOCTL	"ioctl"
949#define	ZPOOL_HIST_INPUT_NVL	"in_nvl"
950#define	ZPOOL_HIST_OUTPUT_NVL	"out_nvl"
951#define	ZPOOL_HIST_DSNAME	"dsname"
952#define	ZPOOL_HIST_DSID		"dsid"
953
954/*
955 * Flags for ZFS_IOC_VDEV_SET_STATE
956 */
957#define	ZFS_ONLINE_CHECKREMOVE	0x1
958#define	ZFS_ONLINE_UNSPARE	0x2
959#define	ZFS_ONLINE_FORCEFAULT	0x4
960#define	ZFS_ONLINE_EXPAND	0x8
961#define	ZFS_OFFLINE_TEMPORARY	0x1
962
963/*
964 * Flags for ZFS_IOC_POOL_IMPORT
965 */
966#define	ZFS_IMPORT_NORMAL	0x0
967#define	ZFS_IMPORT_VERBATIM	0x1
968#define	ZFS_IMPORT_ANY_HOST	0x2
969#define	ZFS_IMPORT_MISSING_LOG	0x4
970#define	ZFS_IMPORT_ONLY		0x8
971
972/*
973 * Sysevent payload members.  ZFS will generate the following sysevents with the
974 * given payloads:
975 *
976 *	ESC_ZFS_RESILVER_START
977 *	ESC_ZFS_RESILVER_END
978 *	ESC_ZFS_POOL_DESTROY
979 *	ESC_ZFS_POOL_REGUID
980 *
981 *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
982 *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
983 *
984 *	ESC_ZFS_VDEV_REMOVE
985 *	ESC_ZFS_VDEV_CLEAR
986 *	ESC_ZFS_VDEV_CHECK
987 *
988 *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
989 *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
990 *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
991 *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
992 */
993#define	ZFS_EV_POOL_NAME	"pool_name"
994#define	ZFS_EV_POOL_GUID	"pool_guid"
995#define	ZFS_EV_VDEV_PATH	"vdev_path"
996#define	ZFS_EV_VDEV_GUID	"vdev_guid"
997
998#ifdef	__cplusplus
999}
1000#endif
1001
1002#endif	/* _SYS_FS_ZFS_H */
1003