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.
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.
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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #include <sys/types.h>
30 #include <sys/ioccom.h>
38 * Types and constants shared between userland and the kernel.
42 * Each dataset can be one of the following types. These constants can be
43 * combined into masks that can be passed to various functions.
46 ZFS_TYPE_FILESYSTEM = 0x1,
47 ZFS_TYPE_SNAPSHOT = 0x2,
48 ZFS_TYPE_VOLUME = 0x4,
52 #define ZFS_TYPE_DATASET \
53 (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
56 * Dataset properties are identified by these constants and must be added to
57 * the end of this list to ensure that external consumers are not affected
58 * by the change. If you make any changes to this list, be sure to update
59 * the property table in usr/src/common/zfs/zfs_prop.c.
67 ZFS_PROP_COMPRESSRATIO,
73 ZFS_PROP_VOLBLOCKSIZE,
88 ZFS_PROP_CREATETXG, /* not exposed to the user */
89 ZFS_PROP_NAME, /* not exposed to the user */
92 ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */
94 ZFS_PROP_NUMCLONES, /* not exposed to the user */
104 ZFS_PROP_REFRESERVATION,
106 ZFS_PROP_PRIMARYCACHE,
107 ZFS_PROP_SECONDARYCACHE,
111 ZFS_PROP_USEDREFRESERV,
116 * Pool properties are identified by these constants and must be added to the
117 * end of this list to ensure that external consumers are not affected
118 * by the change. If you make any changes to this list, be sure to update
119 * the property table in usr/src/common/zfs/zpool_prop.c.
125 ZPOOL_PROP_AVAILABLE,
132 ZPOOL_PROP_DELEGATION,
133 ZPOOL_PROP_AUTOREPLACE,
134 ZPOOL_PROP_CACHEFILE,
135 ZPOOL_PROP_FAILUREMODE,
136 ZPOOL_PROP_LISTSNAPS,
140 #define ZPROP_CONT -2
141 #define ZPROP_INVAL -1
143 #define ZPROP_VALUE "value"
144 #define ZPROP_SOURCE "source"
147 ZPROP_SRC_NONE = 0x1,
148 ZPROP_SRC_DEFAULT = 0x2,
149 ZPROP_SRC_TEMPORARY = 0x4,
150 ZPROP_SRC_LOCAL = 0x8,
151 ZPROP_SRC_INHERITED = 0x10
154 #define ZPROP_SRC_ALL 0x1f
156 typedef int (*zprop_func)(int, void *);
159 * Properties to be set on the root file system of a new pool
160 * are stuffed into their own nvlist, which is then included in
161 * the properties nvlist with the pool properties.
163 #define ZPOOL_ROOTFS_PROPS "root-props-nvl"
166 * Dataset property functions shared between libzfs and kernel.
168 const char *zfs_prop_default_string(zfs_prop_t);
169 uint64_t zfs_prop_default_numeric(zfs_prop_t);
170 boolean_t zfs_prop_readonly(zfs_prop_t);
171 boolean_t zfs_prop_inheritable(zfs_prop_t);
172 boolean_t zfs_prop_setonce(zfs_prop_t);
173 const char *zfs_prop_to_name(zfs_prop_t);
174 zfs_prop_t zfs_name_to_prop(const char *);
175 boolean_t zfs_prop_user(const char *);
176 int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
177 int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
178 boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
181 * Pool property functions shared between libzfs and kernel.
183 zpool_prop_t zpool_name_to_prop(const char *);
184 const char *zpool_prop_to_name(zpool_prop_t);
185 const char *zpool_prop_default_string(zpool_prop_t);
186 uint64_t zpool_prop_default_numeric(zpool_prop_t);
187 boolean_t zpool_prop_readonly(zpool_prop_t);
188 int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
189 int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
192 * Definitions for the Delegation.
195 ZFS_DELEG_WHO_UNKNOWN = 0,
196 ZFS_DELEG_USER = 'u',
197 ZFS_DELEG_USER_SETS = 'U',
198 ZFS_DELEG_GROUP = 'g',
199 ZFS_DELEG_GROUP_SETS = 'G',
200 ZFS_DELEG_EVERYONE = 'e',
201 ZFS_DELEG_EVERYONE_SETS = 'E',
202 ZFS_DELEG_CREATE = 'c',
203 ZFS_DELEG_CREATE_SETS = 'C',
204 ZFS_DELEG_NAMED_SET = 's',
205 ZFS_DELEG_NAMED_SET_SETS = 'S'
206 } zfs_deleg_who_type_t;
210 ZFS_DELEG_PERM_LOCAL = 1,
211 ZFS_DELEG_PERM_DESCENDENT = 2,
212 ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
213 ZFS_DELEG_PERM_CREATE = 4
214 } zfs_deleg_inherit_t;
216 #define ZFS_DELEG_PERM_UID "uid"
217 #define ZFS_DELEG_PERM_GID "gid"
218 #define ZFS_DELEG_PERM_GROUPS "groups"
221 ZFS_CANMOUNT_OFF = 0,
223 ZFS_CANMOUNT_NOAUTO = 2
224 } zfs_canmount_type_t;
226 typedef enum zfs_share_op {
233 typedef enum zfs_cache_type {
235 ZFS_CACHE_METADATA = 1,
241 * On-disk version number.
243 #define SPA_VERSION_1 1ULL
244 #define SPA_VERSION_2 2ULL
245 #define SPA_VERSION_3 3ULL
246 #define SPA_VERSION_4 4ULL
247 #define SPA_VERSION_5 5ULL
248 #define SPA_VERSION_6 6ULL
249 #define SPA_VERSION_7 7ULL
250 #define SPA_VERSION_8 8ULL
251 #define SPA_VERSION_9 9ULL
252 #define SPA_VERSION_10 10ULL
253 #define SPA_VERSION_11 11ULL
254 #define SPA_VERSION_12 12ULL
255 #define SPA_VERSION_13 13ULL
256 #define SPA_VERSION_14 14ULL
258 * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
259 * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*},
260 * and do the appropriate changes.
262 #define SPA_VERSION SPA_VERSION_14
263 #define SPA_VERSION_STRING "14"
266 * Symbolic names for the changes that caused a SPA_VERSION switch.
267 * Used in the code when checking for presence or absence of a feature.
268 * Feel free to define multiple symbolic names for each version if there
269 * were multiple changes to on-disk structures during that version.
271 * NOTE: When checking the current SPA_VERSION in your code, be sure
272 * to use spa_version() since it reports the version of the
273 * last synced uberblock. Checking the in-flight version can
274 * be dangerous in some cases.
276 #define SPA_VERSION_INITIAL SPA_VERSION_1
277 #define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2
278 #define SPA_VERSION_SPARES SPA_VERSION_3
279 #define SPA_VERSION_RAID6 SPA_VERSION_3
280 #define SPA_VERSION_BPLIST_ACCOUNT SPA_VERSION_3
281 #define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3
282 #define SPA_VERSION_DNODE_BYTES SPA_VERSION_3
283 #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4
284 #define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5
285 #define SPA_VERSION_BOOTFS SPA_VERSION_6
286 #define SPA_VERSION_SLOGS SPA_VERSION_7
287 #define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8
288 #define SPA_VERSION_FUID SPA_VERSION_9
289 #define SPA_VERSION_REFRESERVATION SPA_VERSION_9
290 #define SPA_VERSION_REFQUOTA SPA_VERSION_9
291 #define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9
292 #define SPA_VERSION_L2CACHE SPA_VERSION_10
293 #define SPA_VERSION_NEXT_CLONES SPA_VERSION_11
294 #define SPA_VERSION_ORIGIN SPA_VERSION_11
295 #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11
296 #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12
297 #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13
298 #define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14
301 * ZPL version - rev'd whenever an incompatible on-disk format change
302 * occurs. This is independent of SPA/DMU/ZAP versioning. You must
303 * also update the version_table[] and help message in zfs_prop.c.
305 * When changing, be sure to teach GRUB how to read the new format!
306 * See usr/src/grub/grub-0.95/stage2/{zfs-include/,fsys_zfs*}
308 #define ZPL_VERSION_1 1ULL
309 #define ZPL_VERSION_2 2ULL
310 #define ZPL_VERSION_3 3ULL
311 #define ZPL_VERSION ZPL_VERSION_3
312 #define ZPL_VERSION_STRING "3"
314 #define ZPL_VERSION_INITIAL ZPL_VERSION_1
315 #define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2
316 #define ZPL_VERSION_FUID ZPL_VERSION_3
317 #define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3
318 #define ZPL_VERSION_SYSATTR ZPL_VERSION_3
321 * The following are configuration names used in the nvlist describing a pool's
324 #define ZPOOL_CONFIG_VERSION "version"
325 #define ZPOOL_CONFIG_POOL_NAME "name"
326 #define ZPOOL_CONFIG_POOL_STATE "state"
327 #define ZPOOL_CONFIG_POOL_TXG "txg"
328 #define ZPOOL_CONFIG_POOL_GUID "pool_guid"
329 #define ZPOOL_CONFIG_CREATE_TXG "create_txg"
330 #define ZPOOL_CONFIG_TOP_GUID "top_guid"
331 #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree"
332 #define ZPOOL_CONFIG_TYPE "type"
333 #define ZPOOL_CONFIG_CHILDREN "children"
334 #define ZPOOL_CONFIG_ID "id"
335 #define ZPOOL_CONFIG_GUID "guid"
336 #define ZPOOL_CONFIG_PATH "path"
337 #define ZPOOL_CONFIG_DEVID "devid"
338 #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array"
339 #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift"
340 #define ZPOOL_CONFIG_ASHIFT "ashift"
341 #define ZPOOL_CONFIG_ASIZE "asize"
342 #define ZPOOL_CONFIG_DTL "DTL"
343 #define ZPOOL_CONFIG_STATS "stats"
344 #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
345 #define ZPOOL_CONFIG_ERRCOUNT "error_count"
346 #define ZPOOL_CONFIG_NOT_PRESENT "not_present"
347 #define ZPOOL_CONFIG_SPARES "spares"
348 #define ZPOOL_CONFIG_IS_SPARE "is_spare"
349 #define ZPOOL_CONFIG_NPARITY "nparity"
350 #define ZPOOL_CONFIG_HOSTID "hostid"
351 #define ZPOOL_CONFIG_HOSTNAME "hostname"
352 #define ZPOOL_CONFIG_UNSPARE "unspare"
353 #define ZPOOL_CONFIG_PHYS_PATH "phys_path"
354 #define ZPOOL_CONFIG_IS_LOG "is_log"
355 #define ZPOOL_CONFIG_L2CACHE "l2cache"
356 #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
357 #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
358 #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
360 * The persistent vdev state is stored as separate values rather than a single
361 * 'vdev_state' entry. This is because a device can be in multiple states, such
362 * as offline and degraded.
364 #define ZPOOL_CONFIG_OFFLINE "offline"
365 #define ZPOOL_CONFIG_FAULTED "faulted"
366 #define ZPOOL_CONFIG_DEGRADED "degraded"
367 #define ZPOOL_CONFIG_REMOVED "removed"
369 #define VDEV_TYPE_ROOT "root"
370 #define VDEV_TYPE_MIRROR "mirror"
371 #define VDEV_TYPE_REPLACING "replacing"
372 #define VDEV_TYPE_RAIDZ "raidz"
373 #define VDEV_TYPE_DISK "disk"
374 #define VDEV_TYPE_FILE "file"
375 #define VDEV_TYPE_MISSING "missing"
376 #define VDEV_TYPE_SPARE "spare"
377 #define VDEV_TYPE_LOG "log"
378 #define VDEV_TYPE_L2CACHE "l2cache"
381 * This is needed in userland to report the minimum necessary device size.
383 #define SPA_MINDEVSIZE (64ULL << 20)
386 * The location of the pool configuration repository, shared between kernel and
389 #define ZPOOL_CACHE "/boot/zfs/zpool.cache"
392 * vdev states are ordered from least to most healthy.
393 * A vdev that's CANT_OPEN or below is considered unusable.
395 typedef enum vdev_state {
396 VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */
397 VDEV_STATE_CLOSED, /* Not currently open */
398 VDEV_STATE_OFFLINE, /* Not allowed to open */
399 VDEV_STATE_REMOVED, /* Explicitly removed from system */
400 VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */
401 VDEV_STATE_FAULTED, /* External request to fault device */
402 VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */
403 VDEV_STATE_HEALTHY /* Presumed good */
406 #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY
409 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
410 * of the vdev stats structure uses these constants to distinguish why.
412 typedef enum vdev_aux {
413 VDEV_AUX_NONE, /* no error */
414 VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */
415 VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */
416 VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */
417 VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */
418 VDEV_AUX_TOO_SMALL, /* vdev size is too small */
419 VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */
420 VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
421 VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
422 VDEV_AUX_SPARED, /* hot spare used in another pool */
423 VDEV_AUX_ERR_EXCEEDED, /* too many errors */
424 VDEV_AUX_IO_FAILURE, /* experienced I/O failure */
425 VDEV_AUX_BAD_LOG /* cannot read log chain(s) */
429 * pool state. The following states are written to disk as part of the normal
430 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
431 * states are software abstractions used at various levels to communicate
434 typedef enum pool_state {
435 POOL_STATE_ACTIVE = 0, /* In active use */
436 POOL_STATE_EXPORTED, /* Explicitly exported */
437 POOL_STATE_DESTROYED, /* Explicitly destroyed */
438 POOL_STATE_SPARE, /* Reserved for hot spare use */
439 POOL_STATE_L2CACHE, /* Level 2 ARC device */
440 POOL_STATE_UNINITIALIZED, /* Internal spa_t state */
441 POOL_STATE_UNAVAIL, /* Internal libzfs state */
442 POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */
448 typedef enum pool_scrub_type {
451 POOL_SCRUB_EVERYTHING,
456 * ZIO types. Needed to interpret vdev statistics below.
458 typedef enum zio_type {
469 * Vdev statistics. Note: all fields should be 64-bit because this
470 * is passed between kernel and userland as an nvlist uint64 array.
472 typedef struct vdev_stat {
473 hrtime_t vs_timestamp; /* time since vdev load */
474 uint64_t vs_state; /* vdev state */
475 uint64_t vs_aux; /* see vdev_aux_t */
476 uint64_t vs_alloc; /* space allocated */
477 uint64_t vs_space; /* total capacity */
478 uint64_t vs_dspace; /* deflated capacity */
479 uint64_t vs_rsize; /* replaceable dev size */
480 uint64_t vs_ops[ZIO_TYPES]; /* operation count */
481 uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */
482 uint64_t vs_read_errors; /* read errors */
483 uint64_t vs_write_errors; /* write errors */
484 uint64_t vs_checksum_errors; /* checksum errors */
485 uint64_t vs_self_healed; /* self-healed bytes */
486 uint64_t vs_scrub_type; /* pool_scrub_type_t */
487 uint64_t vs_scrub_complete; /* completed? */
488 uint64_t vs_scrub_examined; /* bytes examined; top */
489 uint64_t vs_scrub_repaired; /* bytes repaired; leaf */
490 uint64_t vs_scrub_errors; /* errors during scrub */
491 uint64_t vs_scrub_start; /* UTC scrub start time */
492 uint64_t vs_scrub_end; /* UTC scrub end time */
495 #define ZVOL_DRIVER "zvol"
496 #define ZFS_DRIVER "zfs"
497 #define ZFS_DEV_NAME "zfs"
498 #define ZFS_DEV "/dev/" ZFS_DEV_NAME
501 * zvol paths. Irritatingly, the devfsadm interfaces want all these
502 * paths without the /dev prefix, but for some things, we want the
503 * /dev prefix. Below are the names without /dev.
505 #define ZVOL_DEV_DIR "zvol"
508 * And here are the things we need with /dev, etc. in front of them.
510 #define ZVOL_PSEUDO_DEV "/devices/pseudo/zvol@0:"
511 #define ZVOL_FULL_DEV_DIR "/dev/" ZVOL_DEV_DIR "/"
513 #define ZVOL_PROP_NAME "name"
516 * /dev/zfs ioctl numbers.
518 typedef unsigned long zfs_ioc_t;
520 #define ZFS_IOC(ioreq) ((ioreq) & 0xff)
522 #define ZFS_IOC_POOL_CREATE _IOWR('Z', 0, struct zfs_cmd)
523 #define ZFS_IOC_POOL_DESTROY _IOWR('Z', 1, struct zfs_cmd)
524 #define ZFS_IOC_POOL_IMPORT _IOWR('Z', 2, struct zfs_cmd)
525 #define ZFS_IOC_POOL_EXPORT _IOWR('Z', 3, struct zfs_cmd)
526 #define ZFS_IOC_POOL_CONFIGS _IOWR('Z', 4, struct zfs_cmd)
527 #define ZFS_IOC_POOL_STATS _IOWR('Z', 5, struct zfs_cmd)
528 #define ZFS_IOC_POOL_TRYIMPORT _IOWR('Z', 6, struct zfs_cmd)
529 #define ZFS_IOC_POOL_SCRUB _IOWR('Z', 7, struct zfs_cmd)
530 #define ZFS_IOC_POOL_FREEZE _IOWR('Z', 8, struct zfs_cmd)
531 #define ZFS_IOC_POOL_UPGRADE _IOWR('Z', 9, struct zfs_cmd)
532 #define ZFS_IOC_POOL_GET_HISTORY _IOWR('Z', 10, struct zfs_cmd)
533 #define ZFS_IOC_VDEV_ADD _IOWR('Z', 11, struct zfs_cmd)
534 #define ZFS_IOC_VDEV_REMOVE _IOWR('Z', 12, struct zfs_cmd)
535 #define ZFS_IOC_VDEV_SET_STATE _IOWR('Z', 13, struct zfs_cmd)
536 #define ZFS_IOC_VDEV_ATTACH _IOWR('Z', 14, struct zfs_cmd)
537 #define ZFS_IOC_VDEV_DETACH _IOWR('Z', 15, struct zfs_cmd)
538 #define ZFS_IOC_VDEV_SETPATH _IOWR('Z', 16, struct zfs_cmd)
539 #define ZFS_IOC_OBJSET_STATS _IOWR('Z', 17, struct zfs_cmd)
540 #define ZFS_IOC_OBJSET_ZPLPROPS _IOWR('Z', 18, struct zfs_cmd)
541 #define ZFS_IOC_DATASET_LIST_NEXT _IOWR('Z', 19, struct zfs_cmd)
542 #define ZFS_IOC_SNAPSHOT_LIST_NEXT _IOWR('Z', 20, struct zfs_cmd)
543 #define ZFS_IOC_SET_PROP _IOWR('Z', 21, struct zfs_cmd)
544 #define ZFS_IOC_CREATE_MINOR _IOWR('Z', 22, struct zfs_cmd)
545 #define ZFS_IOC_REMOVE_MINOR _IOWR('Z', 23, struct zfs_cmd)
546 #define ZFS_IOC_CREATE _IOWR('Z', 24, struct zfs_cmd)
547 #define ZFS_IOC_DESTROY _IOWR('Z', 25, struct zfs_cmd)
548 #define ZFS_IOC_ROLLBACK _IOWR('Z', 26, struct zfs_cmd)
549 #define ZFS_IOC_RENAME _IOWR('Z', 27, struct zfs_cmd)
550 #define ZFS_IOC_RECV _IOWR('Z', 28, struct zfs_cmd)
551 #define ZFS_IOC_SEND _IOWR('Z', 29, struct zfs_cmd)
552 #define ZFS_IOC_INJECT_FAULT _IOWR('Z', 30, struct zfs_cmd)
553 #define ZFS_IOC_CLEAR_FAULT _IOWR('Z', 31, struct zfs_cmd)
554 #define ZFS_IOC_INJECT_LIST_NEXT _IOWR('Z', 32, struct zfs_cmd)
555 #define ZFS_IOC_ERROR_LOG _IOWR('Z', 33, struct zfs_cmd)
556 #define ZFS_IOC_CLEAR _IOWR('Z', 34, struct zfs_cmd)
557 #define ZFS_IOC_PROMOTE _IOWR('Z', 35, struct zfs_cmd)
558 #define ZFS_IOC_DESTROY_SNAPS _IOWR('Z', 36, struct zfs_cmd)
559 #define ZFS_IOC_SNAPSHOT _IOWR('Z', 37, struct zfs_cmd)
560 #define ZFS_IOC_DSOBJ_TO_DSNAME _IOWR('Z', 38, struct zfs_cmd)
561 #define ZFS_IOC_OBJ_TO_PATH _IOWR('Z', 39, struct zfs_cmd)
562 #define ZFS_IOC_POOL_SET_PROPS _IOWR('Z', 40, struct zfs_cmd)
563 #define ZFS_IOC_POOL_GET_PROPS _IOWR('Z', 41, struct zfs_cmd)
564 #define ZFS_IOC_SET_FSACL _IOWR('Z', 42, struct zfs_cmd)
565 #define ZFS_IOC_GET_FSACL _IOWR('Z', 43, struct zfs_cmd)
566 #define ZFS_IOC_ISCSI_PERM_CHECK _IOWR('Z', 44, struct zfs_cmd)
567 #define ZFS_IOC_SHARE _IOWR('Z', 45, struct zfs_cmd)
568 #define ZFS_IOC_INHERIT_PROP _IOWR('Z', 46, struct zfs_cmd)
569 #define ZFS_IOC_JAIL _IOWR('Z', 47, struct zfs_cmd)
570 #define ZFS_IOC_UNJAIL _IOWR('Z', 48, struct zfs_cmd)
573 * Internal SPA load state. Used by FMA diagnosis engine.
576 SPA_LOAD_NONE, /* no load in progress */
577 SPA_LOAD_OPEN, /* normal open */
578 SPA_LOAD_IMPORT, /* import in progress */
579 SPA_LOAD_TRYIMPORT /* tryimport in progress */
583 * Bookmark name values.
585 #define ZPOOL_ERR_LIST "error list"
586 #define ZPOOL_ERR_DATASET "dataset"
587 #define ZPOOL_ERR_OBJECT "object"
589 #define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1)
592 * The following are names used in the nvlist describing
593 * the pool's history log.
595 #define ZPOOL_HIST_RECORD "history record"
596 #define ZPOOL_HIST_TIME "history time"
597 #define ZPOOL_HIST_CMD "history command"
598 #define ZPOOL_HIST_WHO "history who"
599 #define ZPOOL_HIST_ZONE "history zone"
600 #define ZPOOL_HIST_HOST "history hostname"
601 #define ZPOOL_HIST_TXG "history txg"
602 #define ZPOOL_HIST_INT_EVENT "history internal event"
603 #define ZPOOL_HIST_INT_STR "history internal str"
606 * Flags for ZFS_IOC_VDEV_SET_STATE
608 #define ZFS_ONLINE_CHECKREMOVE 0x1
609 #define ZFS_ONLINE_UNSPARE 0x2
610 #define ZFS_ONLINE_FORCEFAULT 0x4
611 #define ZFS_OFFLINE_TEMPORARY 0x1
614 * Sysevent payload members. ZFS will generate the following sysevents with the
617 * ESC_ZFS_RESILVER_START
618 * ESC_ZFS_RESILVER_END
619 * ESC_ZFS_POOL_DESTROY
621 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
622 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
624 * ESC_ZFS_VDEV_REMOVE
628 * ZFS_EV_POOL_NAME DATA_TYPE_STRING
629 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64
630 * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional)
631 * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64
633 #define ZFS_EV_POOL_NAME "pool_name"
634 #define ZFS_EV_POOL_GUID "pool_guid"
635 #define ZFS_EV_VDEV_PATH "vdev_path"
636 #define ZFS_EV_VDEV_GUID "vdev_guid"
639 * Note: This is encoded on-disk, so new events must be added to the
640 * end, and unused events can not be removed. Be sure to edit
641 * zpool_main.c: hist_event_table[].
643 typedef enum history_internal_events {
651 LOG_POOL_VDEV_ATTACH,
652 LOG_POOL_VDEV_REPLACE,
653 LOG_POOL_VDEV_DETACH,
654 LOG_POOL_VDEV_ONLINE,
655 LOG_POOL_VDEV_OFFLINE,
663 LOG_DS_DESTROY_BEGIN,
669 LOG_DS_PERM_WHO_REMOVE,
674 LOG_DS_REPLAY_INC_SYNC,
675 LOG_DS_REPLAY_FULL_SYNC,
683 } history_internal_events_t;
689 #endif /* _SYS_FS_ZFS_H */