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