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 */ 21f94275ceSAdam Leventhal 22fa9e4066Sahrens /* 2327dd1e87SMark Shellenbaum * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 24dfc11533SChris Williamson * Copyright (c) 2011, 2016 by Delphix. All rights reserved. 25e9103aaeSGarrett D'Amore * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 26c3d26abcSMatthew Ahrens * Copyright (c) 2014 Integros [integros.com] 27ce1577b0SDave Eddy * Copyright 2017 Joyent, Inc. 281702cce7SAlek Pinchuk * Copyright (c) 2017 Datto Inc. 29663207adSDon Brady * Copyright (c) 2017, Intel Corporation. 30fa9e4066Sahrens */ 31fa9e4066Sahrens 3255da60b9SMark J Musante /* Portions Copyright 2010 Robert Milkowski */ 3355da60b9SMark J Musante 34fa9e4066Sahrens #ifndef _SYS_FS_ZFS_H 35fa9e4066Sahrens #define _SYS_FS_ZFS_H 36fa9e4066Sahrens 37842727c2SChris Kirby #include <sys/time.h> 38842727c2SChris Kirby 39fa9e4066Sahrens #ifdef __cplusplus 40fa9e4066Sahrens extern "C" { 41fa9e4066Sahrens #endif 42fa9e4066Sahrens 43fa9e4066Sahrens /* 44fa9e4066Sahrens * Types and constants shared between userland and the kernel. 45fa9e4066Sahrens */ 46fa9e4066Sahrens 47fa9e4066Sahrens /* 48fa9e4066Sahrens * Each dataset can be one of the following types. These constants can be 49fa9e4066Sahrens * combined into masks that can be passed to various functions. 50fa9e4066Sahrens */ 51fa9e4066Sahrens typedef enum { 5278f17100SMatthew Ahrens ZFS_TYPE_FILESYSTEM = (1 << 0), 5378f17100SMatthew Ahrens ZFS_TYPE_SNAPSHOT = (1 << 1), 5478f17100SMatthew Ahrens ZFS_TYPE_VOLUME = (1 << 2), 5578f17100SMatthew Ahrens ZFS_TYPE_POOL = (1 << 3), 5678f17100SMatthew Ahrens ZFS_TYPE_BOOKMARK = (1 << 4) 57fa9e4066Sahrens } zfs_type_t; 58fa9e4066Sahrens 5926455f9eSAndriy Gapon /* 6026455f9eSAndriy Gapon * NB: lzc_dataset_type should be updated whenever a new objset type is added, 6126455f9eSAndriy Gapon * if it represents a real type of a dataset that can be created from userland. 6226455f9eSAndriy Gapon */ 634445fffbSMatthew Ahrens typedef enum dmu_objset_type { 644445fffbSMatthew Ahrens DMU_OST_NONE, 654445fffbSMatthew Ahrens DMU_OST_META, 664445fffbSMatthew Ahrens DMU_OST_ZFS, 674445fffbSMatthew Ahrens DMU_OST_ZVOL, 684445fffbSMatthew Ahrens DMU_OST_OTHER, /* For testing only! */ 694445fffbSMatthew Ahrens DMU_OST_ANY, /* Be careful! */ 704445fffbSMatthew Ahrens DMU_OST_NUMTYPES 714445fffbSMatthew Ahrens } dmu_objset_type_t; 724445fffbSMatthew Ahrens 73990b4856Slling #define ZFS_TYPE_DATASET \ 74fa9e4066Sahrens (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT) 75fa9e4066Sahrens 769adfa60dSMatthew Ahrens /* 779adfa60dSMatthew Ahrens * All of these include the terminating NUL byte. 789adfa60dSMatthew Ahrens */ 79478ed9adSEric Taylor #define ZAP_MAXNAMELEN 256 80478ed9adSEric Taylor #define ZAP_MAXVALUELEN (1024 * 8) 81478ed9adSEric Taylor #define ZAP_OLDMAXVALUELEN 1024 829adfa60dSMatthew Ahrens #define ZFS_MAX_DATASET_NAME_LEN 256 83478ed9adSEric Taylor 84fa9e4066Sahrens /* 85990b4856Slling * Dataset properties are identified by these constants and must be added to 86990b4856Slling * the end of this list to ensure that external consumers are not affected 87990b4856Slling * by the change. If you make any changes to this list, be sure to update 8866e2aaccSgw * the property table in usr/src/common/zfs/zfs_prop.c. 89fa9e4066Sahrens */ 90fa9e4066Sahrens typedef enum { 914ae5f5f0SAlan Somers ZPROP_CONT = -2, 924ae5f5f0SAlan Somers ZPROP_INVAL = -1, 93c16bcc45SIgor Kozhukhov ZFS_PROP_TYPE = 0, 94fa9e4066Sahrens ZFS_PROP_CREATION, 95fa9e4066Sahrens ZFS_PROP_USED, 96fa9e4066Sahrens ZFS_PROP_AVAILABLE, 97fa9e4066Sahrens ZFS_PROP_REFERENCED, 98fa9e4066Sahrens ZFS_PROP_COMPRESSRATIO, 99fa9e4066Sahrens ZFS_PROP_MOUNTED, 100fa9e4066Sahrens ZFS_PROP_ORIGIN, 101fa9e4066Sahrens ZFS_PROP_QUOTA, 102fa9e4066Sahrens ZFS_PROP_RESERVATION, 103fa9e4066Sahrens ZFS_PROP_VOLSIZE, 104fa9e4066Sahrens ZFS_PROP_VOLBLOCKSIZE, 105fa9e4066Sahrens ZFS_PROP_RECORDSIZE, 106fa9e4066Sahrens ZFS_PROP_MOUNTPOINT, 107fa9e4066Sahrens ZFS_PROP_SHARENFS, 108fa9e4066Sahrens ZFS_PROP_CHECKSUM, 109fa9e4066Sahrens ZFS_PROP_COMPRESSION, 110fa9e4066Sahrens ZFS_PROP_ATIME, 111fa9e4066Sahrens ZFS_PROP_DEVICES, 112fa9e4066Sahrens ZFS_PROP_EXEC, 113fa9e4066Sahrens ZFS_PROP_SETUID, 114fa9e4066Sahrens ZFS_PROP_READONLY, 115fa9e4066Sahrens ZFS_PROP_ZONED, 116fa9e4066Sahrens ZFS_PROP_SNAPDIR, 117a3c49ce1SAlbert Lee ZFS_PROP_ACLMODE, 118fa9e4066Sahrens ZFS_PROP_ACLINHERIT, 119e8d4a73cSJosh Paetzel ZFS_PROP_CREATETXG, 12066e2aaccSgw ZFS_PROP_NAME, /* not exposed to the user */ 121e9dbad6fSeschrock ZFS_PROP_CANMOUNT, 12266e2aaccSgw ZFS_PROP_ISCSIOPTIONS, /* not exposed to the user */ 1237b55fa8eSck ZFS_PROP_XATTR, 124d0ad202dSahrens ZFS_PROP_NUMCLONES, /* not exposed to the user */ 125b1b8ab34Slling ZFS_PROP_COPIES, 126e7437265Sahrens ZFS_PROP_VERSION, 127da6c28aaSamw ZFS_PROP_UTF8ONLY, 128da6c28aaSamw ZFS_PROP_NORMALIZE, 129da6c28aaSamw ZFS_PROP_CASE, 130da6c28aaSamw ZFS_PROP_VSCAN, 131da6c28aaSamw ZFS_PROP_NBMAND, 132da6c28aaSamw ZFS_PROP_SHARESMB, 133a9799022Sck ZFS_PROP_REFQUOTA, 134a9799022Sck ZFS_PROP_REFRESERVATION, 135c5904d13Seschrock ZFS_PROP_GUID, 1363baa08fcSek ZFS_PROP_PRIMARYCACHE, 1373baa08fcSek ZFS_PROP_SECONDARYCACHE, 13874e7dc98SMatthew Ahrens ZFS_PROP_USEDSNAP, 13974e7dc98SMatthew Ahrens ZFS_PROP_USEDDS, 14074e7dc98SMatthew Ahrens ZFS_PROP_USEDCHILD, 14174e7dc98SMatthew Ahrens ZFS_PROP_USEDREFRESERV, 14214843421SMatthew Ahrens ZFS_PROP_USERACCOUNTING, /* not exposed to the user */ 143478ed9adSEric Taylor ZFS_PROP_STMF_SHAREINFO, /* not exposed to the user */ 144842727c2SChris Kirby ZFS_PROP_DEFER_DESTROY, 145842727c2SChris Kirby ZFS_PROP_USERREFS, 146e09fa4daSNeil Perrin ZFS_PROP_LOGBIAS, 1471d713200SEric Schrock ZFS_PROP_UNIQUE, /* not exposed to the user */ 1481d713200SEric Schrock ZFS_PROP_OBJSETID, /* not exposed to the user */ 149b24ab676SJeff Bonwick ZFS_PROP_DEDUP, 1504201a95eSRic Aleshire ZFS_PROP_MLSLABEL, 15155da60b9SMark J Musante ZFS_PROP_SYNC, 15254811da5SToomas Soome ZFS_PROP_DNODESIZE, 153187d6ac0SMatt Ahrens ZFS_PROP_REFRATIO, 15419b94df9SMatthew Ahrens ZFS_PROP_WRITTEN, 15519b94df9SMatthew Ahrens ZFS_PROP_CLONES, 15677372cb0SMatthew Ahrens ZFS_PROP_LOGICALUSED, 15777372cb0SMatthew Ahrens ZFS_PROP_LOGICALREFERENCED, 158ca48f36fSKeith M Wesolowski ZFS_PROP_INCONSISTENT, /* not exposed to the user */ 159a2afb611SJerry Jelinek ZFS_PROP_FILESYSTEM_LIMIT, 160a2afb611SJerry Jelinek ZFS_PROP_SNAPSHOT_LIMIT, 161a2afb611SJerry Jelinek ZFS_PROP_FILESYSTEM_COUNT, 162a2afb611SJerry Jelinek ZFS_PROP_SNAPSHOT_COUNT, 163edf345e6SMatthew Ahrens ZFS_PROP_REDUNDANT_METADATA, 164b461c746SMatthew Ahrens ZFS_PROP_PREV_SNAP, 1659c3fd121SMatthew Ahrens ZFS_PROP_RECEIVE_RESUME_TOKEN, 1665cabbc6bSPrashanth Sreenivasa ZFS_PROP_REMAPTXG, /* not exposed to the user */ 167663207adSDon Brady ZFS_PROP_SPECIAL_SMALL_BLOCKS, 168eb633035STom Caputi ZFS_PROP_ENCRYPTION, 169eb633035STom Caputi ZFS_PROP_KEYLOCATION, 170eb633035STom Caputi ZFS_PROP_KEYFORMAT, 171eb633035STom Caputi ZFS_PROP_PBKDF2_SALT, 172eb633035STom Caputi ZFS_PROP_PBKDF2_ITERS, 173eb633035STom Caputi ZFS_PROP_ENCRYPTION_ROOT, 174eb633035STom Caputi ZFS_PROP_KEY_GUID, 175eb633035STom Caputi ZFS_PROP_KEYSTATUS, 176eb633035STom Caputi ZFS_PROP_IVSET_GUID, /* not exposed to the user */ 17791ebeef5Sahrens ZFS_NUM_PROPS 178fa9e4066Sahrens } zfs_prop_t; 179fa9e4066Sahrens 18014843421SMatthew Ahrens typedef enum { 18114843421SMatthew Ahrens ZFS_PROP_USERUSED, 18214843421SMatthew Ahrens ZFS_PROP_USERQUOTA, 18314843421SMatthew Ahrens ZFS_PROP_GROUPUSED, 18414843421SMatthew Ahrens ZFS_PROP_GROUPQUOTA, 185f67950b2SNasf-Fan ZFS_PROP_USEROBJUSED, 186f67950b2SNasf-Fan ZFS_PROP_USEROBJQUOTA, 187f67950b2SNasf-Fan ZFS_PROP_GROUPOBJUSED, 188f67950b2SNasf-Fan ZFS_PROP_GROUPOBJQUOTA, 189f67950b2SNasf-Fan ZFS_PROP_PROJECTUSED, 190f67950b2SNasf-Fan ZFS_PROP_PROJECTQUOTA, 191f67950b2SNasf-Fan ZFS_PROP_PROJECTOBJUSED, 192f67950b2SNasf-Fan ZFS_PROP_PROJECTOBJQUOTA, 19314843421SMatthew Ahrens ZFS_NUM_USERQUOTA_PROPS 19414843421SMatthew Ahrens } zfs_userquota_prop_t; 19514843421SMatthew Ahrens 19614843421SMatthew Ahrens extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS]; 19714843421SMatthew Ahrens 198990b4856Slling /* 199990b4856Slling * Pool properties are identified by these constants and must be added to the 200b87f3af3Sperrin * end of this list to ensure that external consumers are not affected 201990b4856Slling * by the change. If you make any changes to this list, be sure to update 202990b4856Slling * the property table in usr/src/common/zfs/zpool_prop.c. 203990b4856Slling */ 204990b4856Slling typedef enum { 2054ae5f5f0SAlan Somers ZPOOL_PROP_INVAL = -1, 206990b4856Slling ZPOOL_PROP_NAME, 207990b4856Slling ZPOOL_PROP_SIZE, 208990b4856Slling ZPOOL_PROP_CAPACITY, 209990b4856Slling ZPOOL_PROP_ALTROOT, 210990b4856Slling ZPOOL_PROP_HEALTH, 211990b4856Slling ZPOOL_PROP_GUID, 212990b4856Slling ZPOOL_PROP_VERSION, 213990b4856Slling ZPOOL_PROP_BOOTFS, 214990b4856Slling ZPOOL_PROP_DELEGATION, 215990b4856Slling ZPOOL_PROP_AUTOREPLACE, 2162f8aaab3Seschrock ZPOOL_PROP_CACHEFILE, 2170a4e9518Sgw ZPOOL_PROP_FAILUREMODE, 218d5b5bb25SRich Morris ZPOOL_PROP_LISTSNAPS, 219573ca77eSGeorge Wilson ZPOOL_PROP_AUTOEXPAND, 220b24ab676SJeff Bonwick ZPOOL_PROP_DEDUPDITTO, 221b24ab676SJeff Bonwick ZPOOL_PROP_DEDUPRATIO, 222485bbbf5SGeorge Wilson ZPOOL_PROP_FREE, 223485bbbf5SGeorge Wilson ZPOOL_PROP_ALLOCATED, 224f9af39baSGeorge Wilson ZPOOL_PROP_READONLY, 2258704186eSDan McDonald ZPOOL_PROP_COMMENT, 2264263d13fSGeorge Wilson ZPOOL_PROP_EXPANDSZ, 227ad135b5dSChristopher Siden ZPOOL_PROP_FREEING, 2282e4c9986SGeorge Wilson ZPOOL_PROP_FRAGMENTATION, 2297fd05ac4SMatthew Ahrens ZPOOL_PROP_LEAKED, 230b5152584SMatthew Ahrens ZPOOL_PROP_MAXBLOCKSIZE, 2317855d95bSToomas Soome ZPOOL_PROP_BOOTSIZE, 23286714001SSerapheim Dimitropoulos ZPOOL_PROP_CHECKPOINT, 23304e56356SAndriy Gapon ZPOOL_PROP_TNAME, 23454811da5SToomas Soome ZPOOL_PROP_MAXDNODESIZE, 235e0f1c0afSOlaf Faaland ZPOOL_PROP_MULTIHOST, 2365711d393Sloli ZPOOL_PROP_ASHIFT, 237*084fd14fSBrian Behlendorf ZPOOL_PROP_AUTOTRIM, 238990b4856Slling ZPOOL_NUM_PROPS 239990b4856Slling } zpool_prop_t; 240b1b8ab34Slling 2418704186eSDan McDonald /* Small enough to not hog a whole line of printout in zpool(1M). */ 2428704186eSDan McDonald #define ZPROP_MAX_COMMENT 32 2438704186eSDan McDonald 244990b4856Slling #define ZPROP_VALUE "value" 245990b4856Slling #define ZPROP_SOURCE "source" 2467f7322feSeschrock 247b1b8ab34Slling typedef enum { 248990b4856Slling ZPROP_SRC_NONE = 0x1, 249990b4856Slling ZPROP_SRC_DEFAULT = 0x2, 250990b4856Slling ZPROP_SRC_TEMPORARY = 0x4, 251990b4856Slling ZPROP_SRC_LOCAL = 0x8, 25292241e0bSTom Erickson ZPROP_SRC_INHERITED = 0x10, 25392241e0bSTom Erickson ZPROP_SRC_RECEIVED = 0x20 254990b4856Slling } zprop_source_t; 255990b4856Slling 25692241e0bSTom Erickson #define ZPROP_SRC_ALL 0x3f 25792241e0bSTom Erickson 25892241e0bSTom Erickson #define ZPROP_SOURCE_VAL_RECVD "$recvd" 25992241e0bSTom Erickson #define ZPROP_N_MORE_ERRORS "N_MORE_ERRORS" 26092241e0bSTom Erickson /* 26192241e0bSTom Erickson * Dataset flag implemented as a special entry in the props zap object 26292241e0bSTom Erickson * indicating that the dataset has received properties on or after 26392241e0bSTom Erickson * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties 26492241e0bSTom Erickson * just as it did in earlier versions, and thereafter, local properties are 26592241e0bSTom Erickson * preserved. 26692241e0bSTom Erickson */ 26792241e0bSTom Erickson #define ZPROP_HAS_RECVD "$hasrecvd" 26892241e0bSTom Erickson 26992241e0bSTom Erickson typedef enum { 27092241e0bSTom Erickson ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */ 27192241e0bSTom Erickson ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */ 27292241e0bSTom Erickson } zprop_errflags_t; 273990b4856Slling 274990b4856Slling typedef int (*zprop_func)(int, void *); 275990b4856Slling 2760a48a24eStimh /* 2770a48a24eStimh * Properties to be set on the root file system of a new pool 2780a48a24eStimh * are stuffed into their own nvlist, which is then included in 2790a48a24eStimh * the properties nvlist with the pool properties. 2800a48a24eStimh */ 2810a48a24eStimh #define ZPOOL_ROOTFS_PROPS "root-props-nvl" 2820a48a24eStimh 283dfc11533SChris Williamson /* 284dfc11533SChris Williamson * Length of 'written@' and 'written#' 285dfc11533SChris Williamson */ 286dfc11533SChris Williamson #define ZFS_WRITTEN_PROP_PREFIX_LEN 8 287dfc11533SChris Williamson 288990b4856Slling /* 289990b4856Slling * Dataset property functions shared between libzfs and kernel. 290990b4856Slling */ 291990b4856Slling const char *zfs_prop_default_string(zfs_prop_t); 292990b4856Slling uint64_t zfs_prop_default_numeric(zfs_prop_t); 293990b4856Slling boolean_t zfs_prop_readonly(zfs_prop_t); 294dfc11533SChris Williamson boolean_t zfs_prop_visible(zfs_prop_t prop); 295990b4856Slling boolean_t zfs_prop_inheritable(zfs_prop_t); 296da6c28aaSamw boolean_t zfs_prop_setonce(zfs_prop_t); 297eb633035STom Caputi boolean_t zfs_prop_encryption_key_param(zfs_prop_t); 298eb633035STom Caputi boolean_t zfs_prop_valid_keylocation(const char *, boolean_t); 299990b4856Slling const char *zfs_prop_to_name(zfs_prop_t); 300990b4856Slling zfs_prop_t zfs_name_to_prop(const char *); 301990b4856Slling boolean_t zfs_prop_user(const char *); 30292241e0bSTom Erickson boolean_t zfs_prop_userquota(const char *); 30319b94df9SMatthew Ahrens boolean_t zfs_prop_written(const char *); 304990b4856Slling int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **); 305990b4856Slling int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *); 306b24ab676SJeff Bonwick uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed); 3074853e976Sgw boolean_t zfs_prop_valid_for_type(int, zfs_type_t); 308b1b8ab34Slling 309990b4856Slling /* 310990b4856Slling * Pool property functions shared between libzfs and kernel. 311990b4856Slling */ 312990b4856Slling zpool_prop_t zpool_name_to_prop(const char *); 313990b4856Slling const char *zpool_prop_to_name(zpool_prop_t); 314990b4856Slling const char *zpool_prop_default_string(zpool_prop_t); 315990b4856Slling uint64_t zpool_prop_default_numeric(zpool_prop_t); 316990b4856Slling boolean_t zpool_prop_readonly(zpool_prop_t); 317ad135b5dSChristopher Siden boolean_t zpool_prop_feature(const char *); 318ad135b5dSChristopher Siden boolean_t zpool_prop_unsupported(const char *name); 319990b4856Slling int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **); 320990b4856Slling int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *); 321b24ab676SJeff Bonwick uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed); 322b1b8ab34Slling 323990b4856Slling /* 324990b4856Slling * Definitions for the Delegation. 325990b4856Slling */ 326ecd6cf80Smarks typedef enum { 327ecd6cf80Smarks ZFS_DELEG_WHO_UNKNOWN = 0, 328ecd6cf80Smarks ZFS_DELEG_USER = 'u', 329ecd6cf80Smarks ZFS_DELEG_USER_SETS = 'U', 330ecd6cf80Smarks ZFS_DELEG_GROUP = 'g', 331ecd6cf80Smarks ZFS_DELEG_GROUP_SETS = 'G', 332ecd6cf80Smarks ZFS_DELEG_EVERYONE = 'e', 333ecd6cf80Smarks ZFS_DELEG_EVERYONE_SETS = 'E', 334ecd6cf80Smarks ZFS_DELEG_CREATE = 'c', 335ecd6cf80Smarks ZFS_DELEG_CREATE_SETS = 'C', 336ecd6cf80Smarks ZFS_DELEG_NAMED_SET = 's', 337ecd6cf80Smarks ZFS_DELEG_NAMED_SET_SETS = 'S' 338ecd6cf80Smarks } zfs_deleg_who_type_t; 339ecd6cf80Smarks 340ecd6cf80Smarks typedef enum { 341ecd6cf80Smarks ZFS_DELEG_NONE = 0, 342ecd6cf80Smarks ZFS_DELEG_PERM_LOCAL = 1, 343ecd6cf80Smarks ZFS_DELEG_PERM_DESCENDENT = 2, 344ecd6cf80Smarks ZFS_DELEG_PERM_LOCALDESCENDENT = 3, 345ecd6cf80Smarks ZFS_DELEG_PERM_CREATE = 4 346ecd6cf80Smarks } zfs_deleg_inherit_t; 347ecd6cf80Smarks 348ecd6cf80Smarks #define ZFS_DELEG_PERM_UID "uid" 349ecd6cf80Smarks #define ZFS_DELEG_PERM_GID "gid" 350ecd6cf80Smarks #define ZFS_DELEG_PERM_GROUPS "groups" 351ecd6cf80Smarks 3524201a95eSRic Aleshire #define ZFS_MLSLABEL_DEFAULT "none" 3534201a95eSRic Aleshire 354743a77edSAlan Wright #define ZFS_SMB_ACL_SRC "src" 355743a77edSAlan Wright #define ZFS_SMB_ACL_TARGET "target" 356743a77edSAlan Wright 357a227b7f4Shs typedef enum { 358a227b7f4Shs ZFS_CANMOUNT_OFF = 0, 359a227b7f4Shs ZFS_CANMOUNT_ON = 1, 360a227b7f4Shs ZFS_CANMOUNT_NOAUTO = 2 361a227b7f4Shs } zfs_canmount_type_t; 362a227b7f4Shs 363e09fa4daSNeil Perrin typedef enum { 364e09fa4daSNeil Perrin ZFS_LOGBIAS_LATENCY = 0, 365e09fa4daSNeil Perrin ZFS_LOGBIAS_THROUGHPUT = 1 366e09fa4daSNeil Perrin } zfs_logbias_op_t; 367e09fa4daSNeil Perrin 368da6c28aaSamw typedef enum zfs_share_op { 369da6c28aaSamw ZFS_SHARE_NFS = 0, 370da6c28aaSamw ZFS_UNSHARE_NFS = 1, 371da6c28aaSamw ZFS_SHARE_SMB = 2, 372da6c28aaSamw ZFS_UNSHARE_SMB = 3 373da6c28aaSamw } zfs_share_op_t; 374da6c28aaSamw 375743a77edSAlan Wright typedef enum zfs_smb_acl_op { 376743a77edSAlan Wright ZFS_SMB_ACL_ADD, 377743a77edSAlan Wright ZFS_SMB_ACL_REMOVE, 378743a77edSAlan Wright ZFS_SMB_ACL_RENAME, 379743a77edSAlan Wright ZFS_SMB_ACL_PURGE 380743a77edSAlan Wright } zfs_smb_acl_op_t; 381743a77edSAlan Wright 3823baa08fcSek typedef enum zfs_cache_type { 3833baa08fcSek ZFS_CACHE_NONE = 0, 3843baa08fcSek ZFS_CACHE_METADATA = 1, 3853baa08fcSek ZFS_CACHE_ALL = 2 3863baa08fcSek } zfs_cache_type_t; 3873baa08fcSek 38855da60b9SMark J Musante typedef enum { 38955da60b9SMark J Musante ZFS_SYNC_STANDARD = 0, 39055da60b9SMark J Musante ZFS_SYNC_ALWAYS = 1, 39155da60b9SMark J Musante ZFS_SYNC_DISABLED = 2 39255da60b9SMark J Musante } zfs_sync_type_t; 39355da60b9SMark J Musante 39454811da5SToomas Soome typedef enum { 39554811da5SToomas Soome ZFS_DNSIZE_LEGACY = 0, 39654811da5SToomas Soome ZFS_DNSIZE_AUTO = 1, 39754811da5SToomas Soome ZFS_DNSIZE_1K = 1024, 39854811da5SToomas Soome ZFS_DNSIZE_2K = 2048, 39954811da5SToomas Soome ZFS_DNSIZE_4K = 4096, 40054811da5SToomas Soome ZFS_DNSIZE_8K = 8192, 40154811da5SToomas Soome ZFS_DNSIZE_16K = 16384 40254811da5SToomas Soome } zfs_dnsize_type_t; 40354811da5SToomas Soome 404edf345e6SMatthew Ahrens typedef enum { 405edf345e6SMatthew Ahrens ZFS_REDUNDANT_METADATA_ALL, 406edf345e6SMatthew Ahrens ZFS_REDUNDANT_METADATA_MOST 407edf345e6SMatthew Ahrens } zfs_redundant_metadata_type_t; 4083baa08fcSek 409eb633035STom Caputi typedef enum zfs_keystatus { 410eb633035STom Caputi ZFS_KEYSTATUS_NONE = 0, 411eb633035STom Caputi ZFS_KEYSTATUS_UNAVAILABLE, 412eb633035STom Caputi ZFS_KEYSTATUS_AVAILABLE 413eb633035STom Caputi } zfs_keystatus_t; 414eb633035STom Caputi 415eb633035STom Caputi typedef enum zfs_keyformat { 416eb633035STom Caputi ZFS_KEYFORMAT_NONE = 0, 417eb633035STom Caputi ZFS_KEYFORMAT_RAW, 418eb633035STom Caputi ZFS_KEYFORMAT_HEX, 419eb633035STom Caputi ZFS_KEYFORMAT_PASSPHRASE, 420eb633035STom Caputi ZFS_KEYFORMAT_FORMATS 421eb633035STom Caputi } zfs_keyformat_t; 422eb633035STom Caputi 423eb633035STom Caputi typedef enum zfs_key_location { 424eb633035STom Caputi ZFS_KEYLOCATION_NONE = 0, 425eb633035STom Caputi ZFS_KEYLOCATION_PROMPT, 426eb633035STom Caputi ZFS_KEYLOCATION_URI, 427eb633035STom Caputi ZFS_KEYLOCATION_LOCATIONS 428eb633035STom Caputi } zfs_keylocation_t; 429eb633035STom Caputi 430eb633035STom Caputi #define DEFAULT_PBKDF2_ITERATIONS 350000 431eb633035STom Caputi #define MIN_PBKDF2_ITERATIONS 100000 432eb633035STom Caputi 433eaca9bbdSeschrock /* 43499653d4eSeschrock * On-disk version number. 435eaca9bbdSeschrock */ 436e7437265Sahrens #define SPA_VERSION_1 1ULL 437e7437265Sahrens #define SPA_VERSION_2 2ULL 438e7437265Sahrens #define SPA_VERSION_3 3ULL 439e7437265Sahrens #define SPA_VERSION_4 4ULL 440e7437265Sahrens #define SPA_VERSION_5 5ULL 441e7437265Sahrens #define SPA_VERSION_6 6ULL 442e7437265Sahrens #define SPA_VERSION_7 7ULL 443e7437265Sahrens #define SPA_VERSION_8 8ULL 444da6c28aaSamw #define SPA_VERSION_9 9ULL 445fa94a07fSbrendan #define SPA_VERSION_10 10ULL 446088f3894Sahrens #define SPA_VERSION_11 11ULL 447bb0ade09Sahrens #define SPA_VERSION_12 12ULL 44874e7dc98SMatthew Ahrens #define SPA_VERSION_13 13ULL 449d0f3f37eSMark Shellenbaum #define SPA_VERSION_14 14ULL 45014843421SMatthew Ahrens #define SPA_VERSION_15 15ULL 451478ed9adSEric Taylor #define SPA_VERSION_16 16ULL 452f94275ceSAdam Leventhal #define SPA_VERSION_17 17ULL 453842727c2SChris Kirby #define SPA_VERSION_18 18ULL 45488ecc943SGeorge Wilson #define SPA_VERSION_19 19ULL 455b24ab676SJeff Bonwick #define SPA_VERSION_20 20ULL 456b24ab676SJeff Bonwick #define SPA_VERSION_21 21ULL 45792241e0bSTom Erickson #define SPA_VERSION_22 22ULL 4586e1f5caaSNeil Perrin #define SPA_VERSION_23 23ULL 4590a586ceaSMark Shellenbaum #define SPA_VERSION_24 24ULL 4603f9d6ad7SLin Ling #define SPA_VERSION_25 25ULL 461cde58dbcSMatthew Ahrens #define SPA_VERSION_26 26ULL 4626e0cbcaaSMatthew Ahrens #define SPA_VERSION_27 27ULL 463cb04b873SMark J Musante #define SPA_VERSION_28 28ULL 464ad135b5dSChristopher Siden #define SPA_VERSION_5000 5000ULL 465cb04b873SMark J Musante 466b1b8ab34Slling /* 467e7cbe64fSgw * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk 468478ed9adSEric Taylor * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*}, 46914843421SMatthew Ahrens * and do the appropriate changes. Also bump the version number in 47014843421SMatthew Ahrens * usr/src/grub/capability. 471b1b8ab34Slling */ 472ad135b5dSChristopher Siden #define SPA_VERSION SPA_VERSION_5000 473ad135b5dSChristopher Siden #define SPA_VERSION_STRING "5000" 47444cd46caSbillm 47544cd46caSbillm /* 476e7437265Sahrens * Symbolic names for the changes that caused a SPA_VERSION switch. 47744cd46caSbillm * Used in the code when checking for presence or absence of a feature. 47844cd46caSbillm * Feel free to define multiple symbolic names for each version if there 47944cd46caSbillm * were multiple changes to on-disk structures during that version. 48044cd46caSbillm * 481e7437265Sahrens * NOTE: When checking the current SPA_VERSION in your code, be sure 48244cd46caSbillm * to use spa_version() since it reports the version of the 48344cd46caSbillm * last synced uberblock. Checking the in-flight version can 48444cd46caSbillm * be dangerous in some cases. 48544cd46caSbillm */ 486e7437265Sahrens #define SPA_VERSION_INITIAL SPA_VERSION_1 487e7437265Sahrens #define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2 488e7437265Sahrens #define SPA_VERSION_SPARES SPA_VERSION_3 489f94275ceSAdam Leventhal #define SPA_VERSION_RAIDZ2 SPA_VERSION_3 490cde58dbcSMatthew Ahrens #define SPA_VERSION_BPOBJ_ACCOUNT SPA_VERSION_3 491e7437265Sahrens #define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3 492e7437265Sahrens #define SPA_VERSION_DNODE_BYTES SPA_VERSION_3 493e7437265Sahrens #define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4 494e7437265Sahrens #define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5 495e7437265Sahrens #define SPA_VERSION_BOOTFS SPA_VERSION_6 496990b4856Slling #define SPA_VERSION_SLOGS SPA_VERSION_7 497990b4856Slling #define SPA_VERSION_DELEGATED_PERMS SPA_VERSION_8 498da6c28aaSamw #define SPA_VERSION_FUID SPA_VERSION_9 499a9799022Sck #define SPA_VERSION_REFRESERVATION SPA_VERSION_9 500a9799022Sck #define SPA_VERSION_REFQUOTA SPA_VERSION_9 501a9799022Sck #define SPA_VERSION_UNIQUE_ACCURATE SPA_VERSION_9 502fa94a07fSbrendan #define SPA_VERSION_L2CACHE SPA_VERSION_10 503088f3894Sahrens #define SPA_VERSION_NEXT_CLONES SPA_VERSION_11 504088f3894Sahrens #define SPA_VERSION_ORIGIN SPA_VERSION_11 505088f3894Sahrens #define SPA_VERSION_DSL_SCRUB SPA_VERSION_11 506bb0ade09Sahrens #define SPA_VERSION_SNAP_PROPS SPA_VERSION_12 50774e7dc98SMatthew Ahrens #define SPA_VERSION_USED_BREAKDOWN SPA_VERSION_13 508d0f3f37eSMark Shellenbaum #define SPA_VERSION_PASSTHROUGH_X SPA_VERSION_14 50914843421SMatthew Ahrens #define SPA_VERSION_USERSPACE SPA_VERSION_15 510478ed9adSEric Taylor #define SPA_VERSION_STMF_PROP SPA_VERSION_16 511f94275ceSAdam Leventhal #define SPA_VERSION_RAIDZ3 SPA_VERSION_17 512842727c2SChris Kirby #define SPA_VERSION_USERREFS SPA_VERSION_18 51388ecc943SGeorge Wilson #define SPA_VERSION_HOLES SPA_VERSION_19 514b24ab676SJeff Bonwick #define SPA_VERSION_ZLE_COMPRESSION SPA_VERSION_20 515b24ab676SJeff Bonwick #define SPA_VERSION_DEDUP SPA_VERSION_21 51692241e0bSTom Erickson #define SPA_VERSION_RECVD_PROPS SPA_VERSION_22 5176e1f5caaSNeil Perrin #define SPA_VERSION_SLIM_ZIL SPA_VERSION_23 5180a586ceaSMark Shellenbaum #define SPA_VERSION_SA SPA_VERSION_24 5193f9d6ad7SLin Ling #define SPA_VERSION_SCAN SPA_VERSION_25 520cde58dbcSMatthew Ahrens #define SPA_VERSION_DIR_CLONES SPA_VERSION_26 521cde58dbcSMatthew Ahrens #define SPA_VERSION_DEADLISTS SPA_VERSION_26 5226e0cbcaaSMatthew Ahrens #define SPA_VERSION_FAST_SNAP SPA_VERSION_27 523cb04b873SMark J Musante #define SPA_VERSION_MULTI_REPLACE SPA_VERSION_28 524ad135b5dSChristopher Siden #define SPA_VERSION_BEFORE_FEATURES SPA_VERSION_28 525ad135b5dSChristopher Siden #define SPA_VERSION_FEATURES SPA_VERSION_5000 526ad135b5dSChristopher Siden 527ad135b5dSChristopher Siden #define SPA_VERSION_IS_SUPPORTED(v) \ 528ad135b5dSChristopher Siden (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \ 529ad135b5dSChristopher Siden ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION)) 530e7437265Sahrens 531e7437265Sahrens /* 532e7437265Sahrens * ZPL version - rev'd whenever an incompatible on-disk format change 533e7437265Sahrens * occurs. This is independent of SPA/DMU/ZAP versioning. You must 534e7437265Sahrens * also update the version_table[] and help message in zfs_prop.c. 535e7437265Sahrens * 536e7437265Sahrens * When changing, be sure to teach GRUB how to read the new format! 537478ed9adSEric Taylor * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*} 538e7437265Sahrens */ 539e7437265Sahrens #define ZPL_VERSION_1 1ULL 540e7437265Sahrens #define ZPL_VERSION_2 2ULL 541da6c28aaSamw #define ZPL_VERSION_3 3ULL 54214843421SMatthew Ahrens #define ZPL_VERSION_4 4ULL 5430a586ceaSMark Shellenbaum #define ZPL_VERSION_5 5ULL 5440a586ceaSMark Shellenbaum #define ZPL_VERSION ZPL_VERSION_5 5450a586ceaSMark Shellenbaum #define ZPL_VERSION_STRING "5" 546e7437265Sahrens 547e7437265Sahrens #define ZPL_VERSION_INITIAL ZPL_VERSION_1 548e7437265Sahrens #define ZPL_VERSION_DIRENT_TYPE ZPL_VERSION_2 549da6c28aaSamw #define ZPL_VERSION_FUID ZPL_VERSION_3 550de8267e0Stimh #define ZPL_VERSION_NORMALIZATION ZPL_VERSION_3 551da6c28aaSamw #define ZPL_VERSION_SYSATTR ZPL_VERSION_3 55214843421SMatthew Ahrens #define ZPL_VERSION_USERSPACE ZPL_VERSION_4 5530a586ceaSMark Shellenbaum #define ZPL_VERSION_SA ZPL_VERSION_5 554eaca9bbdSeschrock 5555dafeea3SPavel Zakharov /* Rewind policy information */ 556c8ee1847SVictor Latushkin #define ZPOOL_NO_REWIND 1 /* No policy - default behavior */ 557c8ee1847SVictor Latushkin #define ZPOOL_NEVER_REWIND 2 /* Do not search for best txg or rewind */ 558c8ee1847SVictor Latushkin #define ZPOOL_TRY_REWIND 4 /* Search for best txg, but do not rewind */ 559c8ee1847SVictor Latushkin #define ZPOOL_DO_REWIND 8 /* Rewind to best txg w/in deferred frees */ 560c8ee1847SVictor Latushkin #define ZPOOL_EXTREME_REWIND 16 /* Allow extreme measures to find best txg */ 561c8ee1847SVictor Latushkin #define ZPOOL_REWIND_MASK 28 /* All the possible rewind bits */ 562c8ee1847SVictor Latushkin #define ZPOOL_REWIND_POLICIES 31 /* All the possible policy bits */ 563468c413aSTim Haley 5645dafeea3SPavel Zakharov typedef struct zpool_load_policy { 5655dafeea3SPavel Zakharov uint32_t zlp_rewind; /* rewind policy requested */ 5665dafeea3SPavel Zakharov uint64_t zlp_maxmeta; /* max acceptable meta-data errors */ 5675dafeea3SPavel Zakharov uint64_t zlp_maxdata; /* max acceptable data errors */ 5685dafeea3SPavel Zakharov uint64_t zlp_txg; /* specific txg to load */ 5695dafeea3SPavel Zakharov } zpool_load_policy_t; 570468c413aSTim Haley 571fa9e4066Sahrens /* 572fa9e4066Sahrens * The following are configuration names used in the nvlist describing a pool's 5735cabbc6bSPrashanth Sreenivasa * configuration. New on-disk names should be prefixed with "<reverse-DNS>:" 5745cabbc6bSPrashanth Sreenivasa * (e.g. "org.open-zfs:") to avoid conflicting names being developed 5755cabbc6bSPrashanth Sreenivasa * independently. 576fa9e4066Sahrens */ 577fa9e4066Sahrens #define ZPOOL_CONFIG_VERSION "version" 578fa9e4066Sahrens #define ZPOOL_CONFIG_POOL_NAME "name" 579fa9e4066Sahrens #define ZPOOL_CONFIG_POOL_STATE "state" 580fa9e4066Sahrens #define ZPOOL_CONFIG_POOL_TXG "txg" 581fa9e4066Sahrens #define ZPOOL_CONFIG_POOL_GUID "pool_guid" 582fa9e4066Sahrens #define ZPOOL_CONFIG_CREATE_TXG "create_txg" 583fa9e4066Sahrens #define ZPOOL_CONFIG_TOP_GUID "top_guid" 584fa9e4066Sahrens #define ZPOOL_CONFIG_VDEV_TREE "vdev_tree" 585fa9e4066Sahrens #define ZPOOL_CONFIG_TYPE "type" 586fa9e4066Sahrens #define ZPOOL_CONFIG_CHILDREN "children" 587fa9e4066Sahrens #define ZPOOL_CONFIG_ID "id" 588fa9e4066Sahrens #define ZPOOL_CONFIG_GUID "guid" 5895cabbc6bSPrashanth Sreenivasa #define ZPOOL_CONFIG_INDIRECT_OBJECT "com.delphix:indirect_object" 5905cabbc6bSPrashanth Sreenivasa #define ZPOOL_CONFIG_INDIRECT_BIRTHS "com.delphix:indirect_births" 5915cabbc6bSPrashanth Sreenivasa #define ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev" 592fa9e4066Sahrens #define ZPOOL_CONFIG_PATH "path" 593fa9e4066Sahrens #define ZPOOL_CONFIG_DEVID "devid" 594fa9e4066Sahrens #define ZPOOL_CONFIG_METASLAB_ARRAY "metaslab_array" 595fa9e4066Sahrens #define ZPOOL_CONFIG_METASLAB_SHIFT "metaslab_shift" 596fa9e4066Sahrens #define ZPOOL_CONFIG_ASHIFT "ashift" 597fa9e4066Sahrens #define ZPOOL_CONFIG_ASIZE "asize" 598fa9e4066Sahrens #define ZPOOL_CONFIG_DTL "DTL" 5993f9d6ad7SLin Ling #define ZPOOL_CONFIG_SCAN_STATS "scan_stats" /* not stored on disk */ 6005cabbc6bSPrashanth Sreenivasa #define ZPOOL_CONFIG_REMOVAL_STATS "removal_stats" /* not stored on disk */ 60186714001SSerapheim Dimitropoulos #define ZPOOL_CONFIG_CHECKPOINT_STATS "checkpoint_stats" /* not on disk */ 6023f9d6ad7SLin Ling #define ZPOOL_CONFIG_VDEV_STATS "vdev_stats" /* not stored on disk */ 6035cabbc6bSPrashanth Sreenivasa #define ZPOOL_CONFIG_INDIRECT_SIZE "indirect_size" /* not stored on disk */ 604afefbcddSeschrock #define ZPOOL_CONFIG_WHOLE_DISK "whole_disk" 605ea8dc4b6Seschrock #define ZPOOL_CONFIG_ERRCOUNT "error_count" 606ea8dc4b6Seschrock #define ZPOOL_CONFIG_NOT_PRESENT "not_present" 60799653d4eSeschrock #define ZPOOL_CONFIG_SPARES "spares" 60899653d4eSeschrock #define ZPOOL_CONFIG_IS_SPARE "is_spare" 60999653d4eSeschrock #define ZPOOL_CONFIG_NPARITY "nparity" 61095173954Sek #define ZPOOL_CONFIG_HOSTID "hostid" 61195173954Sek #define ZPOOL_CONFIG_HOSTNAME "hostname" 61211027bc7STim Haley #define ZPOOL_CONFIG_LOADED_TIME "initial_load_time" 6133d7072f8Seschrock #define ZPOOL_CONFIG_UNSPARE "unspare" 6143d7072f8Seschrock #define ZPOOL_CONFIG_PHYS_PATH "phys_path" 6158654d025Sperrin #define ZPOOL_CONFIG_IS_LOG "is_log" 616fa94a07fSbrendan #define ZPOOL_CONFIG_L2CACHE "l2cache" 61788ecc943SGeorge Wilson #define ZPOOL_CONFIG_HOLE_ARRAY "hole_array" 61888ecc943SGeorge Wilson #define ZPOOL_CONFIG_VDEV_CHILDREN "vdev_children" 61988ecc943SGeorge Wilson #define ZPOOL_CONFIG_IS_HOLE "is_hole" 6209eb19f4dSGeorge Wilson #define ZPOOL_CONFIG_DDT_HISTOGRAM "ddt_histogram" 6219eb19f4dSGeorge Wilson #define ZPOOL_CONFIG_DDT_OBJ_STATS "ddt_object_stats" 6229eb19f4dSGeorge Wilson #define ZPOOL_CONFIG_DDT_STATS "ddt_stats" 6231195e687SMark J Musante #define ZPOOL_CONFIG_SPLIT "splitcfg" 6241195e687SMark J Musante #define ZPOOL_CONFIG_ORIG_GUID "orig_guid" 6251195e687SMark J Musante #define ZPOOL_CONFIG_SPLIT_GUID "split_guid" 6261195e687SMark J Musante #define ZPOOL_CONFIG_SPLIT_LIST "guid_list" 6273f9d6ad7SLin Ling #define ZPOOL_CONFIG_REMOVING "removing" 628b4952e17SGeorge Wilson #define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg" 6298704186eSDan McDonald #define ZPOOL_CONFIG_COMMENT "comment" 630e14bb325SJeff Bonwick #define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */ 631e0f1c0afSOlaf Faaland #define ZPOOL_CONFIG_SUSPENDED_REASON "suspended_reason" /* not stored */ 632e7cbe64fSgw #define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */ 633e7cbe64fSgw #define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */ 6344b964adaSGeorge Wilson #define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */ 6354b964adaSGeorge Wilson #define ZPOOL_CONFIG_LOAD_INFO "load_info" /* not stored on disk */ 636ad135b5dSChristopher Siden #define ZPOOL_CONFIG_REWIND_INFO "rewind_info" /* not stored on disk */ 637ad135b5dSChristopher Siden #define ZPOOL_CONFIG_UNSUP_FEAT "unsup_feat" /* not stored on disk */ 63857221772SChristopher Siden #define ZPOOL_CONFIG_ENABLED_FEAT "enabled_feat" /* not stored on disk */ 639ad135b5dSChristopher Siden #define ZPOOL_CONFIG_CAN_RDONLY "can_rdonly" /* not stored on disk */ 640ad135b5dSChristopher Siden #define ZPOOL_CONFIG_FEATURES_FOR_READ "features_for_read" 641ad135b5dSChristopher Siden #define ZPOOL_CONFIG_FEATURE_STATS "feature_stats" /* not stored on disk */ 642eb633035STom Caputi #define ZPOOL_CONFIG_ERRATA "errata" /* not stored on disk */ 643215198a6SJoe Stein #define ZPOOL_CONFIG_VDEV_TOP_ZAP "com.delphix:vdev_zap_top" 644215198a6SJoe Stein #define ZPOOL_CONFIG_VDEV_LEAF_ZAP "com.delphix:vdev_zap_leaf" 645215198a6SJoe Stein #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS "com.delphix:has_per_vdev_zaps" 646e4c795beSTom Caputi #define ZPOOL_CONFIG_RESILVER_DEFER "com.datto:resilver_defer" 6476f793812SPavel Zakharov #define ZPOOL_CONFIG_CACHEFILE "cachefile" /* not stored on disk */ 648e0f1c0afSOlaf Faaland #define ZPOOL_CONFIG_MMP_STATE "mmp_state" /* not stored on disk */ 649e0f1c0afSOlaf Faaland #define ZPOOL_CONFIG_MMP_TXG "mmp_txg" /* not stored on disk */ 650e0f1c0afSOlaf Faaland #define ZPOOL_CONFIG_MMP_HOSTNAME "mmp_hostname" /* not stored on disk */ 651e0f1c0afSOlaf Faaland #define ZPOOL_CONFIG_MMP_HOSTID "mmp_hostid" /* not stored on disk */ 652663207adSDon Brady #define ZPOOL_CONFIG_ALLOCATION_BIAS "alloc_bias" /* not stored on disk */ 653663207adSDon Brady 6543d7072f8Seschrock /* 6553d7072f8Seschrock * The persistent vdev state is stored as separate values rather than a single 6563d7072f8Seschrock * 'vdev_state' entry. This is because a device can be in multiple states, such 6573d7072f8Seschrock * as offline and degraded. 6583d7072f8Seschrock */ 6593d7072f8Seschrock #define ZPOOL_CONFIG_OFFLINE "offline" 6603d7072f8Seschrock #define ZPOOL_CONFIG_FAULTED "faulted" 6613d7072f8Seschrock #define ZPOOL_CONFIG_DEGRADED "degraded" 6623d7072f8Seschrock #define ZPOOL_CONFIG_REMOVED "removed" 6636809eb4eSEric Schrock #define ZPOOL_CONFIG_FRU "fru" 664069f55e2SEric Schrock #define ZPOOL_CONFIG_AUX_STATE "aux_state" 665fa9e4066Sahrens 6665dafeea3SPavel Zakharov /* Pool load policy parameters */ 6675dafeea3SPavel Zakharov #define ZPOOL_LOAD_POLICY "load-policy" 6685dafeea3SPavel Zakharov #define ZPOOL_LOAD_REWIND_POLICY "load-rewind-policy" 6695dafeea3SPavel Zakharov #define ZPOOL_LOAD_REQUEST_TXG "load-request-txg" 6705dafeea3SPavel Zakharov #define ZPOOL_LOAD_META_THRESH "load-meta-thresh" 6715dafeea3SPavel Zakharov #define ZPOOL_LOAD_DATA_THRESH "load-data-thresh" 672468c413aSTim Haley 673468c413aSTim Haley /* Rewind data discovered */ 674468c413aSTim Haley #define ZPOOL_CONFIG_LOAD_TIME "rewind_txg_ts" 675468c413aSTim Haley #define ZPOOL_CONFIG_LOAD_DATA_ERRORS "verify_data_errors" 676468c413aSTim Haley #define ZPOOL_CONFIG_REWIND_TIME "seconds_of_rewind" 677468c413aSTim Haley 678fa9e4066Sahrens #define VDEV_TYPE_ROOT "root" 679fa9e4066Sahrens #define VDEV_TYPE_MIRROR "mirror" 680fa9e4066Sahrens #define VDEV_TYPE_REPLACING "replacing" 681fa9e4066Sahrens #define VDEV_TYPE_RAIDZ "raidz" 682fa9e4066Sahrens #define VDEV_TYPE_DISK "disk" 683fa9e4066Sahrens #define VDEV_TYPE_FILE "file" 684fa9e4066Sahrens #define VDEV_TYPE_MISSING "missing" 68588ecc943SGeorge Wilson #define VDEV_TYPE_HOLE "hole" 68699653d4eSeschrock #define VDEV_TYPE_SPARE "spare" 6878654d025Sperrin #define VDEV_TYPE_LOG "log" 688fa94a07fSbrendan #define VDEV_TYPE_L2CACHE "l2cache" 6895cabbc6bSPrashanth Sreenivasa #define VDEV_TYPE_INDIRECT "indirect" 6905cabbc6bSPrashanth Sreenivasa 6915cabbc6bSPrashanth Sreenivasa /* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */ 6925cabbc6bSPrashanth Sreenivasa #define VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \ 6935cabbc6bSPrashanth Sreenivasa "com.delphix:indirect_obsolete_sm" 6945cabbc6bSPrashanth Sreenivasa #define VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \ 6955cabbc6bSPrashanth Sreenivasa "com.delphix:obsolete_counts_are_precise" 69686714001SSerapheim Dimitropoulos #define VDEV_TOP_ZAP_POOL_CHECKPOINT_SM \ 69786714001SSerapheim Dimitropoulos "com.delphix:pool_checkpoint_sm" 698fa9e4066Sahrens 699663207adSDon Brady #define VDEV_TOP_ZAP_ALLOCATION_BIAS \ 700663207adSDon Brady "org.zfsonlinux:allocation_bias" 701663207adSDon Brady 702663207adSDon Brady /* vdev metaslab allocation bias */ 703663207adSDon Brady #define VDEV_ALLOC_BIAS_LOG "log" 704663207adSDon Brady #define VDEV_ALLOC_BIAS_SPECIAL "special" 705663207adSDon Brady #define VDEV_ALLOC_BIAS_DEDUP "dedup" 706663207adSDon Brady 707*084fd14fSBrian Behlendorf /* vdev initialize state */ 708094e47e9SGeorge Wilson #define VDEV_LEAF_ZAP_INITIALIZE_LAST_OFFSET \ 709094e47e9SGeorge Wilson "com.delphix:next_offset_to_initialize" 710094e47e9SGeorge Wilson #define VDEV_LEAF_ZAP_INITIALIZE_STATE \ 711094e47e9SGeorge Wilson "com.delphix:vdev_initialize_state" 712094e47e9SGeorge Wilson #define VDEV_LEAF_ZAP_INITIALIZE_ACTION_TIME \ 713094e47e9SGeorge Wilson "com.delphix:vdev_initialize_action_time" 714094e47e9SGeorge Wilson 715*084fd14fSBrian Behlendorf /* vdev TRIM state */ 716*084fd14fSBrian Behlendorf #define VDEV_LEAF_ZAP_TRIM_LAST_OFFSET \ 717*084fd14fSBrian Behlendorf "org.zfsonlinux:next_offset_to_trim" 718*084fd14fSBrian Behlendorf #define VDEV_LEAF_ZAP_TRIM_STATE \ 719*084fd14fSBrian Behlendorf "org.zfsonlinux:vdev_trim_state" 720*084fd14fSBrian Behlendorf #define VDEV_LEAF_ZAP_TRIM_ACTION_TIME \ 721*084fd14fSBrian Behlendorf "org.zfsonlinux:vdev_trim_action_time" 722*084fd14fSBrian Behlendorf #define VDEV_LEAF_ZAP_TRIM_RATE \ 723*084fd14fSBrian Behlendorf "org.zfsonlinux:vdev_trim_rate" 724*084fd14fSBrian Behlendorf #define VDEV_LEAF_ZAP_TRIM_PARTIAL \ 725*084fd14fSBrian Behlendorf "org.zfsonlinux:vdev_trim_partial" 726*084fd14fSBrian Behlendorf #define VDEV_LEAF_ZAP_TRIM_SECURE \ 727*084fd14fSBrian Behlendorf "org.zfsonlinux:vdev_trim_secure" 728*084fd14fSBrian Behlendorf 729fa9e4066Sahrens /* 730fa9e4066Sahrens * This is needed in userland to report the minimum necessary device size. 7314b5c8e93SMatthew Ahrens * 7324b5c8e93SMatthew Ahrens * Note that the zfs test suite uses 64MB vdevs. 733fa9e4066Sahrens */ 734fa9e4066Sahrens #define SPA_MINDEVSIZE (64ULL << 20) 735fa9e4066Sahrens 7362e4c9986SGeorge Wilson /* 7372e4c9986SGeorge Wilson * Set if the fragmentation has not yet been calculated. This can happen 7382e4c9986SGeorge Wilson * because the space maps have not been upgraded or the histogram feature 7392e4c9986SGeorge Wilson * is not enabled. 7402e4c9986SGeorge Wilson */ 7412e4c9986SGeorge Wilson #define ZFS_FRAG_INVALID UINT64_MAX 7422e4c9986SGeorge Wilson 743fa9e4066Sahrens /* 744fa9e4066Sahrens * The location of the pool configuration repository, shared between kernel and 745fa9e4066Sahrens * userland. 746fa9e4066Sahrens */ 747c5904d13Seschrock #define ZPOOL_CACHE "/etc/zfs/zpool.cache" 748fa9e4066Sahrens 749fa9e4066Sahrens /* 750fa9e4066Sahrens * vdev states are ordered from least to most healthy. 751fa9e4066Sahrens * A vdev that's CANT_OPEN or below is considered unusable. 752fa9e4066Sahrens */ 753fa9e4066Sahrens typedef enum vdev_state { 754fa9e4066Sahrens VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev */ 755fa9e4066Sahrens VDEV_STATE_CLOSED, /* Not currently open */ 756fa9e4066Sahrens VDEV_STATE_OFFLINE, /* Not allowed to open */ 7573d7072f8Seschrock VDEV_STATE_REMOVED, /* Explicitly removed from system */ 758fa9e4066Sahrens VDEV_STATE_CANT_OPEN, /* Tried to open, but failed */ 7593d7072f8Seschrock VDEV_STATE_FAULTED, /* External request to fault device */ 760fa9e4066Sahrens VDEV_STATE_DEGRADED, /* Replicated vdev with unhealthy kids */ 761fa9e4066Sahrens VDEV_STATE_HEALTHY /* Presumed good */ 762fa9e4066Sahrens } vdev_state_t; 763fa9e4066Sahrens 7643d7072f8Seschrock #define VDEV_STATE_ONLINE VDEV_STATE_HEALTHY 7653d7072f8Seschrock 766fa9e4066Sahrens /* 767fa9e4066Sahrens * vdev aux states. When a vdev is in the CANT_OPEN state, the aux field 768fa9e4066Sahrens * of the vdev stats structure uses these constants to distinguish why. 769fa9e4066Sahrens */ 770fa9e4066Sahrens typedef enum vdev_aux { 771fa9e4066Sahrens VDEV_AUX_NONE, /* no error */ 772fa9e4066Sahrens VDEV_AUX_OPEN_FAILED, /* ldi_open_*() or vn_open() failed */ 773fa9e4066Sahrens VDEV_AUX_CORRUPT_DATA, /* bad label or disk contents */ 774fa9e4066Sahrens VDEV_AUX_NO_REPLICAS, /* insufficient number of replicas */ 775fa9e4066Sahrens VDEV_AUX_BAD_GUID_SUM, /* vdev guid sum doesn't match */ 776fa9e4066Sahrens VDEV_AUX_TOO_SMALL, /* vdev size is too small */ 777eaca9bbdSeschrock VDEV_AUX_BAD_LABEL, /* the label is OK but invalid */ 778eaca9bbdSeschrock VDEV_AUX_VERSION_NEWER, /* on-disk version is too new */ 77999653d4eSeschrock VDEV_AUX_VERSION_OLDER, /* on-disk version is too old */ 780ad135b5dSChristopher Siden VDEV_AUX_UNSUP_FEAT, /* unsupported features */ 7813d7072f8Seschrock VDEV_AUX_SPARED, /* hot spare used in another pool */ 78232b87932Sek VDEV_AUX_ERR_EXCEEDED, /* too many errors */ 783b87f3af3Sperrin VDEV_AUX_IO_FAILURE, /* experienced I/O failure */ 784069f55e2SEric Schrock VDEV_AUX_BAD_LOG, /* cannot read log chain(s) */ 7851195e687SMark J Musante VDEV_AUX_EXTERNAL, /* external diagnosis */ 7866f793812SPavel Zakharov VDEV_AUX_SPLIT_POOL, /* vdev was split off into another pool */ 787e0f1c0afSOlaf Faaland VDEV_AUX_ACTIVE, /* vdev active on a different host */ 7885711d393Sloli VDEV_AUX_CHILDREN_OFFLINE, /* all children are offline */ 7895711d393Sloli VDEV_AUX_BAD_ASHIFT /* vdev ashift is invalid */ 790fa9e4066Sahrens } vdev_aux_t; 791fa9e4066Sahrens 792fa9e4066Sahrens /* 79346a2abf2Seschrock * pool state. The following states are written to disk as part of the normal 794fa94a07fSbrendan * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE. The remaining 795fa94a07fSbrendan * states are software abstractions used at various levels to communicate 796fa94a07fSbrendan * pool state. 797fa9e4066Sahrens */ 798fa9e4066Sahrens typedef enum pool_state { 799fa9e4066Sahrens POOL_STATE_ACTIVE = 0, /* In active use */ 800fa9e4066Sahrens POOL_STATE_EXPORTED, /* Explicitly exported */ 801fa9e4066Sahrens POOL_STATE_DESTROYED, /* Explicitly destroyed */ 80299653d4eSeschrock POOL_STATE_SPARE, /* Reserved for hot spare use */ 803fa94a07fSbrendan POOL_STATE_L2CACHE, /* Level 2 ARC device */ 804fa9e4066Sahrens POOL_STATE_UNINITIALIZED, /* Internal spa_t state */ 80546a2abf2Seschrock POOL_STATE_UNAVAIL, /* Internal libzfs state */ 80646a2abf2Seschrock POOL_STATE_POTENTIALLY_ACTIVE /* Internal libzfs state */ 807fa9e4066Sahrens } pool_state_t; 808fa9e4066Sahrens 809e0f1c0afSOlaf Faaland /* 810e0f1c0afSOlaf Faaland * mmp state. The following states provide additional detail describing 811e0f1c0afSOlaf Faaland * why a pool couldn't be safely imported. 812e0f1c0afSOlaf Faaland */ 813e0f1c0afSOlaf Faaland typedef enum mmp_state { 814e0f1c0afSOlaf Faaland MMP_STATE_ACTIVE = 0, /* In active use */ 815e0f1c0afSOlaf Faaland MMP_STATE_INACTIVE, /* Inactive and safe to import */ 816e0f1c0afSOlaf Faaland MMP_STATE_NO_HOSTID /* System hostid is not set */ 817e0f1c0afSOlaf Faaland } mmp_state_t; 818e0f1c0afSOlaf Faaland 819fa9e4066Sahrens /* 8203f9d6ad7SLin Ling * Scan Functions. 821fa9e4066Sahrens */ 8223f9d6ad7SLin Ling typedef enum pool_scan_func { 8233f9d6ad7SLin Ling POOL_SCAN_NONE, 8243f9d6ad7SLin Ling POOL_SCAN_SCRUB, 8253f9d6ad7SLin Ling POOL_SCAN_RESILVER, 8263f9d6ad7SLin Ling POOL_SCAN_FUNCS 8273f9d6ad7SLin Ling } pool_scan_func_t; 828fa9e4066Sahrens 8291702cce7SAlek Pinchuk /* 8301702cce7SAlek Pinchuk * Used to control scrub pause and resume. 8311702cce7SAlek Pinchuk */ 8321702cce7SAlek Pinchuk typedef enum pool_scrub_cmd { 8331702cce7SAlek Pinchuk POOL_SCRUB_NORMAL = 0, 8341702cce7SAlek Pinchuk POOL_SCRUB_PAUSE, 8351702cce7SAlek Pinchuk POOL_SCRUB_FLAGS_END 8361702cce7SAlek Pinchuk } pool_scrub_cmd_t; 8371702cce7SAlek Pinchuk 838094e47e9SGeorge Wilson /* 839094e47e9SGeorge Wilson * Initialize functions. 840094e47e9SGeorge Wilson */ 841094e47e9SGeorge Wilson typedef enum pool_initialize_func { 842*084fd14fSBrian Behlendorf POOL_INITIALIZE_START, 843094e47e9SGeorge Wilson POOL_INITIALIZE_CANCEL, 844094e47e9SGeorge Wilson POOL_INITIALIZE_SUSPEND, 845094e47e9SGeorge Wilson POOL_INITIALIZE_FUNCS 846094e47e9SGeorge Wilson } pool_initialize_func_t; 8471702cce7SAlek Pinchuk 848*084fd14fSBrian Behlendorf /* 849*084fd14fSBrian Behlendorf * TRIM functions. 850*084fd14fSBrian Behlendorf */ 851*084fd14fSBrian Behlendorf typedef enum pool_trim_func { 852*084fd14fSBrian Behlendorf POOL_TRIM_START, 853*084fd14fSBrian Behlendorf POOL_TRIM_CANCEL, 854*084fd14fSBrian Behlendorf POOL_TRIM_SUSPEND, 855*084fd14fSBrian Behlendorf POOL_TRIM_FUNCS 856*084fd14fSBrian Behlendorf } pool_trim_func_t; 857*084fd14fSBrian Behlendorf 858fa9e4066Sahrens /* 859fa9e4066Sahrens * ZIO types. Needed to interpret vdev statistics below. 860fa9e4066Sahrens */ 861fa9e4066Sahrens typedef enum zio_type { 862fa9e4066Sahrens ZIO_TYPE_NULL = 0, 863fa9e4066Sahrens ZIO_TYPE_READ, 864fa9e4066Sahrens ZIO_TYPE_WRITE, 865fa9e4066Sahrens ZIO_TYPE_FREE, 866fa9e4066Sahrens ZIO_TYPE_CLAIM, 867fa9e4066Sahrens ZIO_TYPE_IOCTL, 868*084fd14fSBrian Behlendorf ZIO_TYPE_TRIM, 869fa9e4066Sahrens ZIO_TYPES 870fa9e4066Sahrens } zio_type_t; 871fa9e4066Sahrens 8723f9d6ad7SLin Ling /* 8733f9d6ad7SLin Ling * Pool statistics. Note: all fields should be 64-bit because this 8743f9d6ad7SLin Ling * is passed between kernel and userland as an nvlist uint64 array. 8753f9d6ad7SLin Ling */ 8763f9d6ad7SLin Ling typedef struct pool_scan_stat { 8773f9d6ad7SLin Ling /* values stored on disk */ 8783f9d6ad7SLin Ling uint64_t pss_func; /* pool_scan_func_t */ 8793f9d6ad7SLin Ling uint64_t pss_state; /* dsl_scan_state_t */ 8803f9d6ad7SLin Ling uint64_t pss_start_time; /* scan start time */ 8813f9d6ad7SLin Ling uint64_t pss_end_time; /* scan end time */ 8823f9d6ad7SLin Ling uint64_t pss_to_examine; /* total bytes to scan */ 883a3874b8bSToomas Soome uint64_t pss_examined; /* total bytes located by scanner */ 8843f9d6ad7SLin Ling uint64_t pss_to_process; /* total bytes to process */ 8853f9d6ad7SLin Ling uint64_t pss_processed; /* total processed bytes */ 8863f9d6ad7SLin Ling uint64_t pss_errors; /* scan errors */ 8873f9d6ad7SLin Ling 8883f9d6ad7SLin Ling /* values not stored on disk */ 8893f9d6ad7SLin Ling uint64_t pss_pass_exam; /* examined bytes per scan pass */ 890a3874b8bSToomas Soome uint64_t pss_pass_issued; /* issued bytes per scan pass */ 8913f9d6ad7SLin Ling uint64_t pss_pass_start; /* start time of a scan pass */ 8921702cce7SAlek Pinchuk uint64_t pss_pass_scrub_pause; /* pause time of a scurb pass */ 8931702cce7SAlek Pinchuk /* cumulative time scrub spent paused, needed for rate calculation */ 8941702cce7SAlek Pinchuk uint64_t pss_pass_scrub_spent_paused; 895a3874b8bSToomas Soome 896a3874b8bSToomas Soome /* Sorted scrubbing new fields */ 897a3874b8bSToomas Soome /* Stored on disk */ 898a3874b8bSToomas Soome uint64_t pss_issued; /* total bytes checked by scanner */ 8993f9d6ad7SLin Ling } pool_scan_stat_t; 9003f9d6ad7SLin Ling 901eb633035STom Caputi /* 902eb633035STom Caputi * Errata described by http://zfsonlinux.org/msg/ZFS-8000-ER. The ordering 903eb633035STom Caputi * of this enum must be maintained to ensure the errata identifiers map to 904eb633035STom Caputi * the correct documentation. New errata may only be appended to the list 905eb633035STom Caputi * and must contain corresponding documentation at the above link. 906eb633035STom Caputi */ 907eb633035STom Caputi typedef enum zpool_errata { 908eb633035STom Caputi ZPOOL_ERRATA_NONE, 909eb633035STom Caputi ZPOOL_ERRATA_ZOL_2094_SCRUB, 910eb633035STom Caputi ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY, 911eb633035STom Caputi ZPOOL_ERRATA_ZOL_6845_ENCRYPTION, 912eb633035STom Caputi ZPOOL_ERRATA_ZOL_8308_ENCRYPTION, 913eb633035STom Caputi } zpool_errata_t; 914eb633035STom Caputi 9155cabbc6bSPrashanth Sreenivasa typedef struct pool_removal_stat { 9165cabbc6bSPrashanth Sreenivasa uint64_t prs_state; /* dsl_scan_state_t */ 9175cabbc6bSPrashanth Sreenivasa uint64_t prs_removing_vdev; 9185cabbc6bSPrashanth Sreenivasa uint64_t prs_start_time; 9195cabbc6bSPrashanth Sreenivasa uint64_t prs_end_time; 9205cabbc6bSPrashanth Sreenivasa uint64_t prs_to_copy; /* bytes that need to be copied */ 9215cabbc6bSPrashanth Sreenivasa uint64_t prs_copied; /* bytes copied so far */ 9225cabbc6bSPrashanth Sreenivasa /* 9235cabbc6bSPrashanth Sreenivasa * bytes of memory used for indirect mappings. 9245cabbc6bSPrashanth Sreenivasa * This includes all removed vdevs. 9255cabbc6bSPrashanth Sreenivasa */ 9265cabbc6bSPrashanth Sreenivasa uint64_t prs_mapping_memory; 9275cabbc6bSPrashanth Sreenivasa } pool_removal_stat_t; 9285cabbc6bSPrashanth Sreenivasa 9293f9d6ad7SLin Ling typedef enum dsl_scan_state { 9303f9d6ad7SLin Ling DSS_NONE, 9313f9d6ad7SLin Ling DSS_SCANNING, 9323f9d6ad7SLin Ling DSS_FINISHED, 9333f9d6ad7SLin Ling DSS_CANCELED, 9343f9d6ad7SLin Ling DSS_NUM_STATES 9353f9d6ad7SLin Ling } dsl_scan_state_t; 9363f9d6ad7SLin Ling 93786714001SSerapheim Dimitropoulos typedef enum { 93886714001SSerapheim Dimitropoulos CS_NONE, 93986714001SSerapheim Dimitropoulos CS_CHECKPOINT_EXISTS, 94086714001SSerapheim Dimitropoulos CS_CHECKPOINT_DISCARDING, 94186714001SSerapheim Dimitropoulos CS_NUM_STATES 94286714001SSerapheim Dimitropoulos } checkpoint_state_t; 94386714001SSerapheim Dimitropoulos 94486714001SSerapheim Dimitropoulos typedef struct pool_checkpoint_stat { 94586714001SSerapheim Dimitropoulos uint64_t pcs_state; /* checkpoint_state_t */ 94686714001SSerapheim Dimitropoulos uint64_t pcs_start_time; /* time checkpoint/discard started */ 94786714001SSerapheim Dimitropoulos uint64_t pcs_space; /* checkpointed space */ 94886714001SSerapheim Dimitropoulos } pool_checkpoint_stat_t; 9493f9d6ad7SLin Ling 950094e47e9SGeorge Wilson typedef enum { 951094e47e9SGeorge Wilson VDEV_INITIALIZE_NONE, 952094e47e9SGeorge Wilson VDEV_INITIALIZE_ACTIVE, 953094e47e9SGeorge Wilson VDEV_INITIALIZE_CANCELED, 954094e47e9SGeorge Wilson VDEV_INITIALIZE_SUSPENDED, 955094e47e9SGeorge Wilson VDEV_INITIALIZE_COMPLETE 956094e47e9SGeorge Wilson } vdev_initializing_state_t; 957094e47e9SGeorge Wilson 958*084fd14fSBrian Behlendorf typedef enum { 959*084fd14fSBrian Behlendorf VDEV_TRIM_NONE, 960*084fd14fSBrian Behlendorf VDEV_TRIM_ACTIVE, 961*084fd14fSBrian Behlendorf VDEV_TRIM_CANCELED, 962*084fd14fSBrian Behlendorf VDEV_TRIM_SUSPENDED, 963*084fd14fSBrian Behlendorf VDEV_TRIM_COMPLETE, 964*084fd14fSBrian Behlendorf } vdev_trim_state_t; 965*084fd14fSBrian Behlendorf 966fa9e4066Sahrens /* 967fa9e4066Sahrens * Vdev statistics. Note: all fields should be 64-bit because this 968*084fd14fSBrian Behlendorf * is passed between kernel and user land as an nvlist uint64 array. 969*084fd14fSBrian Behlendorf * 970*084fd14fSBrian Behlendorf * The vs_ops[] and vs_bytes[] arrays must always be an array size of 6 in 971*084fd14fSBrian Behlendorf * order to keep subsequent members at their known fixed offsets. When 972*084fd14fSBrian Behlendorf * adding a new field it must be added to the end the structure. 973fa9e4066Sahrens */ 974*084fd14fSBrian Behlendorf #define VS_ZIO_TYPES 6 975*084fd14fSBrian Behlendorf 976fa9e4066Sahrens typedef struct vdev_stat { 977fa9e4066Sahrens hrtime_t vs_timestamp; /* time since vdev load */ 978fa9e4066Sahrens uint64_t vs_state; /* vdev state */ 979fa9e4066Sahrens uint64_t vs_aux; /* see vdev_aux_t */ 980fa9e4066Sahrens uint64_t vs_alloc; /* space allocated */ 981fa9e4066Sahrens uint64_t vs_space; /* total capacity */ 98299653d4eSeschrock uint64_t vs_dspace; /* deflated capacity */ 9832a79c5feSlling uint64_t vs_rsize; /* replaceable dev size */ 9844263d13fSGeorge Wilson uint64_t vs_esize; /* expandable dev size */ 985*084fd14fSBrian Behlendorf uint64_t vs_ops[VS_ZIO_TYPES]; /* operation count */ 986*084fd14fSBrian Behlendorf uint64_t vs_bytes[VS_ZIO_TYPES]; /* bytes read/written */ 987fa9e4066Sahrens uint64_t vs_read_errors; /* read errors */ 988fa9e4066Sahrens uint64_t vs_write_errors; /* write errors */ 989fa9e4066Sahrens uint64_t vs_checksum_errors; /* checksum errors */ 990094e47e9SGeorge Wilson uint64_t vs_initialize_errors; /* initializing errors */ 991fa9e4066Sahrens uint64_t vs_self_healed; /* self-healed bytes */ 9923f9d6ad7SLin Ling uint64_t vs_scan_removing; /* removing? */ 9933f9d6ad7SLin Ling uint64_t vs_scan_processed; /* scan processed bytes */ 9942e4c9986SGeorge Wilson uint64_t vs_fragmentation; /* device fragmentation */ 995094e47e9SGeorge Wilson uint64_t vs_initialize_bytes_done; /* bytes initialized */ 996094e47e9SGeorge Wilson uint64_t vs_initialize_bytes_est; /* total bytes to initialize */ 997094e47e9SGeorge Wilson uint64_t vs_initialize_state; /* vdev_initialzing_state_t */ 998094e47e9SGeorge Wilson uint64_t vs_initialize_action_time; /* time_t */ 99986714001SSerapheim Dimitropoulos uint64_t vs_checkpoint_space; /* checkpoint-consumed space */ 1000e4c795beSTom Caputi uint64_t vs_resilver_deferred; /* resilver deferred */ 1001*084fd14fSBrian Behlendorf uint64_t vs_trim_errors; /* trimming errors */ 1002*084fd14fSBrian Behlendorf uint64_t vs_trim_notsup; /* supported by device */ 1003*084fd14fSBrian Behlendorf uint64_t vs_trim_bytes_done; /* bytes trimmed */ 1004*084fd14fSBrian Behlendorf uint64_t vs_trim_bytes_est; /* total bytes to trim */ 1005*084fd14fSBrian Behlendorf uint64_t vs_trim_state; /* vdev_trim_state_t */ 1006*084fd14fSBrian Behlendorf uint64_t vs_trim_action_time; /* time_t */ 1007fa9e4066Sahrens } vdev_stat_t; 1008fa9e4066Sahrens 10099eb19f4dSGeorge Wilson /* 10109eb19f4dSGeorge Wilson * DDT statistics. Note: all fields should be 64-bit because this 10119eb19f4dSGeorge Wilson * is passed between kernel and userland as an nvlist uint64 array. 10129eb19f4dSGeorge Wilson */ 10139eb19f4dSGeorge Wilson typedef struct ddt_object { 101404e56356SAndriy Gapon uint64_t ddo_count; /* number of elments in ddt */ 10159eb19f4dSGeorge Wilson uint64_t ddo_dspace; /* size of ddt on disk */ 10169eb19f4dSGeorge Wilson uint64_t ddo_mspace; /* size of ddt in-core */ 10179eb19f4dSGeorge Wilson } ddt_object_t; 10189eb19f4dSGeorge Wilson 10199eb19f4dSGeorge Wilson typedef struct ddt_stat { 10209eb19f4dSGeorge Wilson uint64_t dds_blocks; /* blocks */ 10219eb19f4dSGeorge Wilson uint64_t dds_lsize; /* logical size */ 10229eb19f4dSGeorge Wilson uint64_t dds_psize; /* physical size */ 10239eb19f4dSGeorge Wilson uint64_t dds_dsize; /* deflated allocated size */ 10249eb19f4dSGeorge Wilson uint64_t dds_ref_blocks; /* referenced blocks */ 10259eb19f4dSGeorge Wilson uint64_t dds_ref_lsize; /* referenced lsize * refcnt */ 10269eb19f4dSGeorge Wilson uint64_t dds_ref_psize; /* referenced psize * refcnt */ 10279eb19f4dSGeorge Wilson uint64_t dds_ref_dsize; /* referenced dsize * refcnt */ 10289eb19f4dSGeorge Wilson } ddt_stat_t; 10299eb19f4dSGeorge Wilson 10309eb19f4dSGeorge Wilson typedef struct ddt_histogram { 10319eb19f4dSGeorge Wilson ddt_stat_t ddh_stat[64]; /* power-of-two histogram buckets */ 10329eb19f4dSGeorge Wilson } ddt_histogram_t; 10339eb19f4dSGeorge Wilson 1034e7cbe64fSgw #define ZVOL_DRIVER "zvol" 1035fa9e4066Sahrens #define ZFS_DRIVER "zfs" 1036fa9e4066Sahrens #define ZFS_DEV "/dev/zfs" 10376401734dSWill Andrews #define ZFS_DISK_ROOT "/dev/dsk" 10386401734dSWill Andrews #define ZFS_DISK_ROOTD ZFS_DISK_ROOT "/" 10396401734dSWill Andrews #define ZFS_RDISK_ROOT "/dev/rdsk" 10406401734dSWill Andrews #define ZFS_RDISK_ROOTD ZFS_RDISK_ROOT "/" 1041fa9e4066Sahrens 1042681d9761SEric Taylor /* general zvol path */ 1043681d9761SEric Taylor #define ZVOL_DIR "/dev/zvol" 1044681d9761SEric Taylor /* expansion */ 1045573ca77eSGeorge Wilson #define ZVOL_PSEUDO_DEV "/devices/pseudo/zfs@0:" 1046681d9761SEric Taylor /* for dump and swap */ 1047681d9761SEric Taylor #define ZVOL_FULL_DEV_DIR ZVOL_DIR "/dsk/" 1048681d9761SEric Taylor #define ZVOL_FULL_RDEV_DIR ZVOL_DIR "/rdsk/" 1049fa9e4066Sahrens 1050fa9e4066Sahrens #define ZVOL_PROP_NAME "name" 1051c1449561SEric Taylor #define ZVOL_DEFAULT_BLOCKSIZE 8192 1052fa9e4066Sahrens 1053fa9e4066Sahrens /* 1054fa9e4066Sahrens * /dev/zfs ioctl numbers. 1055fa9e4066Sahrens */ 1056fa9e4066Sahrens typedef enum zfs_ioc { 10574445fffbSMatthew Ahrens ZFS_IOC_FIRST = ('Z' << 8), 10584445fffbSMatthew Ahrens ZFS_IOC = ZFS_IOC_FIRST, 10594445fffbSMatthew Ahrens ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST, 1060fa9e4066Sahrens ZFS_IOC_POOL_DESTROY, 1061fa9e4066Sahrens ZFS_IOC_POOL_IMPORT, 1062fa9e4066Sahrens ZFS_IOC_POOL_EXPORT, 1063fa9e4066Sahrens ZFS_IOC_POOL_CONFIGS, 1064fa9e4066Sahrens ZFS_IOC_POOL_STATS, 1065fa9e4066Sahrens ZFS_IOC_POOL_TRYIMPORT, 10663f9d6ad7SLin Ling ZFS_IOC_POOL_SCAN, 1067fa9e4066Sahrens ZFS_IOC_POOL_FREEZE, 1068eaca9bbdSeschrock ZFS_IOC_POOL_UPGRADE, 106906eeb2adSek ZFS_IOC_POOL_GET_HISTORY, 1070fa9e4066Sahrens ZFS_IOC_VDEV_ADD, 1071fa9e4066Sahrens ZFS_IOC_VDEV_REMOVE, 10723d7072f8Seschrock ZFS_IOC_VDEV_SET_STATE, 1073fa9e4066Sahrens ZFS_IOC_VDEV_ATTACH, 1074fa9e4066Sahrens ZFS_IOC_VDEV_DETACH, 1075c67d9675Seschrock ZFS_IOC_VDEV_SETPATH, 10766809eb4eSEric Schrock ZFS_IOC_VDEV_SETFRU, 1077fa9e4066Sahrens ZFS_IOC_OBJSET_STATS, 1078de8267e0Stimh ZFS_IOC_OBJSET_ZPLPROPS, 1079fa9e4066Sahrens ZFS_IOC_DATASET_LIST_NEXT, 1080fa9e4066Sahrens ZFS_IOC_SNAPSHOT_LIST_NEXT, 1081fa9e4066Sahrens ZFS_IOC_SET_PROP, 1082fa9e4066Sahrens ZFS_IOC_CREATE, 1083fa9e4066Sahrens ZFS_IOC_DESTROY, 1084fa9e4066Sahrens ZFS_IOC_ROLLBACK, 1085fa9e4066Sahrens ZFS_IOC_RENAME, 10863cb34c60Sahrens ZFS_IOC_RECV, 10873cb34c60Sahrens ZFS_IOC_SEND, 1088ea8dc4b6Seschrock ZFS_IOC_INJECT_FAULT, 1089ea8dc4b6Seschrock ZFS_IOC_CLEAR_FAULT, 1090ea8dc4b6Seschrock ZFS_IOC_INJECT_LIST_NEXT, 1091ea8dc4b6Seschrock ZFS_IOC_ERROR_LOG, 1092ea8dc4b6Seschrock ZFS_IOC_CLEAR, 10931d452cf5Sahrens ZFS_IOC_PROMOTE, 109455434c77Sek ZFS_IOC_SNAPSHOT, 109555434c77Sek ZFS_IOC_DSOBJ_TO_DSNAME, 1096b1b8ab34Slling ZFS_IOC_OBJ_TO_PATH, 1097b1b8ab34Slling ZFS_IOC_POOL_SET_PROPS, 1098ecd6cf80Smarks ZFS_IOC_POOL_GET_PROPS, 1099ecd6cf80Smarks ZFS_IOC_SET_FSACL, 1100ecd6cf80Smarks ZFS_IOC_GET_FSACL, 1101e45ce728Sahrens ZFS_IOC_SHARE, 1102743a77edSAlan Wright ZFS_IOC_INHERIT_PROP, 110314843421SMatthew Ahrens ZFS_IOC_SMB_ACL, 110414843421SMatthew Ahrens ZFS_IOC_USERSPACE_ONE, 110514843421SMatthew Ahrens ZFS_IOC_USERSPACE_MANY, 1106842727c2SChris Kirby ZFS_IOC_USERSPACE_UPGRADE, 1107842727c2SChris Kirby ZFS_IOC_HOLD, 1108842727c2SChris Kirby ZFS_IOC_RELEASE, 110992241e0bSTom Erickson ZFS_IOC_GET_HOLDS, 11101195e687SMark J Musante ZFS_IOC_OBJSET_RECVD_PROPS, 111199d5e173STim Haley ZFS_IOC_VDEV_SPLIT, 111299d5e173STim Haley ZFS_IOC_NEXT_OBJ, 111399d5e173STim Haley ZFS_IOC_DIFF, 111499d5e173STim Haley ZFS_IOC_TMP_SNAPSHOT, 1115e9103aaeSGarrett D'Amore ZFS_IOC_OBJ_TO_STATS, 111619b94df9SMatthew Ahrens ZFS_IOC_SPACE_WRITTEN, 111719b94df9SMatthew Ahrens ZFS_IOC_SPACE_SNAPS, 11184445fffbSMatthew Ahrens ZFS_IOC_DESTROY_SNAPS, 11194263d13fSGeorge Wilson ZFS_IOC_POOL_REGUID, 11204e3c9f44SBill Pijewski ZFS_IOC_POOL_REOPEN, 11214445fffbSMatthew Ahrens ZFS_IOC_SEND_PROGRESS, 11224445fffbSMatthew Ahrens ZFS_IOC_LOG_HISTORY, 11234445fffbSMatthew Ahrens ZFS_IOC_SEND_NEW, 11244445fffbSMatthew Ahrens ZFS_IOC_SEND_SPACE, 11254445fffbSMatthew Ahrens ZFS_IOC_CLONE, 112678f17100SMatthew Ahrens ZFS_IOC_BOOKMARK, 112778f17100SMatthew Ahrens ZFS_IOC_GET_BOOKMARKS, 112878f17100SMatthew Ahrens ZFS_IOC_DESTROY_BOOKMARKS, 1129dfc11533SChris Williamson ZFS_IOC_CHANNEL_PROGRAM, 11305cabbc6bSPrashanth Sreenivasa ZFS_IOC_REMAP, 113186714001SSerapheim Dimitropoulos ZFS_IOC_POOL_CHECKPOINT, 113286714001SSerapheim Dimitropoulos ZFS_IOC_POOL_DISCARD_CHECKPOINT, 1133094e47e9SGeorge Wilson ZFS_IOC_POOL_INITIALIZE, 11349c2acf00SAlek Pinchuk ZFS_IOC_POOL_SYNC, 1135eb633035STom Caputi ZFS_IOC_LOAD_KEY, 1136eb633035STom Caputi ZFS_IOC_UNLOAD_KEY, 1137eb633035STom Caputi ZFS_IOC_CHANGE_KEY, 1138*084fd14fSBrian Behlendorf ZFS_IOC_POOL_TRIM, 11394445fffbSMatthew Ahrens ZFS_IOC_LAST 1140fa9e4066Sahrens } zfs_ioc_t; 1141fa9e4066Sahrens 114286714001SSerapheim Dimitropoulos /* 114386714001SSerapheim Dimitropoulos * ZFS-specific error codes used for returning descriptive errors 114486714001SSerapheim Dimitropoulos * to the userland through zfs ioctls. 114586714001SSerapheim Dimitropoulos * 114686714001SSerapheim Dimitropoulos * The enum implicitly includes all the error codes from errno.h. 114786714001SSerapheim Dimitropoulos * New code should use and extend this enum for errors that are 114886714001SSerapheim Dimitropoulos * not described precisely by generic errno codes. 114986714001SSerapheim Dimitropoulos */ 115086714001SSerapheim Dimitropoulos typedef enum { 115186714001SSerapheim Dimitropoulos ZFS_ERR_CHECKPOINT_EXISTS = 1024, 115286714001SSerapheim Dimitropoulos ZFS_ERR_DISCARDING_CHECKPOINT, 115386714001SSerapheim Dimitropoulos ZFS_ERR_NO_CHECKPOINT, 115486714001SSerapheim Dimitropoulos ZFS_ERR_DEVRM_IN_PROGRESS, 1155eb633035STom Caputi ZFS_ERR_VDEV_TOO_BIG, 1156eb633035STom Caputi ZFS_ERR_FROM_IVSET_GUID_MISSING, 1157eb633035STom Caputi ZFS_ERR_FROM_IVSET_GUID_MISMATCH, 1158eb633035STom Caputi ZFS_ERR_SPILL_BLOCK_FLAG_MISSING, 115986714001SSerapheim Dimitropoulos } zfs_errno_t; 116086714001SSerapheim Dimitropoulos 1161ea8dc4b6Seschrock /* 1162ea8dc4b6Seschrock * Internal SPA load state. Used by FMA diagnosis engine. 1163ea8dc4b6Seschrock */ 1164ea8dc4b6Seschrock typedef enum { 11659eb19f4dSGeorge Wilson SPA_LOAD_NONE, /* no load in progress */ 11669eb19f4dSGeorge Wilson SPA_LOAD_OPEN, /* normal open */ 11679eb19f4dSGeorge Wilson SPA_LOAD_IMPORT, /* import in progress */ 1168468c413aSTim Haley SPA_LOAD_TRYIMPORT, /* tryimport in progress */ 11699eb19f4dSGeorge Wilson SPA_LOAD_RECOVER, /* recovery requested */ 11700f7643c7SGeorge Wilson SPA_LOAD_ERROR, /* load failed */ 11710f7643c7SGeorge Wilson SPA_LOAD_CREATE /* creation in progress */ 1172ea8dc4b6Seschrock } spa_load_state_t; 1173ea8dc4b6Seschrock 1174eb633035STom Caputi /* supported encryption algorithms */ 1175eb633035STom Caputi enum zio_encrypt { 1176eb633035STom Caputi ZIO_CRYPT_INHERIT = 0, 1177eb633035STom Caputi ZIO_CRYPT_ON, 1178eb633035STom Caputi ZIO_CRYPT_OFF, 1179eb633035STom Caputi ZIO_CRYPT_AES_128_CCM, 1180eb633035STom Caputi ZIO_CRYPT_AES_192_CCM, 1181eb633035STom Caputi ZIO_CRYPT_AES_256_CCM, 1182eb633035STom Caputi ZIO_CRYPT_AES_128_GCM, 1183eb633035STom Caputi ZIO_CRYPT_AES_192_GCM, 1184eb633035STom Caputi ZIO_CRYPT_AES_256_GCM, 1185eb633035STom Caputi ZIO_CRYPT_FUNCTIONS 1186eb633035STom Caputi }; 1187eb633035STom Caputi 1188e9dbad6fSeschrock /* 1189e9dbad6fSeschrock * Bookmark name values. 1190e9dbad6fSeschrock */ 119155434c77Sek #define ZPOOL_ERR_LIST "error list" 1192e9dbad6fSeschrock #define ZPOOL_ERR_DATASET "dataset" 1193e9dbad6fSeschrock #define ZPOOL_ERR_OBJECT "object" 1194e9dbad6fSeschrock 119506eeb2adSek #define HIS_MAX_RECORD_LEN (MAXPATHLEN + MAXPATHLEN + 1) 119606eeb2adSek 119706eeb2adSek /* 119806eeb2adSek * The following are names used in the nvlist describing 119906eeb2adSek * the pool's history log. 120006eeb2adSek */ 120106eeb2adSek #define ZPOOL_HIST_RECORD "history record" 120206eeb2adSek #define ZPOOL_HIST_TIME "history time" 120306eeb2adSek #define ZPOOL_HIST_CMD "history command" 1204ecd6cf80Smarks #define ZPOOL_HIST_WHO "history who" 1205ecd6cf80Smarks #define ZPOOL_HIST_ZONE "history zone" 1206ecd6cf80Smarks #define ZPOOL_HIST_HOST "history hostname" 1207ecd6cf80Smarks #define ZPOOL_HIST_TXG "history txg" 1208ecd6cf80Smarks #define ZPOOL_HIST_INT_EVENT "history internal event" 1209ecd6cf80Smarks #define ZPOOL_HIST_INT_STR "history internal str" 12104445fffbSMatthew Ahrens #define ZPOOL_HIST_INT_NAME "internal_name" 12114445fffbSMatthew Ahrens #define ZPOOL_HIST_IOCTL "ioctl" 12124445fffbSMatthew Ahrens #define ZPOOL_HIST_INPUT_NVL "in_nvl" 12134445fffbSMatthew Ahrens #define ZPOOL_HIST_OUTPUT_NVL "out_nvl" 12144445fffbSMatthew Ahrens #define ZPOOL_HIST_DSNAME "dsname" 12154445fffbSMatthew Ahrens #define ZPOOL_HIST_DSID "dsid" 1216dfc11533SChris Williamson #define ZPOOL_HIST_ERRNO "errno" 121706eeb2adSek 1218094e47e9SGeorge Wilson /* 1219094e47e9SGeorge Wilson * The following are names used when invoking ZFS_IOC_POOL_INITIALIZE. 1220094e47e9SGeorge Wilson */ 1221094e47e9SGeorge Wilson #define ZPOOL_INITIALIZE_COMMAND "initialize_command" 1222094e47e9SGeorge Wilson #define ZPOOL_INITIALIZE_VDEVS "initialize_vdevs" 1223094e47e9SGeorge Wilson 1224eb633035STom Caputi /* 1225eb633035STom Caputi * Special nvlist name that will not have its args recorded in the pool's 1226eb633035STom Caputi * history log. 1227eb633035STom Caputi */ 1228eb633035STom Caputi #define ZPOOL_HIDDEN_ARGS "hidden_args" 1229eb633035STom Caputi 1230*084fd14fSBrian Behlendorf /* 1231*084fd14fSBrian Behlendorf * The following are names used when invoking ZFS_IOC_POOL_TRIM. 1232*084fd14fSBrian Behlendorf */ 1233*084fd14fSBrian Behlendorf #define ZPOOL_TRIM_COMMAND "trim_command" 1234*084fd14fSBrian Behlendorf #define ZPOOL_TRIM_VDEVS "trim_vdevs" 1235*084fd14fSBrian Behlendorf #define ZPOOL_TRIM_RATE "trim_rate" 1236*084fd14fSBrian Behlendorf #define ZPOOL_TRIM_SECURE "trim_secure" 1237*084fd14fSBrian Behlendorf 12383d7072f8Seschrock /* 12393d7072f8Seschrock * Flags for ZFS_IOC_VDEV_SET_STATE 12403d7072f8Seschrock */ 12413d7072f8Seschrock #define ZFS_ONLINE_CHECKREMOVE 0x1 12423d7072f8Seschrock #define ZFS_ONLINE_UNSPARE 0x2 12433d7072f8Seschrock #define ZFS_ONLINE_FORCEFAULT 0x4 1244573ca77eSGeorge Wilson #define ZFS_ONLINE_EXPAND 0x8 12453d7072f8Seschrock #define ZFS_OFFLINE_TEMPORARY 0x1 12463d7072f8Seschrock 12474b964adaSGeorge Wilson /* 12484b964adaSGeorge Wilson * Flags for ZFS_IOC_POOL_IMPORT 12494b964adaSGeorge Wilson */ 12504b964adaSGeorge Wilson #define ZFS_IMPORT_NORMAL 0x0 12514b964adaSGeorge Wilson #define ZFS_IMPORT_VERBATIM 0x1 12524b964adaSGeorge Wilson #define ZFS_IMPORT_ANY_HOST 0x2 12534b964adaSGeorge Wilson #define ZFS_IMPORT_MISSING_LOG 0x4 1254f9af39baSGeorge Wilson #define ZFS_IMPORT_ONLY 0x8 125586714001SSerapheim Dimitropoulos #define ZFS_IMPORT_CHECKPOINT 0x10 125604e56356SAndriy Gapon #define ZFS_IMPORT_TEMP_NAME 0x20 1257e0f1c0afSOlaf Faaland #define ZFS_IMPORT_SKIP_MMP 0x40 1258eb633035STom Caputi #define ZFS_IMPORT_LOAD_KEYS 0x80 12594b964adaSGeorge Wilson 1260dfc11533SChris Williamson /* 1261dfc11533SChris Williamson * Channel program argument/return nvlist keys and defaults. 1262dfc11533SChris Williamson */ 1263dfc11533SChris Williamson #define ZCP_ARG_PROGRAM "program" 1264dfc11533SChris Williamson #define ZCP_ARG_ARGLIST "arg" 1265a3b28680SSerapheim Dimitropoulos #define ZCP_ARG_SYNC "sync" 1266dfc11533SChris Williamson #define ZCP_ARG_INSTRLIMIT "instrlimit" 1267dfc11533SChris Williamson #define ZCP_ARG_MEMLIMIT "memlimit" 1268dfc11533SChris Williamson 1269dfc11533SChris Williamson #define ZCP_ARG_CLIARGV "argv" 1270dfc11533SChris Williamson 1271dfc11533SChris Williamson #define ZCP_RET_ERROR "error" 1272dfc11533SChris Williamson #define ZCP_RET_RETURN "return" 1273dfc11533SChris Williamson 1274dfc11533SChris Williamson #define ZCP_DEFAULT_INSTRLIMIT (10 * 1000 * 1000) 1275dfc11533SChris Williamson #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) 1276dfc11533SChris Williamson #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) 1277dfc11533SChris Williamson #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) 1278dfc11533SChris Williamson 12793d7072f8Seschrock /* 12803d7072f8Seschrock * Sysevent payload members. ZFS will generate the following sysevents with the 12813d7072f8Seschrock * given payloads: 12823d7072f8Seschrock * 12833d7072f8Seschrock * ESC_ZFS_RESILVER_START 12843d7072f8Seschrock * ESC_ZFS_RESILVER_END 12853d7072f8Seschrock * ESC_ZFS_POOL_DESTROY 1286e9103aaeSGarrett D'Amore * ESC_ZFS_POOL_REGUID 12873d7072f8Seschrock * 12883d7072f8Seschrock * ZFS_EV_POOL_NAME DATA_TYPE_STRING 12893d7072f8Seschrock * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 12903d7072f8Seschrock * 12913d7072f8Seschrock * ESC_ZFS_VDEV_REMOVE 12923d7072f8Seschrock * ESC_ZFS_VDEV_CLEAR 12933d7072f8Seschrock * ESC_ZFS_VDEV_CHECK 12943d7072f8Seschrock * 12953d7072f8Seschrock * ZFS_EV_POOL_NAME DATA_TYPE_STRING 12963d7072f8Seschrock * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 12973d7072f8Seschrock * ZFS_EV_VDEV_PATH DATA_TYPE_STRING (optional) 12983d7072f8Seschrock * ZFS_EV_VDEV_GUID DATA_TYPE_UINT64 1299ce1577b0SDave Eddy * 1300ce1577b0SDave Eddy * ESC_ZFS_HISTORY_EVENT 1301ce1577b0SDave Eddy * 1302ce1577b0SDave Eddy * ZFS_EV_POOL_NAME DATA_TYPE_STRING 1303ce1577b0SDave Eddy * ZFS_EV_POOL_GUID DATA_TYPE_UINT64 1304ce1577b0SDave Eddy * ZFS_EV_HIST_TIME DATA_TYPE_UINT64 (optional) 1305ce1577b0SDave Eddy * ZFS_EV_HIST_CMD DATA_TYPE_STRING (optional) 1306ce1577b0SDave Eddy * ZFS_EV_HIST_WHO DATA_TYPE_UINT64 (optional) 1307ce1577b0SDave Eddy * ZFS_EV_HIST_ZONE DATA_TYPE_STRING (optional) 1308ce1577b0SDave Eddy * ZFS_EV_HIST_HOST DATA_TYPE_STRING (optional) 1309ce1577b0SDave Eddy * ZFS_EV_HIST_TXG DATA_TYPE_UINT64 (optional) 1310ce1577b0SDave Eddy * ZFS_EV_HIST_INT_EVENT DATA_TYPE_UINT64 (optional) 1311ce1577b0SDave Eddy * ZFS_EV_HIST_INT_STR DATA_TYPE_STRING (optional) 1312ce1577b0SDave Eddy * ZFS_EV_HIST_INT_NAME DATA_TYPE_STRING (optional) 1313ce1577b0SDave Eddy * ZFS_EV_HIST_IOCTL DATA_TYPE_STRING (optional) 1314ce1577b0SDave Eddy * ZFS_EV_HIST_DSNAME DATA_TYPE_STRING (optional) 1315ce1577b0SDave Eddy * ZFS_EV_HIST_DSID DATA_TYPE_UINT64 (optional) 1316ce1577b0SDave Eddy * 1317ce1577b0SDave Eddy * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the 1318ce1577b0SDave Eddy * history log nvlist. The keynames will be free of any spaces or other 1319ce1577b0SDave Eddy * characters that could be potentially unexpected to consumers of the 1320ce1577b0SDave Eddy * sysevents. 13213d7072f8Seschrock */ 13223d7072f8Seschrock #define ZFS_EV_POOL_NAME "pool_name" 13233d7072f8Seschrock #define ZFS_EV_POOL_GUID "pool_guid" 13243d7072f8Seschrock #define ZFS_EV_VDEV_PATH "vdev_path" 13253d7072f8Seschrock #define ZFS_EV_VDEV_GUID "vdev_guid" 1326ce1577b0SDave Eddy #define ZFS_EV_HIST_TIME "history_time" 1327ce1577b0SDave Eddy #define ZFS_EV_HIST_CMD "history_command" 1328ce1577b0SDave Eddy #define ZFS_EV_HIST_WHO "history_who" 1329ce1577b0SDave Eddy #define ZFS_EV_HIST_ZONE "history_zone" 1330ce1577b0SDave Eddy #define ZFS_EV_HIST_HOST "history_hostname" 1331ce1577b0SDave Eddy #define ZFS_EV_HIST_TXG "history_txg" 1332ce1577b0SDave Eddy #define ZFS_EV_HIST_INT_EVENT "history_internal_event" 1333ce1577b0SDave Eddy #define ZFS_EV_HIST_INT_STR "history_internal_str" 1334ce1577b0SDave Eddy #define ZFS_EV_HIST_INT_NAME "history_internal_name" 1335ce1577b0SDave Eddy #define ZFS_EV_HIST_IOCTL "history_ioctl" 1336ce1577b0SDave Eddy #define ZFS_EV_HIST_DSNAME "history_dsname" 1337ce1577b0SDave Eddy #define ZFS_EV_HIST_DSID "history_dsid" 13383d7072f8Seschrock 1339fa9e4066Sahrens #ifdef __cplusplus 1340fa9e4066Sahrens } 1341fa9e4066Sahrens #endif 1342fa9e4066Sahrens 1343fa9e4066Sahrens #endif /* _SYS_FS_ZFS_H */ 1344