1fa9e4066Sahrens /* 2fa9e4066Sahrens * CDDL HEADER START 3fa9e4066Sahrens * 4fa9e4066Sahrens * The contents of this file are subject to the terms of the 5441d80aaSlling * Common Development and Distribution License (the "License"). 6441d80aaSlling * You may not use this file except in compliance with the License. 7fa9e4066Sahrens * 8fa9e4066Sahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fa9e4066Sahrens * or http://www.opensolaris.org/os/licensing. 10fa9e4066Sahrens * See the License for the specific language governing permissions 11fa9e4066Sahrens * and limitations under the License. 12fa9e4066Sahrens * 13fa9e4066Sahrens * When distributing Covered Code, include this CDDL HEADER in each 14fa9e4066Sahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fa9e4066Sahrens * If applicable, add the following below this CDDL HEADER, with the 16fa9e4066Sahrens * fields enclosed by brackets "[]" replaced with your own identifying 17fa9e4066Sahrens * information: Portions Copyright [yyyy] [name of copyright owner] 18fa9e4066Sahrens * 19fa9e4066Sahrens * CDDL HEADER END 20fa9e4066Sahrens */ 21fa9e4066Sahrens /* 2239c23413Seschrock * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23fa9e4066Sahrens * Use is subject to license terms. 24fa9e4066Sahrens */ 25fa9e4066Sahrens 26fa9e4066Sahrens #ifndef _SYS_FS_ZFS_H 27fa9e4066Sahrens #define _SYS_FS_ZFS_H 28fa9e4066Sahrens 29fa9e4066Sahrens #pragma ident "%Z%%M% %I% %E% SMI" 30fa9e4066Sahrens 31fa9e4066Sahrens #include <sys/types.h> 32fa9e4066Sahrens 33fa9e4066Sahrens #ifdef __cplusplus 34fa9e4066Sahrens extern "C" { 35fa9e4066Sahrens #endif 36fa9e4066Sahrens 37fa9e4066Sahrens /* 38fa9e4066Sahrens * Types and constants shared between userland and the kernel. 39fa9e4066Sahrens */ 40fa9e4066Sahrens 41fa9e4066Sahrens /* 42fa9e4066Sahrens * Each dataset can be one of the following types. These constants can be 43fa9e4066Sahrens * combined into masks that can be passed to various functions. 44fa9e4066Sahrens */ 45fa9e4066Sahrens typedef enum { 46fa9e4066Sahrens ZFS_TYPE_FILESYSTEM = 0x1, 47fa9e4066Sahrens ZFS_TYPE_SNAPSHOT = 0x2, 48b1b8ab34Slling ZFS_TYPE_VOLUME = 0x4, 49b1b8ab34Slling ZFS_TYPE_POOL = 0x8 50fa9e4066Sahrens } zfs_type_t; 51fa9e4066Sahrens 52fa9e4066Sahrens #define ZFS_TYPE_ANY \ 53fa9e4066Sahrens (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT) 54fa9e4066Sahrens 55fa9e4066Sahrens /* 5666e2aaccSgw * Properties are identified by these constants and must be added to the 573d7072f8Seschrock * end of this list to ensure that external consumers are not affected 5866e2aaccSgw * by the change. The property list also determines how 'zfs get' will 5966e2aaccSgw * display them. If you make any changes to this list, be sure to update 6066e2aaccSgw * the property table in usr/src/common/zfs/zfs_prop.c. 61fa9e4066Sahrens */ 62fa9e4066Sahrens typedef enum { 6366e2aaccSgw ZFS_PROP_CONT = -2, 64fa9e4066Sahrens ZFS_PROP_INVAL = -1, 65fa9e4066Sahrens ZFS_PROP_TYPE, 66fa9e4066Sahrens ZFS_PROP_CREATION, 67fa9e4066Sahrens ZFS_PROP_USED, 68fa9e4066Sahrens ZFS_PROP_AVAILABLE, 69fa9e4066Sahrens ZFS_PROP_REFERENCED, 70fa9e4066Sahrens ZFS_PROP_COMPRESSRATIO, 71fa9e4066Sahrens ZFS_PROP_MOUNTED, 72fa9e4066Sahrens ZFS_PROP_ORIGIN, 73fa9e4066Sahrens ZFS_PROP_QUOTA, 74fa9e4066Sahrens ZFS_PROP_RESERVATION, 75fa9e4066Sahrens ZFS_PROP_VOLSIZE, 76fa9e4066Sahrens ZFS_PROP_VOLBLOCKSIZE, 77fa9e4066Sahrens ZFS_PROP_RECORDSIZE, 78fa9e4066Sahrens ZFS_PROP_MOUNTPOINT, 79fa9e4066Sahrens ZFS_PROP_SHARENFS, 80fa9e4066Sahrens ZFS_PROP_CHECKSUM, 81fa9e4066Sahrens ZFS_PROP_COMPRESSION, 82fa9e4066Sahrens ZFS_PROP_ATIME, 83fa9e4066Sahrens ZFS_PROP_DEVICES, 84fa9e4066Sahrens ZFS_PROP_EXEC, 85fa9e4066Sahrens ZFS_PROP_SETUID, 86fa9e4066Sahrens ZFS_PROP_READONLY, 87fa9e4066Sahrens ZFS_PROP_ZONED, 88fa9e4066Sahrens ZFS_PROP_SNAPDIR, 89fa9e4066Sahrens ZFS_PROP_ACLMODE, 90fa9e4066Sahrens ZFS_PROP_ACLINHERIT, 9166e2aaccSgw ZFS_PROP_CREATETXG, /* not exposed to the user */ 9266e2aaccSgw ZFS_PROP_NAME, /* not exposed to the user */ 93e9dbad6fSeschrock ZFS_PROP_CANMOUNT, 9466e2aaccSgw ZFS_PROP_SHAREISCSI, 9566e2aaccSgw ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */ 967b55fa8eSck ZFS_PROP_XATTR, 97d0ad202dSahrens ZFS_PROP_NUMCLONES, /* not exposed to the user */ 98b1b8ab34Slling ZFS_PROP_COPIES, 993d7072f8Seschrock ZPOOL_PROP_BOOTFS, 1003d7072f8Seschrock ZPOOL_PROP_AUTOREPLACE, 1013d7072f8Seschrock ZPOOL_PROP_NAME 102fa9e4066Sahrens } zfs_prop_t; 103fa9e4066Sahrens 104b1b8ab34Slling typedef zfs_prop_t zpool_prop_t; 105b1b8ab34Slling 1063d7072f8Seschrock #define ZPOOL_PROP_CONT ZFS_PROP_CONT 1073d7072f8Seschrock #define ZPOOL_PROP_INVAL ZFS_PROP_INVAL 1083d7072f8Seschrock 1097f7322feSeschrock #define ZFS_PROP_VALUE "value" 1107f7322feSeschrock #define ZFS_PROP_SOURCE "source" 1117f7322feSeschrock 112b1b8ab34Slling typedef enum { 113b1b8ab34Slling ZFS_SRC_NONE = 0x1, 114b1b8ab34Slling ZFS_SRC_DEFAULT = 0x2, 115b1b8ab34Slling ZFS_SRC_TEMPORARY = 0x4, 116b1b8ab34Slling ZFS_SRC_LOCAL = 0x8, 117b1b8ab34Slling ZFS_SRC_INHERITED = 0x10 118b1b8ab34Slling } zfs_source_t; 119b1b8ab34Slling 120b1b8ab34Slling #define ZFS_SRC_ALL 0x1f 121b1b8ab34Slling 122fa9e4066Sahrens /* 123fa9e4066Sahrens * The following functions are shared between libzfs and the kernel. 124fa9e4066Sahrens */ 125fa9e4066Sahrens zfs_prop_t zfs_name_to_prop(const char *); 126b1b8ab34Slling zpool_prop_t zpool_name_to_prop(const char *); 127e9dbad6fSeschrock boolean_t zfs_prop_user(const char *); 128fa9e4066Sahrens int zfs_prop_readonly(zfs_prop_t); 1297f7322feSeschrock const char *zfs_prop_default_string(zfs_prop_t); 130e9dbad6fSeschrock const char *zfs_prop_to_name(zfs_prop_t); 1313d7072f8Seschrock const char *zpool_prop_to_name(zpool_prop_t); 132fa9e4066Sahrens uint64_t zfs_prop_default_numeric(zfs_prop_t); 133e9dbad6fSeschrock int zfs_prop_inheritable(zfs_prop_t); 134acd76fe5Seschrock int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *); 135acd76fe5Seschrock int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **); 1363d7072f8Seschrock uint64_t zpool_prop_default_numeric(zpool_prop_t); 13799653d4eSeschrock 13866e2aaccSgw /* 13966e2aaccSgw * Property Iterator 14066e2aaccSgw */ 14166e2aaccSgw typedef zfs_prop_t (*zfs_prop_f)(zfs_prop_t, void *); 1423d7072f8Seschrock typedef zpool_prop_t (*zpool_prop_f)(zpool_prop_t, void *); 14366e2aaccSgw extern zfs_prop_t zfs_prop_iter(zfs_prop_f, void *, boolean_t); 144b1b8ab34Slling extern zpool_prop_t zpool_prop_iter(zpool_prop_f, void *, boolean_t); 14566e2aaccSgw 146eaca9bbdSeschrock /* 14799653d4eSeschrock * On-disk version number. 148eaca9bbdSeschrock */ 14944cd46caSbillm #define ZFS_VERSION_1 1ULL 15044cd46caSbillm #define ZFS_VERSION_2 2ULL 15199653d4eSeschrock #define ZFS_VERSION_3 3ULL 152d7306b64Sek #define ZFS_VERSION_4 4ULL 153c9431fa1Sahl #define ZFS_VERSION_5 5ULL 154b1b8ab34Slling #define ZFS_VERSION_6 6ULL 155*8654d025Sperrin #define ZFS_VERSION_7 7ULL 156b1b8ab34Slling /* 157b1b8ab34Slling * When bumping up ZFS_VERSION, make sure GRUB ZFS understand the on-disk 158b1b8ab34Slling * format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*}, 159b1b8ab34Slling * and do the appropriate changes. 160b1b8ab34Slling */ 161*8654d025Sperrin #define ZFS_VERSION ZFS_VERSION_7 162*8654d025Sperrin #define ZFS_VERSION_STRING "7" 16344cd46caSbillm 16444cd46caSbillm /* 16544cd46caSbillm * Symbolic names for the changes that caused a ZFS_VERSION switch. 16644cd46caSbillm * Used in the code when checking for presence or absence of a feature. 16744cd46caSbillm * Feel free to define multiple symbolic names for each version if there 16844cd46caSbillm * were multiple changes to on-disk structures during that version. 16944cd46caSbillm * 17044cd46caSbillm * NOTE: When checking the current ZFS_VERSION in your code, be sure 17144cd46caSbillm * to use spa_version() since it reports the version of the 17244cd46caSbillm * last synced uberblock. Checking the in-flight version can 17344cd46caSbillm * be dangerous in some cases. 17444cd46caSbillm */ 17544cd46caSbillm #define ZFS_VERSION_INITIAL ZFS_VERSION_1 17644cd46caSbillm #define ZFS_VERSION_DITTO_BLOCKS ZFS_VERSION_2 17799653d4eSeschrock #define ZFS_VERSION_SPARES ZFS_VERSION_3 17899653d4eSeschrock #define ZFS_VERSION_RAID6 ZFS_VERSION_3 17999653d4eSeschrock #define ZFS_VERSION_BPLIST_ACCOUNT ZFS_VERSION_3 18099653d4eSeschrock #define ZFS_VERSION_RAIDZ_DEFLATE ZFS_VERSION_3 18199653d4eSeschrock #define ZFS_VERSION_DNODE_BYTES ZFS_VERSION_3 182d7306b64Sek #define ZFS_VERSION_ZPOOL_HISTORY ZFS_VERSION_4 183c9431fa1Sahl #define ZFS_VERSION_GZIP_COMPRESSION ZFS_VERSION_5 184b1b8ab34Slling #define ZFS_VERSION_BOOTFS ZFS_VERSION_6 185*8654d025Sperrin #define ZFS_VERSION_SLOGS ZFS_VERSION_7 186eaca9bbdSeschrock 187fa9e4066Sahrens /* 188fa9e4066Sahrens * The following are configuration names used in the nvlist describing a pool's 189fa9e4066Sahrens * configuration. 190fa9e4066Sahrens */ 191fa9e4066Sahrens #define ZPOOL_CONFIG_VERSION "version" 192fa9e4066Sahrens #define ZPOOL_CONFIG_POOL_NAME "name" 193fa9e4066Sahrens #define ZPOOL_CONFIG_POOL_STATE "state" 194fa9e4066Sahrens #define ZPOOL_CONFIG_POOL_TXG "txg" 195fa9e4066Sahrens #define ZPOOL_CONFIG_POOL_GUID "pool_guid" 196fa9e4066Sahrens #define ZPOOL_CONFIG_CREATE_TXG "create_txg" 197fa9e4066Sahrens #define ZPOOL_CONFIG_TOP_GUID "top_guid" 198fa9e4066Sahrens #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree" 199fa9e4066Sahrens #define ZPOOL_CONFIG_TYPE "type" 200fa9e4066Sahrens #define ZPOOL_CONFIG_CHILDREN "children" 201fa9e4066Sahrens #define ZPOOL_CONFIG_ID "id" 202fa9e4066Sahrens #define ZPOOL_CONFIG_GUID "guid" 203fa9e4066Sahrens #define ZPOOL_CONFIG_PATH "path" 204fa9e4066Sahrens #define ZPOOL_CONFIG_DEVID "devid" 205fa9e4066Sahrens #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array" 206fa9e4066Sahrens #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift" 207fa9e4066Sahrens #define ZPOOL_CONFIG_ASHIFT "ashift" 208fa9e4066Sahrens #define ZPOOL_CONFIG_ASIZE "asize" 209fa9e4066Sahrens #define ZPOOL_CONFIG_DTL "DTL" 210fa9e4066Sahrens #define ZPOOL_CONFIG_STATS "stats" 211afefbcddSeschrock #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk" 212ea8dc4b6Seschrock #define ZPOOL_CONFIG_ERRCOUNT "error_count" 213ea8dc4b6Seschrock #define ZPOOL_CONFIG_NOT_PRESENT "not_present" 21499653d4eSeschrock #define ZPOOL_CONFIG_SPARES "spares" 21599653d4eSeschrock #define ZPOOL_CONFIG_IS_SPARE "is_spare" 21699653d4eSeschrock #define ZPOOL_CONFIG_NPARITY "nparity" 21795173954Sek #define ZPOOL_CONFIG_HOSTID "hostid" 21895173954Sek #define ZPOOL_CONFIG_HOSTNAME "hostname" 21995173954Sek #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ 2203d7072f8Seschrock #define ZPOOL_CONFIG_UNSPARE "unspare" 2213d7072f8Seschrock #define ZPOOL_CONFIG_PHYS_PATH "phys_path" 222*8654d025Sperrin #define ZPOOL_CONFIG_IS_LOG "is_log" 2233d7072f8Seschrock /* 2243d7072f8Seschrock * The persistent vdev state is stored as separate values rather than a single 2253d7072f8Seschrock * 'vdev_state' entry. This is because a device can be in multiple states, such 2263d7072f8Seschrock * as offline and degraded. 2273d7072f8Seschrock */ 2283d7072f8Seschrock #define ZPOOL_CONFIG_OFFLINE "offline" 2293d7072f8Seschrock #define ZPOOL_CONFIG_FAULTED "faulted" 2303d7072f8Seschrock #define ZPOOL_CONFIG_DEGRADED "degraded" 2313d7072f8Seschrock #define ZPOOL_CONFIG_REMOVED "removed" 232fa9e4066Sahrens 233fa9e4066Sahrens #define VDEV_TYPE_ROOT "root" 234fa9e4066Sahrens #define VDEV_TYPE_MIRROR "mirror" 235fa9e4066Sahrens #define VDEV_TYPE_REPLACING "replacing" 236fa9e4066Sahrens #define VDEV_TYPE_RAIDZ "raidz" 237fa9e4066Sahrens #define VDEV_TYPE_DISK "disk" 238fa9e4066Sahrens #define VDEV_TYPE_FILE "file" 239fa9e4066Sahrens #define VDEV_TYPE_MISSING "missing" 24099653d4eSeschrock #define VDEV_TYPE_SPARE "spare" 241*8654d025Sperrin #define VDEV_TYPE_LOG "log" 242fa9e4066Sahrens 243fa9e4066Sahrens /* 244fa9e4066Sahrens * This is needed in userland to report the minimum necessary device size. 245fa9e4066Sahrens */ 246fa9e4066Sahrens #define SPA_MINDEVSIZE (64ULL << 20) 247fa9e4066Sahrens 248fa9e4066Sahrens /* 249fa9e4066Sahrens * The location of the pool configuration repository, shared between kernel and 250fa9e4066Sahrens * userland. 251fa9e4066Sahrens */ 252fa9e4066Sahrens #define ZPOOL_CACHE_DIR "/etc/zfs" 253fa9e4066Sahrens #define ZPOOL_CACHE_FILE "zpool.cache" 254fa9e4066Sahrens #define ZPOOL_CACHE_TMP ".zpool.cache" 255fa9e4066Sahrens 256fa9e4066Sahrens #define ZPOOL_CACHE ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE 257fa9e4066Sahrens 258fa9e4066Sahrens /* 259fa9e4066Sahrens * vdev states are ordered from least to most healthy. 260fa9e4066Sahrens * A vdev that's CANT_OPEN or below is considered unusable. 261fa9e4066Sahrens */ 262fa9e4066Sahrens typedef enum vdev_state { 263fa9e4066Sahrens VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */ 264fa9e4066Sahrens VDEV_STATE_CLOSED, /* Not currently open */ 265fa9e4066Sahrens VDEV_STATE_OFFLINE, /* Not allowed to open */ 2663d7072f8Seschrock VDEV_STATE_REMOVED, /* Explicitly removed from system */ 267fa9e4066Sahrens VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */ 2683d7072f8Seschrock VDEV_STATE_FAULTED, /* External request to fault device */ 269fa9e4066Sahrens VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */ 270fa9e4066Sahrens VDEV_STATE_HEALTHY /* Presumed good */ 271fa9e4066Sahrens } vdev_state_t; 272fa9e4066Sahrens 2733d7072f8Seschrock #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY 2743d7072f8Seschrock 275fa9e4066Sahrens /* 276fa9e4066Sahrens * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field 277fa9e4066Sahrens * of the vdev stats structure uses these constants to distinguish why. 278fa9e4066Sahrens */ 279fa9e4066Sahrens typedef enum vdev_aux { 280fa9e4066Sahrens VDEV_AUX_NONE, /* no error */ 281fa9e4066Sahrens VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */ 282fa9e4066Sahrens VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */ 283fa9e4066Sahrens VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */ 284fa9e4066Sahrens VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */ 285fa9e4066Sahrens VDEV_AUX_TOO_SMALL, /* vdev size is too small */ 286eaca9bbdSeschrock VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */ 287eaca9bbdSeschrock VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */ 28899653d4eSeschrock VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */ 2893d7072f8Seschrock VDEV_AUX_SPARED, /* hot spare used in another pool */ 2903d7072f8Seschrock VDEV_AUX_ERR_EXCEEDED /* too many errors */ 291fa9e4066Sahrens } vdev_aux_t; 292fa9e4066Sahrens 293fa9e4066Sahrens /* 29446a2abf2Seschrock * pool state. The following states are written to disk as part of the normal 29599653d4eSeschrock * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE. The remaining states are 29646a2abf2Seschrock * software abstractions used at various levels to communicate pool state. 297fa9e4066Sahrens */ 298fa9e4066Sahrens typedef enum pool_state { 299fa9e4066Sahrens POOL_STATE_ACTIVE = 0, /* In active use */ 300fa9e4066Sahrens POOL_STATE_EXPORTED, /* Explicitly exported */ 301fa9e4066Sahrens POOL_STATE_DESTROYED, /* Explicitly destroyed */ 30299653d4eSeschrock POOL_STATE_SPARE, /* Reserved for hot spare use */ 303fa9e4066Sahrens POOL_STATE_UNINITIALIZED, /* Internal spa_t state */ 30446a2abf2Seschrock POOL_STATE_UNAVAIL, /* Internal libzfs state */ 30546a2abf2Seschrock POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */ 306fa9e4066Sahrens } pool_state_t; 307fa9e4066Sahrens 308fa9e4066Sahrens /* 309fa9e4066Sahrens * Scrub types. 310fa9e4066Sahrens */ 311fa9e4066Sahrens typedef enum pool_scrub_type { 312fa9e4066Sahrens POOL_SCRUB_NONE, 313fa9e4066Sahrens POOL_SCRUB_RESILVER, 314fa9e4066Sahrens POOL_SCRUB_EVERYTHING, 315fa9e4066Sahrens POOL_SCRUB_TYPES 316fa9e4066Sahrens } pool_scrub_type_t; 317fa9e4066Sahrens 318fa9e4066Sahrens /* 319fa9e4066Sahrens * ZIO types. Needed to interpret vdev statistics below. 320fa9e4066Sahrens */ 321fa9e4066Sahrens typedef enum zio_type { 322fa9e4066Sahrens ZIO_TYPE_NULL = 0, 323fa9e4066Sahrens ZIO_TYPE_READ, 324fa9e4066Sahrens ZIO_TYPE_WRITE, 325fa9e4066Sahrens ZIO_TYPE_FREE, 326fa9e4066Sahrens ZIO_TYPE_CLAIM, 327fa9e4066Sahrens ZIO_TYPE_IOCTL, 328fa9e4066Sahrens ZIO_TYPES 329fa9e4066Sahrens } zio_type_t; 330fa9e4066Sahrens 331fa9e4066Sahrens /* 332fa9e4066Sahrens * Vdev statistics. Note: all fields should be 64-bit because this 333fa9e4066Sahrens * is passed between kernel and userland as an nvlist uint64 array. 334fa9e4066Sahrens */ 335fa9e4066Sahrens typedef struct vdev_stat { 336fa9e4066Sahrens hrtime_t vs_timestamp; /* time since vdev load */ 337fa9e4066Sahrens uint64_t vs_state; /* vdev state */ 338fa9e4066Sahrens uint64_t vs_aux; /* see vdev_aux_t */ 339fa9e4066Sahrens uint64_t vs_alloc; /* space allocated */ 340fa9e4066Sahrens uint64_t vs_space; /* total capacity */ 34199653d4eSeschrock uint64_t vs_dspace; /* deflated capacity */ 3422a79c5feSlling uint64_t vs_rsize; /* replaceable dev size */ 343fa9e4066Sahrens uint64_t vs_ops[ZIO_TYPES]; /* operation count */ 344fa9e4066Sahrens uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */ 345fa9e4066Sahrens uint64_t vs_read_errors; /* read errors */ 346fa9e4066Sahrens uint64_t vs_write_errors; /* write errors */ 347fa9e4066Sahrens uint64_t vs_checksum_errors; /* checksum errors */ 348fa9e4066Sahrens uint64_t vs_self_healed; /* self-healed bytes */ 349fa9e4066Sahrens uint64_t vs_scrub_type; /* pool_scrub_type_t */ 350fa9e4066Sahrens uint64_t vs_scrub_complete; /* completed? */ 351fa9e4066Sahrens uint64_t vs_scrub_examined; /* bytes examined; top */ 352fa9e4066Sahrens uint64_t vs_scrub_repaired; /* bytes repaired; leaf */ 353fa9e4066Sahrens uint64_t vs_scrub_errors; /* errors during scrub */ 354fa9e4066Sahrens uint64_t vs_scrub_start; /* UTC scrub start time */ 355fa9e4066Sahrens uint64_t vs_scrub_end; /* UTC scrub end time */ 356fa9e4066Sahrens } vdev_stat_t; 357fa9e4066Sahrens 358fa9e4066Sahrens #define ZFS_DRIVER "zfs" 359fa9e4066Sahrens #define ZFS_DEV "/dev/zfs" 360fa9e4066Sahrens 361fa9e4066Sahrens /* 362fa9e4066Sahrens * zvol paths. Irritatingly, the devfsadm interfaces want all these 363fa9e4066Sahrens * paths without the /dev prefix, but for some things, we want the 364fa9e4066Sahrens * /dev prefix. Below are the names without /dev. 365fa9e4066Sahrens */ 366fa9e4066Sahrens #define ZVOL_DEV_DIR "zvol/dsk" 367fa9e4066Sahrens #define ZVOL_RDEV_DIR "zvol/rdsk" 368fa9e4066Sahrens 369fa9e4066Sahrens /* 370fa9e4066Sahrens * And here are the things we need with /dev, etc. in front of them. 371fa9e4066Sahrens */ 372fa9e4066Sahrens #define ZVOL_PSEUDO_DEV "/devices/pseudo/zvol@0:" 373fa9e4066Sahrens #define ZVOL_FULL_DEV_DIR "/dev/" ZVOL_DEV_DIR 374fa9e4066Sahrens 375fa9e4066Sahrens #define ZVOL_PROP_NAME "name" 376fa9e4066Sahrens 377fa9e4066Sahrens /* 378fa9e4066Sahrens * /dev/zfs ioctl numbers. 379fa9e4066Sahrens */ 380fa9e4066Sahrens #define ZFS_IOC ('Z' << 8) 381fa9e4066Sahrens 382fa9e4066Sahrens typedef enum zfs_ioc { 383fa9e4066Sahrens ZFS_IOC_POOL_CREATE = ZFS_IOC, 384fa9e4066Sahrens ZFS_IOC_POOL_DESTROY, 385fa9e4066Sahrens ZFS_IOC_POOL_IMPORT, 386fa9e4066Sahrens ZFS_IOC_POOL_EXPORT, 387fa9e4066Sahrens ZFS_IOC_POOL_CONFIGS, 388fa9e4066Sahrens ZFS_IOC_POOL_STATS, 389fa9e4066Sahrens ZFS_IOC_POOL_TRYIMPORT, 390fa9e4066Sahrens ZFS_IOC_POOL_SCRUB, 391fa9e4066Sahrens ZFS_IOC_POOL_FREEZE, 392eaca9bbdSeschrock ZFS_IOC_POOL_UPGRADE, 39306eeb2adSek ZFS_IOC_POOL_GET_HISTORY, 39406eeb2adSek ZFS_IOC_POOL_LOG_HISTORY, 395fa9e4066Sahrens ZFS_IOC_VDEV_ADD, 396fa9e4066Sahrens ZFS_IOC_VDEV_REMOVE, 3973d7072f8Seschrock ZFS_IOC_VDEV_SET_STATE, 398fa9e4066Sahrens ZFS_IOC_VDEV_ATTACH, 399fa9e4066Sahrens ZFS_IOC_VDEV_DETACH, 400c67d9675Seschrock ZFS_IOC_VDEV_SETPATH, 401fa9e4066Sahrens ZFS_IOC_OBJSET_STATS, 402fa9e4066Sahrens ZFS_IOC_DATASET_LIST_NEXT, 403fa9e4066Sahrens ZFS_IOC_SNAPSHOT_LIST_NEXT, 404fa9e4066Sahrens ZFS_IOC_SET_PROP, 405fa9e4066Sahrens ZFS_IOC_CREATE_MINOR, 406fa9e4066Sahrens ZFS_IOC_REMOVE_MINOR, 407fa9e4066Sahrens ZFS_IOC_CREATE, 408fa9e4066Sahrens ZFS_IOC_DESTROY, 409fa9e4066Sahrens ZFS_IOC_ROLLBACK, 410fa9e4066Sahrens ZFS_IOC_RENAME, 411fa9e4066Sahrens ZFS_IOC_RECVBACKUP, 412ea8dc4b6Seschrock ZFS_IOC_SENDBACKUP, 413ea8dc4b6Seschrock ZFS_IOC_INJECT_FAULT, 414ea8dc4b6Seschrock ZFS_IOC_CLEAR_FAULT, 415ea8dc4b6Seschrock ZFS_IOC_INJECT_LIST_NEXT, 416ea8dc4b6Seschrock ZFS_IOC_ERROR_LOG, 417ea8dc4b6Seschrock ZFS_IOC_CLEAR, 4181d452cf5Sahrens ZFS_IOC_PROMOTE, 4191d452cf5Sahrens ZFS_IOC_DESTROY_SNAPS, 42055434c77Sek ZFS_IOC_SNAPSHOT, 42155434c77Sek ZFS_IOC_DSOBJ_TO_DSNAME, 422b1b8ab34Slling ZFS_IOC_OBJ_TO_PATH, 423b1b8ab34Slling ZFS_IOC_POOL_SET_PROPS, 424b1b8ab34Slling ZFS_IOC_POOL_GET_PROPS 425fa9e4066Sahrens } zfs_ioc_t; 426fa9e4066Sahrens 427ea8dc4b6Seschrock /* 428ea8dc4b6Seschrock * Internal SPA load state. Used by FMA diagnosis engine. 429ea8dc4b6Seschrock */ 430ea8dc4b6Seschrock typedef enum { 431ea8dc4b6Seschrock SPA_LOAD_NONE, /* no load in progress */ 432ea8dc4b6Seschrock SPA_LOAD_OPEN, /* normal open */ 433ea8dc4b6Seschrock SPA_LOAD_IMPORT, /* import in progress */ 434ea8dc4b6Seschrock SPA_LOAD_TRYIMPORT /* tryimport in progress */ 435ea8dc4b6Seschrock } spa_load_state_t; 436ea8dc4b6Seschrock 437e9dbad6fSeschrock /* 438e9dbad6fSeschrock * Bookmark name values. 439e9dbad6fSeschrock */ 44055434c77Sek #define ZPOOL_ERR_LIST "error list" 441e9dbad6fSeschrock #define ZPOOL_ERR_DATASET "dataset" 442e9dbad6fSeschrock #define ZPOOL_ERR_OBJECT "object" 443e9dbad6fSeschrock 44406eeb2adSek #define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1) 44506eeb2adSek 44606eeb2adSek /* 44706eeb2adSek * The following are names used in the nvlist describing 44806eeb2adSek * the pool's history log. 44906eeb2adSek */ 45006eeb2adSek #define ZPOOL_HIST_RECORD "history record" 45106eeb2adSek #define ZPOOL_HIST_TIME "history time" 45206eeb2adSek #define ZPOOL_HIST_CMD "history command" 45306eeb2adSek 4543d7072f8Seschrock /* 4553d7072f8Seschrock * Flags for ZFS_IOC_VDEV_SET_STATE 4563d7072f8Seschrock */ 4573d7072f8Seschrock #define ZFS_ONLINE_CHECKREMOVE 0x1 4583d7072f8Seschrock #define ZFS_ONLINE_UNSPARE 0x2 4593d7072f8Seschrock #define ZFS_ONLINE_FORCEFAULT 0x4 4603d7072f8Seschrock #define ZFS_OFFLINE_TEMPORARY 0x1 4613d7072f8Seschrock 4623d7072f8Seschrock /* 4633d7072f8Seschrock * Sysevent payload members. ZFS will generate the following sysevents with the 4643d7072f8Seschrock * given payloads: 4653d7072f8Seschrock * 4663d7072f8Seschrock * ESC_ZFS_RESILVER_START 4673d7072f8Seschrock * ESC_ZFS_RESILVER_END 4683d7072f8Seschrock * ESC_ZFS_POOL_DESTROY 4693d7072f8Seschrock * 4703d7072f8Seschrock * ZFS_EV_POOL_NAME DATA_TYPE_STRING 4713d7072f8Seschrock * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 4723d7072f8Seschrock * 4733d7072f8Seschrock * ESC_ZFS_VDEV_REMOVE 4743d7072f8Seschrock * ESC_ZFS_VDEV_CLEAR 4753d7072f8Seschrock * ESC_ZFS_VDEV_CHECK 4763d7072f8Seschrock * 4773d7072f8Seschrock * ZFS_EV_POOL_NAME DATA_TYPE_STRING 4783d7072f8Seschrock * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 4793d7072f8Seschrock * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) 4803d7072f8Seschrock * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 4813d7072f8Seschrock */ 4823d7072f8Seschrock #define ZFS_EV_POOL_NAME "pool_name" 4833d7072f8Seschrock #define ZFS_EV_POOL_GUID "pool_guid" 4843d7072f8Seschrock #define ZFS_EV_VDEV_PATH "vdev_path" 4853d7072f8Seschrock #define ZFS_EV_VDEV_GUID "vdev_guid" 4863d7072f8Seschrock 487fa9e4066Sahrens #ifdef __cplusplus 488fa9e4066Sahrens } 489fa9e4066Sahrens #endif 490fa9e4066Sahrens 491fa9e4066Sahrens #endif /* _SYS_FS_ZFS_H */ 492