zfs.h revision 331395
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/* 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) 2013, Joyent, Inc. All rights reserved. 27 * Copyright (c) 2012, Martin Matuska <mm@FreeBSD.org>. All rights reserved. 28 * Copyright (c) 2014 Integros [integros.com] 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/types.h> 38#include <sys/ioccom.h> 39#include <sys/time.h> 40 41#ifdef __cplusplus 42extern "C" { 43#endif 44 45/* 46 * Types and constants shared between userland and the kernel. 47 */ 48 49/* 50 * Each dataset can be one of the following types. These constants can be 51 * combined into masks that can be passed to various functions. 52 */ 53typedef enum { 54 ZFS_TYPE_FILESYSTEM = (1 << 0), 55 ZFS_TYPE_SNAPSHOT = (1 << 1), 56 ZFS_TYPE_VOLUME = (1 << 2), 57 ZFS_TYPE_POOL = (1 << 3), 58 ZFS_TYPE_BOOKMARK = (1 << 4) 59} zfs_type_t; 60 61/* 62 * NB: lzc_dataset_type should be updated whenever a new objset type is added, 63 * if it represents a real type of a dataset that can be created from userland. 64 */ 65typedef enum dmu_objset_type { 66 DMU_OST_NONE, 67 DMU_OST_META, 68 DMU_OST_ZFS, 69 DMU_OST_ZVOL, 70 DMU_OST_OTHER, /* For testing only! */ 71 DMU_OST_ANY, /* Be careful! */ 72 DMU_OST_NUMTYPES 73} dmu_objset_type_t; 74 75#define ZFS_TYPE_DATASET \ 76 (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT) 77 78/* 79 * All of these include the terminating NUL byte. 80 */ 81#define ZAP_MAXNAMELEN 256 82#define ZAP_MAXVALUELEN (1024 * 8) 83#define ZAP_OLDMAXVALUELEN 1024 84#define ZFS_MAX_DATASET_NAME_LEN 256 85 86/* 87 * Dataset properties are identified by these constants and must be added to 88 * the end of this list to ensure that external consumers are not affected 89 * by the change. If you make any changes to this list, be sure to update 90 * the property table in usr/src/common/zfs/zfs_prop.c. 91 */ 92typedef enum { 93 ZPROP_CONT = -2, 94 ZPROP_INVAL = -1, 95 ZFS_PROP_TYPE = 0, 96 ZFS_PROP_CREATION, 97 ZFS_PROP_USED, 98 ZFS_PROP_AVAILABLE, 99 ZFS_PROP_REFERENCED, 100 ZFS_PROP_COMPRESSRATIO, 101 ZFS_PROP_MOUNTED, 102 ZFS_PROP_ORIGIN, 103 ZFS_PROP_QUOTA, 104 ZFS_PROP_RESERVATION, 105 ZFS_PROP_VOLSIZE, 106 ZFS_PROP_VOLBLOCKSIZE, 107 ZFS_PROP_RECORDSIZE, 108 ZFS_PROP_MOUNTPOINT, 109 ZFS_PROP_SHARENFS, 110 ZFS_PROP_CHECKSUM, 111 ZFS_PROP_COMPRESSION, 112 ZFS_PROP_ATIME, 113 ZFS_PROP_DEVICES, 114 ZFS_PROP_EXEC, 115 ZFS_PROP_SETUID, 116 ZFS_PROP_READONLY, 117 ZFS_PROP_ZONED, 118 ZFS_PROP_SNAPDIR, 119 ZFS_PROP_ACLMODE, 120 ZFS_PROP_ACLINHERIT, 121 ZFS_PROP_CREATETXG, /* not exposed to the user */ 122 ZFS_PROP_NAME, /* not exposed to the user */ 123 ZFS_PROP_CANMOUNT, 124 ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */ 125 ZFS_PROP_XATTR, 126 ZFS_PROP_NUMCLONES, /* not exposed to the user */ 127 ZFS_PROP_COPIES, 128 ZFS_PROP_VERSION, 129 ZFS_PROP_UTF8ONLY, 130 ZFS_PROP_NORMALIZE, 131 ZFS_PROP_CASE, 132 ZFS_PROP_VSCAN, 133 ZFS_PROP_NBMAND, 134 ZFS_PROP_SHARESMB, 135 ZFS_PROP_REFQUOTA, 136 ZFS_PROP_REFRESERVATION, 137 ZFS_PROP_GUID, 138 ZFS_PROP_PRIMARYCACHE, 139 ZFS_PROP_SECONDARYCACHE, 140 ZFS_PROP_USEDSNAP, 141 ZFS_PROP_USEDDS, 142 ZFS_PROP_USEDCHILD, 143 ZFS_PROP_USEDREFRESERV, 144 ZFS_PROP_USERACCOUNTING, /* not exposed to the user */ 145 ZFS_PROP_STMF_SHAREINFO, /* not exposed to the user */ 146 ZFS_PROP_DEFER_DESTROY, 147 ZFS_PROP_USERREFS, 148 ZFS_PROP_LOGBIAS, 149 ZFS_PROP_UNIQUE, /* not exposed to the user */ 150 ZFS_PROP_OBJSETID, /* not exposed to the user */ 151 ZFS_PROP_DEDUP, 152 ZFS_PROP_MLSLABEL, 153 ZFS_PROP_SYNC, 154 ZFS_PROP_REFRATIO, 155 ZFS_PROP_WRITTEN, 156 ZFS_PROP_CLONES, 157 ZFS_PROP_LOGICALUSED, 158 ZFS_PROP_LOGICALREFERENCED, 159 ZFS_PROP_INCONSISTENT, /* not exposed to the user */ 160 ZFS_PROP_VOLMODE, 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_RECEIVE_RESUME_TOKEN, 168 ZFS_NUM_PROPS 169} zfs_prop_t; 170 171typedef enum { 172 ZFS_PROP_USERUSED, 173 ZFS_PROP_USERQUOTA, 174 ZFS_PROP_GROUPUSED, 175 ZFS_PROP_GROUPQUOTA, 176 ZFS_NUM_USERQUOTA_PROPS 177} zfs_userquota_prop_t; 178 179extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS]; 180 181/* 182 * Pool properties are identified by these constants and must be added to the 183 * end of this list to ensure that external consumers are not affected 184 * by the change. If you make any changes to this list, be sure to update 185 * the property table in usr/src/common/zfs/zpool_prop.c. 186 */ 187typedef enum { 188 ZPOOL_PROP_INVAL = -1, 189 ZPOOL_PROP_NAME, 190 ZPOOL_PROP_SIZE, 191 ZPOOL_PROP_CAPACITY, 192 ZPOOL_PROP_ALTROOT, 193 ZPOOL_PROP_HEALTH, 194 ZPOOL_PROP_GUID, 195 ZPOOL_PROP_VERSION, 196 ZPOOL_PROP_BOOTFS, 197 ZPOOL_PROP_DELEGATION, 198 ZPOOL_PROP_AUTOREPLACE, 199 ZPOOL_PROP_CACHEFILE, 200 ZPOOL_PROP_FAILUREMODE, 201 ZPOOL_PROP_LISTSNAPS, 202 ZPOOL_PROP_AUTOEXPAND, 203 ZPOOL_PROP_DEDUPDITTO, 204 ZPOOL_PROP_DEDUPRATIO, 205 ZPOOL_PROP_FREE, 206 ZPOOL_PROP_ALLOCATED, 207 ZPOOL_PROP_READONLY, 208 ZPOOL_PROP_COMMENT, 209 ZPOOL_PROP_EXPANDSZ, 210 ZPOOL_PROP_FREEING, 211 ZPOOL_PROP_FRAGMENTATION, 212 ZPOOL_PROP_LEAKED, 213 ZPOOL_PROP_MAXBLOCKSIZE, 214 ZPOOL_PROP_BOOTSIZE, 215 ZPOOL_NUM_PROPS 216} zpool_prop_t; 217 218/* Small enough to not hog a whole line of printout in zpool(1M). */ 219#define ZPROP_MAX_COMMENT 32 220 221#define ZPROP_VALUE "value" 222#define ZPROP_SOURCE "source" 223 224typedef enum { 225 ZPROP_SRC_NONE = 0x1, 226 ZPROP_SRC_DEFAULT = 0x2, 227 ZPROP_SRC_TEMPORARY = 0x4, 228 ZPROP_SRC_LOCAL = 0x8, 229 ZPROP_SRC_INHERITED = 0x10, 230 ZPROP_SRC_RECEIVED = 0x20 231} zprop_source_t; 232 233#define ZPROP_SRC_ALL 0x3f 234 235#define ZPROP_SOURCE_VAL_RECVD "$recvd" 236#define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS" 237/* 238 * Dataset flag implemented as a special entry in the props zap object 239 * indicating that the dataset has received properties on or after 240 * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties 241 * just as it did in earlier versions, and thereafter, local properties are 242 * preserved. 243 */ 244#define ZPROP_HAS_RECVD "$hasrecvd" 245 246typedef enum { 247 ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */ 248 ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */ 249} zprop_errflags_t; 250 251typedef int (*zprop_func)(int, void *); 252 253/* 254 * Properties to be set on the root file system of a new pool 255 * are stuffed into their own nvlist, which is then included in 256 * the properties nvlist with the pool properties. 257 */ 258#define ZPOOL_ROOTFS_PROPS "root-props-nvl" 259 260/* 261 * Length of 'written@' and 'written#' 262 */ 263#define ZFS_WRITTEN_PROP_PREFIX_LEN 8 264 265/* 266 * Dataset property functions shared between libzfs and kernel. 267 */ 268const char *zfs_prop_default_string(zfs_prop_t); 269uint64_t zfs_prop_default_numeric(zfs_prop_t); 270boolean_t zfs_prop_readonly(zfs_prop_t); 271boolean_t zfs_prop_visible(zfs_prop_t prop); 272boolean_t zfs_prop_inheritable(zfs_prop_t); 273boolean_t zfs_prop_setonce(zfs_prop_t); 274const char *zfs_prop_to_name(zfs_prop_t); 275zfs_prop_t zfs_name_to_prop(const char *); 276boolean_t zfs_prop_user(const char *); 277boolean_t zfs_prop_userquota(const char *); 278int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **); 279int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *); 280uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed); 281boolean_t zfs_prop_valid_for_type(int, zfs_type_t); 282 283/* 284 * Pool property functions shared between libzfs and kernel. 285 */ 286zpool_prop_t zpool_name_to_prop(const char *); 287const char *zpool_prop_to_name(zpool_prop_t); 288const char *zpool_prop_default_string(zpool_prop_t); 289uint64_t zpool_prop_default_numeric(zpool_prop_t); 290boolean_t zpool_prop_readonly(zpool_prop_t); 291boolean_t zpool_prop_feature(const char *); 292boolean_t zpool_prop_unsupported(const char *name); 293int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **); 294int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *); 295uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed); 296 297/* 298 * Definitions for the Delegation. 299 */ 300typedef enum { 301 ZFS_DELEG_WHO_UNKNOWN = 0, 302 ZFS_DELEG_USER = 'u', 303 ZFS_DELEG_USER_SETS = 'U', 304 ZFS_DELEG_GROUP = 'g', 305 ZFS_DELEG_GROUP_SETS = 'G', 306 ZFS_DELEG_EVERYONE = 'e', 307 ZFS_DELEG_EVERYONE_SETS = 'E', 308 ZFS_DELEG_CREATE = 'c', 309 ZFS_DELEG_CREATE_SETS = 'C', 310 ZFS_DELEG_NAMED_SET = 's', 311 ZFS_DELEG_NAMED_SET_SETS = 'S' 312} zfs_deleg_who_type_t; 313 314typedef enum { 315 ZFS_DELEG_NONE = 0, 316 ZFS_DELEG_PERM_LOCAL = 1, 317 ZFS_DELEG_PERM_DESCENDENT = 2, 318 ZFS_DELEG_PERM_LOCALDESCENDENT = 3, 319 ZFS_DELEG_PERM_CREATE = 4 320} zfs_deleg_inherit_t; 321 322#define ZFS_DELEG_PERM_UID "uid" 323#define ZFS_DELEG_PERM_GID "gid" 324#define ZFS_DELEG_PERM_GROUPS "groups" 325 326#define ZFS_MLSLABEL_DEFAULT "none" 327 328#define ZFS_SMB_ACL_SRC "src" 329#define ZFS_SMB_ACL_TARGET "target" 330 331typedef enum { 332 ZFS_CANMOUNT_OFF = 0, 333 ZFS_CANMOUNT_ON = 1, 334 ZFS_CANMOUNT_NOAUTO = 2 335} zfs_canmount_type_t; 336 337typedef enum { 338 ZFS_LOGBIAS_LATENCY = 0, 339 ZFS_LOGBIAS_THROUGHPUT = 1 340} zfs_logbias_op_t; 341 342typedef enum zfs_share_op { 343 ZFS_SHARE_NFS = 0, 344 ZFS_UNSHARE_NFS = 1, 345 ZFS_SHARE_SMB = 2, 346 ZFS_UNSHARE_SMB = 3 347} zfs_share_op_t; 348 349typedef enum zfs_smb_acl_op { 350 ZFS_SMB_ACL_ADD, 351 ZFS_SMB_ACL_REMOVE, 352 ZFS_SMB_ACL_RENAME, 353 ZFS_SMB_ACL_PURGE 354} zfs_smb_acl_op_t; 355 356typedef enum zfs_cache_type { 357 ZFS_CACHE_NONE = 0, 358 ZFS_CACHE_METADATA = 1, 359 ZFS_CACHE_ALL = 2 360} zfs_cache_type_t; 361 362typedef enum { 363 ZFS_SYNC_STANDARD = 0, 364 ZFS_SYNC_ALWAYS = 1, 365 ZFS_SYNC_DISABLED = 2 366} zfs_sync_type_t; 367 368typedef enum { 369 ZFS_VOLMODE_DEFAULT = 0, 370 ZFS_VOLMODE_GEOM = 1, 371 ZFS_VOLMODE_DEV = 2, 372 ZFS_VOLMODE_NONE = 3 373} zfs_volmode_t; 374 375typedef enum { 376 ZFS_REDUNDANT_METADATA_ALL, 377 ZFS_REDUNDANT_METADATA_MOST 378} zfs_redundant_metadata_type_t; 379 380/* 381 * On-disk version number. 382 */ 383#define SPA_VERSION_1 1ULL 384#define SPA_VERSION_2 2ULL 385#define SPA_VERSION_3 3ULL 386#define SPA_VERSION_4 4ULL 387#define SPA_VERSION_5 5ULL 388#define SPA_VERSION_6 6ULL 389#define SPA_VERSION_7 7ULL 390#define SPA_VERSION_8 8ULL 391#define SPA_VERSION_9 9ULL 392#define SPA_VERSION_10 10ULL 393#define SPA_VERSION_11 11ULL 394#define SPA_VERSION_12 12ULL 395#define SPA_VERSION_13 13ULL 396#define SPA_VERSION_14 14ULL 397#define SPA_VERSION_15 15ULL 398#define SPA_VERSION_16 16ULL 399#define SPA_VERSION_17 17ULL 400#define SPA_VERSION_18 18ULL 401#define SPA_VERSION_19 19ULL 402#define SPA_VERSION_20 20ULL 403#define SPA_VERSION_21 21ULL 404#define SPA_VERSION_22 22ULL 405#define SPA_VERSION_23 23ULL 406#define SPA_VERSION_24 24ULL 407#define SPA_VERSION_25 25ULL 408#define SPA_VERSION_26 26ULL 409#define SPA_VERSION_27 27ULL 410#define SPA_VERSION_28 28ULL 411#define SPA_VERSION_5000 5000ULL 412 413/* 414 * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk 415 * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*}, 416 * and do the appropriate changes. Also bump the version number in 417 * usr/src/grub/capability. 418 */ 419#define SPA_VERSION SPA_VERSION_5000 420#define SPA_VERSION_STRING "5000" 421 422/* 423 * Symbolic names for the changes that caused a SPA_VERSION switch. 424 * Used in the code when checking for presence or absence of a feature. 425 * Feel free to define multiple symbolic names for each version if there 426 * were multiple changes to on-disk structures during that version. 427 * 428 * NOTE: When checking the current SPA_VERSION in your code, be sure 429 * to use spa_version() since it reports the version of the 430 * last synced uberblock. Checking the in-flight version can 431 * be dangerous in some cases. 432 */ 433#define SPA_VERSION_INITIAL SPA_VERSION_1 434#define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2 435#define SPA_VERSION_SPARES SPA_VERSION_3 436#define SPA_VERSION_RAIDZ2 SPA_VERSION_3 437#define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3 438#define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3 439#define SPA_VERSION_DNODE_BYTES SPA_VERSION_3 440#define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4 441#define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5 442#define SPA_VERSION_BOOTFS SPA_VERSION_6 443#define SPA_VERSION_SLOGS SPA_VERSION_7 444#define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8 445#define SPA_VERSION_FUID SPA_VERSION_9 446#define SPA_VERSION_REFRESERVATION SPA_VERSION_9 447#define SPA_VERSION_REFQUOTA SPA_VERSION_9 448#define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9 449#define SPA_VERSION_L2CACHE SPA_VERSION_10 450#define SPA_VERSION_NEXT_CLONES SPA_VERSION_11 451#define SPA_VERSION_ORIGIN SPA_VERSION_11 452#define SPA_VERSION_DSL_SCRUB SPA_VERSION_11 453#define SPA_VERSION_SNAP_PROPS SPA_VERSION_12 454#define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13 455#define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14 456#define SPA_VERSION_USERSPACE SPA_VERSION_15 457#define SPA_VERSION_STMF_PROP SPA_VERSION_16 458#define SPA_VERSION_RAIDZ3 SPA_VERSION_17 459#define SPA_VERSION_USERREFS SPA_VERSION_18 460#define SPA_VERSION_HOLES SPA_VERSION_19 461#define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20 462#define SPA_VERSION_DEDUP SPA_VERSION_21 463#define SPA_VERSION_RECVD_PROPS SPA_VERSION_22 464#define SPA_VERSION_SLIM_ZIL SPA_VERSION_23 465#define SPA_VERSION_SA SPA_VERSION_24 466#define SPA_VERSION_SCAN SPA_VERSION_25 467#define SPA_VERSION_DIR_CLONES SPA_VERSION_26 468#define SPA_VERSION_DEADLISTS SPA_VERSION_26 469#define SPA_VERSION_FAST_SNAP SPA_VERSION_27 470#define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28 471#define SPA_VERSION_BEFORE_FEATURES SPA_VERSION_28 472#define SPA_VERSION_FEATURES SPA_VERSION_5000 473 474#define SPA_VERSION_IS_SUPPORTED(v) \ 475 (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \ 476 ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION)) 477 478/* 479 * ZPL version - rev'd whenever an incompatible on-disk format change 480 * occurs. This is independent of SPA/DMU/ZAP versioning. You must 481 * also update the version_table[] and help message in zfs_prop.c. 482 * 483 * When changing, be sure to teach GRUB how to read the new format! 484 * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*} 485 */ 486#define ZPL_VERSION_1 1ULL 487#define ZPL_VERSION_2 2ULL 488#define ZPL_VERSION_3 3ULL 489#define ZPL_VERSION_4 4ULL 490#define ZPL_VERSION_5 5ULL 491#define ZPL_VERSION ZPL_VERSION_5 492#define ZPL_VERSION_STRING "5" 493 494#define ZPL_VERSION_INITIAL ZPL_VERSION_1 495#define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2 496#define ZPL_VERSION_FUID ZPL_VERSION_3 497#define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3 498#define ZPL_VERSION_SYSATTR ZPL_VERSION_3 499#define ZPL_VERSION_USERSPACE ZPL_VERSION_4 500#define ZPL_VERSION_SA ZPL_VERSION_5 501 502/* Rewind request information */ 503#define ZPOOL_NO_REWIND 1 /* No policy - default behavior */ 504#define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */ 505#define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */ 506#define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */ 507#define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */ 508#define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */ 509#define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */ 510 511typedef struct zpool_rewind_policy { 512 uint32_t zrp_request; /* rewind behavior requested */ 513 uint64_t zrp_maxmeta; /* max acceptable meta-data errors */ 514 uint64_t zrp_maxdata; /* max acceptable data errors */ 515 uint64_t zrp_txg; /* specific txg to load */ 516} zpool_rewind_policy_t; 517 518/* 519 * The following are configuration names used in the nvlist describing a pool's 520 * configuration. 521 */ 522#define ZPOOL_CONFIG_VERSION "version" 523#define ZPOOL_CONFIG_POOL_NAME "name" 524#define ZPOOL_CONFIG_POOL_STATE "state" 525#define ZPOOL_CONFIG_POOL_TXG "txg" 526#define ZPOOL_CONFIG_POOL_GUID "pool_guid" 527#define ZPOOL_CONFIG_CREATE_TXG "create_txg" 528#define ZPOOL_CONFIG_TOP_GUID "top_guid" 529#define ZPOOL_CONFIG_VDEV_TREE "vdev_tree" 530#define ZPOOL_CONFIG_TYPE "type" 531#define ZPOOL_CONFIG_CHILDREN "children" 532#define ZPOOL_CONFIG_ID "id" 533#define ZPOOL_CONFIG_GUID "guid" 534#define ZPOOL_CONFIG_PATH "path" 535#define ZPOOL_CONFIG_DEVID "devid" 536#define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array" 537#define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift" 538#define ZPOOL_CONFIG_ASHIFT "ashift" 539#define ZPOOL_CONFIG_ASIZE "asize" 540#define ZPOOL_CONFIG_DTL "DTL" 541#define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */ 542#define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */ 543#define ZPOOL_CONFIG_WHOLE_DISK "whole_disk" 544#define ZPOOL_CONFIG_ERRCOUNT "error_count" 545#define ZPOOL_CONFIG_NOT_PRESENT "not_present" 546#define ZPOOL_CONFIG_SPARES "spares" 547#define ZPOOL_CONFIG_IS_SPARE "is_spare" 548#define ZPOOL_CONFIG_NPARITY "nparity" 549#define ZPOOL_CONFIG_HOSTID "hostid" 550#define ZPOOL_CONFIG_HOSTNAME "hostname" 551#define ZPOOL_CONFIG_LOADED_TIME "initial_load_time" 552#define ZPOOL_CONFIG_UNSPARE "unspare" 553#define ZPOOL_CONFIG_PHYS_PATH "phys_path" 554#define ZPOOL_CONFIG_IS_LOG "is_log" 555#define ZPOOL_CONFIG_L2CACHE "l2cache" 556#define ZPOOL_CONFIG_HOLE_ARRAY "hole_array" 557#define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children" 558#define ZPOOL_CONFIG_IS_HOLE "is_hole" 559#define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram" 560#define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats" 561#define ZPOOL_CONFIG_DDT_STATS "ddt_stats" 562#define ZPOOL_CONFIG_SPLIT "splitcfg" 563#define ZPOOL_CONFIG_ORIG_GUID "orig_guid" 564#define ZPOOL_CONFIG_SPLIT_GUID "split_guid" 565#define ZPOOL_CONFIG_SPLIT_LIST "guid_list" 566#define ZPOOL_CONFIG_REMOVING "removing" 567#define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg" 568#define ZPOOL_CONFIG_COMMENT "comment" 569#define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */ 570#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ 571#define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */ 572#define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */ 573#define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */ 574#define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */ 575#define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */ 576#define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */ 577#define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */ 578#define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read" 579#define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */ 580#define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top" 581#define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf" 582#define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps" 583/* 584 * The persistent vdev state is stored as separate values rather than a single 585 * 'vdev_state' entry. This is because a device can be in multiple states, such 586 * as offline and degraded. 587 */ 588#define ZPOOL_CONFIG_OFFLINE "offline" 589#define ZPOOL_CONFIG_FAULTED "faulted" 590#define ZPOOL_CONFIG_DEGRADED "degraded" 591#define ZPOOL_CONFIG_REMOVED "removed" 592#define ZPOOL_CONFIG_FRU "fru" 593#define ZPOOL_CONFIG_AUX_STATE "aux_state" 594 595/* Rewind policy parameters */ 596#define ZPOOL_REWIND_POLICY "rewind-policy" 597#define ZPOOL_REWIND_REQUEST "rewind-request" 598#define ZPOOL_REWIND_REQUEST_TXG "rewind-request-txg" 599#define ZPOOL_REWIND_META_THRESH "rewind-meta-thresh" 600#define ZPOOL_REWIND_DATA_THRESH "rewind-data-thresh" 601 602/* Rewind data discovered */ 603#define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts" 604#define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors" 605#define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind" 606 607#define VDEV_TYPE_ROOT "root" 608#define VDEV_TYPE_MIRROR "mirror" 609#define VDEV_TYPE_REPLACING "replacing" 610#define VDEV_TYPE_RAIDZ "raidz" 611#define VDEV_TYPE_DISK "disk" 612#define VDEV_TYPE_FILE "file" 613#define VDEV_TYPE_MISSING "missing" 614#define VDEV_TYPE_HOLE "hole" 615#define VDEV_TYPE_SPARE "spare" 616#define VDEV_TYPE_LOG "log" 617#define VDEV_TYPE_L2CACHE "l2cache" 618 619/* 620 * This is needed in userland to report the minimum necessary device size. 621 * 622 * Note that the zfs test suite uses 64MB vdevs. 623 */ 624#define SPA_MINDEVSIZE (64ULL << 20) 625 626/* 627 * Set if the fragmentation has not yet been calculated. This can happen 628 * because the space maps have not been upgraded or the histogram feature 629 * is not enabled. 630 */ 631#define ZFS_FRAG_INVALID UINT64_MAX 632 633/* 634 * The location of the pool configuration repository, shared between kernel and 635 * userland. 636 */ 637#define ZPOOL_CACHE "/boot/zfs/zpool.cache" 638 639/* 640 * vdev states are ordered from least to most healthy. 641 * A vdev that's CANT_OPEN or below is considered unusable. 642 */ 643typedef enum vdev_state { 644 VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */ 645 VDEV_STATE_CLOSED, /* Not currently open */ 646 VDEV_STATE_OFFLINE, /* Not allowed to open */ 647 VDEV_STATE_REMOVED, /* Explicitly removed from system */ 648 VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */ 649 VDEV_STATE_FAULTED, /* External request to fault device */ 650 VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */ 651 VDEV_STATE_HEALTHY /* Presumed good */ 652} vdev_state_t; 653 654#define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY 655 656/* 657 * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field 658 * of the vdev stats structure uses these constants to distinguish why. 659 */ 660typedef enum vdev_aux { 661 VDEV_AUX_NONE, /* no error */ 662 VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */ 663 VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */ 664 VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */ 665 VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */ 666 VDEV_AUX_TOO_SMALL, /* vdev size is too small */ 667 VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */ 668 VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */ 669 VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */ 670 VDEV_AUX_UNSUP_FEAT, /* unsupported features */ 671 VDEV_AUX_SPARED, /* hot spare used in another pool */ 672 VDEV_AUX_ERR_EXCEEDED, /* too many errors */ 673 VDEV_AUX_IO_FAILURE, /* experienced I/O failure */ 674 VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */ 675 VDEV_AUX_EXTERNAL, /* external diagnosis */ 676 VDEV_AUX_SPLIT_POOL, /* vdev was split off into another pool */ 677 VDEV_AUX_ASHIFT_TOO_BIG /* vdev's min block size is too large */ 678} vdev_aux_t; 679 680/* 681 * pool state. The following states are written to disk as part of the normal 682 * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining 683 * states are software abstractions used at various levels to communicate 684 * pool state. 685 */ 686typedef enum pool_state { 687 POOL_STATE_ACTIVE = 0, /* In active use */ 688 POOL_STATE_EXPORTED, /* Explicitly exported */ 689 POOL_STATE_DESTROYED, /* Explicitly destroyed */ 690 POOL_STATE_SPARE, /* Reserved for hot spare use */ 691 POOL_STATE_L2CACHE, /* Level 2 ARC device */ 692 POOL_STATE_UNINITIALIZED, /* Internal spa_t state */ 693 POOL_STATE_UNAVAIL, /* Internal libzfs state */ 694 POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */ 695} pool_state_t; 696 697/* 698 * Scan Functions. 699 */ 700typedef enum pool_scan_func { 701 POOL_SCAN_NONE, 702 POOL_SCAN_SCRUB, 703 POOL_SCAN_RESILVER, 704 POOL_SCAN_FUNCS 705} pool_scan_func_t; 706 707/* 708 * Used to control scrub pause and resume. 709 */ 710typedef enum pool_scrub_cmd { 711 POOL_SCRUB_NORMAL = 0, 712 POOL_SCRUB_PAUSE, 713 POOL_SCRUB_FLAGS_END 714} pool_scrub_cmd_t; 715 716 717/* 718 * ZIO types. Needed to interpret vdev statistics below. 719 */ 720typedef enum zio_type { 721 ZIO_TYPE_NULL = 0, 722 ZIO_TYPE_READ, 723 ZIO_TYPE_WRITE, 724 ZIO_TYPE_FREE, 725 ZIO_TYPE_CLAIM, 726 ZIO_TYPE_IOCTL, 727 ZIO_TYPES 728} zio_type_t; 729 730/* 731 * Pool statistics. Note: all fields should be 64-bit because this 732 * is passed between kernel and userland as an nvlist uint64 array. 733 */ 734typedef struct pool_scan_stat { 735 /* values stored on disk */ 736 uint64_t pss_func; /* pool_scan_func_t */ 737 uint64_t pss_state; /* dsl_scan_state_t */ 738 uint64_t pss_start_time; /* scan start time */ 739 uint64_t pss_end_time; /* scan end time */ 740 uint64_t pss_to_examine; /* total bytes to scan */ 741 uint64_t pss_examined; /* total examined bytes */ 742 uint64_t pss_to_process; /* total bytes to process */ 743 uint64_t pss_processed; /* total processed bytes */ 744 uint64_t pss_errors; /* scan errors */ 745 746 /* values not stored on disk */ 747 uint64_t pss_pass_exam; /* examined bytes per scan pass */ 748 uint64_t pss_pass_start; /* start time of a scan pass */ 749 uint64_t pss_pass_scrub_pause; /* pause time of a scurb pass */ 750 /* cumulative time scrub spent paused, needed for rate calculation */ 751 uint64_t pss_pass_scrub_spent_paused; 752} pool_scan_stat_t; 753 754typedef enum dsl_scan_state { 755 DSS_NONE, 756 DSS_SCANNING, 757 DSS_FINISHED, 758 DSS_CANCELED, 759 DSS_NUM_STATES 760} dsl_scan_state_t; 761 762 763/* 764 * Vdev statistics. Note: all fields should be 64-bit because this 765 * is passed between kernel and userland as an nvlist uint64 array. 766 */ 767typedef struct vdev_stat { 768 hrtime_t vs_timestamp; /* time since vdev load */ 769 uint64_t vs_state; /* vdev state */ 770 uint64_t vs_aux; /* see vdev_aux_t */ 771 uint64_t vs_alloc; /* space allocated */ 772 uint64_t vs_space; /* total capacity */ 773 uint64_t vs_dspace; /* deflated capacity */ 774 uint64_t vs_rsize; /* replaceable dev size */ 775 uint64_t vs_esize; /* expandable dev size */ 776 uint64_t vs_ops[ZIO_TYPES]; /* operation count */ 777 uint64_t vs_bytes[ZIO_TYPES]; /* bytes read/written */ 778 uint64_t vs_read_errors; /* read errors */ 779 uint64_t vs_write_errors; /* write errors */ 780 uint64_t vs_checksum_errors; /* checksum errors */ 781 uint64_t vs_self_healed; /* self-healed bytes */ 782 uint64_t vs_scan_removing; /* removing? */ 783 uint64_t vs_scan_processed; /* scan processed bytes */ 784 uint64_t vs_configured_ashift; /* TLV vdev_ashift */ 785 uint64_t vs_logical_ashift; /* vdev_logical_ashift */ 786 uint64_t vs_physical_ashift; /* vdev_physical_ashift */ 787 uint64_t vs_fragmentation; /* device fragmentation */ 788} vdev_stat_t; 789#define VDEV_STAT_VALID(field, uint64_t_field_count) \ 790 ((uint64_t_field_count * sizeof(uint64_t)) >= \ 791 (offsetof(vdev_stat_t, field) + sizeof(((vdev_stat_t *)NULL)->field))) 792 793/* 794 * DDT statistics. Note: all fields should be 64-bit because this 795 * is passed between kernel and userland as an nvlist uint64 array. 796 */ 797typedef struct ddt_object { 798 uint64_t ddo_count; /* number of elments in ddt */ 799 uint64_t ddo_dspace; /* size of ddt on disk */ 800 uint64_t ddo_mspace; /* size of ddt in-core */ 801} ddt_object_t; 802 803typedef struct ddt_stat { 804 uint64_t dds_blocks; /* blocks */ 805 uint64_t dds_lsize; /* logical size */ 806 uint64_t dds_psize; /* physical size */ 807 uint64_t dds_dsize; /* deflated allocated size */ 808 uint64_t dds_ref_blocks; /* referenced blocks */ 809 uint64_t dds_ref_lsize; /* referenced lsize * refcnt */ 810 uint64_t dds_ref_psize; /* referenced psize * refcnt */ 811 uint64_t dds_ref_dsize; /* referenced dsize * refcnt */ 812} ddt_stat_t; 813 814typedef struct ddt_histogram { 815 ddt_stat_t ddh_stat[64]; /* power-of-two histogram buckets */ 816} ddt_histogram_t; 817 818#define ZVOL_DRIVER "zvol" 819#define ZFS_DRIVER "zfs" 820#define ZFS_DEV_NAME "zfs" 821#define ZFS_DEV "/dev/" ZFS_DEV_NAME 822#define ZFS_DISK_ROOT "/dev/dsk" 823#define ZFS_DISK_ROOTD ZFS_DISK_ROOT "/" 824#define ZFS_RDISK_ROOT "/dev/rdsk" 825#define ZFS_RDISK_ROOTD ZFS_RDISK_ROOT "/" 826 827/* general zvol path */ 828#define ZVOL_DIR "/dev/zvol" 829/* expansion */ 830#define ZVOL_PSEUDO_DEV "/devices/pseudo/zfs@0:" 831/* for dump and swap */ 832#define ZVOL_FULL_DEV_DIR ZVOL_DIR "/dsk/" 833#define ZVOL_FULL_RDEV_DIR ZVOL_DIR "/rdsk/" 834 835#define ZVOL_PROP_NAME "name" 836#define ZVOL_DEFAULT_BLOCKSIZE 8192 837 838/* 839 * /dev/zfs ioctl numbers. 840 */ 841typedef enum zfs_ioc { 842 ZFS_IOC_FIRST = 0, 843 ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST, 844 ZFS_IOC_POOL_DESTROY, 845 ZFS_IOC_POOL_IMPORT, 846 ZFS_IOC_POOL_EXPORT, 847 ZFS_IOC_POOL_CONFIGS, 848 ZFS_IOC_POOL_STATS, 849 ZFS_IOC_POOL_TRYIMPORT, 850 ZFS_IOC_POOL_SCAN, 851 ZFS_IOC_POOL_FREEZE, 852 ZFS_IOC_POOL_UPGRADE, 853 ZFS_IOC_POOL_GET_HISTORY, 854 ZFS_IOC_VDEV_ADD, 855 ZFS_IOC_VDEV_REMOVE, 856 ZFS_IOC_VDEV_SET_STATE, 857 ZFS_IOC_VDEV_ATTACH, 858 ZFS_IOC_VDEV_DETACH, 859 ZFS_IOC_VDEV_SETPATH, 860 ZFS_IOC_VDEV_SETFRU, 861 ZFS_IOC_OBJSET_STATS, 862 ZFS_IOC_OBJSET_ZPLPROPS, 863 ZFS_IOC_DATASET_LIST_NEXT, 864 ZFS_IOC_SNAPSHOT_LIST_NEXT, 865 ZFS_IOC_SET_PROP, 866 ZFS_IOC_CREATE, 867 ZFS_IOC_DESTROY, 868 ZFS_IOC_ROLLBACK, 869 ZFS_IOC_RENAME, 870 ZFS_IOC_RECV, 871 ZFS_IOC_SEND, 872 ZFS_IOC_INJECT_FAULT, 873 ZFS_IOC_CLEAR_FAULT, 874 ZFS_IOC_INJECT_LIST_NEXT, 875 ZFS_IOC_ERROR_LOG, 876 ZFS_IOC_CLEAR, 877 ZFS_IOC_PROMOTE, 878 ZFS_IOC_DESTROY_SNAPS, 879 ZFS_IOC_SNAPSHOT, 880 ZFS_IOC_DSOBJ_TO_DSNAME, 881 ZFS_IOC_OBJ_TO_PATH, 882 ZFS_IOC_POOL_SET_PROPS, 883 ZFS_IOC_POOL_GET_PROPS, 884 ZFS_IOC_SET_FSACL, 885 ZFS_IOC_GET_FSACL, 886 ZFS_IOC_SHARE, 887 ZFS_IOC_INHERIT_PROP, 888 ZFS_IOC_SMB_ACL, 889 ZFS_IOC_USERSPACE_ONE, 890 ZFS_IOC_USERSPACE_MANY, 891 ZFS_IOC_USERSPACE_UPGRADE, 892 ZFS_IOC_HOLD, 893 ZFS_IOC_RELEASE, 894 ZFS_IOC_GET_HOLDS, 895 ZFS_IOC_OBJSET_RECVD_PROPS, 896 ZFS_IOC_VDEV_SPLIT, 897 ZFS_IOC_NEXT_OBJ, 898 ZFS_IOC_DIFF, 899 ZFS_IOC_TMP_SNAPSHOT, 900 ZFS_IOC_OBJ_TO_STATS, 901 ZFS_IOC_JAIL, 902 ZFS_IOC_UNJAIL, 903 ZFS_IOC_POOL_REGUID, 904 ZFS_IOC_SPACE_WRITTEN, 905 ZFS_IOC_SPACE_SNAPS, 906 ZFS_IOC_SEND_PROGRESS, 907 ZFS_IOC_POOL_REOPEN, 908 ZFS_IOC_LOG_HISTORY, 909 ZFS_IOC_SEND_NEW, 910 ZFS_IOC_SEND_SPACE, 911 ZFS_IOC_CLONE, 912 ZFS_IOC_BOOKMARK, 913 ZFS_IOC_GET_BOOKMARKS, 914 ZFS_IOC_DESTROY_BOOKMARKS, 915#ifdef __FreeBSD__ 916 ZFS_IOC_NEXTBOOT, 917#endif 918 ZFS_IOC_CHANNEL_PROGRAM, 919 ZFS_IOC_LAST 920} zfs_ioc_t; 921 922/* 923 * Internal SPA load state. Used by FMA diagnosis engine. 924 */ 925typedef enum { 926 SPA_LOAD_NONE, /* no load in progress */ 927 SPA_LOAD_OPEN, /* normal open */ 928 SPA_LOAD_IMPORT, /* import in progress */ 929 SPA_LOAD_TRYIMPORT, /* tryimport in progress */ 930 SPA_LOAD_RECOVER, /* recovery requested */ 931 SPA_LOAD_ERROR, /* load failed */ 932 SPA_LOAD_CREATE /* creation in progress */ 933} spa_load_state_t; 934 935/* 936 * Bookmark name values. 937 */ 938#define ZPOOL_ERR_LIST "error list" 939#define ZPOOL_ERR_DATASET "dataset" 940#define ZPOOL_ERR_OBJECT "object" 941 942#define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1) 943 944/* 945 * The following are names used in the nvlist describing 946 * the pool's history log. 947 */ 948#define ZPOOL_HIST_RECORD "history record" 949#define ZPOOL_HIST_TIME "history time" 950#define ZPOOL_HIST_CMD "history command" 951#define ZPOOL_HIST_WHO "history who" 952#define ZPOOL_HIST_ZONE "history zone" 953#define ZPOOL_HIST_HOST "history hostname" 954#define ZPOOL_HIST_TXG "history txg" 955#define ZPOOL_HIST_INT_EVENT "history internal event" 956#define ZPOOL_HIST_INT_STR "history internal str" 957#define ZPOOL_HIST_INT_NAME "internal_name" 958#define ZPOOL_HIST_IOCTL "ioctl" 959#define ZPOOL_HIST_INPUT_NVL "in_nvl" 960#define ZPOOL_HIST_OUTPUT_NVL "out_nvl" 961#define ZPOOL_HIST_DSNAME "dsname" 962#define ZPOOL_HIST_DSID "dsid" 963#define ZPOOL_HIST_ERRNO "errno" 964 965/* 966 * Flags for ZFS_IOC_VDEV_SET_STATE 967 */ 968#define ZFS_ONLINE_CHECKREMOVE 0x1 969#define ZFS_ONLINE_UNSPARE 0x2 970#define ZFS_ONLINE_FORCEFAULT 0x4 971#define ZFS_ONLINE_EXPAND 0x8 972#define ZFS_OFFLINE_TEMPORARY 0x1 973 974/* 975 * Flags for ZFS_IOC_POOL_IMPORT 976 */ 977#define ZFS_IMPORT_NORMAL 0x0 978#define ZFS_IMPORT_VERBATIM 0x1 979#define ZFS_IMPORT_ANY_HOST 0x2 980#define ZFS_IMPORT_MISSING_LOG 0x4 981#define ZFS_IMPORT_ONLY 0x8 982 983/* 984 * Channel program argument/return nvlist keys and defaults. 985 */ 986#define ZCP_ARG_PROGRAM "program" 987#define ZCP_ARG_ARGLIST "arg" 988#define ZCP_ARG_SYNC "sync" 989#define ZCP_ARG_INSTRLIMIT "instrlimit" 990#define ZCP_ARG_MEMLIMIT "memlimit" 991 992#define ZCP_ARG_CLIARGV "argv" 993 994#define ZCP_RET_ERROR "error" 995#define ZCP_RET_RETURN "return" 996 997#define ZCP_DEFAULT_INSTRLIMIT (10 * 1000 * 1000) 998#define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) 999#define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) 1000#define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) 1001 1002/* 1003 * Sysevent payload members. ZFS will generate the following sysevents with the 1004 * given payloads: 1005 * 1006 * ESC_ZFS_RESILVER_START 1007 * ESC_ZFS_RESILVER_END 1008 * ESC_ZFS_POOL_DESTROY 1009 * ESC_ZFS_POOL_REGUID 1010 * 1011 * ZFS_EV_POOL_NAME DATA_TYPE_STRING 1012 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 1013 * 1014 * ESC_ZFS_VDEV_REMOVE 1015 * ESC_ZFS_VDEV_CLEAR 1016 * ESC_ZFS_VDEV_CHECK 1017 * 1018 * ZFS_EV_POOL_NAME DATA_TYPE_STRING 1019 * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 1020 * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) 1021 * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 1022 */ 1023#define ZFS_EV_POOL_NAME "pool_name" 1024#define ZFS_EV_POOL_GUID "pool_guid" 1025#define ZFS_EV_VDEV_PATH "vdev_path" 1026#define ZFS_EV_VDEV_GUID "vdev_guid" 1027 1028#ifdef __cplusplus 1029} 1030#endif 1031 1032#endif /* _SYS_FS_ZFS_H */ 1033