diff --git a/cmd/zfs/zfs_iter.c b/cmd/zfs/zfs_iter.c index d44bc2ad76..c0426d4f81 100644 --- a/cmd/zfs/zfs_iter.c +++ b/cmd/zfs/zfs_iter.c @@ -174,7 +174,7 @@ zfs_add_sort_column(zfs_sort_column_t **sc, const char *name, zfs_sort_column_t *col; zfs_prop_t prop; - if ((prop = zfs_name_to_prop(name)) == ZPROP_INVAL && + if ((prop = zfs_name_to_prop(name)) == ZPROP_USERPROP && !zfs_prop_user(name)) return (-1); @@ -182,7 +182,7 @@ zfs_add_sort_column(zfs_sort_column_t **sc, const char *name, col->sc_prop = prop; col->sc_reverse = reverse; - if (prop == ZPROP_INVAL) { + if (prop == ZPROP_USERPROP) { col->sc_user_prop = safe_malloc(strlen(name) + 1); (void) strcpy(col->sc_user_prop, name); } @@ -311,7 +311,7 @@ zfs_sort(const void *larg, const void *rarg, void *data) * Otherwise, we compare 'lnum' and 'rnum'. */ lstr = rstr = NULL; - if (psc->sc_prop == ZPROP_INVAL) { + if (psc->sc_prop == ZPROP_USERPROP) { nvlist_t *luser, *ruser; nvlist_t *lval, *rval; diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 30b2ae0c4b..3cb88b6a1a 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -1917,7 +1917,7 @@ get_callback(zfs_handle_t *zhp, void *data) pl == cbp->cb_proplist) continue; - if (pl->pl_prop != ZPROP_INVAL) { + if (pl->pl_prop != ZPROP_USERPROP) { if (zfs_prop_get(zhp, pl->pl_prop, buf, sizeof (buf), &sourcetype, source, sizeof (source), @@ -2307,7 +2307,7 @@ zfs_do_inherit(int argc, char **argv) argc--; argv++; - if ((prop = zfs_name_to_prop(propname)) != ZPROP_INVAL) { + if ((prop = zfs_name_to_prop(propname)) != ZPROP_USERPROP) { if (zfs_prop_readonly(prop)) { (void) fprintf(stderr, gettext( "%s property is read-only\n"), @@ -3443,7 +3443,7 @@ print_header(list_cbdata_t *cb) } right_justify = B_FALSE; - if (pl->pl_prop != ZPROP_INVAL) { + if (pl->pl_prop != ZPROP_USERPROP) { header = zfs_prop_column_name(pl->pl_prop); right_justify = zfs_prop_align_right(pl->pl_prop); } else { @@ -3494,7 +3494,7 @@ print_dataset(zfs_handle_t *zhp, list_cbdata_t *cb) sizeof (property)); propstr = property; right_justify = zfs_prop_align_right(pl->pl_prop); - } else if (pl->pl_prop != ZPROP_INVAL) { + } else if (pl->pl_prop != ZPROP_USERPROP) { if (zfs_prop_get(zhp, pl->pl_prop, property, sizeof (property), NULL, NULL, 0, cb->cb_literal) != 0) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 598d8b1bbb..a0aeb8c06b 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -5946,7 +5946,7 @@ print_header(list_cbdata_t *cb) first = B_FALSE; right_justify = B_FALSE; - if (pl->pl_prop != ZPROP_INVAL) { + if (pl->pl_prop != ZPROP_USERPROP) { header = zpool_prop_column_name(pl->pl_prop); right_justify = zpool_prop_align_right(pl->pl_prop); } else { @@ -6004,7 +6004,7 @@ print_pool(zpool_handle_t *zhp, list_cbdata_t *cb) } right_justify = B_FALSE; - if (pl->pl_prop != ZPROP_INVAL) { + if (pl->pl_prop != ZPROP_USERPROP) { if (zpool_get_prop(zhp, pl->pl_prop, property, sizeof (property), NULL, cb->cb_literal) != 0) propstr = "-"; diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index bc6666a2a1..f013e6b206 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -93,6 +93,7 @@ typedef enum dmu_objset_type { typedef enum { ZPROP_CONT = -2, ZPROP_INVAL = -1, + ZPROP_USERPROP = ZPROP_INVAL, ZFS_PROP_TYPE = 0, ZFS_PROP_CREATION, ZFS_PROP_USED, @@ -310,7 +311,7 @@ typedef int (*zprop_func)(int, void *); */ typedef enum { VDEV_PROP_INVAL = -1, -#define VDEV_PROP_USER VDEV_PROP_INVAL + VDEV_PROP_USERPROP = VDEV_PROP_INVAL, VDEV_PROP_NAME, VDEV_PROP_CAPACITY, VDEV_PROP_STATE, diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index b449fabdf5..24d9b81f49 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -1022,7 +1022,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, const char *propname = nvpair_name(elem); prop = zfs_name_to_prop(propname); - if (prop == ZPROP_INVAL && zfs_prop_user(propname)) { + if (prop == ZPROP_USERPROP && zfs_prop_user(propname)) { /* * This is a user property: make sure it's a * string, and that it's less than ZAP_MAXNAMELEN. @@ -1061,7 +1061,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, goto error; } - if (prop == ZPROP_INVAL && zfs_prop_userquota(propname)) { + if (prop == ZPROP_USERPROP && zfs_prop_userquota(propname)) { zfs_userquota_prop_t uqtype; char *newpropname = NULL; char domain[128]; @@ -1143,7 +1143,8 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, } free(newpropname); continue; - } else if (prop == ZPROP_INVAL && zfs_prop_written(propname)) { + } else if (prop == ZPROP_USERPROP && + zfs_prop_written(propname)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "'%s' is readonly"), propname); @@ -1937,7 +1938,7 @@ zfs_prop_inherit(zfs_handle_t *zhp, const char *propname, boolean_t received) "cannot inherit %s for '%s'"), propname, zhp->zfs_name); zc.zc_cookie = received; - if ((prop = zfs_name_to_prop(propname)) == ZPROP_INVAL) { + if ((prop = zfs_name_to_prop(propname)) == ZPROP_USERPROP) { /* * For user properties, the amount of work we have to do is very * small, so just do it here. @@ -2356,7 +2357,7 @@ zfs_prop_get_recvd(zfs_handle_t *zhp, const char *propname, char *propbuf, prop = zfs_name_to_prop(propname); - if (prop != ZPROP_INVAL) { + if (prop != ZPROP_USERPROP) { uint64_t cookie; if (!nvlist_exists(zhp->zfs_recvd_props, propname)) return (-1); @@ -4635,7 +4636,7 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received, */ start = plp; while (*start != NULL) { - if ((*start)->pl_prop == ZPROP_INVAL) + if ((*start)->pl_prop == ZPROP_USERPROP) break; start = &(*start)->pl_next; } @@ -4656,7 +4657,7 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received, entry = zfs_alloc(hdl, sizeof (zprop_list_t)); entry->pl_user_prop = zfs_strdup(hdl, nvpair_name(elem)); - entry->pl_prop = ZPROP_INVAL; + entry->pl_prop = ZPROP_USERPROP; entry->pl_width = strlen(nvpair_name(elem)); entry->pl_all = B_TRUE; *last = entry; @@ -4671,7 +4672,7 @@ zfs_expand_proplist(zfs_handle_t *zhp, zprop_list_t **plp, boolean_t received, if (entry->pl_fixed && !literal) continue; - if (entry->pl_prop != ZPROP_INVAL) { + if (entry->pl_prop != ZPROP_USERPROP) { if (zfs_prop_get(zhp, entry->pl_prop, buf, sizeof (buf), NULL, NULL, 0, literal) == 0) { if (strlen(buf) > entry->pl_width) @@ -4720,13 +4721,14 @@ zfs_prune_proplist(zfs_handle_t *zhp, uint8_t *props) next = nvlist_next_nvpair(zhp->zfs_props, curr); /* - * User properties will result in ZPROP_INVAL, and since we + * User properties will result in ZPROP_USERPROP (an alias + * for ZPROP_INVAL), and since we * only know how to prune standard ZFS properties, we always * leave these in the list. This can also happen if we * encounter an unknown DSL property (when running older * software, for example). */ - if (zfs_prop != ZPROP_INVAL && props[zfs_prop] == B_FALSE) + if (zfs_prop != ZPROP_USERPROP && props[zfs_prop] == B_FALSE) (void) nvlist_remove(zhp->zfs_props, nvpair_name(curr), nvpair_type(curr)); curr = next; diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 73283505a1..8333e0e786 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -854,7 +854,7 @@ zpool_expand_proplist(zpool_handle_t *zhp, zprop_list_t **plp, for (i = 0; i < SPA_FEATURES; i++) { zprop_list_t *entry = zfs_alloc(hdl, sizeof (zprop_list_t)); - entry->pl_prop = ZPROP_INVAL; + entry->pl_prop = ZPROP_USERPROP; entry->pl_user_prop = zfs_asprintf(hdl, "feature@%s", spa_feature_table[i].fi_uname); entry->pl_width = strlen(entry->pl_user_prop); @@ -898,7 +898,7 @@ zpool_expand_proplist(zpool_handle_t *zhp, zprop_list_t **plp, } entry = zfs_alloc(hdl, sizeof (zprop_list_t)); - entry->pl_prop = ZPROP_INVAL; + entry->pl_prop = ZPROP_USERPROP; entry->pl_user_prop = propname; entry->pl_width = strlen(entry->pl_user_prop); entry->pl_all = B_TRUE; @@ -911,7 +911,7 @@ zpool_expand_proplist(zpool_handle_t *zhp, zprop_list_t **plp, if (entry->pl_fixed && !literal) continue; - if (entry->pl_prop != ZPROP_INVAL && + if (entry->pl_prop != ZPROP_USERPROP && zpool_get_prop(zhp, entry->pl_prop, buf, sizeof (buf), NULL, literal) == 0) { if (strlen(buf) > entry->pl_width) @@ -967,7 +967,7 @@ vdev_expand_proplist(zpool_handle_t *zhp, const char *vdevname, /* Skip properties that are not user defined */ if ((prop = vdev_name_to_prop(propname)) != - VDEV_PROP_USER) + VDEV_PROP_USERPROP) continue; if (nvpair_value_nvlist(elem, &propval) != 0) @@ -5033,7 +5033,7 @@ zpool_get_vdev_prop_value(nvlist_t *nvprop, vdev_prop_t prop, char *prop_name, uint64_t intval; zprop_source_t src = ZPROP_SRC_NONE; - if (prop == VDEV_PROP_USER) { + if (prop == VDEV_PROP_USERPROP) { /* user property, prop_name must contain the property name */ assert(prop_name != NULL); if (nvlist_lookup_nvlist(nvprop, prop_name, &nv) == 0) { @@ -5195,7 +5195,7 @@ zpool_get_vdev_prop(zpool_handle_t *zhp, const char *vdevname, vdev_prop_t prop, fnvlist_add_uint64(reqnvl, ZPOOL_VDEV_PROPS_GET_VDEV, vdev_guid); - if (prop != VDEV_PROP_USER) { + if (prop != VDEV_PROP_USERPROP) { /* prop_name overrides prop value */ if (prop_name != NULL) prop = vdev_name_to_prop(prop_name); diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c index 683813ee3b..f7b2a0e870 100644 --- a/lib/libzfs/libzfs_sendrecv.c +++ b/lib/libzfs/libzfs_sendrecv.c @@ -5107,7 +5107,7 @@ zfs_receive_checkprops(libzfs_handle_t *hdl, nvlist_t *props, name = nvpair_name(nvp); prop = zfs_name_to_prop(name); - if (prop == ZPROP_INVAL) { + if (prop == ZPROP_USERPROP) { if (!zfs_prop_user(name)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "%s: invalid property '%s'"), errbuf, name); diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 1d40cbbfca..3ab82c350f 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1282,7 +1282,7 @@ zprop_print_headers(zprop_get_cbdata_t *cbp, zfs_type_t type) /* * 'PROPERTY' column */ - if (pl->pl_prop != ZPROP_INVAL) { + if (pl->pl_prop != ZPROP_USERPROP) { const char *propname = (type == ZFS_TYPE_POOL) ? zpool_prop_to_name(pl->pl_prop) : ((type == ZFS_TYPE_VDEV) ? @@ -1755,7 +1755,7 @@ addlist(libzfs_handle_t *hdl, const char *propname, zprop_list_t **listp, * Return failure if no property table entry was found and this isn't * a user-defined property. */ - if (prop == ZPROP_INVAL && ((type == ZFS_TYPE_POOL && + if (prop == ZPROP_USERPROP && ((type == ZFS_TYPE_POOL && !zpool_prop_feature(propname) && !zpool_prop_unsupported(propname)) || ((type == ZFS_TYPE_DATASET) && !zfs_prop_user(propname) && @@ -1770,7 +1770,7 @@ addlist(libzfs_handle_t *hdl, const char *propname, zprop_list_t **listp, zprop_list_t *entry = zfs_alloc(hdl, sizeof (*entry)); entry->pl_prop = prop; - if (prop == ZPROP_INVAL) { + if (prop == ZPROP_USERPROP) { entry->pl_user_prop = zfs_strdup(hdl, propname); entry->pl_width = strlen(propname); } else { diff --git a/module/zfs/dsl_prop.c b/module/zfs/dsl_prop.c index cfdafd2f44..51d689355e 100644 --- a/module/zfs/dsl_prop.c +++ b/module/zfs/dsl_prop.c @@ -88,7 +88,7 @@ dsl_prop_get_dd(dsl_dir_t *dd, const char *propname, setpoint[0] = '\0'; prop = zfs_name_to_prop(propname); - inheritable = (prop == ZPROP_INVAL || zfs_prop_inheritable(prop)); + inheritable = (prop == ZPROP_USERPROP || zfs_prop_inheritable(prop)); inheritstr = kmem_asprintf("%s%s", propname, ZPROP_INHERIT_SUFFIX); recvdstr = kmem_asprintf("%s%s", propname, ZPROP_RECVD_SUFFIX); @@ -168,7 +168,7 @@ dsl_prop_get_ds(dsl_dataset_t *ds, const char *propname, uint64_t zapobj; ASSERT(dsl_pool_config_held(ds->ds_dir->dd_pool)); - inheritable = (prop == ZPROP_INVAL || zfs_prop_inheritable(prop)); + inheritable = (prop == ZPROP_USERPROP || zfs_prop_inheritable(prop)); zapobj = dsl_dataset_phys(ds)->ds_props_obj; if (zapobj != 0) { @@ -1055,12 +1055,12 @@ dsl_prop_get_all_impl(objset_t *mos, uint64_t propobj, prop = zfs_name_to_prop(propname); /* Skip non-inheritable properties. */ - if ((flags & DSL_PROP_GET_INHERITING) && prop != ZPROP_INVAL && - !zfs_prop_inheritable(prop)) + if ((flags & DSL_PROP_GET_INHERITING) && + prop != ZPROP_USERPROP && !zfs_prop_inheritable(prop)) continue; /* Skip properties not valid for this type. */ - if ((flags & DSL_PROP_GET_SNAPSHOT) && prop != ZPROP_INVAL && + if ((flags & DSL_PROP_GET_SNAPSHOT) && prop != ZPROP_USERPROP && !zfs_prop_valid_for_type(prop, ZFS_TYPE_SNAPSHOT, B_FALSE)) continue; diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index ce7f020a0d..2dcb97b7fe 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -5496,7 +5496,7 @@ vdev_props_set_sync(void *arg, dmu_tx_t *tx) } switch (prop = vdev_name_to_prop(propname)) { - case VDEV_PROP_USER: + case VDEV_PROP_USERPROP: if (vdev_prop_user(propname)) { strval = fnvpair_value_string(elem); if (strlen(strval) == 0) { @@ -5580,7 +5580,7 @@ vdev_prop_set(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl) uint64_t intval = 0; char *strval = NULL; - if (prop == VDEV_PROP_USER && !vdev_prop_user(propname)) { + if (prop == VDEV_PROP_USERPROP && !vdev_prop_user(propname)) { error = EINVAL; goto end; } @@ -5937,7 +5937,7 @@ vdev_prop_get(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl) case VDEV_PROP_COMMENT: /* Exists in the ZAP below */ /* FALLTHRU */ - case VDEV_PROP_USER: + case VDEV_PROP_USERPROP: /* User Properites */ src = ZPROP_SRC_LOCAL; diff --git a/module/zfs/zcp_synctask.c b/module/zfs/zcp_synctask.c index 403856ae35..24210117ec 100644 --- a/module/zfs/zcp_synctask.c +++ b/module/zfs/zcp_synctask.c @@ -325,7 +325,7 @@ zcp_synctask_inherit_prop_check(void *arg, dmu_tx_t *tx) zcp_inherit_prop_arg_t *args = arg; zfs_prop_t prop = zfs_name_to_prop(args->zipa_prop); - if (prop == ZPROP_INVAL) { + if (prop == ZPROP_USERPROP) { if (zfs_prop_user(args->zipa_prop)) return (0); diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c index b3f32d64f3..35aec52262 100644 --- a/module/zfs/zfs_ioctl.c +++ b/module/zfs/zfs_ioctl.c @@ -1104,7 +1104,7 @@ zfs_secpolicy_inherit_prop(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr) (void) innvl; zfs_prop_t prop = zfs_name_to_prop(zc->zc_value); - if (prop == ZPROP_INVAL) { + if (prop == ZPROP_USERPROP) { if (!zfs_prop_user(zc->zc_value)) return (SET_ERROR(EINVAL)); return (zfs_secpolicy_write_perms(zc->zc_name, @@ -2406,7 +2406,7 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source, const char *strval = NULL; int err = -1; - if (prop == ZPROP_INVAL) { + if (prop == ZPROP_USERPROP) { if (zfs_prop_userquota(propname)) return (zfs_prop_set_userquota(dsname, pair)); return (-1); @@ -2577,7 +2577,7 @@ retry: /* inherited properties are expected to be booleans */ if (nvpair_type(propval) != DATA_TYPE_BOOLEAN) err = SET_ERROR(EINVAL); - } else if (err == 0 && prop == ZPROP_INVAL) { + } else if (err == 0 && prop == ZPROP_USERPROP) { if (zfs_prop_user(propname)) { if (nvpair_type(propval) != DATA_TYPE_STRING) err = SET_ERROR(EINVAL); @@ -2853,11 +2853,11 @@ zfs_ioc_inherit_prop(zfs_cmd_t *zc) * and reservation to the received or default values even though * they are not considered inheritable. */ - if (prop != ZPROP_INVAL && !zfs_prop_inheritable(prop)) + if (prop != ZPROP_USERPROP && !zfs_prop_inheritable(prop)) return (SET_ERROR(EINVAL)); } - if (prop == ZPROP_INVAL) { + if (prop == ZPROP_USERPROP) { if (!zfs_prop_user(propname)) return (SET_ERROR(EINVAL)); @@ -4488,7 +4488,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr) uint64_t intval, compval; int err; - if (prop == ZPROP_INVAL) { + if (prop == ZPROP_USERPROP) { if (zfs_prop_user(propname)) { if ((err = zfs_secpolicy_write_perms(dsname, ZFS_DELEG_PERM_USERPROP, cr))) @@ -5034,7 +5034,7 @@ zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, nvlist_t *recvprops, /* -x property */ const char *name = nvpair_name(nvp); zfs_prop_t prop = zfs_name_to_prop(name); - if (prop != ZPROP_INVAL) { + if (prop != ZPROP_USERPROP) { if (!zfs_prop_inheritable(prop)) continue; } else if (!zfs_prop_user(name))