mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Replace ZPROP_INVAL with ZPROP_USERPROP where it means a user property
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Allan Jude <allan@klarasystems.com> Sponsored-by: Klara Inc. Closes #12676
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
+3
-3
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user