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 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright (c) 2014 Integros [integros.com]
27 * Copyright 2017 Joyent, Inc.
28 * Copyright (c) 2017 Datto Inc.
29 */
30
31 /* Portions Copyright 2010 Robert Milkowski */
32
33 #ifndef _SYS_FS_ZFS_H
34 #define _SYS_FS_ZFS_H
35
36 #include <sys/time.h>
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /*
43 * Types and constants shared between userland and the kernel.
44 */
45
46 /*
47 * Each dataset can be one of the following types. These constants can be
48 * combined into masks that can be passed to various functions.
49 */
50 typedef enum {
51 ZFS_TYPE_FILESYSTEM = (1 << 0),
52 ZFS_TYPE_SNAPSHOT = (1 << 1),
53 ZFS_TYPE_VOLUME = (1 << 2),
54 ZFS_TYPE_POOL = (1 << 3),
55 ZFS_TYPE_BOOKMARK = (1 << 4)
56 } zfs_type_t;
57
58 /*
59 * NB: lzc_dataset_type should be updated whenever a new objset type is added,
60 * if it represents a real type of a dataset that can be created from userland.
61 */
62 typedef enum dmu_objset_type {
63 DMU_OST_NONE,
64 DMU_OST_META,
65 DMU_OST_ZFS,
66 DMU_OST_ZVOL,
67 DMU_OST_OTHER, /* For testing only! */
68 DMU_OST_ANY, /* Be careful! */
69 DMU_OST_NUMTYPES
70 } dmu_objset_type_t;
71
72 #define ZFS_TYPE_DATASET \
73 (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
74
75 /*
76 * All of these include the terminating NUL byte.
77 */
78 #define ZAP_MAXNAMELEN 256
79 #define ZAP_MAXVALUELEN (1024 * 8)
80 #define ZAP_OLDMAXVALUELEN 1024
81 #define ZFS_MAX_DATASET_NAME_LEN 256
82
83 /*
84 * Dataset properties are identified by these constants and must be added to
85 * the end of this list to ensure that external consumers are not affected
86 * by the change. If you make any changes to this list, be sure to update
87 * the property table in usr/src/common/zfs/zfs_prop.c.
88 */
89 typedef enum {
90 ZPROP_CONT = -2,
91 ZPROP_INVAL = -1,
92 ZFS_PROP_TYPE = 0,
93 ZFS_PROP_CREATION,
94 ZFS_PROP_USED,
95 ZFS_PROP_AVAILABLE,
96 ZFS_PROP_REFERENCED,
97 ZFS_PROP_COMPRESSRATIO,
98 ZFS_PROP_MOUNTED,
99 ZFS_PROP_ORIGIN,
100 ZFS_PROP_QUOTA,
101 ZFS_PROP_RESERVATION,
102 ZFS_PROP_VOLSIZE,
103 ZFS_PROP_VOLBLOCKSIZE,
104 ZFS_PROP_RECORDSIZE,
105 ZFS_PROP_MOUNTPOINT,
106 ZFS_PROP_SHARENFS,
107 ZFS_PROP_CHECKSUM,
108 ZFS_PROP_COMPRESSION,
109 ZFS_PROP_ATIME,
110 ZFS_PROP_DEVICES,
111 ZFS_PROP_EXEC,
143 ZFS_PROP_DEFER_DESTROY,
144 ZFS_PROP_USERREFS,
145 ZFS_PROP_LOGBIAS,
146 ZFS_PROP_UNIQUE, /* not exposed to the user */
147 ZFS_PROP_OBJSETID, /* not exposed to the user */
148 ZFS_PROP_DEDUP,
149 ZFS_PROP_MLSLABEL,
150 ZFS_PROP_SYNC,
151 ZFS_PROP_REFRATIO,
152 ZFS_PROP_WRITTEN,
153 ZFS_PROP_CLONES,
154 ZFS_PROP_LOGICALUSED,
155 ZFS_PROP_LOGICALREFERENCED,
156 ZFS_PROP_INCONSISTENT, /* not exposed to the user */
157 ZFS_PROP_FILESYSTEM_LIMIT,
158 ZFS_PROP_SNAPSHOT_LIMIT,
159 ZFS_PROP_FILESYSTEM_COUNT,
160 ZFS_PROP_SNAPSHOT_COUNT,
161 ZFS_PROP_REDUNDANT_METADATA,
162 ZFS_PROP_PREV_SNAP,
163 ZFS_PROP_RECEIVE_RESUME_TOKEN,
164 ZFS_PROP_REMAPTXG, /* not exposed to the user */
165 ZFS_NUM_PROPS
166 } zfs_prop_t;
167
168 typedef enum {
169 ZFS_PROP_USERUSED,
170 ZFS_PROP_USERQUOTA,
171 ZFS_PROP_GROUPUSED,
172 ZFS_PROP_GROUPQUOTA,
173 ZFS_NUM_USERQUOTA_PROPS
174 } zfs_userquota_prop_t;
175
176 extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
177
178 /*
179 * Pool properties are identified by these constants and must be added to the
180 * end of this list to ensure that external consumers are not affected
181 * by the change. If you make any changes to this list, be sure to update
182 * the property table in usr/src/common/zfs/zpool_prop.c.
183 */
184 typedef enum {
185 ZPOOL_PROP_INVAL = -1,
186 ZPOOL_PROP_NAME,
187 ZPOOL_PROP_SIZE,
188 ZPOOL_PROP_CAPACITY,
189 ZPOOL_PROP_ALTROOT,
190 ZPOOL_PROP_HEALTH,
191 ZPOOL_PROP_GUID,
192 ZPOOL_PROP_VERSION,
193 ZPOOL_PROP_BOOTFS,
194 ZPOOL_PROP_DELEGATION,
195 ZPOOL_PROP_AUTOREPLACE,
196 ZPOOL_PROP_CACHEFILE,
197 ZPOOL_PROP_FAILUREMODE,
198 ZPOOL_PROP_LISTSNAPS,
199 ZPOOL_PROP_AUTOEXPAND,
200 ZPOOL_PROP_DEDUPDITTO,
201 ZPOOL_PROP_DEDUPRATIO,
202 ZPOOL_PROP_FREE,
203 ZPOOL_PROP_ALLOCATED,
204 ZPOOL_PROP_READONLY,
205 ZPOOL_PROP_COMMENT,
206 ZPOOL_PROP_EXPANDSZ,
207 ZPOOL_PROP_FREEING,
208 ZPOOL_PROP_FRAGMENTATION,
209 ZPOOL_PROP_LEAKED,
210 ZPOOL_PROP_MAXBLOCKSIZE,
211 ZPOOL_PROP_BOOTSIZE,
212 ZPOOL_NUM_PROPS
213 } zpool_prop_t;
214
215 /* Small enough to not hog a whole line of printout in zpool(1M). */
216 #define ZPROP_MAX_COMMENT 32
217
218 #define ZPROP_VALUE "value"
219 #define ZPROP_SOURCE "source"
220
221 typedef enum {
222 ZPROP_SRC_NONE = 0x1,
223 ZPROP_SRC_DEFAULT = 0x2,
224 ZPROP_SRC_TEMPORARY = 0x4,
225 ZPROP_SRC_LOCAL = 0x8,
226 ZPROP_SRC_INHERITED = 0x10,
227 ZPROP_SRC_RECEIVED = 0x20
228 } zprop_source_t;
229
230 #define ZPROP_SRC_ALL 0x3f
231
232 #define ZPROP_SOURCE_VAL_RECVD "$recvd"
233 #define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS"
234 /*
235 * Dataset flag implemented as a special entry in the props zap object
236 * indicating that the dataset has received properties on or after
237 * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
276 int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
277 int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
278 uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
279 boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
280
281 /*
282 * Pool property functions shared between libzfs and kernel.
283 */
284 zpool_prop_t zpool_name_to_prop(const char *);
285 const char *zpool_prop_to_name(zpool_prop_t);
286 const char *zpool_prop_default_string(zpool_prop_t);
287 uint64_t zpool_prop_default_numeric(zpool_prop_t);
288 boolean_t zpool_prop_readonly(zpool_prop_t);
289 boolean_t zpool_prop_feature(const char *);
290 boolean_t zpool_prop_unsupported(const char *name);
291 int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
292 int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
293 uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
294
295 /*
296 * Definitions for the Delegation.
297 */
298 typedef enum {
299 ZFS_DELEG_WHO_UNKNOWN = 0,
300 ZFS_DELEG_USER = 'u',
301 ZFS_DELEG_USER_SETS = 'U',
302 ZFS_DELEG_GROUP = 'g',
303 ZFS_DELEG_GROUP_SETS = 'G',
304 ZFS_DELEG_EVERYONE = 'e',
305 ZFS_DELEG_EVERYONE_SETS = 'E',
306 ZFS_DELEG_CREATE = 'c',
307 ZFS_DELEG_CREATE_SETS = 'C',
308 ZFS_DELEG_NAMED_SET = 's',
309 ZFS_DELEG_NAMED_SET_SETS = 'S'
310 } zfs_deleg_who_type_t;
311
312 typedef enum {
313 ZFS_DELEG_NONE = 0,
314 ZFS_DELEG_PERM_LOCAL = 1,
315 ZFS_DELEG_PERM_DESCENDENT = 2,
337 ZFS_LOGBIAS_THROUGHPUT = 1
338 } zfs_logbias_op_t;
339
340 typedef enum zfs_share_op {
341 ZFS_SHARE_NFS = 0,
342 ZFS_UNSHARE_NFS = 1,
343 ZFS_SHARE_SMB = 2,
344 ZFS_UNSHARE_SMB = 3
345 } zfs_share_op_t;
346
347 typedef enum zfs_smb_acl_op {
348 ZFS_SMB_ACL_ADD,
349 ZFS_SMB_ACL_REMOVE,
350 ZFS_SMB_ACL_RENAME,
351 ZFS_SMB_ACL_PURGE
352 } zfs_smb_acl_op_t;
353
354 typedef enum zfs_cache_type {
355 ZFS_CACHE_NONE = 0,
356 ZFS_CACHE_METADATA = 1,
357 ZFS_CACHE_ALL = 2
358 } zfs_cache_type_t;
359
360 typedef enum {
361 ZFS_SYNC_STANDARD = 0,
362 ZFS_SYNC_ALWAYS = 1,
363 ZFS_SYNC_DISABLED = 2
364 } zfs_sync_type_t;
365
366 typedef enum {
367 ZFS_REDUNDANT_METADATA_ALL,
368 ZFS_REDUNDANT_METADATA_MOST
369 } zfs_redundant_metadata_type_t;
370
371 /*
372 * On-disk version number.
373 */
374 #define SPA_VERSION_1 1ULL
375 #define SPA_VERSION_2 2ULL
376 #define SPA_VERSION_3 3ULL
377 #define SPA_VERSION_4 4ULL
378 #define SPA_VERSION_5 5ULL
379 #define SPA_VERSION_6 6ULL
380 #define SPA_VERSION_7 7ULL
381 #define SPA_VERSION_8 8ULL
382 #define SPA_VERSION_9 9ULL
383 #define SPA_VERSION_10 10ULL
384 #define SPA_VERSION_11 11ULL
385 #define SPA_VERSION_12 12ULL
386 #define SPA_VERSION_13 13ULL
387 #define SPA_VERSION_14 14ULL
388 #define SPA_VERSION_15 15ULL
389 #define SPA_VERSION_16 16ULL
390 #define SPA_VERSION_17 17ULL
491 #define ZPL_VERSION_SA ZPL_VERSION_5
492
493 /* Rewind request information */
494 #define ZPOOL_NO_REWIND 1 /* No policy - default behavior */
495 #define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */
496 #define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */
497 #define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */
498 #define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */
499 #define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */
500 #define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */
501
502 typedef struct zpool_rewind_policy {
503 uint32_t zrp_request; /* rewind behavior requested */
504 uint64_t zrp_maxmeta; /* max acceptable meta-data errors */
505 uint64_t zrp_maxdata; /* max acceptable data errors */
506 uint64_t zrp_txg; /* specific txg to load */
507 } zpool_rewind_policy_t;
508
509 /*
510 * The following are configuration names used in the nvlist describing a pool's
511 * configuration. New on-disk names should be prefixed with "<reverse-DNS>:"
512 * (e.g. "org.open-zfs:") to avoid conflicting names being developed
513 * independently.
514 */
515 #define ZPOOL_CONFIG_VERSION "version"
516 #define ZPOOL_CONFIG_POOL_NAME "name"
517 #define ZPOOL_CONFIG_POOL_STATE "state"
518 #define ZPOOL_CONFIG_POOL_TXG "txg"
519 #define ZPOOL_CONFIG_POOL_GUID "pool_guid"
520 #define ZPOOL_CONFIG_CREATE_TXG "create_txg"
521 #define ZPOOL_CONFIG_TOP_GUID "top_guid"
522 #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree"
523 #define ZPOOL_CONFIG_TYPE "type"
524 #define ZPOOL_CONFIG_CHILDREN "children"
525 #define ZPOOL_CONFIG_ID "id"
526 #define ZPOOL_CONFIG_GUID "guid"
527 #define ZPOOL_CONFIG_INDIRECT_OBJECT "com.delphix:indirect_object"
528 #define ZPOOL_CONFIG_INDIRECT_BIRTHS "com.delphix:indirect_births"
529 #define ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev"
530 #define ZPOOL_CONFIG_PATH "path"
531 #define ZPOOL_CONFIG_DEVID "devid"
532 #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array"
533 #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift"
534 #define ZPOOL_CONFIG_ASHIFT "ashift"
535 #define ZPOOL_CONFIG_ASIZE "asize"
536 #define ZPOOL_CONFIG_DTL "DTL"
537 #define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */
538 #define ZPOOL_CONFIG_REMOVAL_STATS "removal_stats" /* not stored on disk */
539 #define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */
540 #define ZPOOL_CONFIG_INDIRECT_SIZE "indirect_size" /* not stored on disk */
541 #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
542 #define ZPOOL_CONFIG_ERRCOUNT "error_count"
543 #define ZPOOL_CONFIG_NOT_PRESENT "not_present"
544 #define ZPOOL_CONFIG_SPARES "spares"
545 #define ZPOOL_CONFIG_IS_SPARE "is_spare"
546 #define ZPOOL_CONFIG_NPARITY "nparity"
547 #define ZPOOL_CONFIG_HOSTID "hostid"
548 #define ZPOOL_CONFIG_HOSTNAME "hostname"
549 #define ZPOOL_CONFIG_LOADED_TIME "initial_load_time"
550 #define ZPOOL_CONFIG_UNSPARE "unspare"
551 #define ZPOOL_CONFIG_PHYS_PATH "phys_path"
552 #define ZPOOL_CONFIG_IS_LOG "is_log"
553 #define ZPOOL_CONFIG_L2CACHE "l2cache"
554 #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
555 #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
556 #define ZPOOL_CONFIG_IS_HOLE "is_hole"
557 #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
558 #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
559 #define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
560 #define ZPOOL_CONFIG_SPLIT "splitcfg"
561 #define ZPOOL_CONFIG_ORIG_GUID "orig_guid"
562 #define ZPOOL_CONFIG_SPLIT_GUID "split_guid"
563 #define ZPOOL_CONFIG_SPLIT_LIST "guid_list"
564 #define ZPOOL_CONFIG_REMOVING "removing"
565 #define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg"
566 #define ZPOOL_CONFIG_COMMENT "comment"
567 #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
568 #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
569 #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
570 #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */
571 #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */
572 #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */
573 #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */
574 #define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */
575 #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */
576 #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read"
577 #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */
578 #define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top"
579 #define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf"
580 #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps"
581 #define ZPOOL_CONFIG_CACHEFILE "cachefile" /* not stored on disk */
582 /*
583 * The persistent vdev state is stored as separate values rather than a single
584 * 'vdev_state' entry. This is because a device can be in multiple states, such
585 * as offline and degraded.
586 */
587 #define ZPOOL_CONFIG_OFFLINE "offline"
588 #define ZPOOL_CONFIG_FAULTED "faulted"
589 #define ZPOOL_CONFIG_DEGRADED "degraded"
590 #define ZPOOL_CONFIG_REMOVED "removed"
591 #define ZPOOL_CONFIG_FRU "fru"
592 #define ZPOOL_CONFIG_AUX_STATE "aux_state"
593
594 /* Rewind policy parameters */
595 #define ZPOOL_REWIND_POLICY "rewind-policy"
596 #define ZPOOL_REWIND_REQUEST "rewind-request"
597 #define ZPOOL_REWIND_REQUEST_TXG "rewind-request-txg"
598 #define ZPOOL_REWIND_META_THRESH "rewind-meta-thresh"
599 #define ZPOOL_REWIND_DATA_THRESH "rewind-data-thresh"
600
601 /* Rewind data discovered */
602 #define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts"
603 #define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors"
604 #define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind"
605
606 #define VDEV_TYPE_ROOT "root"
607 #define VDEV_TYPE_MIRROR "mirror"
608 #define VDEV_TYPE_REPLACING "replacing"
609 #define VDEV_TYPE_RAIDZ "raidz"
610 #define VDEV_TYPE_DISK "disk"
611 #define VDEV_TYPE_FILE "file"
612 #define VDEV_TYPE_MISSING "missing"
613 #define VDEV_TYPE_HOLE "hole"
614 #define VDEV_TYPE_SPARE "spare"
615 #define VDEV_TYPE_LOG "log"
616 #define VDEV_TYPE_L2CACHE "l2cache"
617 #define VDEV_TYPE_INDIRECT "indirect"
618
619 /* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */
620 #define VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \
621 "com.delphix:indirect_obsolete_sm"
622 #define VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \
623 "com.delphix:obsolete_counts_are_precise"
624
625 /*
626 * This is needed in userland to report the minimum necessary device size.
627 *
628 * Note that the zfs test suite uses 64MB vdevs.
629 */
630 #define SPA_MINDEVSIZE (64ULL << 20)
631
632 /*
633 * Set if the fragmentation has not yet been calculated. This can happen
634 * because the space maps have not been upgraded or the histogram feature
635 * is not enabled.
636 */
637 #define ZFS_FRAG_INVALID UINT64_MAX
638
639 /*
640 * The location of the pool configuration repository, shared between kernel and
641 * userland.
642 */
643 #define ZPOOL_CACHE "/etc/zfs/zpool.cache"
644
662 /*
663 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
664 * of the vdev stats structure uses these constants to distinguish why.
665 */
666 typedef enum vdev_aux {
667 VDEV_AUX_NONE, /* no error */
668 VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */
669 VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */
670 VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */
671 VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */
672 VDEV_AUX_TOO_SMALL, /* vdev size is too small */
673 VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */
674 VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
675 VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
676 VDEV_AUX_UNSUP_FEAT, /* unsupported features */
677 VDEV_AUX_SPARED, /* hot spare used in another pool */
678 VDEV_AUX_ERR_EXCEEDED, /* too many errors */
679 VDEV_AUX_IO_FAILURE, /* experienced I/O failure */
680 VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */
681 VDEV_AUX_EXTERNAL, /* external diagnosis */
682 VDEV_AUX_SPLIT_POOL, /* vdev was split off into another pool */
683 VDEV_AUX_CHILDREN_OFFLINE /* all children are offline */
684 } vdev_aux_t;
685
686 /*
687 * pool state. The following states are written to disk as part of the normal
688 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
689 * states are software abstractions used at various levels to communicate
690 * pool state.
691 */
692 typedef enum pool_state {
693 POOL_STATE_ACTIVE = 0, /* In active use */
694 POOL_STATE_EXPORTED, /* Explicitly exported */
695 POOL_STATE_DESTROYED, /* Explicitly destroyed */
696 POOL_STATE_SPARE, /* Reserved for hot spare use */
697 POOL_STATE_L2CACHE, /* Level 2 ARC device */
698 POOL_STATE_UNINITIALIZED, /* Internal spa_t state */
699 POOL_STATE_UNAVAIL, /* Internal libzfs state */
700 POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */
701 } pool_state_t;
702
703 /*
704 * Scan Functions.
705 */
706 typedef enum pool_scan_func {
707 POOL_SCAN_NONE,
708 POOL_SCAN_SCRUB,
709 POOL_SCAN_RESILVER,
710 POOL_SCAN_FUNCS
711 } pool_scan_func_t;
712
713 /*
714 * Used to control scrub pause and resume.
715 */
716 typedef enum pool_scrub_cmd {
717 POOL_SCRUB_NORMAL = 0,
718 POOL_SCRUB_PAUSE,
719 POOL_SCRUB_FLAGS_END
720 } pool_scrub_cmd_t;
721
722
723 /*
724 * ZIO types. Needed to interpret vdev statistics below.
725 */
726 typedef enum zio_type {
727 ZIO_TYPE_NULL = 0,
728 ZIO_TYPE_READ,
729 ZIO_TYPE_WRITE,
730 ZIO_TYPE_FREE,
731 ZIO_TYPE_CLAIM,
732 ZIO_TYPE_IOCTL,
733 ZIO_TYPES
734 } zio_type_t;
735
736 /*
737 * Pool statistics. Note: all fields should be 64-bit because this
738 * is passed between kernel and userland as an nvlist uint64 array.
739 */
740 typedef struct pool_scan_stat {
741 /* values stored on disk */
742 uint64_t pss_func; /* pool_scan_func_t */
743 uint64_t pss_state; /* dsl_scan_state_t */
744 uint64_t pss_start_time; /* scan start time */
745 uint64_t pss_end_time; /* scan end time */
746 uint64_t pss_to_examine; /* total bytes to scan */
747 uint64_t pss_examined; /* total examined bytes */
748 uint64_t pss_to_process; /* total bytes to process */
749 uint64_t pss_processed; /* total processed bytes */
750 uint64_t pss_errors; /* scan errors */
751
752 /* values not stored on disk */
753 uint64_t pss_pass_exam; /* examined bytes per scan pass */
754 uint64_t pss_pass_start; /* start time of a scan pass */
755 uint64_t pss_pass_scrub_pause; /* pause time of a scurb pass */
756 /* cumulative time scrub spent paused, needed for rate calculation */
757 uint64_t pss_pass_scrub_spent_paused;
758 } pool_scan_stat_t;
759
760 typedef struct pool_removal_stat {
761 uint64_t prs_state; /* dsl_scan_state_t */
762 uint64_t prs_removing_vdev;
763 uint64_t prs_start_time;
764 uint64_t prs_end_time;
765 uint64_t prs_to_copy; /* bytes that need to be copied */
766 uint64_t prs_copied; /* bytes copied so far */
767 /*
768 * bytes of memory used for indirect mappings.
769 * This includes all removed vdevs.
770 */
771 uint64_t prs_mapping_memory;
772 } pool_removal_stat_t;
773
774 typedef enum dsl_scan_state {
775 DSS_NONE,
776 DSS_SCANNING,
777 DSS_FINISHED,
778 DSS_CANCELED,
779 DSS_NUM_STATES
780 } dsl_scan_state_t;
781
782
783 /*
784 * Vdev statistics. Note: all fields should be 64-bit because this
785 * is passed between kernel and userland as an nvlist uint64 array.
786 */
787 typedef struct vdev_stat {
788 hrtime_t vs_timestamp; /* time since vdev load */
789 uint64_t vs_state; /* vdev state */
790 uint64_t vs_aux; /* see vdev_aux_t */
791 uint64_t vs_alloc; /* space allocated */
792 uint64_t vs_space; /* total capacity */
793 uint64_t vs_dspace; /* deflated capacity */
794 uint64_t vs_rsize; /* replaceable dev size */
795 uint64_t vs_esize; /* expandable dev size */
796 uint64_t vs_ops[ZIO_TYPES]; /* operation count */
797 uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */
798 uint64_t vs_read_errors; /* read errors */
799 uint64_t vs_write_errors; /* write errors */
800 uint64_t vs_checksum_errors; /* checksum errors */
801 uint64_t vs_self_healed; /* self-healed bytes */
802 uint64_t vs_scan_removing; /* removing? */
803 uint64_t vs_scan_processed; /* scan processed bytes */
804 uint64_t vs_fragmentation; /* device fragmentation */
805 } vdev_stat_t;
806
807 /*
808 * DDT statistics. Note: all fields should be 64-bit because this
809 * is passed between kernel and userland as an nvlist uint64 array.
810 */
811 typedef struct ddt_object {
812 uint64_t ddo_count; /* number of elments in ddt */
813 uint64_t ddo_dspace; /* size of ddt on disk */
814 uint64_t ddo_mspace; /* size of ddt in-core */
815 } ddt_object_t;
816
817 typedef struct ddt_stat {
818 uint64_t dds_blocks; /* blocks */
819 uint64_t dds_lsize; /* logical size */
820 uint64_t dds_psize; /* physical size */
821 uint64_t dds_dsize; /* deflated allocated size */
822 uint64_t dds_ref_blocks; /* referenced blocks */
823 uint64_t dds_ref_lsize; /* referenced lsize * refcnt */
824 uint64_t dds_ref_psize; /* referenced psize * refcnt */
853 */
854 typedef enum zfs_ioc {
855 ZFS_IOC_FIRST = ('Z' << 8),
856 ZFS_IOC = ZFS_IOC_FIRST,
857 ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
858 ZFS_IOC_POOL_DESTROY,
859 ZFS_IOC_POOL_IMPORT,
860 ZFS_IOC_POOL_EXPORT,
861 ZFS_IOC_POOL_CONFIGS,
862 ZFS_IOC_POOL_STATS,
863 ZFS_IOC_POOL_TRYIMPORT,
864 ZFS_IOC_POOL_SCAN,
865 ZFS_IOC_POOL_FREEZE,
866 ZFS_IOC_POOL_UPGRADE,
867 ZFS_IOC_POOL_GET_HISTORY,
868 ZFS_IOC_VDEV_ADD,
869 ZFS_IOC_VDEV_REMOVE,
870 ZFS_IOC_VDEV_SET_STATE,
871 ZFS_IOC_VDEV_ATTACH,
872 ZFS_IOC_VDEV_DETACH,
873 ZFS_IOC_VDEV_SETPATH,
874 ZFS_IOC_VDEV_SETFRU,
875 ZFS_IOC_OBJSET_STATS,
876 ZFS_IOC_OBJSET_ZPLPROPS,
877 ZFS_IOC_DATASET_LIST_NEXT,
878 ZFS_IOC_SNAPSHOT_LIST_NEXT,
879 ZFS_IOC_SET_PROP,
880 ZFS_IOC_CREATE,
881 ZFS_IOC_DESTROY,
882 ZFS_IOC_ROLLBACK,
883 ZFS_IOC_RENAME,
884 ZFS_IOC_RECV,
885 ZFS_IOC_SEND,
886 ZFS_IOC_INJECT_FAULT,
887 ZFS_IOC_CLEAR_FAULT,
888 ZFS_IOC_INJECT_LIST_NEXT,
889 ZFS_IOC_ERROR_LOG,
890 ZFS_IOC_CLEAR,
891 ZFS_IOC_PROMOTE,
892 ZFS_IOC_SNAPSHOT,
907 ZFS_IOC_GET_HOLDS,
908 ZFS_IOC_OBJSET_RECVD_PROPS,
909 ZFS_IOC_VDEV_SPLIT,
910 ZFS_IOC_NEXT_OBJ,
911 ZFS_IOC_DIFF,
912 ZFS_IOC_TMP_SNAPSHOT,
913 ZFS_IOC_OBJ_TO_STATS,
914 ZFS_IOC_SPACE_WRITTEN,
915 ZFS_IOC_SPACE_SNAPS,
916 ZFS_IOC_DESTROY_SNAPS,
917 ZFS_IOC_POOL_REGUID,
918 ZFS_IOC_POOL_REOPEN,
919 ZFS_IOC_SEND_PROGRESS,
920 ZFS_IOC_LOG_HISTORY,
921 ZFS_IOC_SEND_NEW,
922 ZFS_IOC_SEND_SPACE,
923 ZFS_IOC_CLONE,
924 ZFS_IOC_BOOKMARK,
925 ZFS_IOC_GET_BOOKMARKS,
926 ZFS_IOC_DESTROY_BOOKMARKS,
927 ZFS_IOC_CHANNEL_PROGRAM,
928 ZFS_IOC_REMAP,
929 ZFS_IOC_LAST
930 } zfs_ioc_t;
931
932 /*
933 * Internal SPA load state. Used by FMA diagnosis engine.
934 */
935 typedef enum {
936 SPA_LOAD_NONE, /* no load in progress */
937 SPA_LOAD_OPEN, /* normal open */
938 SPA_LOAD_IMPORT, /* import in progress */
939 SPA_LOAD_TRYIMPORT, /* tryimport in progress */
940 SPA_LOAD_RECOVER, /* recovery requested */
941 SPA_LOAD_ERROR, /* load failed */
942 SPA_LOAD_CREATE /* creation in progress */
943 } spa_load_state_t;
944
945 /*
946 * Bookmark name values.
947 */
948 #define ZPOOL_ERR_LIST "error list"
|
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 /*
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
25 * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
26 * Copyright (c) 2013, Saso Kiselkov. All rights reserved.
27 * Copyright (c) 2014 Integros [integros.com]
28 * Copyright 2017 Joyent, Inc.
29 * Copyright (c) 2017 Datto Inc.
30 */
31
32 /* Portions Copyright 2010 Robert Milkowski */
33
34 #ifndef _SYS_FS_ZFS_H
35 #define _SYS_FS_ZFS_H
36
37 #include <sys/time.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * Types and constants shared between userland and the kernel.
45 */
46
47 /*
48 * Each dataset can be one of the following types. These constants can be
49 * combined into masks that can be passed to various functions.
50 */
51 typedef enum {
52 ZFS_TYPE_FILESYSTEM = (1 << 0),
53 ZFS_TYPE_SNAPSHOT = (1 << 1),
54 ZFS_TYPE_VOLUME = (1 << 2),
55 ZFS_TYPE_POOL = (1 << 3),
56 ZFS_TYPE_BOOKMARK = (1 << 4),
57 ZFS_TYPE_VDEV = (1 << 5),
58 ZFS_TYPE_COS = (1 << 6),
59 ZFS_TYPE_AUTOSNAP = (1 << 7)
60 } zfs_type_t;
61
62 /*
63 * NB: lzc_dataset_type should be updated whenever a new objset type is added,
64 * if it represents a real type of a dataset that can be created from userland.
65 */
66 typedef enum dmu_objset_type {
67 DMU_OST_NONE,
68 DMU_OST_META,
69 DMU_OST_ZFS,
70 DMU_OST_ZVOL,
71 DMU_OST_OTHER, /* For testing only! */
72 DMU_OST_ANY, /* Be careful! */
73 DMU_OST_NUMTYPES
74 } dmu_objset_type_t;
75
76 #define ZFS_TYPE_DATASET \
77 (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME |\
78 ZFS_TYPE_SNAPSHOT | ZFS_TYPE_AUTOSNAP)
79
80 /*
81 * All of these include the terminating NUL byte.
82 */
83 #define ZAP_MAXNAMELEN 256
84 #define ZAP_MAXVALUELEN (1024 * 8)
85 #define ZAP_OLDMAXVALUELEN 1024
86 #define ZFS_MAX_DATASET_NAME_LEN 256
87
88 /*
89 * Dataset properties are identified by these constants and must be added to
90 * the end of this list to ensure that external consumers are not affected
91 * by the change. If you make any changes to this list, be sure to update
92 * the property table in usr/src/common/zfs/zfs_prop.c.
93 */
94 typedef enum {
95 ZFS_PROP_BAD = -1,
96 ZFS_PROP_TYPE = 0,
97 ZFS_PROP_CREATION,
98 ZFS_PROP_USED,
99 ZFS_PROP_AVAILABLE,
100 ZFS_PROP_REFERENCED,
101 ZFS_PROP_COMPRESSRATIO,
102 ZFS_PROP_MOUNTED,
103 ZFS_PROP_ORIGIN,
104 ZFS_PROP_QUOTA,
105 ZFS_PROP_RESERVATION,
106 ZFS_PROP_VOLSIZE,
107 ZFS_PROP_VOLBLOCKSIZE,
108 ZFS_PROP_RECORDSIZE,
109 ZFS_PROP_MOUNTPOINT,
110 ZFS_PROP_SHARENFS,
111 ZFS_PROP_CHECKSUM,
112 ZFS_PROP_COMPRESSION,
113 ZFS_PROP_ATIME,
114 ZFS_PROP_DEVICES,
115 ZFS_PROP_EXEC,
147 ZFS_PROP_DEFER_DESTROY,
148 ZFS_PROP_USERREFS,
149 ZFS_PROP_LOGBIAS,
150 ZFS_PROP_UNIQUE, /* not exposed to the user */
151 ZFS_PROP_OBJSETID, /* not exposed to the user */
152 ZFS_PROP_DEDUP,
153 ZFS_PROP_MLSLABEL,
154 ZFS_PROP_SYNC,
155 ZFS_PROP_REFRATIO,
156 ZFS_PROP_WRITTEN,
157 ZFS_PROP_CLONES,
158 ZFS_PROP_LOGICALUSED,
159 ZFS_PROP_LOGICALREFERENCED,
160 ZFS_PROP_INCONSISTENT, /* not exposed to the user */
161 ZFS_PROP_FILESYSTEM_LIMIT,
162 ZFS_PROP_SNAPSHOT_LIMIT,
163 ZFS_PROP_FILESYSTEM_COUNT,
164 ZFS_PROP_SNAPSHOT_COUNT,
165 ZFS_PROP_REDUNDANT_METADATA,
166 ZFS_PROP_PREV_SNAP,
167 ZFS_PROP_LSTXG,
168 ZFS_PROP_ZPL_META_TO_METADEV,
169 ZFS_PROP_WBC_MODE,
170 ZFS_PROP_RECEIVE_RESUME_TOKEN,
171 ZFS_PROP_SMARTCOMPRESSION,
172 ZFS_PROP_RATE_LIMIT,
173 ZFS_PROP_MODIFIED,
174 ZFS_NUM_PROPS
175 } zfs_prop_t;
176
177 typedef enum {
178 ZFS_PROP_USERUSED,
179 ZFS_PROP_USERQUOTA,
180 ZFS_PROP_GROUPUSED,
181 ZFS_PROP_GROUPQUOTA,
182 ZFS_NUM_USERQUOTA_PROPS
183 } zfs_userquota_prop_t;
184
185 extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
186
187 /*
188 * Pool properties are identified by these constants and must be added to the
189 * end of this list to ensure that external consumers are not affected
190 * by the change. If you make any changes to this list, be sure to update
191 * the property table in usr/src/common/zfs/zpool_prop.c.
192 *
193 * NOTE: When either adding or changing a feature make sure
194 * to update the zfs-tests zpool_get configuration file
195 * at usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
196 */
197 typedef enum {
198 ZPOOL_PROP_NAME,
199 ZPOOL_PROP_SIZE,
200 ZPOOL_PROP_CAPACITY,
201 ZPOOL_PROP_ALTROOT,
202 ZPOOL_PROP_HEALTH,
203 ZPOOL_PROP_GUID,
204 ZPOOL_PROP_VERSION,
205 ZPOOL_PROP_BOOTFS,
206 ZPOOL_PROP_DELEGATION,
207 ZPOOL_PROP_AUTOREPLACE,
208 ZPOOL_PROP_CACHEFILE,
209 ZPOOL_PROP_FAILUREMODE,
210 ZPOOL_PROP_LISTSNAPS,
211 ZPOOL_PROP_AUTOEXPAND,
212 ZPOOL_PROP_DEDUPDITTO,
213 ZPOOL_PROP_DEDUPRATIO,
214 ZPOOL_PROP_DDTCAPPED,
215 ZPOOL_PROP_FREE,
216 ZPOOL_PROP_ALLOCATED,
217 ZPOOL_PROP_READONLY,
218 ZPOOL_PROP_COMMENT,
219 ZPOOL_PROP_EXPANDSZ,
220 ZPOOL_PROP_FREEING,
221 ZPOOL_PROP_FRAGMENTATION,
222 ZPOOL_PROP_LEAKED,
223 ZPOOL_PROP_MAXBLOCKSIZE,
224 ZPOOL_PROP_ENABLESPECIAL,
225 ZPOOL_PROP_LOWATERMARK,
226 ZPOOL_PROP_HIWATERMARK,
227 ZPOOL_PROP_DEDUPMETA_DITTO,
228 ZPOOL_PROP_DDT_DESEGREGATION,
229 ZPOOL_PROP_META_PLACEMENT,
230 ZPOOL_PROP_DDT_META_TO_METADEV,
231 ZPOOL_PROP_ZFS_META_TO_METADEV,
232 ZPOOL_PROP_DEDUP_BEST_EFFORT,
233 ZPOOL_PROP_DEDUP_LO_BEST_EFFORT,
234 ZPOOL_PROP_DEDUP_HI_BEST_EFFORT,
235 ZPOOL_PROP_FORCETRIM,
236 ZPOOL_PROP_AUTOTRIM,
237 ZPOOL_PROP_SMALL_DATA_TO_METADEV,
238 ZPOOL_PROP_MINWATERMARK,
239 ZPOOL_PROP_SYNC_TO_SPECIAL,
240 ZPOOL_PROP_BOOTSIZE,
241 ZPOOL_PROP_SCRUB_PRIO,
242 ZPOOL_PROP_RESILVER_PRIO,
243 ZPOOL_NUM_PROPS
244 } zpool_prop_t;
245
246 /*
247 * Note: it is important to keep min/max active properties together in the
248 * same order as the corresponding zio_priority_t definitions as this order
249 * is relied upon when processing in loops. See vdev_impl.h for the set of
250 * macros that rely on this dependency.
251 * Also path must be the first entry in the enum as loops use it as a starting
252 * index.
253 */
254 typedef enum vdev_prop {
255 VDEV_PROP_PATH,
256 VDEV_PROP_FRU,
257 /* minactive props for queue classes */
258 VDEV_PROP_READ_MINACTIVE,
259 VDEV_PROP_AREAD_MINACTIVE,
260 VDEV_PROP_WRITE_MINACTIVE,
261 VDEV_PROP_AWRITE_MINACTIVE,
262 VDEV_PROP_RESILVER_MINACTIVE,
263 VDEV_PROP_SCRUB_MINACTIVE,
264 /* maxactive props for queue classes */
265 VDEV_PROP_READ_MAXACTIVE,
266 VDEV_PROP_AREAD_MAXACTIVE,
267 VDEV_PROP_WRITE_MAXACTIVE,
268 VDEV_PROP_AWRITE_MAXACTIVE,
269 VDEV_PROP_RESILVER_MAXACTIVE,
270 VDEV_PROP_SCRUB_MAXACTIVE,
271 VDEV_PROP_PREFERRED_READ,
272 VDEV_PROP_COS,
273 VDEV_PROP_SPAREGROUP,
274 VDEV_PROP_L2ADDDT,
275 VDEV_PROP_GUID,
276 VDEV_NUM_PROPS
277 } vdev_prop_t;
278
279 /*
280 * Note: it is important to keep min/max active properties together in the
281 * same order as the corresponding zio_priority_t definitions as this order
282 * is relied upon when processing in loops. See cos.h for the set of
283 * macros that rely on this dependency.
284 */
285 typedef enum cos_prop {
286 COS_PROP_GUID,
287 /* user-defined cos name */
288 COS_PROP_NAME,
289 /* IO tunables */
290 /* minactive props for queue classes */
291 COS_PROP_READ_MINACTIVE,
292 COS_PROP_AREAD_MINACTIVE,
293 COS_PROP_WRITE_MINACTIVE,
294 COS_PROP_AWRITE_MINACTIVE,
295 COS_PROP_RESILVER_MINACTIVE,
296 COS_PROP_SCRUB_MINACTIVE,
297 /* maxactive props for queue classes */
298 COS_PROP_READ_MAXACTIVE,
299 COS_PROP_AREAD_MAXACTIVE,
300 COS_PROP_WRITE_MAXACTIVE,
301 COS_PROP_AWRITE_MAXACTIVE,
302 COS_PROP_RESILVER_MAXACTIVE,
303 COS_PROP_SCRUB_MAXACTIVE,
304 /* preference for read in mirror configurations */
305 COS_PROP_PREFERRED_READ,
306 COS_NUM_PROPS
307 } cos_prop_t;
308
309 /* Small enough to not hog a whole line of printout in zpool(1M). */
310 #define ZPROP_MAX_COMMENT 32
311
312 #define ZPROP_CONT -2
313 #define ZPROP_INVAL -1
314
315 #define ZPROP_VALUE "value"
316 #define ZPROP_SOURCE "source"
317
318 typedef enum {
319 ZPROP_SRC_NONE = 0x1,
320 ZPROP_SRC_DEFAULT = 0x2,
321 ZPROP_SRC_TEMPORARY = 0x4,
322 ZPROP_SRC_LOCAL = 0x8,
323 ZPROP_SRC_INHERITED = 0x10,
324 ZPROP_SRC_RECEIVED = 0x20
325 } zprop_source_t;
326
327 #define ZPROP_SRC_ALL 0x3f
328
329 #define ZPROP_SOURCE_VAL_RECVD "$recvd"
330 #define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS"
331 /*
332 * Dataset flag implemented as a special entry in the props zap object
333 * indicating that the dataset has received properties on or after
334 * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
373 int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
374 int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
375 uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
376 boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
377
378 /*
379 * Pool property functions shared between libzfs and kernel.
380 */
381 zpool_prop_t zpool_name_to_prop(const char *);
382 const char *zpool_prop_to_name(zpool_prop_t);
383 const char *zpool_prop_default_string(zpool_prop_t);
384 uint64_t zpool_prop_default_numeric(zpool_prop_t);
385 boolean_t zpool_prop_readonly(zpool_prop_t);
386 boolean_t zpool_prop_feature(const char *);
387 boolean_t zpool_prop_unsupported(const char *name);
388 int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
389 int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
390 uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
391
392 /*
393 * Vdev property functions shared between libzfs and kernel.
394 */
395 vdev_prop_t vdev_name_to_prop(const char *);
396 const char *vdev_prop_to_name(vdev_prop_t);
397 const char *vdev_prop_default_string(vdev_prop_t);
398 uint64_t vdev_prop_default_numeric(vdev_prop_t);
399 boolean_t vdev_prop_readonly(vdev_prop_t);
400 int vdev_prop_index_to_string(vdev_prop_t, uint64_t, const char **);
401 int vdev_prop_string_to_index(vdev_prop_t, const char *, uint64_t *);
402 uint64_t vdev_prop_random_value(vdev_prop_t, uint64_t seed);
403
404 /*
405 * COS property functions shared between libzfs and kernel.
406 */
407 cos_prop_t cos_name_to_prop(const char *);
408 const char *cos_prop_to_name(cos_prop_t);
409 const char *cos_prop_default_string(cos_prop_t);
410 uint64_t cos_prop_default_numeric(cos_prop_t);
411 boolean_t cos_prop_readonly(cos_prop_t);
412 int cos_prop_index_to_string(cos_prop_t, uint64_t, const char **);
413 int cos_prop_string_to_index(cos_prop_t, const char *, uint64_t *);
414 uint64_t cos_prop_random_value(cos_prop_t, uint64_t seed);
415
416 #define MAXCOSNAMELEN (64)
417 /*
418 * Definitions for the Delegation.
419 */
420 typedef enum {
421 ZFS_DELEG_WHO_UNKNOWN = 0,
422 ZFS_DELEG_USER = 'u',
423 ZFS_DELEG_USER_SETS = 'U',
424 ZFS_DELEG_GROUP = 'g',
425 ZFS_DELEG_GROUP_SETS = 'G',
426 ZFS_DELEG_EVERYONE = 'e',
427 ZFS_DELEG_EVERYONE_SETS = 'E',
428 ZFS_DELEG_CREATE = 'c',
429 ZFS_DELEG_CREATE_SETS = 'C',
430 ZFS_DELEG_NAMED_SET = 's',
431 ZFS_DELEG_NAMED_SET_SETS = 'S'
432 } zfs_deleg_who_type_t;
433
434 typedef enum {
435 ZFS_DELEG_NONE = 0,
436 ZFS_DELEG_PERM_LOCAL = 1,
437 ZFS_DELEG_PERM_DESCENDENT = 2,
459 ZFS_LOGBIAS_THROUGHPUT = 1
460 } zfs_logbias_op_t;
461
462 typedef enum zfs_share_op {
463 ZFS_SHARE_NFS = 0,
464 ZFS_UNSHARE_NFS = 1,
465 ZFS_SHARE_SMB = 2,
466 ZFS_UNSHARE_SMB = 3
467 } zfs_share_op_t;
468
469 typedef enum zfs_smb_acl_op {
470 ZFS_SMB_ACL_ADD,
471 ZFS_SMB_ACL_REMOVE,
472 ZFS_SMB_ACL_RENAME,
473 ZFS_SMB_ACL_PURGE
474 } zfs_smb_acl_op_t;
475
476 typedef enum zfs_cache_type {
477 ZFS_CACHE_NONE = 0,
478 ZFS_CACHE_METADATA = 1,
479 ZFS_CACHE_ALL = 2,
480 ZFS_CACHE_DATA = 3
481 } zfs_cache_type_t;
482
483 typedef enum {
484 ZFS_SYNC_STANDARD = 0,
485 ZFS_SYNC_ALWAYS = 1,
486 ZFS_SYNC_DISABLED = 2
487 } zfs_sync_type_t;
488
489 typedef enum {
490 ZFS_REDUNDANT_METADATA_ALL,
491 ZFS_REDUNDANT_METADATA_MOST
492 } zfs_redundant_metadata_type_t;
493
494 typedef enum {
495 ZFS_WBC_MODE_OFF,
496 ZFS_WBC_MODE_ON,
497 ZFS_WBC_MODE_OFF_DELAYED
498 } zfs_wbc_mode_t;
499
500 /*
501 * On-disk version number.
502 */
503 #define SPA_VERSION_1 1ULL
504 #define SPA_VERSION_2 2ULL
505 #define SPA_VERSION_3 3ULL
506 #define SPA_VERSION_4 4ULL
507 #define SPA_VERSION_5 5ULL
508 #define SPA_VERSION_6 6ULL
509 #define SPA_VERSION_7 7ULL
510 #define SPA_VERSION_8 8ULL
511 #define SPA_VERSION_9 9ULL
512 #define SPA_VERSION_10 10ULL
513 #define SPA_VERSION_11 11ULL
514 #define SPA_VERSION_12 12ULL
515 #define SPA_VERSION_13 13ULL
516 #define SPA_VERSION_14 14ULL
517 #define SPA_VERSION_15 15ULL
518 #define SPA_VERSION_16 16ULL
519 #define SPA_VERSION_17 17ULL
620 #define ZPL_VERSION_SA ZPL_VERSION_5
621
622 /* Rewind request information */
623 #define ZPOOL_NO_REWIND 1 /* No policy - default behavior */
624 #define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */
625 #define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */
626 #define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */
627 #define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */
628 #define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */
629 #define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */
630
631 typedef struct zpool_rewind_policy {
632 uint32_t zrp_request; /* rewind behavior requested */
633 uint64_t zrp_maxmeta; /* max acceptable meta-data errors */
634 uint64_t zrp_maxdata; /* max acceptable data errors */
635 uint64_t zrp_txg; /* specific txg to load */
636 } zpool_rewind_policy_t;
637
638 /*
639 * The following are configuration names used in the nvlist describing a pool's
640 * configuration.
641 */
642 #define ZPOOL_CONFIG_VERSION "version"
643 #define ZPOOL_CONFIG_POOL_NAME "name"
644 #define ZPOOL_CONFIG_POOL_STATE "state"
645 #define ZPOOL_CONFIG_POOL_TXG "txg"
646 #define ZPOOL_CONFIG_POOL_GUID "pool_guid"
647 #define ZPOOL_CONFIG_CREATE_TXG "create_txg"
648 #define ZPOOL_CONFIG_TOP_GUID "top_guid"
649 #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree"
650 #define ZPOOL_CONFIG_TYPE "type"
651 #define ZPOOL_CONFIG_CHILDREN "children"
652 #define ZPOOL_CONFIG_ID "id"
653 #define ZPOOL_CONFIG_GUID "guid"
654 #define ZPOOL_CONFIG_PATH "path"
655 #define ZPOOL_CONFIG_DEVID "devid"
656 #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array"
657 #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift"
658 #define ZPOOL_CONFIG_ASHIFT "ashift"
659 #define ZPOOL_CONFIG_ASIZE "asize"
660 #define ZPOOL_CONFIG_DTL "DTL"
661 #define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */
662 #define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */
663 #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk"
664 #define ZPOOL_CONFIG_ERRCOUNT "error_count"
665 #define ZPOOL_CONFIG_NOT_PRESENT "not_present"
666 #define ZPOOL_CONFIG_SPARES "spares"
667 #define ZPOOL_CONFIG_IS_SPARE "is_spare"
668 #define ZPOOL_CONFIG_NPARITY "nparity"
669 #define ZPOOL_CONFIG_HOSTID "hostid"
670 #define ZPOOL_CONFIG_HOSTNAME "hostname"
671 #define ZPOOL_CONFIG_LOADED_TIME "initial_load_time"
672 #define ZPOOL_CONFIG_UNSPARE "unspare"
673 #define ZPOOL_CONFIG_PHYS_PATH "phys_path"
674 #define ZPOOL_CONFIG_IS_LOG "is_log"
675 #define ZPOOL_CONFIG_IS_SPECIAL "is_special"
676 #define ZPOOL_CONFIG_L2CACHE "l2cache"
677 #define ZPOOL_CONFIG_L2CACHE_PERSISTENT "l2cache_persistent"
678 #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array"
679 #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children"
680 #define ZPOOL_CONFIG_IS_HOLE "is_hole"
681 #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram"
682 #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats"
683 #define ZPOOL_CONFIG_DDT_STATS "ddt_stats"
684 #define ZPOOL_CONFIG_SPLIT "splitcfg"
685 #define ZPOOL_CONFIG_ORIG_GUID "orig_guid"
686 #define ZPOOL_CONFIG_SPLIT_GUID "split_guid"
687 #define ZPOOL_CONFIG_SPLIT_LIST "guid_list"
688 #define ZPOOL_CONFIG_REMOVING "removing"
689 #define ZPOOL_CONFIG_RESILVERING "resilvering"
690 #define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg"
691 #define ZPOOL_CONFIG_COMMENT "comment"
692 #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
693 #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
694 #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
695 #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */
696 #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */
697 #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */
698 #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */
699 #define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */
700 #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */
701 #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read"
702 #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */
703 #define ZPOOL_CONFIG_IS_SSD "is_ssd" /* not stored on disk */
704 #define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top"
705 #define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf"
706 #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps"
707 /*
708 * The persistent vdev state is stored as separate values rather than a single
709 * 'vdev_state' entry. This is because a device can be in multiple states, such
710 * as offline and degraded.
711 */
712 #define ZPOOL_CONFIG_OFFLINE "offline"
713 #define ZPOOL_CONFIG_FAULTED "faulted"
714 #define ZPOOL_CONFIG_DEGRADED "degraded"
715 #define ZPOOL_CONFIG_REMOVED "removed"
716 #define ZPOOL_CONFIG_FRU "fru"
717 #define ZPOOL_CONFIG_AUX_STATE "aux_state"
718 #define ZPOOL_CONFIG_TRIM_PROG "trim_prog"
719 #define ZPOOL_CONFIG_TRIM_RATE "trim_rate"
720 #define ZPOOL_CONFIG_TRIM_START_TIME "trim_start_time"
721 #define ZPOOL_CONFIG_TRIM_STOP_TIME "trim_stop_time"
722
723 /* Rewind policy parameters */
724 #define ZPOOL_REWIND_POLICY "rewind-policy"
725 #define ZPOOL_REWIND_REQUEST "rewind-request"
726 #define ZPOOL_REWIND_REQUEST_TXG "rewind-request-txg"
727 #define ZPOOL_REWIND_META_THRESH "rewind-meta-thresh"
728 #define ZPOOL_REWIND_DATA_THRESH "rewind-data-thresh"
729
730 /* Rewind data discovered */
731 #define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts"
732 #define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors"
733 #define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind"
734
735 #define VDEV_TYPE_ROOT "root"
736 #define VDEV_TYPE_MIRROR "mirror"
737 #define VDEV_TYPE_REPLACING "replacing"
738 #define VDEV_TYPE_RAIDZ "raidz"
739 #define VDEV_TYPE_DISK "disk"
740 #define VDEV_TYPE_FILE "file"
741 #define VDEV_TYPE_MISSING "missing"
742 #define VDEV_TYPE_HOLE "hole"
743 #define VDEV_TYPE_SPARE "spare"
744 #define VDEV_TYPE_LOG "log"
745 #define VDEV_TYPE_L2CACHE "l2cache"
746 #define VDEV_TYPE_SPECIAL "special"
747
748 /*
749 * This is needed in userland to report the minimum necessary device size.
750 *
751 * Note that the zfs test suite uses 64MB vdevs.
752 */
753 #define SPA_MINDEVSIZE (64ULL << 20)
754
755 /*
756 * Set if the fragmentation has not yet been calculated. This can happen
757 * because the space maps have not been upgraded or the histogram feature
758 * is not enabled.
759 */
760 #define ZFS_FRAG_INVALID UINT64_MAX
761
762 /*
763 * The location of the pool configuration repository, shared between kernel and
764 * userland.
765 */
766 #define ZPOOL_CACHE "/etc/zfs/zpool.cache"
767
785 /*
786 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field
787 * of the vdev stats structure uses these constants to distinguish why.
788 */
789 typedef enum vdev_aux {
790 VDEV_AUX_NONE, /* no error */
791 VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */
792 VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */
793 VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */
794 VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */
795 VDEV_AUX_TOO_SMALL, /* vdev size is too small */
796 VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */
797 VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */
798 VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */
799 VDEV_AUX_UNSUP_FEAT, /* unsupported features */
800 VDEV_AUX_SPARED, /* hot spare used in another pool */
801 VDEV_AUX_ERR_EXCEEDED, /* too many errors */
802 VDEV_AUX_IO_FAILURE, /* experienced I/O failure */
803 VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */
804 VDEV_AUX_EXTERNAL, /* external diagnosis */
805 VDEV_AUX_SPLIT_POOL /* vdev was split off into another pool */
806 } vdev_aux_t;
807
808 /*
809 * pool state. The following states are written to disk as part of the normal
810 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining
811 * states are software abstractions used at various levels to communicate
812 * pool state.
813 */
814 typedef enum pool_state {
815 POOL_STATE_ACTIVE = 0, /* In active use */
816 POOL_STATE_EXPORTED, /* Explicitly exported */
817 POOL_STATE_DESTROYED, /* Explicitly destroyed */
818 POOL_STATE_SPARE, /* Reserved for hot spare use */
819 POOL_STATE_L2CACHE, /* Level 2 ARC device */
820 POOL_STATE_UNINITIALIZED, /* Internal spa_t state */
821 POOL_STATE_UNAVAIL, /* Internal libzfs state */
822 POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */
823 } pool_state_t;
824
825 /*
826 * Scan Functions.
827 */
828 typedef enum pool_scan_func {
829 POOL_SCAN_NONE,
830 POOL_SCAN_SCRUB,
831 POOL_SCAN_RESILVER,
832 POOL_SCAN_MOS,
833 POOL_SCAN_META,
834 POOL_SCAN_FUNCS
835 } pool_scan_func_t;
836
837 /*
838 * TRIM command configuration info.
839 */
840 typedef struct trim_cmd_info_s {
841 uint64_t tci_start; /* B_TRUE = start; B_FALSE = stop */
842 uint64_t tci_rate; /* requested TRIM rate in bytes/sec */
843 } trim_cmd_info_t;
844
845 /*
846 * Used to control scrub pause and resume.
847 */
848 typedef enum pool_scrub_cmd {
849 POOL_SCRUB_NORMAL = 0,
850 POOL_SCRUB_PAUSE,
851 POOL_SCRUB_FLAGS_END
852 } pool_scrub_cmd_t;
853
854 /*
855 * ZIO types. Needed to interpret vdev statistics below.
856 */
857 typedef enum zio_type {
858 ZIO_TYPE_NULL = 0,
859 ZIO_TYPE_READ,
860 ZIO_TYPE_WRITE,
861 ZIO_TYPE_FREE,
862 ZIO_TYPE_CLAIM,
863 ZIO_TYPE_IOCTL,
864 ZIO_TYPES
865 } zio_type_t;
866
867 /*
868 * Pool statistics. Note: all fields should be 64-bit because this
869 * is passed between kernel and userland as an nvlist uint64 array.
870 */
871 typedef struct pool_scan_stat {
872 /* values stored on disk */
873 uint64_t pss_func; /* pool_scan_func_t */
874 uint64_t pss_state; /* dsl_scan_state_t */
875 uint64_t pss_start_time; /* scan start time */
876 uint64_t pss_end_time; /* scan end time */
877 uint64_t pss_to_examine; /* total bytes to scan */
878 uint64_t pss_examined; /* total bytes located by scanner */
879 uint64_t pss_issued; /* total bytes checked by scanner */
880 uint64_t pss_to_process; /* total bytes to process */
881 uint64_t pss_processed; /* total processed bytes */
882 uint64_t pss_errors; /* scan errors */
883
884 /* values not stored on disk */
885 uint64_t pss_pass_exam; /* examined bytes per scan pass */
886 uint64_t pss_pass_work; /* issued bytes per scan pass */
887 uint64_t pss_pass_start; /* start time of a scan pass */
888 uint64_t pss_pass_scrub_pause; /* pause time of a scurb pass */
889 /* cumulative time scrub spent paused, needed for rate calculation */
890 uint64_t pss_pass_scrub_spent_paused;
891 } pool_scan_stat_t;
892
893 typedef enum dsl_scan_state {
894 DSS_NONE,
895 DSS_SCANNING,
896 DSS_FINISHED,
897 DSS_CANCELED,
898 DSS_FINISHING,
899 DSS_NUM_STATES
900 } dsl_scan_state_t;
901
902
903 /*
904 * Vdev statistics. Note: all fields should be 64-bit because this
905 * is passed between kernel and userland as an nvlist uint64 array.
906 */
907 typedef struct vdev_stat {
908 hrtime_t vs_timestamp; /* time since vdev load */
909 uint64_t vs_state; /* vdev state */
910 uint64_t vs_aux; /* see vdev_aux_t */
911 uint64_t vs_alloc; /* space allocated */
912 uint64_t vs_space; /* total capacity */
913 uint64_t vs_dspace; /* deflated capacity */
914 uint64_t vs_rsize; /* replaceable dev size */
915 uint64_t vs_esize; /* expandable dev size */
916 uint64_t vs_ops[ZIO_TYPES]; /* operation count */
917 uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */
918 uint64_t vs_read_errors; /* read errors */
919 uint64_t vs_write_errors; /* write errors */
920 uint64_t vs_checksum_errors; /* checksum errors */
921 uint64_t vs_self_healed; /* self-healed bytes */
922 uint64_t vs_scan_removing; /* removing? */
923 uint64_t vs_scan_processed; /* scan processed bytes */
924 uint64_t vs_fragmentation; /* device fragmentation */
925 hrtime_t vs_latency[ZIO_TYPES]; /* moving average of latency */
926 hrtime_t vs_iotime[ZIO_TYPES]; /* time spent doing i/o */
927 } vdev_stat_t;
928
929 /*
930 * DDT statistics. Note: all fields should be 64-bit because this
931 * is passed between kernel and userland as an nvlist uint64 array.
932 */
933 typedef struct ddt_object {
934 uint64_t ddo_count; /* number of elments in ddt */
935 uint64_t ddo_dspace; /* size of ddt on disk */
936 uint64_t ddo_mspace; /* size of ddt in-core */
937 } ddt_object_t;
938
939 typedef struct ddt_stat {
940 uint64_t dds_blocks; /* blocks */
941 uint64_t dds_lsize; /* logical size */
942 uint64_t dds_psize; /* physical size */
943 uint64_t dds_dsize; /* deflated allocated size */
944 uint64_t dds_ref_blocks; /* referenced blocks */
945 uint64_t dds_ref_lsize; /* referenced lsize * refcnt */
946 uint64_t dds_ref_psize; /* referenced psize * refcnt */
975 */
976 typedef enum zfs_ioc {
977 ZFS_IOC_FIRST = ('Z' << 8),
978 ZFS_IOC = ZFS_IOC_FIRST,
979 ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
980 ZFS_IOC_POOL_DESTROY,
981 ZFS_IOC_POOL_IMPORT,
982 ZFS_IOC_POOL_EXPORT,
983 ZFS_IOC_POOL_CONFIGS,
984 ZFS_IOC_POOL_STATS,
985 ZFS_IOC_POOL_TRYIMPORT,
986 ZFS_IOC_POOL_SCAN,
987 ZFS_IOC_POOL_FREEZE,
988 ZFS_IOC_POOL_UPGRADE,
989 ZFS_IOC_POOL_GET_HISTORY,
990 ZFS_IOC_VDEV_ADD,
991 ZFS_IOC_VDEV_REMOVE,
992 ZFS_IOC_VDEV_SET_STATE,
993 ZFS_IOC_VDEV_ATTACH,
994 ZFS_IOC_VDEV_DETACH,
995 ZFS_IOC_VDEV_SETL2ADDDT,
996 ZFS_IOC_VDEV_SETPATH,
997 ZFS_IOC_VDEV_SETFRU,
998 ZFS_IOC_OBJSET_STATS,
999 ZFS_IOC_OBJSET_ZPLPROPS,
1000 ZFS_IOC_DATASET_LIST_NEXT,
1001 ZFS_IOC_SNAPSHOT_LIST_NEXT,
1002 ZFS_IOC_SET_PROP,
1003 ZFS_IOC_CREATE,
1004 ZFS_IOC_DESTROY,
1005 ZFS_IOC_ROLLBACK,
1006 ZFS_IOC_RENAME,
1007 ZFS_IOC_RECV,
1008 ZFS_IOC_SEND,
1009 ZFS_IOC_INJECT_FAULT,
1010 ZFS_IOC_CLEAR_FAULT,
1011 ZFS_IOC_INJECT_LIST_NEXT,
1012 ZFS_IOC_ERROR_LOG,
1013 ZFS_IOC_CLEAR,
1014 ZFS_IOC_PROMOTE,
1015 ZFS_IOC_SNAPSHOT,
1030 ZFS_IOC_GET_HOLDS,
1031 ZFS_IOC_OBJSET_RECVD_PROPS,
1032 ZFS_IOC_VDEV_SPLIT,
1033 ZFS_IOC_NEXT_OBJ,
1034 ZFS_IOC_DIFF,
1035 ZFS_IOC_TMP_SNAPSHOT,
1036 ZFS_IOC_OBJ_TO_STATS,
1037 ZFS_IOC_SPACE_WRITTEN,
1038 ZFS_IOC_SPACE_SNAPS,
1039 ZFS_IOC_DESTROY_SNAPS,
1040 ZFS_IOC_POOL_REGUID,
1041 ZFS_IOC_POOL_REOPEN,
1042 ZFS_IOC_SEND_PROGRESS,
1043 ZFS_IOC_LOG_HISTORY,
1044 ZFS_IOC_SEND_NEW,
1045 ZFS_IOC_SEND_SPACE,
1046 ZFS_IOC_CLONE,
1047 ZFS_IOC_BOOKMARK,
1048 ZFS_IOC_GET_BOOKMARKS,
1049 ZFS_IOC_DESTROY_BOOKMARKS,
1050 ZFS_IOC_VDEV_SET_PROPS,
1051 ZFS_IOC_VDEV_GET_PROPS,
1052 ZFS_IOC_COS_ALLOC,
1053 ZFS_IOC_COS_FREE,
1054 ZFS_IOC_COS_LIST,
1055 ZFS_IOC_COS_SET_PROPS,
1056 ZFS_IOC_COS_GET_PROPS,
1057 ZFS_IOC_POOL_CONFIGS_NVL,
1058 ZFS_IOC_POOL_STATS_NVL,
1059 ZFS_IOC_OBJSET_STATS_NVL,
1060 ZFS_IOC_DATASET_LIST_NEXT_NVL,
1061 ZFS_IOC_SNAPSHOT_LIST_NEXT_NVL,
1062 ZFS_IOC_POOL_GET_PROPS_NVL,
1063 ZFS_IOC_CHECK_KRRP,
1064 ZFS_IOC_BULK_LIST,
1065 ZFS_IOC_POOL_TRIM,
1066 ZFS_IOC_CHANNEL_PROGRAM,
1067 ZFS_IOC_SET_PROPS_MDS,
1068 ZFS_IOC_LAST
1069 } zfs_ioc_t;
1070
1071 /*
1072 * Internal SPA load state. Used by FMA diagnosis engine.
1073 */
1074 typedef enum {
1075 SPA_LOAD_NONE, /* no load in progress */
1076 SPA_LOAD_OPEN, /* normal open */
1077 SPA_LOAD_IMPORT, /* import in progress */
1078 SPA_LOAD_TRYIMPORT, /* tryimport in progress */
1079 SPA_LOAD_RECOVER, /* recovery requested */
1080 SPA_LOAD_ERROR, /* load failed */
1081 SPA_LOAD_CREATE /* creation in progress */
1082 } spa_load_state_t;
1083
1084 /*
1085 * Bookmark name values.
1086 */
1087 #define ZPOOL_ERR_LIST "error list"
|