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