Print this page
    
usr/src/cmd/zpool/zpool_util.c
    
      
        | Split | 
	Close | 
      
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/common/sys/fs/zfs.h
          +++ new/usr/src/uts/common/sys/fs/zfs.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  
    | 
      ↓ open down ↓ | 
    14 lines elided | 
    
      ↑ open up ↑ | 
  
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  25      - * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
       26 + * Copyright (c) 2013, Saso Kiselkov. All rights reserved.
  26   27   * Copyright (c) 2014 Integros [integros.com]
  27   28   * Copyright 2017 Joyent, Inc.
  28   29   * Copyright (c) 2017 Datto Inc.
  29   30   */
  30   31  
  31   32  /* Portions Copyright 2010 Robert Milkowski */
  32   33  
  33   34  #ifndef _SYS_FS_ZFS_H
  34   35  #define _SYS_FS_ZFS_H
  35   36  
  36   37  #include <sys/time.h>
  37   38  
  38   39  #ifdef  __cplusplus
  39   40  extern "C" {
  40   41  #endif
  41   42  
  42   43  /*
  43   44   * Types and constants shared between userland and the kernel.
  44   45   */
  
    | 
      ↓ open down ↓ | 
    9 lines elided | 
    
      ↑ open up ↑ | 
  
  45   46  
  46   47  /*
  47   48   * Each dataset can be one of the following types.  These constants can be
  48   49   * combined into masks that can be passed to various functions.
  49   50   */
  50   51  typedef enum {
  51   52          ZFS_TYPE_FILESYSTEM     = (1 << 0),
  52   53          ZFS_TYPE_SNAPSHOT       = (1 << 1),
  53   54          ZFS_TYPE_VOLUME         = (1 << 2),
  54   55          ZFS_TYPE_POOL           = (1 << 3),
  55      -        ZFS_TYPE_BOOKMARK       = (1 << 4)
       56 +        ZFS_TYPE_BOOKMARK       = (1 << 4),
       57 +        ZFS_TYPE_VDEV           = (1 << 5),
       58 +        ZFS_TYPE_COS            = (1 << 6),
       59 +        ZFS_TYPE_AUTOSNAP       = (1 << 7)
  56   60  } zfs_type_t;
  57   61  
  58   62  /*
  59   63   * NB: lzc_dataset_type should be updated whenever a new objset type is added,
  60   64   * if it represents a real type of a dataset that can be created from userland.
  61   65   */
  62   66  typedef enum dmu_objset_type {
  63   67          DMU_OST_NONE,
  64   68          DMU_OST_META,
  65   69          DMU_OST_ZFS,
  66   70          DMU_OST_ZVOL,
  67   71          DMU_OST_OTHER,                  /* For testing only! */
  68   72          DMU_OST_ANY,                    /* Be careful! */
  69   73          DMU_OST_NUMTYPES
  70   74  } dmu_objset_type_t;
  71   75  
  72   76  #define ZFS_TYPE_DATASET        \
  73      -        (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME | ZFS_TYPE_SNAPSHOT)
       77 +        (ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME |\
       78 +    ZFS_TYPE_SNAPSHOT | ZFS_TYPE_AUTOSNAP)
  74   79  
  75   80  /*
  76   81   * All of these include the terminating NUL byte.
  77   82   */
  78   83  #define ZAP_MAXNAMELEN 256
  79   84  #define ZAP_MAXVALUELEN (1024 * 8)
  80   85  #define ZAP_OLDMAXVALUELEN 1024
  81   86  #define ZFS_MAX_DATASET_NAME_LEN 256
  82   87  
  83   88  /*
  84   89   * Dataset properties are identified by these constants and must be added to
  85   90   * the end of this list to ensure that external consumers are not affected
  86   91   * by the change. If you make any changes to this list, be sure to update
  87   92   * the property table in usr/src/common/zfs/zfs_prop.c.
  88   93   */
  89   94  typedef enum {
  90      -        ZPROP_CONT = -2,
  91      -        ZPROP_INVAL = -1,
       95 +        ZFS_PROP_BAD = -1,
  92   96          ZFS_PROP_TYPE = 0,
  93   97          ZFS_PROP_CREATION,
  94   98          ZFS_PROP_USED,
  95   99          ZFS_PROP_AVAILABLE,
  96  100          ZFS_PROP_REFERENCED,
  97  101          ZFS_PROP_COMPRESSRATIO,
  98  102          ZFS_PROP_MOUNTED,
  99  103          ZFS_PROP_ORIGIN,
 100  104          ZFS_PROP_QUOTA,
 101  105          ZFS_PROP_RESERVATION,
 102  106          ZFS_PROP_VOLSIZE,
 103  107          ZFS_PROP_VOLBLOCKSIZE,
 104  108          ZFS_PROP_RECORDSIZE,
 105  109          ZFS_PROP_MOUNTPOINT,
 106  110          ZFS_PROP_SHARENFS,
 107  111          ZFS_PROP_CHECKSUM,
 108  112          ZFS_PROP_COMPRESSION,
 109  113          ZFS_PROP_ATIME,
 110  114          ZFS_PROP_DEVICES,
 111  115          ZFS_PROP_EXEC,
 112  116          ZFS_PROP_SETUID,
 113  117          ZFS_PROP_READONLY,
 114  118          ZFS_PROP_ZONED,
 115  119          ZFS_PROP_SNAPDIR,
 116  120          ZFS_PROP_ACLMODE,
 117  121          ZFS_PROP_ACLINHERIT,
 118  122          ZFS_PROP_CREATETXG,             /* not exposed to the user */
 119  123          ZFS_PROP_NAME,                  /* not exposed to the user */
 120  124          ZFS_PROP_CANMOUNT,
 121  125          ZFS_PROP_ISCSIOPTIONS,          /* not exposed to the user */
 122  126          ZFS_PROP_XATTR,
 123  127          ZFS_PROP_NUMCLONES,             /* not exposed to the user */
 124  128          ZFS_PROP_COPIES,
 125  129          ZFS_PROP_VERSION,
 126  130          ZFS_PROP_UTF8ONLY,
 127  131          ZFS_PROP_NORMALIZE,
 128  132          ZFS_PROP_CASE,
 129  133          ZFS_PROP_VSCAN,
 130  134          ZFS_PROP_NBMAND,
 131  135          ZFS_PROP_SHARESMB,
 132  136          ZFS_PROP_REFQUOTA,
 133  137          ZFS_PROP_REFRESERVATION,
 134  138          ZFS_PROP_GUID,
 135  139          ZFS_PROP_PRIMARYCACHE,
 136  140          ZFS_PROP_SECONDARYCACHE,
 137  141          ZFS_PROP_USEDSNAP,
 138  142          ZFS_PROP_USEDDS,
 139  143          ZFS_PROP_USEDCHILD,
 140  144          ZFS_PROP_USEDREFRESERV,
 141  145          ZFS_PROP_USERACCOUNTING,        /* not exposed to the user */
 142  146          ZFS_PROP_STMF_SHAREINFO,        /* not exposed to the user */
 143  147          ZFS_PROP_DEFER_DESTROY,
 144  148          ZFS_PROP_USERREFS,
 145  149          ZFS_PROP_LOGBIAS,
 146  150          ZFS_PROP_UNIQUE,                /* not exposed to the user */
 147  151          ZFS_PROP_OBJSETID,              /* not exposed to the user */
 148  152          ZFS_PROP_DEDUP,
 149  153          ZFS_PROP_MLSLABEL,
 150  154          ZFS_PROP_SYNC,
 151  155          ZFS_PROP_REFRATIO,
 152  156          ZFS_PROP_WRITTEN,
  
    | 
      ↓ open down ↓ | 
    51 lines elided | 
    
      ↑ open up ↑ | 
  
 153  157          ZFS_PROP_CLONES,
 154  158          ZFS_PROP_LOGICALUSED,
 155  159          ZFS_PROP_LOGICALREFERENCED,
 156  160          ZFS_PROP_INCONSISTENT,          /* not exposed to the user */
 157  161          ZFS_PROP_FILESYSTEM_LIMIT,
 158  162          ZFS_PROP_SNAPSHOT_LIMIT,
 159  163          ZFS_PROP_FILESYSTEM_COUNT,
 160  164          ZFS_PROP_SNAPSHOT_COUNT,
 161  165          ZFS_PROP_REDUNDANT_METADATA,
 162  166          ZFS_PROP_PREV_SNAP,
      167 +        ZFS_PROP_LSTXG,
      168 +        ZFS_PROP_ZPL_META_TO_METADEV,
      169 +        ZFS_PROP_WBC_MODE,
 163  170          ZFS_PROP_RECEIVE_RESUME_TOKEN,
 164      -        ZFS_PROP_REMAPTXG,              /* not exposed to the user */
      171 +        ZFS_PROP_SMARTCOMPRESSION,
      172 +        ZFS_PROP_RATE_LIMIT,
      173 +        ZFS_PROP_MODIFIED,
 165  174          ZFS_NUM_PROPS
 166  175  } zfs_prop_t;
 167  176  
 168  177  typedef enum {
 169  178          ZFS_PROP_USERUSED,
 170  179          ZFS_PROP_USERQUOTA,
 171  180          ZFS_PROP_GROUPUSED,
 172  181          ZFS_PROP_GROUPQUOTA,
 173  182          ZFS_NUM_USERQUOTA_PROPS
 174  183  } zfs_userquota_prop_t;
 175  184  
 176  185  extern const char *zfs_userquota_prop_prefixes[ZFS_NUM_USERQUOTA_PROPS];
 177  186  
 178  187  /*
 179  188   * Pool properties are identified by these constants and must be added to the
 180  189   * end of this list to ensure that external consumers are not affected
 181  190   * by the change. If you make any changes to this list, be sure to update
 182  191   * the property table in usr/src/common/zfs/zpool_prop.c.
      192 + *
      193 + * NOTE: When either adding or changing a feature make sure
      194 + * to update the zfs-tests zpool_get configuration file
      195 + * at usr/src/test/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
 183  196   */
 184  197  typedef enum {
 185      -        ZPOOL_PROP_INVAL = -1,
 186  198          ZPOOL_PROP_NAME,
 187  199          ZPOOL_PROP_SIZE,
 188  200          ZPOOL_PROP_CAPACITY,
 189  201          ZPOOL_PROP_ALTROOT,
 190  202          ZPOOL_PROP_HEALTH,
 191  203          ZPOOL_PROP_GUID,
 192  204          ZPOOL_PROP_VERSION,
 193  205          ZPOOL_PROP_BOOTFS,
 194  206          ZPOOL_PROP_DELEGATION,
 195  207          ZPOOL_PROP_AUTOREPLACE,
 196  208          ZPOOL_PROP_CACHEFILE,
 197  209          ZPOOL_PROP_FAILUREMODE,
 198  210          ZPOOL_PROP_LISTSNAPS,
 199  211          ZPOOL_PROP_AUTOEXPAND,
 200  212          ZPOOL_PROP_DEDUPDITTO,
 201  213          ZPOOL_PROP_DEDUPRATIO,
      214 +        ZPOOL_PROP_DDTCAPPED,
 202  215          ZPOOL_PROP_FREE,
 203  216          ZPOOL_PROP_ALLOCATED,
 204  217          ZPOOL_PROP_READONLY,
 205  218          ZPOOL_PROP_COMMENT,
 206  219          ZPOOL_PROP_EXPANDSZ,
 207  220          ZPOOL_PROP_FREEING,
 208  221          ZPOOL_PROP_FRAGMENTATION,
 209  222          ZPOOL_PROP_LEAKED,
 210  223          ZPOOL_PROP_MAXBLOCKSIZE,
      224 +        ZPOOL_PROP_ENABLESPECIAL,
      225 +        ZPOOL_PROP_LOWATERMARK,
      226 +        ZPOOL_PROP_HIWATERMARK,
      227 +        ZPOOL_PROP_DEDUPMETA_DITTO,
      228 +        ZPOOL_PROP_DDT_DESEGREGATION,
      229 +        ZPOOL_PROP_META_PLACEMENT,
      230 +        ZPOOL_PROP_DDT_META_TO_METADEV,
      231 +        ZPOOL_PROP_ZFS_META_TO_METADEV,
      232 +        ZPOOL_PROP_DEDUP_BEST_EFFORT,
      233 +        ZPOOL_PROP_DEDUP_LO_BEST_EFFORT,
      234 +        ZPOOL_PROP_DEDUP_HI_BEST_EFFORT,
      235 +        ZPOOL_PROP_FORCETRIM,
      236 +        ZPOOL_PROP_AUTOTRIM,
      237 +        ZPOOL_PROP_SMALL_DATA_TO_METADEV,
      238 +        ZPOOL_PROP_MINWATERMARK,
      239 +        ZPOOL_PROP_SYNC_TO_SPECIAL,
 211  240          ZPOOL_PROP_BOOTSIZE,
      241 +        ZPOOL_PROP_SCRUB_PRIO,
      242 +        ZPOOL_PROP_RESILVER_PRIO,
 212  243          ZPOOL_NUM_PROPS
 213  244  } zpool_prop_t;
 214  245  
      246 +/*
      247 + * Note: it is important to keep min/max active properties together in the
      248 + * same order as the corresponding zio_priority_t definitions as this order
      249 + * is relied upon when processing in loops. See vdev_impl.h for the set of
      250 + * macros that rely on this dependency.
      251 + * Also path must be the first entry in the enum as loops use it as a starting
      252 + * index.
      253 + */
      254 +typedef enum vdev_prop {
      255 +        VDEV_PROP_PATH,
      256 +        VDEV_PROP_FRU,
      257 +        /* minactive props for queue classes */
      258 +        VDEV_PROP_READ_MINACTIVE,
      259 +        VDEV_PROP_AREAD_MINACTIVE,
      260 +        VDEV_PROP_WRITE_MINACTIVE,
      261 +        VDEV_PROP_AWRITE_MINACTIVE,
      262 +        VDEV_PROP_RESILVER_MINACTIVE,
      263 +        VDEV_PROP_SCRUB_MINACTIVE,
      264 +        /* maxactive props for queue classes */
      265 +        VDEV_PROP_READ_MAXACTIVE,
      266 +        VDEV_PROP_AREAD_MAXACTIVE,
      267 +        VDEV_PROP_WRITE_MAXACTIVE,
      268 +        VDEV_PROP_AWRITE_MAXACTIVE,
      269 +        VDEV_PROP_RESILVER_MAXACTIVE,
      270 +        VDEV_PROP_SCRUB_MAXACTIVE,
      271 +        VDEV_PROP_PREFERRED_READ,
      272 +        VDEV_PROP_COS,
      273 +        VDEV_PROP_SPAREGROUP,
      274 +        VDEV_PROP_L2ADDDT,
      275 +        VDEV_PROP_GUID,
      276 +        VDEV_NUM_PROPS
      277 +} vdev_prop_t;
      278 +
      279 +/*
      280 + * Note: it is important to keep min/max active properties together in the
      281 + * same order as the corresponding zio_priority_t definitions as this order
      282 + * is relied upon when processing in loops. See cos.h for the set of
      283 + * macros that rely on this dependency.
      284 + */
      285 +typedef enum cos_prop {
      286 +        COS_PROP_GUID,
      287 +        /* user-defined cos name */
      288 +        COS_PROP_NAME,
      289 +        /* IO tunables */
      290 +        /* minactive props for queue classes */
      291 +        COS_PROP_READ_MINACTIVE,
      292 +        COS_PROP_AREAD_MINACTIVE,
      293 +        COS_PROP_WRITE_MINACTIVE,
      294 +        COS_PROP_AWRITE_MINACTIVE,
      295 +        COS_PROP_RESILVER_MINACTIVE,
      296 +        COS_PROP_SCRUB_MINACTIVE,
      297 +        /* maxactive props for queue classes */
      298 +        COS_PROP_READ_MAXACTIVE,
      299 +        COS_PROP_AREAD_MAXACTIVE,
      300 +        COS_PROP_WRITE_MAXACTIVE,
      301 +        COS_PROP_AWRITE_MAXACTIVE,
      302 +        COS_PROP_RESILVER_MAXACTIVE,
      303 +        COS_PROP_SCRUB_MAXACTIVE,
      304 +        /* preference for read in mirror configurations */
      305 +        COS_PROP_PREFERRED_READ,
      306 +        COS_NUM_PROPS
      307 +} cos_prop_t;
      308 +
 215  309  /* Small enough to not hog a whole line of printout in zpool(1M). */
 216  310  #define ZPROP_MAX_COMMENT       32
 217  311  
      312 +#define ZPROP_CONT              -2
      313 +#define ZPROP_INVAL             -1
      314 +
 218  315  #define ZPROP_VALUE             "value"
 219  316  #define ZPROP_SOURCE            "source"
 220  317  
 221  318  typedef enum {
 222  319          ZPROP_SRC_NONE = 0x1,
 223  320          ZPROP_SRC_DEFAULT = 0x2,
 224  321          ZPROP_SRC_TEMPORARY = 0x4,
 225  322          ZPROP_SRC_LOCAL = 0x8,
 226  323          ZPROP_SRC_INHERITED = 0x10,
 227  324          ZPROP_SRC_RECEIVED = 0x20
 228  325  } zprop_source_t;
 229  326  
 230  327  #define ZPROP_SRC_ALL   0x3f
 231  328  
 232  329  #define ZPROP_SOURCE_VAL_RECVD  "$recvd"
 233  330  #define ZPROP_N_MORE_ERRORS     "N_MORE_ERRORS"
 234  331  /*
 235  332   * Dataset flag implemented as a special entry in the props zap object
 236  333   * indicating that the dataset has received properties on or after
 237  334   * SPA_VERSION_RECVD_PROPS. The first such receive blows away local properties
 238  335   * just as it did in earlier versions, and thereafter, local properties are
 239  336   * preserved.
 240  337   */
 241  338  #define ZPROP_HAS_RECVD         "$hasrecvd"
 242  339  
 243  340  typedef enum {
 244  341          ZPROP_ERR_NOCLEAR = 0x1, /* failure to clear existing props */
 245  342          ZPROP_ERR_NORESTORE = 0x2 /* failure to restore props on error */
 246  343  } zprop_errflags_t;
 247  344  
 248  345  typedef int (*zprop_func)(int, void *);
 249  346  
 250  347  /*
 251  348   * Properties to be set on the root file system of a new pool
 252  349   * are stuffed into their own nvlist, which is then included in
 253  350   * the properties nvlist with the pool properties.
 254  351   */
 255  352  #define ZPOOL_ROOTFS_PROPS      "root-props-nvl"
 256  353  
 257  354  /*
 258  355   * Length of 'written@' and 'written#'
 259  356   */
 260  357  #define ZFS_WRITTEN_PROP_PREFIX_LEN     8
 261  358  
 262  359  /*
 263  360   * Dataset property functions shared between libzfs and kernel.
 264  361   */
 265  362  const char *zfs_prop_default_string(zfs_prop_t);
 266  363  uint64_t zfs_prop_default_numeric(zfs_prop_t);
 267  364  boolean_t zfs_prop_readonly(zfs_prop_t);
 268  365  boolean_t zfs_prop_visible(zfs_prop_t prop);
 269  366  boolean_t zfs_prop_inheritable(zfs_prop_t);
 270  367  boolean_t zfs_prop_setonce(zfs_prop_t);
 271  368  const char *zfs_prop_to_name(zfs_prop_t);
 272  369  zfs_prop_t zfs_name_to_prop(const char *);
 273  370  boolean_t zfs_prop_user(const char *);
 274  371  boolean_t zfs_prop_userquota(const char *);
 275  372  boolean_t zfs_prop_written(const char *);
 276  373  int zfs_prop_index_to_string(zfs_prop_t, uint64_t, const char **);
 277  374  int zfs_prop_string_to_index(zfs_prop_t, const char *, uint64_t *);
 278  375  uint64_t zfs_prop_random_value(zfs_prop_t, uint64_t seed);
 279  376  boolean_t zfs_prop_valid_for_type(int, zfs_type_t);
 280  377  
 281  378  /*
 282  379   * Pool property functions shared between libzfs and kernel.
 283  380   */
 284  381  zpool_prop_t zpool_name_to_prop(const char *);
 285  382  const char *zpool_prop_to_name(zpool_prop_t);
  
    | 
      ↓ open down ↓ | 
    58 lines elided | 
    
      ↑ open up ↑ | 
  
 286  383  const char *zpool_prop_default_string(zpool_prop_t);
 287  384  uint64_t zpool_prop_default_numeric(zpool_prop_t);
 288  385  boolean_t zpool_prop_readonly(zpool_prop_t);
 289  386  boolean_t zpool_prop_feature(const char *);
 290  387  boolean_t zpool_prop_unsupported(const char *name);
 291  388  int zpool_prop_index_to_string(zpool_prop_t, uint64_t, const char **);
 292  389  int zpool_prop_string_to_index(zpool_prop_t, const char *, uint64_t *);
 293  390  uint64_t zpool_prop_random_value(zpool_prop_t, uint64_t seed);
 294  391  
 295  392  /*
      393 + * Vdev property functions shared between libzfs and kernel.
      394 + */
      395 +vdev_prop_t vdev_name_to_prop(const char *);
      396 +const char *vdev_prop_to_name(vdev_prop_t);
      397 +const char *vdev_prop_default_string(vdev_prop_t);
      398 +uint64_t vdev_prop_default_numeric(vdev_prop_t);
      399 +boolean_t vdev_prop_readonly(vdev_prop_t);
      400 +int vdev_prop_index_to_string(vdev_prop_t, uint64_t, const char **);
      401 +int vdev_prop_string_to_index(vdev_prop_t, const char *, uint64_t *);
      402 +uint64_t vdev_prop_random_value(vdev_prop_t, uint64_t seed);
      403 +
      404 +/*
      405 + * COS property functions shared between libzfs and kernel.
      406 + */
      407 +cos_prop_t cos_name_to_prop(const char *);
      408 +const char *cos_prop_to_name(cos_prop_t);
      409 +const char *cos_prop_default_string(cos_prop_t);
      410 +uint64_t cos_prop_default_numeric(cos_prop_t);
      411 +boolean_t cos_prop_readonly(cos_prop_t);
      412 +int cos_prop_index_to_string(cos_prop_t, uint64_t, const char **);
      413 +int cos_prop_string_to_index(cos_prop_t, const char *, uint64_t *);
      414 +uint64_t cos_prop_random_value(cos_prop_t, uint64_t seed);
      415 +
      416 +#define MAXCOSNAMELEN   (64)
      417 +/*
 296  418   * Definitions for the Delegation.
 297  419   */
 298  420  typedef enum {
 299  421          ZFS_DELEG_WHO_UNKNOWN = 0,
 300  422          ZFS_DELEG_USER = 'u',
 301  423          ZFS_DELEG_USER_SETS = 'U',
 302  424          ZFS_DELEG_GROUP = 'g',
 303  425          ZFS_DELEG_GROUP_SETS = 'G',
 304  426          ZFS_DELEG_EVERYONE = 'e',
 305  427          ZFS_DELEG_EVERYONE_SETS = 'E',
 306  428          ZFS_DELEG_CREATE = 'c',
 307  429          ZFS_DELEG_CREATE_SETS = 'C',
 308  430          ZFS_DELEG_NAMED_SET = 's',
 309  431          ZFS_DELEG_NAMED_SET_SETS = 'S'
 310  432  } zfs_deleg_who_type_t;
 311  433  
 312  434  typedef enum {
 313  435          ZFS_DELEG_NONE = 0,
 314  436          ZFS_DELEG_PERM_LOCAL = 1,
 315  437          ZFS_DELEG_PERM_DESCENDENT = 2,
 316  438          ZFS_DELEG_PERM_LOCALDESCENDENT = 3,
 317  439          ZFS_DELEG_PERM_CREATE = 4
 318  440  } zfs_deleg_inherit_t;
 319  441  
 320  442  #define ZFS_DELEG_PERM_UID      "uid"
 321  443  #define ZFS_DELEG_PERM_GID      "gid"
 322  444  #define ZFS_DELEG_PERM_GROUPS   "groups"
 323  445  
 324  446  #define ZFS_MLSLABEL_DEFAULT    "none"
 325  447  
 326  448  #define ZFS_SMB_ACL_SRC         "src"
 327  449  #define ZFS_SMB_ACL_TARGET      "target"
 328  450  
 329  451  typedef enum {
 330  452          ZFS_CANMOUNT_OFF = 0,
 331  453          ZFS_CANMOUNT_ON = 1,
 332  454          ZFS_CANMOUNT_NOAUTO = 2
 333  455  } zfs_canmount_type_t;
 334  456  
 335  457  typedef enum {
 336  458          ZFS_LOGBIAS_LATENCY = 0,
 337  459          ZFS_LOGBIAS_THROUGHPUT = 1
 338  460  } zfs_logbias_op_t;
 339  461  
 340  462  typedef enum zfs_share_op {
 341  463          ZFS_SHARE_NFS = 0,
 342  464          ZFS_UNSHARE_NFS = 1,
 343  465          ZFS_SHARE_SMB = 2,
 344  466          ZFS_UNSHARE_SMB = 3
 345  467  } zfs_share_op_t;
 346  468  
  
    | 
      ↓ open down ↓ | 
    41 lines elided | 
    
      ↑ open up ↑ | 
  
 347  469  typedef enum zfs_smb_acl_op {
 348  470          ZFS_SMB_ACL_ADD,
 349  471          ZFS_SMB_ACL_REMOVE,
 350  472          ZFS_SMB_ACL_RENAME,
 351  473          ZFS_SMB_ACL_PURGE
 352  474  } zfs_smb_acl_op_t;
 353  475  
 354  476  typedef enum zfs_cache_type {
 355  477          ZFS_CACHE_NONE = 0,
 356  478          ZFS_CACHE_METADATA = 1,
 357      -        ZFS_CACHE_ALL = 2
      479 +        ZFS_CACHE_ALL = 2,
      480 +        ZFS_CACHE_DATA = 3
 358  481  } zfs_cache_type_t;
 359  482  
 360  483  typedef enum {
 361  484          ZFS_SYNC_STANDARD = 0,
 362  485          ZFS_SYNC_ALWAYS = 1,
 363  486          ZFS_SYNC_DISABLED = 2
 364  487  } zfs_sync_type_t;
 365  488  
 366  489  typedef enum {
 367  490          ZFS_REDUNDANT_METADATA_ALL,
 368  491          ZFS_REDUNDANT_METADATA_MOST
 369  492  } zfs_redundant_metadata_type_t;
 370  493  
      494 +typedef enum {
      495 +        ZFS_WBC_MODE_OFF,
      496 +        ZFS_WBC_MODE_ON,
      497 +        ZFS_WBC_MODE_OFF_DELAYED
      498 +} zfs_wbc_mode_t;
      499 +
 371  500  /*
 372  501   * On-disk version number.
 373  502   */
 374  503  #define SPA_VERSION_1                   1ULL
 375  504  #define SPA_VERSION_2                   2ULL
 376  505  #define SPA_VERSION_3                   3ULL
 377  506  #define SPA_VERSION_4                   4ULL
 378  507  #define SPA_VERSION_5                   5ULL
 379  508  #define SPA_VERSION_6                   6ULL
 380  509  #define SPA_VERSION_7                   7ULL
 381  510  #define SPA_VERSION_8                   8ULL
 382  511  #define SPA_VERSION_9                   9ULL
 383  512  #define SPA_VERSION_10                  10ULL
 384  513  #define SPA_VERSION_11                  11ULL
 385  514  #define SPA_VERSION_12                  12ULL
 386  515  #define SPA_VERSION_13                  13ULL
 387  516  #define SPA_VERSION_14                  14ULL
 388  517  #define SPA_VERSION_15                  15ULL
 389  518  #define SPA_VERSION_16                  16ULL
 390  519  #define SPA_VERSION_17                  17ULL
 391  520  #define SPA_VERSION_18                  18ULL
 392  521  #define SPA_VERSION_19                  19ULL
 393  522  #define SPA_VERSION_20                  20ULL
 394  523  #define SPA_VERSION_21                  21ULL
 395  524  #define SPA_VERSION_22                  22ULL
 396  525  #define SPA_VERSION_23                  23ULL
 397  526  #define SPA_VERSION_24                  24ULL
 398  527  #define SPA_VERSION_25                  25ULL
 399  528  #define SPA_VERSION_26                  26ULL
 400  529  #define SPA_VERSION_27                  27ULL
 401  530  #define SPA_VERSION_28                  28ULL
 402  531  #define SPA_VERSION_5000                5000ULL
 403  532  
 404  533  /*
 405  534   * When bumping up SPA_VERSION, make sure GRUB ZFS understands the on-disk
 406  535   * format change. Go to usr/src/grub/grub-0.97/stage2/{zfs-include/, fsys_zfs*},
 407  536   * and do the appropriate changes.  Also bump the version number in
 408  537   * usr/src/grub/capability.
 409  538   */
 410  539  #define SPA_VERSION                     SPA_VERSION_5000
 411  540  #define SPA_VERSION_STRING              "5000"
 412  541  
 413  542  /*
 414  543   * Symbolic names for the changes that caused a SPA_VERSION switch.
 415  544   * Used in the code when checking for presence or absence of a feature.
 416  545   * Feel free to define multiple symbolic names for each version if there
 417  546   * were multiple changes to on-disk structures during that version.
 418  547   *
 419  548   * NOTE: When checking the current SPA_VERSION in your code, be sure
 420  549   *       to use spa_version() since it reports the version of the
 421  550   *       last synced uberblock.  Checking the in-flight version can
 422  551   *       be dangerous in some cases.
 423  552   */
 424  553  #define SPA_VERSION_INITIAL             SPA_VERSION_1
 425  554  #define SPA_VERSION_DITTO_BLOCKS        SPA_VERSION_2
 426  555  #define SPA_VERSION_SPARES              SPA_VERSION_3
 427  556  #define SPA_VERSION_RAIDZ2              SPA_VERSION_3
 428  557  #define SPA_VERSION_BPOBJ_ACCOUNT       SPA_VERSION_3
 429  558  #define SPA_VERSION_RAIDZ_DEFLATE       SPA_VERSION_3
 430  559  #define SPA_VERSION_DNODE_BYTES         SPA_VERSION_3
 431  560  #define SPA_VERSION_ZPOOL_HISTORY       SPA_VERSION_4
 432  561  #define SPA_VERSION_GZIP_COMPRESSION    SPA_VERSION_5
 433  562  #define SPA_VERSION_BOOTFS              SPA_VERSION_6
 434  563  #define SPA_VERSION_SLOGS               SPA_VERSION_7
 435  564  #define SPA_VERSION_DELEGATED_PERMS     SPA_VERSION_8
 436  565  #define SPA_VERSION_FUID                SPA_VERSION_9
 437  566  #define SPA_VERSION_REFRESERVATION      SPA_VERSION_9
 438  567  #define SPA_VERSION_REFQUOTA            SPA_VERSION_9
 439  568  #define SPA_VERSION_UNIQUE_ACCURATE     SPA_VERSION_9
 440  569  #define SPA_VERSION_L2CACHE             SPA_VERSION_10
 441  570  #define SPA_VERSION_NEXT_CLONES         SPA_VERSION_11
 442  571  #define SPA_VERSION_ORIGIN              SPA_VERSION_11
 443  572  #define SPA_VERSION_DSL_SCRUB           SPA_VERSION_11
 444  573  #define SPA_VERSION_SNAP_PROPS          SPA_VERSION_12
 445  574  #define SPA_VERSION_USED_BREAKDOWN      SPA_VERSION_13
 446  575  #define SPA_VERSION_PASSTHROUGH_X       SPA_VERSION_14
 447  576  #define SPA_VERSION_USERSPACE           SPA_VERSION_15
 448  577  #define SPA_VERSION_STMF_PROP           SPA_VERSION_16
 449  578  #define SPA_VERSION_RAIDZ3              SPA_VERSION_17
 450  579  #define SPA_VERSION_USERREFS            SPA_VERSION_18
 451  580  #define SPA_VERSION_HOLES               SPA_VERSION_19
 452  581  #define SPA_VERSION_ZLE_COMPRESSION     SPA_VERSION_20
 453  582  #define SPA_VERSION_DEDUP               SPA_VERSION_21
 454  583  #define SPA_VERSION_RECVD_PROPS         SPA_VERSION_22
 455  584  #define SPA_VERSION_SLIM_ZIL            SPA_VERSION_23
 456  585  #define SPA_VERSION_SA                  SPA_VERSION_24
 457  586  #define SPA_VERSION_SCAN                SPA_VERSION_25
 458  587  #define SPA_VERSION_DIR_CLONES          SPA_VERSION_26
 459  588  #define SPA_VERSION_DEADLISTS           SPA_VERSION_26
 460  589  #define SPA_VERSION_FAST_SNAP           SPA_VERSION_27
 461  590  #define SPA_VERSION_MULTI_REPLACE       SPA_VERSION_28
 462  591  #define SPA_VERSION_BEFORE_FEATURES     SPA_VERSION_28
 463  592  #define SPA_VERSION_FEATURES            SPA_VERSION_5000
 464  593  
 465  594  #define SPA_VERSION_IS_SUPPORTED(v) \
 466  595          (((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
 467  596          ((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
 468  597  
 469  598  /*
 470  599   * ZPL version - rev'd whenever an incompatible on-disk format change
 471  600   * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
 472  601   * also update the version_table[] and help message in zfs_prop.c.
 473  602   *
 474  603   * When changing, be sure to teach GRUB how to read the new format!
 475  604   * See usr/src/grub/grub-0.97/stage2/{zfs-include/,fsys_zfs*}
 476  605   */
 477  606  #define ZPL_VERSION_1                   1ULL
 478  607  #define ZPL_VERSION_2                   2ULL
 479  608  #define ZPL_VERSION_3                   3ULL
 480  609  #define ZPL_VERSION_4                   4ULL
 481  610  #define ZPL_VERSION_5                   5ULL
 482  611  #define ZPL_VERSION                     ZPL_VERSION_5
 483  612  #define ZPL_VERSION_STRING              "5"
 484  613  
 485  614  #define ZPL_VERSION_INITIAL             ZPL_VERSION_1
 486  615  #define ZPL_VERSION_DIRENT_TYPE         ZPL_VERSION_2
 487  616  #define ZPL_VERSION_FUID                ZPL_VERSION_3
 488  617  #define ZPL_VERSION_NORMALIZATION       ZPL_VERSION_3
 489  618  #define ZPL_VERSION_SYSATTR             ZPL_VERSION_3
 490  619  #define ZPL_VERSION_USERSPACE           ZPL_VERSION_4
 491  620  #define ZPL_VERSION_SA                  ZPL_VERSION_5
 492  621  
 493  622  /* Rewind request information */
 494  623  #define ZPOOL_NO_REWIND         1  /* No policy - default behavior */
 495  624  #define ZPOOL_NEVER_REWIND      2  /* Do not search for best txg or rewind */
 496  625  #define ZPOOL_TRY_REWIND        4  /* Search for best txg, but do not rewind */
 497  626  #define ZPOOL_DO_REWIND         8  /* Rewind to best txg w/in deferred frees */
 498  627  #define ZPOOL_EXTREME_REWIND    16 /* Allow extreme measures to find best txg */
 499  628  #define ZPOOL_REWIND_MASK       28 /* All the possible rewind bits */
 500  629  #define ZPOOL_REWIND_POLICIES   31 /* All the possible policy bits */
  
    | 
      ↓ open down ↓ | 
    120 lines elided | 
    
      ↑ open up ↑ | 
  
 501  630  
 502  631  typedef struct zpool_rewind_policy {
 503  632          uint32_t        zrp_request;    /* rewind behavior requested */
 504  633          uint64_t        zrp_maxmeta;    /* max acceptable meta-data errors */
 505  634          uint64_t        zrp_maxdata;    /* max acceptable data errors */
 506  635          uint64_t        zrp_txg;        /* specific txg to load */
 507  636  } zpool_rewind_policy_t;
 508  637  
 509  638  /*
 510  639   * The following are configuration names used in the nvlist describing a pool's
 511      - * configuration.  New on-disk names should be prefixed with "<reverse-DNS>:"
 512      - * (e.g. "org.open-zfs:") to avoid conflicting names being developed
 513      - * independently.
      640 + * configuration.
 514  641   */
 515  642  #define ZPOOL_CONFIG_VERSION            "version"
 516  643  #define ZPOOL_CONFIG_POOL_NAME          "name"
 517  644  #define ZPOOL_CONFIG_POOL_STATE         "state"
 518  645  #define ZPOOL_CONFIG_POOL_TXG           "txg"
 519  646  #define ZPOOL_CONFIG_POOL_GUID          "pool_guid"
 520  647  #define ZPOOL_CONFIG_CREATE_TXG         "create_txg"
 521  648  #define ZPOOL_CONFIG_TOP_GUID           "top_guid"
 522  649  #define ZPOOL_CONFIG_VDEV_TREE          "vdev_tree"
 523  650  #define ZPOOL_CONFIG_TYPE               "type"
 524  651  #define ZPOOL_CONFIG_CHILDREN           "children"
 525  652  #define ZPOOL_CONFIG_ID                 "id"
 526  653  #define ZPOOL_CONFIG_GUID               "guid"
 527      -#define ZPOOL_CONFIG_INDIRECT_OBJECT    "com.delphix:indirect_object"
 528      -#define ZPOOL_CONFIG_INDIRECT_BIRTHS    "com.delphix:indirect_births"
 529      -#define ZPOOL_CONFIG_PREV_INDIRECT_VDEV "com.delphix:prev_indirect_vdev"
 530  654  #define ZPOOL_CONFIG_PATH               "path"
 531  655  #define ZPOOL_CONFIG_DEVID              "devid"
 532  656  #define ZPOOL_CONFIG_METASLAB_ARRAY     "metaslab_array"
 533  657  #define ZPOOL_CONFIG_METASLAB_SHIFT     "metaslab_shift"
 534  658  #define ZPOOL_CONFIG_ASHIFT             "ashift"
 535  659  #define ZPOOL_CONFIG_ASIZE              "asize"
 536  660  #define ZPOOL_CONFIG_DTL                "DTL"
 537  661  #define ZPOOL_CONFIG_SCAN_STATS         "scan_stats"    /* not stored on disk */
 538      -#define ZPOOL_CONFIG_REMOVAL_STATS      "removal_stats" /* not stored on disk */
 539  662  #define ZPOOL_CONFIG_VDEV_STATS         "vdev_stats"    /* not stored on disk */
 540      -#define ZPOOL_CONFIG_INDIRECT_SIZE      "indirect_size" /* not stored on disk */
 541  663  #define ZPOOL_CONFIG_WHOLE_DISK         "whole_disk"
 542  664  #define ZPOOL_CONFIG_ERRCOUNT           "error_count"
 543  665  #define ZPOOL_CONFIG_NOT_PRESENT        "not_present"
 544  666  #define ZPOOL_CONFIG_SPARES             "spares"
 545  667  #define ZPOOL_CONFIG_IS_SPARE           "is_spare"
 546  668  #define ZPOOL_CONFIG_NPARITY            "nparity"
 547  669  #define ZPOOL_CONFIG_HOSTID             "hostid"
 548  670  #define ZPOOL_CONFIG_HOSTNAME           "hostname"
 549  671  #define ZPOOL_CONFIG_LOADED_TIME        "initial_load_time"
 550  672  #define ZPOOL_CONFIG_UNSPARE            "unspare"
 551  673  #define ZPOOL_CONFIG_PHYS_PATH          "phys_path"
 552  674  #define ZPOOL_CONFIG_IS_LOG             "is_log"
      675 +#define ZPOOL_CONFIG_IS_SPECIAL         "is_special"
 553  676  #define ZPOOL_CONFIG_L2CACHE            "l2cache"
      677 +#define ZPOOL_CONFIG_L2CACHE_PERSISTENT "l2cache_persistent"
 554  678  #define ZPOOL_CONFIG_HOLE_ARRAY         "hole_array"
 555  679  #define ZPOOL_CONFIG_VDEV_CHILDREN      "vdev_children"
 556  680  #define ZPOOL_CONFIG_IS_HOLE            "is_hole"
 557  681  #define ZPOOL_CONFIG_DDT_HISTOGRAM      "ddt_histogram"
 558  682  #define ZPOOL_CONFIG_DDT_OBJ_STATS      "ddt_object_stats"
 559  683  #define ZPOOL_CONFIG_DDT_STATS          "ddt_stats"
 560  684  #define ZPOOL_CONFIG_SPLIT              "splitcfg"
 561  685  #define ZPOOL_CONFIG_ORIG_GUID          "orig_guid"
 562  686  #define ZPOOL_CONFIG_SPLIT_GUID         "split_guid"
 563  687  #define ZPOOL_CONFIG_SPLIT_LIST         "guid_list"
 564  688  #define ZPOOL_CONFIG_REMOVING           "removing"
      689 +#define ZPOOL_CONFIG_RESILVERING        "resilvering"
 565  690  #define ZPOOL_CONFIG_RESILVER_TXG       "resilver_txg"
 566  691  #define ZPOOL_CONFIG_COMMENT            "comment"
 567  692  #define ZPOOL_CONFIG_SUSPENDED          "suspended"     /* not stored on disk */
 568  693  #define ZPOOL_CONFIG_TIMESTAMP          "timestamp"     /* not stored on disk */
 569  694  #define ZPOOL_CONFIG_BOOTFS             "bootfs"        /* not stored on disk */
 570  695  #define ZPOOL_CONFIG_MISSING_DEVICES    "missing_vdevs" /* not stored on disk */
 571  696  #define ZPOOL_CONFIG_LOAD_INFO          "load_info"     /* not stored on disk */
 572  697  #define ZPOOL_CONFIG_REWIND_INFO        "rewind_info"   /* not stored on disk */
 573  698  #define ZPOOL_CONFIG_UNSUP_FEAT         "unsup_feat"    /* not stored on disk */
 574  699  #define ZPOOL_CONFIG_ENABLED_FEAT       "enabled_feat"  /* not stored on disk */
 575  700  #define ZPOOL_CONFIG_CAN_RDONLY         "can_rdonly"    /* not stored on disk */
 576  701  #define ZPOOL_CONFIG_FEATURES_FOR_READ  "features_for_read"
 577  702  #define ZPOOL_CONFIG_FEATURE_STATS      "feature_stats" /* not stored on disk */
      703 +#define ZPOOL_CONFIG_IS_SSD             "is_ssd"        /* not stored on disk */
 578  704  #define ZPOOL_CONFIG_VDEV_TOP_ZAP       "com.delphix:vdev_zap_top"
 579  705  #define ZPOOL_CONFIG_VDEV_LEAF_ZAP      "com.delphix:vdev_zap_leaf"
 580  706  #define ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS  "com.delphix:has_per_vdev_zaps"
 581      -#define ZPOOL_CONFIG_CACHEFILE          "cachefile"     /* not stored on disk */
 582  707  /*
 583  708   * The persistent vdev state is stored as separate values rather than a single
 584  709   * 'vdev_state' entry.  This is because a device can be in multiple states, such
 585  710   * as offline and degraded.
 586  711   */
 587  712  #define ZPOOL_CONFIG_OFFLINE            "offline"
 588  713  #define ZPOOL_CONFIG_FAULTED            "faulted"
 589  714  #define ZPOOL_CONFIG_DEGRADED           "degraded"
 590  715  #define ZPOOL_CONFIG_REMOVED            "removed"
 591  716  #define ZPOOL_CONFIG_FRU                "fru"
 592  717  #define ZPOOL_CONFIG_AUX_STATE          "aux_state"
      718 +#define ZPOOL_CONFIG_TRIM_PROG          "trim_prog"
      719 +#define ZPOOL_CONFIG_TRIM_RATE          "trim_rate"
      720 +#define ZPOOL_CONFIG_TRIM_START_TIME    "trim_start_time"
      721 +#define ZPOOL_CONFIG_TRIM_STOP_TIME     "trim_stop_time"
 593  722  
 594  723  /* Rewind policy parameters */
 595  724  #define ZPOOL_REWIND_POLICY             "rewind-policy"
 596  725  #define ZPOOL_REWIND_REQUEST            "rewind-request"
 597  726  #define ZPOOL_REWIND_REQUEST_TXG        "rewind-request-txg"
 598  727  #define ZPOOL_REWIND_META_THRESH        "rewind-meta-thresh"
 599  728  #define ZPOOL_REWIND_DATA_THRESH        "rewind-data-thresh"
 600  729  
 601  730  /* Rewind data discovered */
 602  731  #define ZPOOL_CONFIG_LOAD_TIME          "rewind_txg_ts"
 603  732  #define ZPOOL_CONFIG_LOAD_DATA_ERRORS   "verify_data_errors"
 604  733  #define ZPOOL_CONFIG_REWIND_TIME        "seconds_of_rewind"
 605  734  
 606  735  #define VDEV_TYPE_ROOT                  "root"
  
    | 
      ↓ open down ↓ | 
    4 lines elided | 
    
      ↑ open up ↑ | 
  
 607  736  #define VDEV_TYPE_MIRROR                "mirror"
 608  737  #define VDEV_TYPE_REPLACING             "replacing"
 609  738  #define VDEV_TYPE_RAIDZ                 "raidz"
 610  739  #define VDEV_TYPE_DISK                  "disk"
 611  740  #define VDEV_TYPE_FILE                  "file"
 612  741  #define VDEV_TYPE_MISSING               "missing"
 613  742  #define VDEV_TYPE_HOLE                  "hole"
 614  743  #define VDEV_TYPE_SPARE                 "spare"
 615  744  #define VDEV_TYPE_LOG                   "log"
 616  745  #define VDEV_TYPE_L2CACHE               "l2cache"
 617      -#define VDEV_TYPE_INDIRECT              "indirect"
      746 +#define VDEV_TYPE_SPECIAL               "special"
 618  747  
 619      -/* VDEV_TOP_ZAP_* are used in top-level vdev ZAP objects. */
 620      -#define VDEV_TOP_ZAP_INDIRECT_OBSOLETE_SM \
 621      -        "com.delphix:indirect_obsolete_sm"
 622      -#define VDEV_TOP_ZAP_OBSOLETE_COUNTS_ARE_PRECISE \
 623      -        "com.delphix:obsolete_counts_are_precise"
 624      -
 625  748  /*
 626  749   * This is needed in userland to report the minimum necessary device size.
 627  750   *
 628  751   * Note that the zfs test suite uses 64MB vdevs.
 629  752   */
 630  753  #define SPA_MINDEVSIZE          (64ULL << 20)
 631  754  
 632  755  /*
 633  756   * Set if the fragmentation has not yet been calculated. This can happen
 634  757   * because the space maps have not been upgraded or the histogram feature
 635  758   * is not enabled.
 636  759   */
 637  760  #define ZFS_FRAG_INVALID        UINT64_MAX
 638  761  
 639  762  /*
 640  763   * The location of the pool configuration repository, shared between kernel and
 641  764   * userland.
 642  765   */
 643  766  #define ZPOOL_CACHE             "/etc/zfs/zpool.cache"
 644  767  
 645  768  /*
 646  769   * vdev states are ordered from least to most healthy.
 647  770   * A vdev that's CANT_OPEN or below is considered unusable.
 648  771   */
 649  772  typedef enum vdev_state {
 650  773          VDEV_STATE_UNKNOWN = 0, /* Uninitialized vdev                   */
 651  774          VDEV_STATE_CLOSED,      /* Not currently open                   */
 652  775          VDEV_STATE_OFFLINE,     /* Not allowed to open                  */
 653  776          VDEV_STATE_REMOVED,     /* Explicitly removed from system       */
 654  777          VDEV_STATE_CANT_OPEN,   /* Tried to open, but failed            */
 655  778          VDEV_STATE_FAULTED,     /* External request to fault device     */
 656  779          VDEV_STATE_DEGRADED,    /* Replicated vdev with unhealthy kids  */
 657  780          VDEV_STATE_HEALTHY      /* Presumed good                        */
 658  781  } vdev_state_t;
 659  782  
 660  783  #define VDEV_STATE_ONLINE       VDEV_STATE_HEALTHY
 661  784  
 662  785  /*
 663  786   * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
 664  787   * of the vdev stats structure uses these constants to distinguish why.
 665  788   */
 666  789  typedef enum vdev_aux {
 667  790          VDEV_AUX_NONE,          /* no error                             */
 668  791          VDEV_AUX_OPEN_FAILED,   /* ldi_open_*() or vn_open() failed     */
 669  792          VDEV_AUX_CORRUPT_DATA,  /* bad label or disk contents           */
 670  793          VDEV_AUX_NO_REPLICAS,   /* insufficient number of replicas      */
 671  794          VDEV_AUX_BAD_GUID_SUM,  /* vdev guid sum doesn't match          */
  
    | 
      ↓ open down ↓ | 
    37 lines elided | 
    
      ↑ open up ↑ | 
  
 672  795          VDEV_AUX_TOO_SMALL,     /* vdev size is too small               */
 673  796          VDEV_AUX_BAD_LABEL,     /* the label is OK but invalid          */
 674  797          VDEV_AUX_VERSION_NEWER, /* on-disk version is too new           */
 675  798          VDEV_AUX_VERSION_OLDER, /* on-disk version is too old           */
 676  799          VDEV_AUX_UNSUP_FEAT,    /* unsupported features                 */
 677  800          VDEV_AUX_SPARED,        /* hot spare used in another pool       */
 678  801          VDEV_AUX_ERR_EXCEEDED,  /* too many errors                      */
 679  802          VDEV_AUX_IO_FAILURE,    /* experienced I/O failure              */
 680  803          VDEV_AUX_BAD_LOG,       /* cannot read log chain(s)             */
 681  804          VDEV_AUX_EXTERNAL,      /* external diagnosis                   */
 682      -        VDEV_AUX_SPLIT_POOL,    /* vdev was split off into another pool */
 683      -        VDEV_AUX_CHILDREN_OFFLINE /* all children are offline           */
      805 +        VDEV_AUX_SPLIT_POOL     /* vdev was split off into another pool */
 684  806  } vdev_aux_t;
 685  807  
 686  808  /*
 687  809   * pool state.  The following states are written to disk as part of the normal
 688  810   * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
 689  811   * states are software abstractions used at various levels to communicate
 690  812   * pool state.
 691  813   */
 692  814  typedef enum pool_state {
 693  815          POOL_STATE_ACTIVE = 0,          /* In active use                */
 694  816          POOL_STATE_EXPORTED,            /* Explicitly exported          */
 695  817          POOL_STATE_DESTROYED,           /* Explicitly destroyed         */
 696  818          POOL_STATE_SPARE,               /* Reserved for hot spare use   */
 697  819          POOL_STATE_L2CACHE,             /* Level 2 ARC device           */
 698  820          POOL_STATE_UNINITIALIZED,       /* Internal spa_t state         */
 699  821          POOL_STATE_UNAVAIL,             /* Internal libzfs state        */
  
    | 
      ↓ open down ↓ | 
    6 lines elided | 
    
      ↑ open up ↑ | 
  
 700  822          POOL_STATE_POTENTIALLY_ACTIVE   /* Internal libzfs state        */
 701  823  } pool_state_t;
 702  824  
 703  825  /*
 704  826   * Scan Functions.
 705  827   */
 706  828  typedef enum pool_scan_func {
 707  829          POOL_SCAN_NONE,
 708  830          POOL_SCAN_SCRUB,
 709  831          POOL_SCAN_RESILVER,
      832 +        POOL_SCAN_MOS,
      833 +        POOL_SCAN_META,
 710  834          POOL_SCAN_FUNCS
 711  835  } pool_scan_func_t;
 712  836  
 713  837  /*
      838 + * TRIM command configuration info.
      839 + */
      840 +typedef struct trim_cmd_info_s {
      841 +        uint64_t        tci_start;      /* B_TRUE = start; B_FALSE = stop */
      842 +        uint64_t        tci_rate;       /* requested TRIM rate in bytes/sec */
      843 +} trim_cmd_info_t;
      844 +
      845 +/*
 714  846   * Used to control scrub pause and resume.
 715  847   */
 716  848  typedef enum pool_scrub_cmd {
 717  849          POOL_SCRUB_NORMAL = 0,
 718  850          POOL_SCRUB_PAUSE,
 719  851          POOL_SCRUB_FLAGS_END
 720  852  } pool_scrub_cmd_t;
 721  853  
 722      -
 723  854  /*
 724  855   * ZIO types.  Needed to interpret vdev statistics below.
 725  856   */
 726  857  typedef enum zio_type {
 727  858          ZIO_TYPE_NULL = 0,
 728  859          ZIO_TYPE_READ,
 729  860          ZIO_TYPE_WRITE,
 730  861          ZIO_TYPE_FREE,
 731  862          ZIO_TYPE_CLAIM,
 732  863          ZIO_TYPE_IOCTL,
 733  864          ZIO_TYPES
 734  865  } zio_type_t;
 735  866  
 736  867  /*
  
    | 
      ↓ open down ↓ | 
    4 lines elided | 
    
      ↑ open up ↑ | 
  
 737  868   * Pool statistics.  Note: all fields should be 64-bit because this
 738  869   * is passed between kernel and userland as an nvlist uint64 array.
 739  870   */
 740  871  typedef struct pool_scan_stat {
 741  872          /* values stored on disk */
 742  873          uint64_t        pss_func;       /* pool_scan_func_t */
 743  874          uint64_t        pss_state;      /* dsl_scan_state_t */
 744  875          uint64_t        pss_start_time; /* scan start time */
 745  876          uint64_t        pss_end_time;   /* scan end time */
 746  877          uint64_t        pss_to_examine; /* total bytes to scan */
 747      -        uint64_t        pss_examined;   /* total examined bytes */
      878 +        uint64_t        pss_examined;   /* total bytes located by scanner */
      879 +        uint64_t        pss_issued;     /* total bytes checked by scanner */
 748  880          uint64_t        pss_to_process; /* total bytes to process */
 749  881          uint64_t        pss_processed;  /* total processed bytes */
 750  882          uint64_t        pss_errors;     /* scan errors  */
 751  883  
 752  884          /* values not stored on disk */
 753  885          uint64_t        pss_pass_exam;  /* examined bytes per scan pass */
      886 +        uint64_t        pss_pass_work;  /* issued bytes per scan pass */
 754  887          uint64_t        pss_pass_start; /* start time of a scan pass */
 755  888          uint64_t        pss_pass_scrub_pause; /* pause time of a scurb pass */
 756  889          /* cumulative time scrub spent paused, needed for rate calculation */
 757  890          uint64_t        pss_pass_scrub_spent_paused;
 758  891  } pool_scan_stat_t;
 759  892  
 760      -typedef struct pool_removal_stat {
 761      -        uint64_t prs_state; /* dsl_scan_state_t */
 762      -        uint64_t prs_removing_vdev;
 763      -        uint64_t prs_start_time;
 764      -        uint64_t prs_end_time;
 765      -        uint64_t prs_to_copy; /* bytes that need to be copied */
 766      -        uint64_t prs_copied; /* bytes copied so far */
 767      -        /*
 768      -         * bytes of memory used for indirect mappings.
 769      -         * This includes all removed vdevs.
 770      -         */
 771      -        uint64_t prs_mapping_memory;
 772      -} pool_removal_stat_t;
 773      -
 774  893  typedef enum dsl_scan_state {
 775  894          DSS_NONE,
 776  895          DSS_SCANNING,
 777  896          DSS_FINISHED,
 778  897          DSS_CANCELED,
      898 +        DSS_FINISHING,
 779  899          DSS_NUM_STATES
 780  900  } dsl_scan_state_t;
 781  901  
 782  902  
 783  903  /*
 784  904   * Vdev statistics.  Note: all fields should be 64-bit because this
 785  905   * is passed between kernel and userland as an nvlist uint64 array.
 786  906   */
 787  907  typedef struct vdev_stat {
 788  908          hrtime_t        vs_timestamp;           /* time since vdev load */
 789  909          uint64_t        vs_state;               /* vdev state           */
 790  910          uint64_t        vs_aux;                 /* see vdev_aux_t       */
 791  911          uint64_t        vs_alloc;               /* space allocated      */
 792  912          uint64_t        vs_space;               /* total capacity       */
 793  913          uint64_t        vs_dspace;              /* deflated capacity    */
 794  914          uint64_t        vs_rsize;               /* replaceable dev size */
  
    | 
      ↓ open down ↓ | 
    6 lines elided | 
    
      ↑ open up ↑ | 
  
 795  915          uint64_t        vs_esize;               /* expandable dev size */
 796  916          uint64_t        vs_ops[ZIO_TYPES];      /* operation count      */
 797  917          uint64_t        vs_bytes[ZIO_TYPES];    /* bytes read/written   */
 798  918          uint64_t        vs_read_errors;         /* read errors          */
 799  919          uint64_t        vs_write_errors;        /* write errors         */
 800  920          uint64_t        vs_checksum_errors;     /* checksum errors      */
 801  921          uint64_t        vs_self_healed;         /* self-healed bytes    */
 802  922          uint64_t        vs_scan_removing;       /* removing?    */
 803  923          uint64_t        vs_scan_processed;      /* scan processed bytes */
 804  924          uint64_t        vs_fragmentation;       /* device fragmentation */
      925 +        hrtime_t        vs_latency[ZIO_TYPES];  /* moving average of latency */
      926 +        hrtime_t        vs_iotime[ZIO_TYPES];   /* time spent doing i/o */
 805  927  } vdev_stat_t;
 806  928  
 807  929  /*
 808  930   * DDT statistics.  Note: all fields should be 64-bit because this
 809  931   * is passed between kernel and userland as an nvlist uint64 array.
 810  932   */
 811  933  typedef struct ddt_object {
 812  934          uint64_t        ddo_count;      /* number of elments in ddt     */
 813  935          uint64_t        ddo_dspace;     /* size of ddt on disk          */
 814  936          uint64_t        ddo_mspace;     /* size of ddt in-core          */
 815  937  } ddt_object_t;
 816  938  
 817  939  typedef struct ddt_stat {
 818  940          uint64_t        dds_blocks;     /* blocks                       */
 819  941          uint64_t        dds_lsize;      /* logical size                 */
 820  942          uint64_t        dds_psize;      /* physical size                */
 821  943          uint64_t        dds_dsize;      /* deflated allocated size      */
 822  944          uint64_t        dds_ref_blocks; /* referenced blocks            */
 823  945          uint64_t        dds_ref_lsize;  /* referenced lsize * refcnt    */
 824  946          uint64_t        dds_ref_psize;  /* referenced psize * refcnt    */
 825  947          uint64_t        dds_ref_dsize;  /* referenced dsize * refcnt    */
 826  948  } ddt_stat_t;
 827  949  
 828  950  typedef struct ddt_histogram {
 829  951          ddt_stat_t      ddh_stat[64];   /* power-of-two histogram buckets */
 830  952  } ddt_histogram_t;
 831  953  
 832  954  #define ZVOL_DRIVER     "zvol"
 833  955  #define ZFS_DRIVER      "zfs"
 834  956  #define ZFS_DEV         "/dev/zfs"
 835  957  #define ZFS_DISK_ROOT   "/dev/dsk"
 836  958  #define ZFS_DISK_ROOTD  ZFS_DISK_ROOT "/"
 837  959  #define ZFS_RDISK_ROOT  "/dev/rdsk"
 838  960  #define ZFS_RDISK_ROOTD ZFS_RDISK_ROOT "/"
 839  961  
 840  962  /* general zvol path */
 841  963  #define ZVOL_DIR                "/dev/zvol"
 842  964  /* expansion */
 843  965  #define ZVOL_PSEUDO_DEV         "/devices/pseudo/zfs@0:"
 844  966  /* for dump and swap */
 845  967  #define ZVOL_FULL_DEV_DIR       ZVOL_DIR "/dsk/"
 846  968  #define ZVOL_FULL_RDEV_DIR      ZVOL_DIR "/rdsk/"
 847  969  
 848  970  #define ZVOL_PROP_NAME          "name"
 849  971  #define ZVOL_DEFAULT_BLOCKSIZE  8192
 850  972  
 851  973  /*
 852  974   * /dev/zfs ioctl numbers.
 853  975   */
 854  976  typedef enum zfs_ioc {
 855  977          ZFS_IOC_FIRST = ('Z' << 8),
 856  978          ZFS_IOC = ZFS_IOC_FIRST,
 857  979          ZFS_IOC_POOL_CREATE = ZFS_IOC_FIRST,
 858  980          ZFS_IOC_POOL_DESTROY,
 859  981          ZFS_IOC_POOL_IMPORT,
 860  982          ZFS_IOC_POOL_EXPORT,
 861  983          ZFS_IOC_POOL_CONFIGS,
 862  984          ZFS_IOC_POOL_STATS,
  
    | 
      ↓ open down ↓ | 
    48 lines elided | 
    
      ↑ open up ↑ | 
  
 863  985          ZFS_IOC_POOL_TRYIMPORT,
 864  986          ZFS_IOC_POOL_SCAN,
 865  987          ZFS_IOC_POOL_FREEZE,
 866  988          ZFS_IOC_POOL_UPGRADE,
 867  989          ZFS_IOC_POOL_GET_HISTORY,
 868  990          ZFS_IOC_VDEV_ADD,
 869  991          ZFS_IOC_VDEV_REMOVE,
 870  992          ZFS_IOC_VDEV_SET_STATE,
 871  993          ZFS_IOC_VDEV_ATTACH,
 872  994          ZFS_IOC_VDEV_DETACH,
      995 +        ZFS_IOC_VDEV_SETL2ADDDT,
 873  996          ZFS_IOC_VDEV_SETPATH,
 874  997          ZFS_IOC_VDEV_SETFRU,
 875  998          ZFS_IOC_OBJSET_STATS,
 876  999          ZFS_IOC_OBJSET_ZPLPROPS,
 877 1000          ZFS_IOC_DATASET_LIST_NEXT,
 878 1001          ZFS_IOC_SNAPSHOT_LIST_NEXT,
 879 1002          ZFS_IOC_SET_PROP,
 880 1003          ZFS_IOC_CREATE,
 881 1004          ZFS_IOC_DESTROY,
 882 1005          ZFS_IOC_ROLLBACK,
 883 1006          ZFS_IOC_RENAME,
 884 1007          ZFS_IOC_RECV,
 885 1008          ZFS_IOC_SEND,
 886 1009          ZFS_IOC_INJECT_FAULT,
 887 1010          ZFS_IOC_CLEAR_FAULT,
 888 1011          ZFS_IOC_INJECT_LIST_NEXT,
 889 1012          ZFS_IOC_ERROR_LOG,
 890 1013          ZFS_IOC_CLEAR,
 891 1014          ZFS_IOC_PROMOTE,
 892 1015          ZFS_IOC_SNAPSHOT,
 893 1016          ZFS_IOC_DSOBJ_TO_DSNAME,
 894 1017          ZFS_IOC_OBJ_TO_PATH,
 895 1018          ZFS_IOC_POOL_SET_PROPS,
 896 1019          ZFS_IOC_POOL_GET_PROPS,
 897 1020          ZFS_IOC_SET_FSACL,
 898 1021          ZFS_IOC_GET_FSACL,
 899 1022          ZFS_IOC_SHARE,
 900 1023          ZFS_IOC_INHERIT_PROP,
 901 1024          ZFS_IOC_SMB_ACL,
 902 1025          ZFS_IOC_USERSPACE_ONE,
 903 1026          ZFS_IOC_USERSPACE_MANY,
 904 1027          ZFS_IOC_USERSPACE_UPGRADE,
 905 1028          ZFS_IOC_HOLD,
 906 1029          ZFS_IOC_RELEASE,
 907 1030          ZFS_IOC_GET_HOLDS,
 908 1031          ZFS_IOC_OBJSET_RECVD_PROPS,
 909 1032          ZFS_IOC_VDEV_SPLIT,
 910 1033          ZFS_IOC_NEXT_OBJ,
 911 1034          ZFS_IOC_DIFF,
 912 1035          ZFS_IOC_TMP_SNAPSHOT,
 913 1036          ZFS_IOC_OBJ_TO_STATS,
 914 1037          ZFS_IOC_SPACE_WRITTEN,
 915 1038          ZFS_IOC_SPACE_SNAPS,
 916 1039          ZFS_IOC_DESTROY_SNAPS,
  
    | 
      ↓ open down ↓ | 
    34 lines elided | 
    
      ↑ open up ↑ | 
  
 917 1040          ZFS_IOC_POOL_REGUID,
 918 1041          ZFS_IOC_POOL_REOPEN,
 919 1042          ZFS_IOC_SEND_PROGRESS,
 920 1043          ZFS_IOC_LOG_HISTORY,
 921 1044          ZFS_IOC_SEND_NEW,
 922 1045          ZFS_IOC_SEND_SPACE,
 923 1046          ZFS_IOC_CLONE,
 924 1047          ZFS_IOC_BOOKMARK,
 925 1048          ZFS_IOC_GET_BOOKMARKS,
 926 1049          ZFS_IOC_DESTROY_BOOKMARKS,
     1050 +        ZFS_IOC_VDEV_SET_PROPS,
     1051 +        ZFS_IOC_VDEV_GET_PROPS,
     1052 +        ZFS_IOC_COS_ALLOC,
     1053 +        ZFS_IOC_COS_FREE,
     1054 +        ZFS_IOC_COS_LIST,
     1055 +        ZFS_IOC_COS_SET_PROPS,
     1056 +        ZFS_IOC_COS_GET_PROPS,
     1057 +        ZFS_IOC_POOL_CONFIGS_NVL,
     1058 +        ZFS_IOC_POOL_STATS_NVL,
     1059 +        ZFS_IOC_OBJSET_STATS_NVL,
     1060 +        ZFS_IOC_DATASET_LIST_NEXT_NVL,
     1061 +        ZFS_IOC_SNAPSHOT_LIST_NEXT_NVL,
     1062 +        ZFS_IOC_POOL_GET_PROPS_NVL,
     1063 +        ZFS_IOC_CHECK_KRRP,
     1064 +        ZFS_IOC_BULK_LIST,
     1065 +        ZFS_IOC_POOL_TRIM,
 927 1066          ZFS_IOC_CHANNEL_PROGRAM,
 928      -        ZFS_IOC_REMAP,
     1067 +        ZFS_IOC_SET_PROPS_MDS,
 929 1068          ZFS_IOC_LAST
 930 1069  } zfs_ioc_t;
 931 1070  
 932 1071  /*
 933 1072   * Internal SPA load state.  Used by FMA diagnosis engine.
 934 1073   */
 935 1074  typedef enum {
 936 1075          SPA_LOAD_NONE,          /* no load in progress  */
 937 1076          SPA_LOAD_OPEN,          /* normal open          */
 938 1077          SPA_LOAD_IMPORT,        /* import in progress   */
 939 1078          SPA_LOAD_TRYIMPORT,     /* tryimport in progress */
 940 1079          SPA_LOAD_RECOVER,       /* recovery requested   */
 941 1080          SPA_LOAD_ERROR,         /* load failed          */
 942 1081          SPA_LOAD_CREATE         /* creation in progress */
 943 1082  } spa_load_state_t;
 944 1083  
 945 1084  /*
 946 1085   * Bookmark name values.
 947 1086   */
 948 1087  #define ZPOOL_ERR_LIST          "error list"
 949 1088  #define ZPOOL_ERR_DATASET       "dataset"
 950 1089  #define ZPOOL_ERR_OBJECT        "object"
 951 1090  
 952 1091  #define HIS_MAX_RECORD_LEN      (MAXPATHLEN + MAXPATHLEN + 1)
 953 1092  
 954 1093  /*
 955 1094   * The following are names used in the nvlist describing
 956 1095   * the pool's history log.
 957 1096   */
 958 1097  #define ZPOOL_HIST_RECORD       "history record"
 959 1098  #define ZPOOL_HIST_TIME         "history time"
 960 1099  #define ZPOOL_HIST_CMD          "history command"
 961 1100  #define ZPOOL_HIST_WHO          "history who"
 962 1101  #define ZPOOL_HIST_ZONE         "history zone"
 963 1102  #define ZPOOL_HIST_HOST         "history hostname"
 964 1103  #define ZPOOL_HIST_TXG          "history txg"
 965 1104  #define ZPOOL_HIST_INT_EVENT    "history internal event"
 966 1105  #define ZPOOL_HIST_INT_STR      "history internal str"
 967 1106  #define ZPOOL_HIST_INT_NAME     "internal_name"
 968 1107  #define ZPOOL_HIST_IOCTL        "ioctl"
 969 1108  #define ZPOOL_HIST_INPUT_NVL    "in_nvl"
 970 1109  #define ZPOOL_HIST_OUTPUT_NVL   "out_nvl"
 971 1110  #define ZPOOL_HIST_DSNAME       "dsname"
 972 1111  #define ZPOOL_HIST_DSID         "dsid"
 973 1112  #define ZPOOL_HIST_ERRNO        "errno"
 974 1113  
 975 1114  /*
 976 1115   * Flags for ZFS_IOC_VDEV_SET_STATE
 977 1116   */
 978 1117  #define ZFS_ONLINE_CHECKREMOVE  0x1
 979 1118  #define ZFS_ONLINE_UNSPARE      0x2
 980 1119  #define ZFS_ONLINE_FORCEFAULT   0x4
 981 1120  #define ZFS_ONLINE_EXPAND       0x8
 982 1121  #define ZFS_OFFLINE_TEMPORARY   0x1
 983 1122  
 984 1123  /*
 985 1124   * Flags for ZFS_IOC_POOL_IMPORT
 986 1125   */
 987 1126  #define ZFS_IMPORT_NORMAL       0x0
 988 1127  #define ZFS_IMPORT_VERBATIM     0x1
 989 1128  #define ZFS_IMPORT_ANY_HOST     0x2
 990 1129  #define ZFS_IMPORT_MISSING_LOG  0x4
 991 1130  #define ZFS_IMPORT_ONLY         0x8
 992 1131  
 993 1132  /*
 994 1133   * Channel program argument/return nvlist keys and defaults.
 995 1134   */
 996 1135  #define ZCP_ARG_PROGRAM         "program"
 997 1136  #define ZCP_ARG_ARGLIST         "arg"
 998 1137  #define ZCP_ARG_SYNC            "sync"
 999 1138  #define ZCP_ARG_INSTRLIMIT      "instrlimit"
1000 1139  #define ZCP_ARG_MEMLIMIT        "memlimit"
1001 1140  
1002 1141  #define ZCP_ARG_CLIARGV         "argv"
1003 1142  
1004 1143  #define ZCP_RET_ERROR           "error"
1005 1144  #define ZCP_RET_RETURN          "return"
1006 1145  
1007 1146  #define ZCP_DEFAULT_INSTRLIMIT  (10 * 1000 * 1000)
1008 1147  #define ZCP_MAX_INSTRLIMIT      (10 * ZCP_DEFAULT_INSTRLIMIT)
1009 1148  #define ZCP_DEFAULT_MEMLIMIT    (10 * 1024 * 1024)
1010 1149  #define ZCP_MAX_MEMLIMIT        (10 * ZCP_DEFAULT_MEMLIMIT)
1011 1150  
1012 1151  /*
1013 1152   * Sysevent payload members.  ZFS will generate the following sysevents with the
1014 1153   * given payloads:
1015 1154   *
1016 1155   *      ESC_ZFS_RESILVER_START
1017 1156   *      ESC_ZFS_RESILVER_END
1018 1157   *      ESC_ZFS_POOL_DESTROY
1019 1158   *      ESC_ZFS_POOL_REGUID
1020 1159   *
1021 1160   *              ZFS_EV_POOL_NAME        DATA_TYPE_STRING
1022 1161   *              ZFS_EV_POOL_GUID        DATA_TYPE_UINT64
1023 1162   *
1024 1163   *      ESC_ZFS_VDEV_REMOVE
1025 1164   *      ESC_ZFS_VDEV_CLEAR
1026 1165   *      ESC_ZFS_VDEV_CHECK
1027 1166   *
1028 1167   *              ZFS_EV_POOL_NAME        DATA_TYPE_STRING
1029 1168   *              ZFS_EV_POOL_GUID        DATA_TYPE_UINT64
1030 1169   *              ZFS_EV_VDEV_PATH        DATA_TYPE_STRING        (optional)
1031 1170   *              ZFS_EV_VDEV_GUID        DATA_TYPE_UINT64
1032 1171   *
1033 1172   *      ESC_ZFS_HISTORY_EVENT
1034 1173   *
1035 1174   *              ZFS_EV_POOL_NAME        DATA_TYPE_STRING
1036 1175   *              ZFS_EV_POOL_GUID        DATA_TYPE_UINT64
1037 1176   *              ZFS_EV_HIST_TIME        DATA_TYPE_UINT64        (optional)
1038 1177   *              ZFS_EV_HIST_CMD         DATA_TYPE_STRING        (optional)
1039 1178   *              ZFS_EV_HIST_WHO         DATA_TYPE_UINT64        (optional)
1040 1179   *              ZFS_EV_HIST_ZONE        DATA_TYPE_STRING        (optional)
1041 1180   *              ZFS_EV_HIST_HOST        DATA_TYPE_STRING        (optional)
1042 1181   *              ZFS_EV_HIST_TXG         DATA_TYPE_UINT64        (optional)
1043 1182   *              ZFS_EV_HIST_INT_EVENT   DATA_TYPE_UINT64        (optional)
1044 1183   *              ZFS_EV_HIST_INT_STR     DATA_TYPE_STRING        (optional)
1045 1184   *              ZFS_EV_HIST_INT_NAME    DATA_TYPE_STRING        (optional)
1046 1185   *              ZFS_EV_HIST_IOCTL       DATA_TYPE_STRING        (optional)
1047 1186   *              ZFS_EV_HIST_DSNAME      DATA_TYPE_STRING        (optional)
1048 1187   *              ZFS_EV_HIST_DSID        DATA_TYPE_UINT64        (optional)
1049 1188   *
1050 1189   * The ZFS_EV_HIST_* members will correspond to the ZPOOL_HIST_* members in the
1051 1190   * history log nvlist.  The keynames will be free of any spaces or other
1052 1191   * characters that could be potentially unexpected to consumers of the
1053 1192   * sysevents.
1054 1193   */
1055 1194  #define ZFS_EV_POOL_NAME        "pool_name"
1056 1195  #define ZFS_EV_POOL_GUID        "pool_guid"
1057 1196  #define ZFS_EV_VDEV_PATH        "vdev_path"
1058 1197  #define ZFS_EV_VDEV_GUID        "vdev_guid"
1059 1198  #define ZFS_EV_HIST_TIME        "history_time"
1060 1199  #define ZFS_EV_HIST_CMD         "history_command"
1061 1200  #define ZFS_EV_HIST_WHO         "history_who"
1062 1201  #define ZFS_EV_HIST_ZONE        "history_zone"
1063 1202  #define ZFS_EV_HIST_HOST        "history_hostname"
1064 1203  #define ZFS_EV_HIST_TXG         "history_txg"
1065 1204  #define ZFS_EV_HIST_INT_EVENT   "history_internal_event"
1066 1205  #define ZFS_EV_HIST_INT_STR     "history_internal_str"
1067 1206  #define ZFS_EV_HIST_INT_NAME    "history_internal_name"
1068 1207  #define ZFS_EV_HIST_IOCTL       "history_ioctl"
1069 1208  #define ZFS_EV_HIST_DSNAME      "history_dsname"
1070 1209  #define ZFS_EV_HIST_DSID        "history_dsid"
1071 1210  
1072 1211  #ifdef  __cplusplus
1073 1212  }
1074 1213  #endif
1075 1214  
1076 1215  #endif  /* _SYS_FS_ZFS_H */
  
    | 
      ↓ open down ↓ | 
    138 lines elided | 
    
      ↑ open up ↑ | 
  
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX