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