Print this page
4171 clean up spa_feature_*() interfaces
4172 implement extensible_dataset feature for use by other zpool features
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libzfs/common/libzfs_pool.c
          +++ new/usr/src/lib/libzfs/common/libzfs_pool.c
↓ 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 2011 Nexenta Systems, Inc. All rights reserved.
  25      - * Copyright (c) 2012 by Delphix. All rights reserved.
       25 + * Copyright (c) 2013 by Delphix. All rights reserved.
  26   26   * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  27   27   */
  28   28  
  29   29  #include <ctype.h>
  30   30  #include <errno.h>
  31   31  #include <devid.h>
  32   32  #include <fcntl.h>
  33   33  #include <libintl.h>
  34   34  #include <stdio.h>
  35   35  #include <stdlib.h>
↓ open down ↓ 370 lines elided ↑ open up ↑
 406  406                  return (NULL);
 407  407          }
 408  408  
 409  409          elem = NULL;
 410  410          while ((elem = nvlist_next_nvpair(props, elem)) != NULL) {
 411  411                  const char *propname = nvpair_name(elem);
 412  412  
 413  413                  prop = zpool_name_to_prop(propname);
 414  414                  if (prop == ZPROP_INVAL && zpool_prop_feature(propname)) {
 415  415                          int err;
 416      -                        zfeature_info_t *feature;
 417  416                          char *fname = strchr(propname, '@') + 1;
 418  417  
 419      -                        err = zfeature_lookup_name(fname, &feature);
      418 +                        err = zfeature_lookup_name(fname, NULL);
 420  419                          if (err != 0) {
 421  420                                  ASSERT3U(err, ==, ENOENT);
 422  421                                  zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
 423  422                                      "invalid feature '%s'"), fname);
 424  423                                  (void) zfs_error(hdl, EZFS_BADPROP, errbuf);
 425  424                                  goto error;
 426  425                          }
 427  426  
 428  427                          if (nvpair_type(elem) != DATA_TYPE_STRING) {
 429  428                                  zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
↓ open down ↓ 370 lines elided ↑ open up ↑
 800  799          supported = zpool_prop_feature(propname);
 801  800          ASSERT(supported || zfs_prop_unsupported(propname));
 802  801  
 803  802          /*
 804  803           * Convert from feature name to feature guid. This conversion is
 805  804           * unecessary for unsupported@... properties because they already
 806  805           * use guids.
 807  806           */
 808  807          if (supported) {
 809  808                  int ret;
 810      -                zfeature_info_t *fi;
      809 +                spa_feature_t fid;
 811  810  
 812      -                ret = zfeature_lookup_name(feature, &fi);
      811 +                ret = zfeature_lookup_name(feature, &fid);
 813  812                  if (ret != 0) {
 814  813                          (void) strlcpy(buf, "-", len);
 815  814                          return (ENOTSUP);
 816  815                  }
 817      -                feature = fi->fi_guid;
      816 +                feature = spa_feature_table[fid].fi_guid;
 818  817          }
 819  818  
 820  819          if (nvlist_lookup_uint64(features, feature, &refcount) == 0)
 821  820                  found = B_TRUE;
 822  821  
 823  822          if (supported) {
 824  823                  if (!found) {
 825  824                          (void) strlcpy(buf, ZFS_FEATURE_DISABLED, len);
 826  825                  } else  {
 827  826                          if (refcount == 0)
↓ open down ↓ 3232 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX