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