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);
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);
}
* 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;
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),
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"),
}
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 {
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)
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 {
}
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 = "-";
typedef enum {
ZPROP_CONT = -2,
ZPROP_INVAL = -1,
+ ZPROP_USERPROP = ZPROP_INVAL,
ZFS_PROP_TYPE = 0,
ZFS_PROP_CREATION,
ZFS_PROP_USED,
*/
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,
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.
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];
}
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);
"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.
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);
*/
start = plp;
while (*start != NULL) {
- if ((*start)->pl_prop == ZPROP_INVAL)
+ if ((*start)->pl_prop == ZPROP_USERPROP)
break;
start = &(*start)->pl_next;
}
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;
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)
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;
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);
}
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;
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)
/* 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)
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) {
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);
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);
/*
* '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) ?
* 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) &&
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 {
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);
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) {
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;
}
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) {
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;
}
case VDEV_PROP_COMMENT:
/* Exists in the ZAP below */
/* FALLTHRU */
- case VDEV_PROP_USER:
+ case VDEV_PROP_USERPROP:
/* User Properites */
src = ZPROP_SRC_LOCAL;
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);
(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,
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);
/* 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);
* 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));
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)))
/* -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))