xref: /illumos-gate/usr/src/uts/common/sys/fs/zfs.h (revision e7437265dc2a4920c197ed4337665539d358b22c)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_FS_ZFS_H
27 #define	_SYS_FS_ZFS_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Types and constants shared between userland and the kernel.
37  */
38 
39 /*
40  * Each dataset can be one of the following types.  These constants can be
41  * combined into masks that can be passed to various functions.
42  */
43 typedef enum {
44 	ZFS_TYPE_FILESYSTEM	= 0x1,
45 	ZFS_TYPE_SNAPSHOT	= 0x2,
46 	ZFS_TYPE_VOLUME		= 0x4,
47 	ZFS_TYPE_POOL		= 0x8
48 } zfs_type_t;
49 
50 #define	ZFS_TYPE_ANY	\
51 	(ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
52 
53 /*
54  * Properties are identified by these constants and must be added to the
55  * end of this list to ensure that external consumers are not affected
56  * by the change. The property list also determines how 'zfs get' will
57  * display them.  If you make any changes to this list, be sure to update
58  * the property table in usr/src/common/zfs/zfs_prop.c.
59  */
60 typedef enum {
61 	ZFS_PROP_CONT = -2,
62 	ZFS_PROP_INVAL = -1,
63 	ZFS_PROP_TYPE,
64 	ZFS_PROP_CREATION,
65 	ZFS_PROP_USED,
66 	ZFS_PROP_AVAILABLE,
67 	ZFS_PROP_REFERENCED,
68 	ZFS_PROP_COMPRESSRATIO,
69 	ZFS_PROP_MOUNTED,
70 	ZFS_PROP_ORIGIN,
71 	ZFS_PROP_QUOTA,
72 	ZFS_PROP_RESERVATION,
73 	ZFS_PROP_VOLSIZE,
74 	ZFS_PROP_VOLBLOCKSIZE,
75 	ZFS_PROP_RECORDSIZE,
76 	ZFS_PROP_MOUNTPOINT,
77 	ZFS_PROP_SHARENFS,
78 	ZFS_PROP_CHECKSUM,
79 	ZFS_PROP_COMPRESSION,
80 	ZFS_PROP_ATIME,
81 	ZFS_PROP_DEVICES,
82 	ZFS_PROP_EXEC,
83 	ZFS_PROP_SETUID,
84 	ZFS_PROP_READONLY,
85 	ZFS_PROP_ZONED,
86 	ZFS_PROP_SNAPDIR,
87 	ZFS_PROP_ACLMODE,
88 	ZFS_PROP_ACLINHERIT,
89 	ZFS_PROP_CREATETXG,		/* not exposed to the user */
90 	ZFS_PROP_NAME,			/* not exposed to the user */
91 	ZFS_PROP_CANMOUNT,
92 	ZFS_PROP_SHAREISCSI,
93 	ZFS_PROP_ISCSIOPTIONS,		/* not exposed to the user */
94 	ZFS_PROP_XATTR,
95 	ZFS_PROP_NUMCLONES,		/* not exposed to the user */
96 	ZFS_PROP_COPIES,
97 	ZPOOL_PROP_BOOTFS,
98 	ZPOOL_PROP_AUTOREPLACE,
99 	ZPOOL_PROP_DELEGATION,
100 	ZFS_PROP_VERSION,
101 	ZPOOL_PROP_NAME			/* XXX must be last! */
102 } zfs_prop_t;
103 
104 typedef zfs_prop_t zpool_prop_t;
105 
106 #define	ZPOOL_PROP_CONT		ZFS_PROP_CONT
107 #define	ZPOOL_PROP_INVAL	ZFS_PROP_INVAL
108 
109 #define	ZFS_PROP_VALUE		"value"
110 #define	ZFS_PROP_SOURCE		"source"
111 
112 typedef enum {
113 	ZFS_SRC_NONE = 0x1,
114 	ZFS_SRC_DEFAULT = 0x2,
115 	ZFS_SRC_TEMPORARY = 0x4,
116 	ZFS_SRC_LOCAL = 0x8,
117 	ZFS_SRC_INHERITED = 0x10
118 } zfs_source_t;
119 
120 #define	ZFS_SRC_ALL	0x1f
121 
122 typedef enum {
123 	ZFS_DELEG_WHO_UNKNOWN = 0,
124 	ZFS_DELEG_USER = 'u',
125 	ZFS_DELEG_USER_SETS = 'U',
126 	ZFS_DELEG_GROUP = 'g',
127 	ZFS_DELEG_GROUP_SETS = 'G',
128 	ZFS_DELEG_EVERYONE = 'e',
129 	ZFS_DELEG_EVERYONE_SETS = 'E',
130 	ZFS_DELEG_CREATE = 'c',
131 	ZFS_DELEG_CREATE_SETS = 'C',
132 	ZFS_DELEG_NAMED_SET = 's',
133 	ZFS_DELEG_NAMED_SET_SETS = 'S'
134 } zfs_deleg_who_type_t;
135 
136 typedef enum {
137 	ZFS_DELEG_NONE = 0,
138 	ZFS_DELEG_PERM_LOCAL = 1,
139 	ZFS_DELEG_PERM_DESCENDENT = 2,
140 	ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
141 	ZFS_DELEG_PERM_CREATE = 4
142 } zfs_deleg_inherit_t;
143 
144 #define	ZFS_DELEG_PERM_UID	"uid"
145 #define	ZFS_DELEG_PERM_GID	"gid"
146 #define	ZFS_DELEG_PERM_GROUPS	"groups"
147 
148 /*
149  * The following functions are shared between libzfs and the kernel.
150  */
151 zfs_prop_t zfs_name_to_prop(const char *);
152 zpool_prop_t zpool_name_to_prop(const char *);
153 boolean_t zfs_prop_user(const char *);
154 int zfs_prop_readonly(zfs_prop_t);
155 const char *zfs_prop_default_string(zfs_prop_t);
156 const char *zfs_prop_to_name(zfs_prop_t);
157 const char *zpool_prop_to_name(zpool_prop_t);
158 uint64_t zfs_prop_default_numeric(zfs_prop_t);
159 int zfs_prop_inheritable(zfs_prop_t);
160 int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
161 int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
162 uint64_t zpool_prop_default_numeric(zpool_prop_t);
163 const char *zfs_prop_perm(zfs_prop_t);
164 
165 /*
166  * Property Iterator
167  */
168 typedef zfs_prop_t (*zfs_prop_f)(zfs_prop_t, void *);
169 typedef zpool_prop_t (*zpool_prop_f)(zpool_prop_t, void *);
170 extern zfs_prop_t zfs_prop_iter(zfs_prop_f, void *, boolean_t);
171 extern zpool_prop_t zpool_prop_iter(zpool_prop_f, void *, boolean_t);
172 
173 /*
174  * On-disk version number.
175  */
176 #define	SPA_VERSION_1			1ULL
177 #define	SPA_VERSION_2			2ULL
178 #define	SPA_VERSION_3			3ULL
179 #define	SPA_VERSION_4			4ULL
180 #define	SPA_VERSION_5			5ULL
181 #define	SPA_VERSION_6			6ULL
182 #define	SPA_VERSION_7			7ULL
183 #define	SPA_VERSION_8			8ULL
184 /*
185  * When bumping up SPA_VERSION, make sure GRUB ZFS understand the on-disk
186  * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*},
187  * and do the appropriate changes.
188  */
189 #define	SPA_VERSION			SPA_VERSION_8
190 #define	SPA_VERSION_STRING		"8"
191 
192 /*
193  * Symbolic names for the changes that caused a SPA_VERSION switch.
194  * Used in the code when checking for presence or absence of a feature.
195  * Feel free to define multiple symbolic names for each version if there
196  * were multiple changes to on-disk structures during that version.
197  *
198  * NOTE: When checking the current SPA_VERSION in your code, be sure
199  *       to use spa_version() since it reports the version of the
200  *       last synced uberblock.  Checking the in-flight version can
201  *       be dangerous in some cases.
202  */
203 #define	SPA_VERSION_INITIAL		SPA_VERSION_1
204 #define	SPA_VERSION_DITTO_BLOCKS	SPA_VERSION_2
205 #define	SPA_VERSION_SPARES		SPA_VERSION_3
206 #define	SPA_VERSION_RAID6		SPA_VERSION_3
207 #define	SPA_VERSION_BPLIST_ACCOUNT	SPA_VERSION_3
208 #define	SPA_VERSION_RAIDZ_DEFLATE	SPA_VERSION_3
209 #define	SPA_VERSION_DNODE_BYTES		SPA_VERSION_3
210 #define	SPA_VERSION_ZPOOL_HISTORY	SPA_VERSION_4
211 #define	SPA_VERSION_GZIP_COMPRESSION	SPA_VERSION_5
212 #define	SPA_VERSION_BOOTFS		SPA_VERSION_6
213 #define	ZFS_VERSION_SLOGS		SPA_VERSION_7
214 #define	ZFS_VERSION_DELEGATED_PERMS	SPA_VERSION_8
215 
216 /*
217  * ZPL version - rev'd whenever an incompatible on-disk format change
218  * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
219  * also update the version_table[] and help message in zfs_prop.c.
220  *
221  * When changing, be sure to teach GRUB how to read the new format!
222  * See usr/src/grub/grub-0.95/stage2/{zfs-include/,fsys_zfs*}
223  */
224 #define	ZPL_VERSION_1			1ULL
225 #define	ZPL_VERSION_2			2ULL
226 #define	ZPL_VERSION			ZPL_VERSION_2
227 #define	ZPL_VERSION_STRING		"2"
228 
229 #define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
230 #define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
231 
232 /*
233  * The following are configuration names used in the nvlist describing a pool's
234  * configuration.
235  */
236 #define	ZPOOL_CONFIG_VERSION		"version"
237 #define	ZPOOL_CONFIG_POOL_NAME		"name"
238 #define	ZPOOL_CONFIG_POOL_STATE		"state"
239 #define	ZPOOL_CONFIG_POOL_TXG		"txg"
240 #define	ZPOOL_CONFIG_POOL_GUID		"pool_guid"
241 #define	ZPOOL_CONFIG_CREATE_TXG		"create_txg"
242 #define	ZPOOL_CONFIG_TOP_GUID		"top_guid"
243 #define	ZPOOL_CONFIG_VDEV_TREE		"vdev_tree"
244 #define	ZPOOL_CONFIG_TYPE		"type"
245 #define	ZPOOL_CONFIG_CHILDREN		"children"
246 #define	ZPOOL_CONFIG_ID			"id"
247 #define	ZPOOL_CONFIG_GUID		"guid"
248 #define	ZPOOL_CONFIG_PATH		"path"
249 #define	ZPOOL_CONFIG_DEVID		"devid"
250 #define	ZPOOL_CONFIG_METASLAB_ARRAY	"metaslab_array"
251 #define	ZPOOL_CONFIG_METASLAB_SHIFT	"metaslab_shift"
252 #define	ZPOOL_CONFIG_ASHIFT		"ashift"
253 #define	ZPOOL_CONFIG_ASIZE		"asize"
254 #define	ZPOOL_CONFIG_DTL		"DTL"
255 #define	ZPOOL_CONFIG_STATS		"stats"
256 #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
257 #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
258 #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
259 #define	ZPOOL_CONFIG_SPARES		"spares"
260 #define	ZPOOL_CONFIG_IS_SPARE		"is_spare"
261 #define	ZPOOL_CONFIG_NPARITY		"nparity"
262 #define	ZPOOL_CONFIG_HOSTID		"hostid"
263 #define	ZPOOL_CONFIG_HOSTNAME		"hostname"
264 #define	ZPOOL_CONFIG_TIMESTAMP		"timestamp" /* not stored on disk */
265 #define	ZPOOL_CONFIG_UNSPARE		"unspare"
266 #define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
267 #define	ZPOOL_CONFIG_IS_LOG		"is_log"
268 /*
269  * The persistent vdev state is stored as separate values rather than a single
270  * 'vdev_state' entry.  This is because a device can be in multiple states, such
271  * as offline and degraded.
272  */
273 #define	ZPOOL_CONFIG_OFFLINE		"offline"
274 #define	ZPOOL_CONFIG_FAULTED		"faulted"
275 #define	ZPOOL_CONFIG_DEGRADED		"degraded"
276 #define	ZPOOL_CONFIG_REMOVED		"removed"
277 
278 #define	VDEV_TYPE_ROOT			"root"
279 #define	VDEV_TYPE_MIRROR		"mirror"
280 #define	VDEV_TYPE_REPLACING		"replacing"
281 #define	VDEV_TYPE_RAIDZ			"raidz"
282 #define	VDEV_TYPE_DISK			"disk"
283 #define	VDEV_TYPE_FILE			"file"
284 #define	VDEV_TYPE_MISSING		"missing"
285 #define	VDEV_TYPE_SPARE			"spare"
286 #define	VDEV_TYPE_LOG			"log"
287 
288 /*
289  * This is needed in userland to report the minimum necessary device size.
290  */
291 #define	SPA_MINDEVSIZE		(64ULL << 20)
292 
293 /*
294  * The location of the pool configuration repository, shared between kernel and
295  * userland.
296  */
297 #define	ZPOOL_CACHE_DIR		"/etc/zfs"
298 #define	ZPOOL_CACHE_FILE	"zpool.cache"
299 #define	ZPOOL_CACHE_TMP		".zpool.cache"
300 
301 #define	ZPOOL_CACHE		ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE
302 
303 /*
304  * vdev states are ordered from least to most healthy.
305  * A vdev that's CANT_OPEN or below is considered unusable.
306  */
307 typedef enum vdev_state {
308 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
309 	VDEV_STATE_CLOSED,	/* Not currently open			*/
310 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
311 	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
312 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
313 	VDEV_STATE_FAULTED,	/* External request to fault device	*/
314 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
315 	VDEV_STATE_HEALTHY	/* Presumed good			*/
316 } vdev_state_t;
317 
318 #define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
319 
320 /*
321  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
322  * of the vdev stats structure uses these constants to distinguish why.
323  */
324 typedef enum vdev_aux {
325 	VDEV_AUX_NONE,		/* no error				*/
326 	VDEV_AUX_OPEN_FAILED,	/* ldi_open_*() or vn_open() failed	*/
327 	VDEV_AUX_CORRUPT_DATA,	/* bad label or disk contents		*/
328 	VDEV_AUX_NO_REPLICAS,	/* insufficient number of replicas	*/
329 	VDEV_AUX_BAD_GUID_SUM,	/* vdev guid sum doesn't match		*/
330 	VDEV_AUX_TOO_SMALL,	/* vdev size is too small		*/
331 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
332 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
333 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
334 	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
335 	VDEV_AUX_ERR_EXCEEDED	/* too many errors			*/
336 } vdev_aux_t;
337 
338 /*
339  * pool state.  The following states are written to disk as part of the normal
340  * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE.  The remaining states are
341  * software abstractions used at various levels to communicate pool state.
342  */
343 typedef enum pool_state {
344 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
345 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
346 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
347 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
348 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
349 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
350 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
351 } pool_state_t;
352 
353 /*
354  * Scrub types.
355  */
356 typedef enum pool_scrub_type {
357 	POOL_SCRUB_NONE,
358 	POOL_SCRUB_RESILVER,
359 	POOL_SCRUB_EVERYTHING,
360 	POOL_SCRUB_TYPES
361 } pool_scrub_type_t;
362 
363 /*
364  * ZIO types.  Needed to interpret vdev statistics below.
365  */
366 typedef enum zio_type {
367 	ZIO_TYPE_NULL = 0,
368 	ZIO_TYPE_READ,
369 	ZIO_TYPE_WRITE,
370 	ZIO_TYPE_FREE,
371 	ZIO_TYPE_CLAIM,
372 	ZIO_TYPE_IOCTL,
373 	ZIO_TYPES
374 } zio_type_t;
375 
376 /*
377  * Vdev statistics.  Note: all fields should be 64-bit because this
378  * is passed between kernel and userland as an nvlist uint64 array.
379  */
380 typedef struct vdev_stat {
381 	hrtime_t	vs_timestamp;		/* time since vdev load	*/
382 	uint64_t	vs_state;		/* vdev state		*/
383 	uint64_t	vs_aux;			/* see vdev_aux_t	*/
384 	uint64_t	vs_alloc;		/* space allocated	*/
385 	uint64_t	vs_space;		/* total capacity	*/
386 	uint64_t	vs_dspace;		/* deflated capacity	*/
387 	uint64_t	vs_rsize;		/* replaceable dev size */
388 	uint64_t	vs_ops[ZIO_TYPES];	/* operation count	*/
389 	uint64_t	vs_bytes[ZIO_TYPES];	/* bytes read/written	*/
390 	uint64_t	vs_read_errors;		/* read errors		*/
391 	uint64_t	vs_write_errors;	/* write errors		*/
392 	uint64_t	vs_checksum_errors;	/* checksum errors	*/
393 	uint64_t	vs_self_healed;		/* self-healed bytes	*/
394 	uint64_t	vs_scrub_type;		/* pool_scrub_type_t	*/
395 	uint64_t	vs_scrub_complete;	/* completed?		*/
396 	uint64_t	vs_scrub_examined;	/* bytes examined; top	*/
397 	uint64_t	vs_scrub_repaired;	/* bytes repaired; leaf	*/
398 	uint64_t	vs_scrub_errors;	/* errors during scrub	*/
399 	uint64_t	vs_scrub_start;		/* UTC scrub start time	*/
400 	uint64_t	vs_scrub_end;		/* UTC scrub end time	*/
401 } vdev_stat_t;
402 
403 #define	ZFS_DRIVER	"zfs"
404 #define	ZFS_DEV		"/dev/zfs"
405 
406 /*
407  * zvol paths.  Irritatingly, the devfsadm interfaces want all these
408  * paths without the /dev prefix, but for some things, we want the
409  * /dev prefix.  Below are the names without /dev.
410  */
411 #define	ZVOL_DEV_DIR	"zvol/dsk"
412 #define	ZVOL_RDEV_DIR	"zvol/rdsk"
413 
414 /*
415  * And here are the things we need with /dev, etc. in front of them.
416  */
417 #define	ZVOL_PSEUDO_DEV		"/devices/pseudo/zvol@0:"
418 #define	ZVOL_FULL_DEV_DIR	"/dev/" ZVOL_DEV_DIR
419 
420 #define	ZVOL_PROP_NAME		"name"
421 
422 /*
423  * /dev/zfs ioctl numbers.
424  */
425 #define	ZFS_IOC		('Z' << 8)
426 
427 typedef enum zfs_ioc {
428 	ZFS_IOC_POOL_CREATE = ZFS_IOC,
429 	ZFS_IOC_POOL_DESTROY,
430 	ZFS_IOC_POOL_IMPORT,
431 	ZFS_IOC_POOL_EXPORT,
432 	ZFS_IOC_POOL_CONFIGS,
433 	ZFS_IOC_POOL_STATS,
434 	ZFS_IOC_POOL_TRYIMPORT,
435 	ZFS_IOC_POOL_SCRUB,
436 	ZFS_IOC_POOL_FREEZE,
437 	ZFS_IOC_POOL_UPGRADE,
438 	ZFS_IOC_POOL_GET_HISTORY,
439 	ZFS_IOC_VDEV_ADD,
440 	ZFS_IOC_VDEV_REMOVE,
441 	ZFS_IOC_VDEV_SET_STATE,
442 	ZFS_IOC_VDEV_ATTACH,
443 	ZFS_IOC_VDEV_DETACH,
444 	ZFS_IOC_VDEV_SETPATH,
445 	ZFS_IOC_OBJSET_STATS,
446 	ZFS_IOC_DATASET_LIST_NEXT,
447 	ZFS_IOC_SNAPSHOT_LIST_NEXT,
448 	ZFS_IOC_SET_PROP,
449 	ZFS_IOC_CREATE_MINOR,
450 	ZFS_IOC_REMOVE_MINOR,
451 	ZFS_IOC_CREATE,
452 	ZFS_IOC_DESTROY,
453 	ZFS_IOC_ROLLBACK,
454 	ZFS_IOC_RENAME,
455 	ZFS_IOC_RECVBACKUP,
456 	ZFS_IOC_SENDBACKUP,
457 	ZFS_IOC_INJECT_FAULT,
458 	ZFS_IOC_CLEAR_FAULT,
459 	ZFS_IOC_INJECT_LIST_NEXT,
460 	ZFS_IOC_ERROR_LOG,
461 	ZFS_IOC_CLEAR,
462 	ZFS_IOC_PROMOTE,
463 	ZFS_IOC_DESTROY_SNAPS,
464 	ZFS_IOC_SNAPSHOT,
465 	ZFS_IOC_DSOBJ_TO_DSNAME,
466 	ZFS_IOC_OBJ_TO_PATH,
467 	ZFS_IOC_POOL_SET_PROPS,
468 	ZFS_IOC_POOL_GET_PROPS,
469 	ZFS_IOC_SET_FSACL,
470 	ZFS_IOC_GET_FSACL,
471 	ZFS_IOC_ISCSI_PERM_CHECK,
472 	ZFS_IOC_SHARE
473 } zfs_ioc_t;
474 
475 /*
476  * Internal SPA load state.  Used by FMA diagnosis engine.
477  */
478 typedef enum {
479 	SPA_LOAD_NONE,		/* no load in progress */
480 	SPA_LOAD_OPEN,		/* normal open */
481 	SPA_LOAD_IMPORT,	/* import in progress */
482 	SPA_LOAD_TRYIMPORT	/* tryimport in progress */
483 } spa_load_state_t;
484 
485 /*
486  * Bookmark name values.
487  */
488 #define	ZPOOL_ERR_LIST		"error list"
489 #define	ZPOOL_ERR_DATASET	"dataset"
490 #define	ZPOOL_ERR_OBJECT	"object"
491 
492 #define	HIS_MAX_RECORD_LEN	(MAXPATHLEN + MAXPATHLEN + 1)
493 
494 /*
495  * The following are names used in the nvlist describing
496  * the pool's history log.
497  */
498 #define	ZPOOL_HIST_RECORD	"history record"
499 #define	ZPOOL_HIST_TIME		"history time"
500 #define	ZPOOL_HIST_CMD		"history command"
501 #define	ZPOOL_HIST_WHO		"history who"
502 #define	ZPOOL_HIST_ZONE		"history zone"
503 #define	ZPOOL_HIST_HOST		"history hostname"
504 #define	ZPOOL_HIST_TXG		"history txg"
505 #define	ZPOOL_HIST_INT_EVENT	"history internal event"
506 #define	ZPOOL_HIST_INT_STR	"history internal str"
507 
508 /*
509  * Flags for ZFS_IOC_VDEV_SET_STATE
510  */
511 #define	ZFS_ONLINE_CHECKREMOVE	0x1
512 #define	ZFS_ONLINE_UNSPARE	0x2
513 #define	ZFS_ONLINE_FORCEFAULT	0x4
514 #define	ZFS_OFFLINE_TEMPORARY	0x1
515 
516 /*
517  * Sysevent payload members.  ZFS will generate the following sysevents with the
518  * given payloads:
519  *
520  *	ESC_ZFS_RESILVER_START
521  *	ESC_ZFS_RESILVER_END
522  *	ESC_ZFS_POOL_DESTROY
523  *
524  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
525  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
526  *
527  *	ESC_ZFS_VDEV_REMOVE
528  *	ESC_ZFS_VDEV_CLEAR
529  *	ESC_ZFS_VDEV_CHECK
530  *
531  *		ZFS_EV_POOL_NAME	DATA_TYPE_STRING
532  *		ZFS_EV_POOL_GUID	DATA_TYPE_UINT64
533  *		ZFS_EV_VDEV_PATH	DATA_TYPE_STRING	(optional)
534  *		ZFS_EV_VDEV_GUID	DATA_TYPE_UINT64
535  */
536 #define	ZFS_EV_POOL_NAME	"pool_name"
537 #define	ZFS_EV_POOL_GUID	"pool_guid"
538 #define	ZFS_EV_VDEV_PATH	"vdev_path"
539 #define	ZFS_EV_VDEV_GUID	"vdev_guid"
540 
541 typedef enum history_internal_events {
542 	LOG_NO_EVENT = 0,
543 	LOG_POOL_CREATE,
544 	LOG_POOL_VDEV_ADD,
545 	LOG_POOL_REMOVE,
546 	LOG_POOL_DESTROY,
547 	LOG_POOL_EXPORT,
548 	LOG_POOL_IMPORT,
549 	LOG_POOL_VDEV_ATTACH,
550 	LOG_POOL_VDEV_REPLACE,
551 	LOG_POOL_VDEV_DETACH,
552 	LOG_POOL_VDEV_ONLINE,
553 	LOG_POOL_VDEV_OFFLINE,
554 	LOG_POOL_UPGRADE,
555 	LOG_POOL_CLEAR,
556 	LOG_POOL_SCRUB,
557 	LOG_POOL_PROPSET,
558 	LOG_DS_CREATE,
559 	LOG_DS_CLONE,
560 	LOG_DS_DESTROY,
561 	LOG_DS_DESTROY_BEGIN,
562 	LOG_DS_INHERIT,
563 	LOG_DS_PROPSET,
564 	LOG_DS_QUOTA,
565 	LOG_DS_PERM_UPDATE,
566 	LOG_DS_PERM_REMOVE,
567 	LOG_DS_PERM_WHO_REMOVE,
568 	LOG_DS_PROMOTE,
569 	LOG_DS_RECEIVE,
570 	LOG_DS_RENAME,
571 	LOG_DS_RESERVATION,
572 	LOG_DS_REPLAY_INC_SYNC,
573 	LOG_DS_REPLAY_FULL_SYNC,
574 	LOG_DS_ROLLBACK,
575 	LOG_DS_SNAPSHOT,
576 	LOG_DS_UPGRADE,
577 	LOG_END
578 } history_internal_events_t;
579 
580 #ifdef	__cplusplus
581 }
582 #endif
583 
584 #endif	/* _SYS_FS_ZFS_H */
585