Print this page
NEX-9406 Add a property to show that a dataset has been modified since a snapshot
Reviewed by: Alexey Komarov <alexey.komarov@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Fixup merge results
re #12585 rb4049 ZFS++ work port - refactoring to improve separation of open/closed code, bug fixes, performance improvements - open code
Bug 11205: add missing libzfs_closed_stubs.c to fix opensource-only build.
ZFS plus work: special vdevs, cos, cos/vdev properties

Split Close
Expand all
Collapse all
          --- old/usr/src/common/zfs/zprop_common.c
          +++ new/usr/src/common/zfs/zprop_common.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  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   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24      - */
  25      -/*
  26   24   * Copyright (c) 2012 by Delphix. All rights reserved.
       25 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
  27   26   */
  28   27  
  29   28  /*
  30   29   * Common routines used by zfs and zpool property management.
  31   30   */
  32   31  
  33   32  #include <sys/zio.h>
  34   33  #include <sys/spa.h>
  35   34  #include <sys/zfs_acl.h>
  36   35  #include <sys/zfs_ioctl.h>
↓ open down ↓ 8 lines elided ↑ open up ↑
  45   44  #include <util/qsort.h>
  46   45  #else
  47   46  #include <stdlib.h>
  48   47  #include <string.h>
  49   48  #include <ctype.h>
  50   49  #endif
  51   50  
  52   51  static zprop_desc_t *
  53   52  zprop_get_proptable(zfs_type_t type)
  54   53  {
  55      -        if (type == ZFS_TYPE_POOL)
       54 +        switch (type) {
       55 +        case ZFS_TYPE_POOL:
  56   56                  return (zpool_prop_get_table());
  57      -        else
       57 +        case ZFS_TYPE_VDEV:
       58 +                return (vdev_prop_get_table());
       59 +        case ZFS_TYPE_COS:
       60 +                return (cos_prop_get_table());
       61 +        default:
  58   62                  return (zfs_prop_get_table());
       63 +        }
  59   64  }
  60   65  
  61   66  static int
  62   67  zprop_get_numprops(zfs_type_t type)
  63   68  {
  64      -        if (type == ZFS_TYPE_POOL)
       69 +        switch (type) {
       70 +        case ZFS_TYPE_POOL:
  65   71                  return (ZPOOL_NUM_PROPS);
  66      -        else
       72 +        case ZFS_TYPE_VDEV:
       73 +                return (VDEV_NUM_PROPS);
       74 +        case ZFS_TYPE_COS:
       75 +                return (COS_NUM_PROPS);
       76 +        default:
  67   77                  return (ZFS_NUM_PROPS);
       78 +        }
  68   79  }
  69   80  
  70   81  void
  71   82  zprop_register_impl(int prop, const char *name, zprop_type_t type,
  72   83      uint64_t numdefault, const char *strdefault, zprop_attr_t attr,
  73   84      int objset_types, const char *values, const char *colname,
  74   85      boolean_t rightalign, boolean_t visible, const zprop_index_t *idx_tbl)
  75   86  {
  76   87          zprop_desc_t *prop_tbl = zprop_get_proptable(objset_types);
  77   88          zprop_desc_t *pd;
↓ open down ↓ 42 lines elided ↑ open up ↑
 120  131  
 121  132  void
 122  133  zprop_register_index(int prop, const char *name, uint64_t def,
 123  134      zprop_attr_t attr, int objset_types, const char *values,
 124  135      const char *colname, const zprop_index_t *idx_tbl)
 125  136  {
 126  137          zprop_register_impl(prop, name, PROP_TYPE_INDEX, def, NULL, attr,
 127  138              objset_types, values, colname, B_TRUE, B_TRUE, idx_tbl);
 128  139  }
 129  140  
      141 +/* Same as zprop_register_index, except the property is hidden */
      142 +void
      143 +zprop_register_index_hidden(int prop, const char *name, uint64_t def,
      144 +    zprop_attr_t attr, int objset_types, const char *values,
      145 +    const char *colname, const zprop_index_t *idx_tbl)
      146 +{
      147 +        zprop_register_impl(prop, name, PROP_TYPE_INDEX, def, NULL, attr,
      148 +            objset_types, values, colname, B_TRUE, B_FALSE, idx_tbl);
      149 +}
      150 +
 130  151  void
 131  152  zprop_register_hidden(int prop, const char *name, zprop_type_t type,
 132  153      zprop_attr_t attr, int objset_types, const char *colname)
 133  154  {
 134  155          zprop_register_impl(prop, name, type, 0, NULL, attr,
 135  156              objset_types, NULL, colname,
 136  157              type == PROP_TYPE_NUMBER, B_FALSE, NULL);
 137  158  }
 138  159  
 139  160  
↓ open down ↓ 291 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX