summaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_ioctl.c
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-10-02 20:44:10 -0400
committerGitHub <[email protected]>2020-10-02 17:44:10 -0700
commit4d55ea811d4f5b832398f4e3b24c4da365956d62 (patch)
treec799540f0984809efa47a3b5d2218940def15297 /module/zfs/zfs_ioctl.c
parent5b525165e9113e7faabd230b504ae4e9b85d35a5 (diff)
Throw const on some strings
In C, const indicates to the reader that mutation will not occur. It can also serve as a hint about ownership. Add const in a few places where it makes sense. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #10997
Diffstat (limited to 'module/zfs/zfs_ioctl.c')
-rw-r--r--module/zfs/zfs_ioctl.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index d2550750c..94cd1a3dc 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -270,7 +270,7 @@ static int zfs_ioc_userspace_upgrade(zfs_cmd_t *zc);
static int zfs_ioc_id_quota_upgrade(zfs_cmd_t *zc);
static int zfs_check_settable(const char *name, nvpair_t *property,
cred_t *cr);
-static int zfs_check_clearable(char *dataset, nvlist_t *props,
+static int zfs_check_clearable(const char *dataset, nvlist_t *props,
nvlist_t **errors);
static int zfs_fill_zplprops_root(uint64_t, nvlist_t *, nvlist_t *,
boolean_t *);
@@ -498,7 +498,7 @@ zfs_secpolicy_write_perms(const char *name, const char *perm, cred_t *cr)
* Returns 0 for success, non-zero for access and other errors.
*/
static int
-zfs_set_slabel_policy(const char *name, char *strval, cred_t *cr)
+zfs_set_slabel_policy(const char *name, const char *strval, cred_t *cr)
{
#ifdef HAVE_MLSLABEL
char ds_hexsl[MAXNAMELEN];
@@ -553,7 +553,7 @@ zfs_set_slabel_policy(const char *name, char *strval, cred_t *cr)
*/
if (strcasecmp(ds_hexsl, ZFS_MLSLABEL_DEFAULT) != 0) {
objset_t *os;
- static char *setsl_tag = "setsl_tag";
+ static const char *setsl_tag = "setsl_tag";
/*
* Try to own the dataset; abort if there is any error,
@@ -680,7 +680,7 @@ zfs_secpolicy_send(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
{
dsl_pool_t *dp;
dsl_dataset_t *ds;
- char *cp;
+ const char *cp;
int error;
/*
@@ -1443,7 +1443,7 @@ zfs_ioc_pool_create(zfs_cmd_t *zc)
nvlist_t *rootprops = NULL;
nvlist_t *zplprops = NULL;
dsl_crypto_params_t *dcp = NULL;
- char *spa_name = zc->zc_name;
+ const char *spa_name = zc->zc_name;
boolean_t unload_wkey = B_TRUE;
if ((error = get_nvlist(zc->zc_nvlist_conf, zc->zc_nvlist_conf_size,
@@ -1997,7 +1997,7 @@ static int
zfs_ioc_vdev_setpath(zfs_cmd_t *zc)
{
spa_t *spa;
- char *path = zc->zc_value;
+ const char *path = zc->zc_value;
uint64_t guid = zc->zc_guid;
int error;
@@ -2014,7 +2014,7 @@ static int
zfs_ioc_vdev_setfru(zfs_cmd_t *zc)
{
spa_t *spa;
- char *fru = zc->zc_value;
+ const char *fru = zc->zc_value;
uint64_t guid = zc->zc_guid;
int error;
@@ -2351,8 +2351,7 @@ zfs_prop_set_userquota(const char *dsname, nvpair_t *pair)
const char *propname = nvpair_name(pair);
uint64_t *valary;
unsigned int vallen;
- const char *domain;
- char *dash;
+ const char *dash, *domain;
zfs_userquota_prop_t type;
uint64_t rid;
uint64_t quota;
@@ -2405,7 +2404,7 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source,
const char *propname = nvpair_name(pair);
zfs_prop_t prop = zfs_name_to_prop(propname);
uint64_t intval = 0;
- char *strval = NULL;
+ const char *strval = NULL;
int err = -1;
if (prop == ZPROP_INVAL) {
@@ -2531,7 +2530,7 @@ zfs_set_prop_nvlist(const char *dsname, zprop_source_t source, nvlist_t *nvl,
nvpair_t *propval;
int rv = 0;
uint64_t intval;
- char *strval;
+ const char *strval;
nvlist_t *genericnvl = fnvlist_alloc();
nvlist_t *retrynvl = fnvlist_alloc();
@@ -3349,7 +3348,7 @@ zfs_ioc_clone(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl)
{
int error = 0;
nvlist_t *nvprops = NULL;
- char *origin_name;
+ const char *origin_name;
origin_name = fnvlist_lookup_string(innvl, "origin");
(void) nvlist_lookup_nvlist(innvl, "props", &nvprops);
@@ -3475,10 +3474,10 @@ static const zfs_ioc_key_t zfs_keys_log_history[] = {
static int
zfs_ioc_log_history(const char *unused, nvlist_t *innvl, nvlist_t *outnvl)
{
- char *message;
+ const char *message;
+ char *poolname;
spa_t *spa;
int error;
- char *poolname;
/*
* The poolname in the ioctl is not set, we get it from the TSD,
@@ -3574,7 +3573,7 @@ zfs_unmount_snap(const char *snapname)
if (strchr(snapname, '@') == NULL)
return;
- (void) zfsctl_snapshot_unmount((char *)snapname, MNT_FORCE);
+ (void) zfsctl_snapshot_unmount(snapname, MNT_FORCE);
}
/* ARGSUSED */
@@ -4617,7 +4616,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
* pointed at by errlist is NULL.
*/
static int
-zfs_check_clearable(char *dataset, nvlist_t *props, nvlist_t **errlist)
+zfs_check_clearable(const char *dataset, nvlist_t *props, nvlist_t **errlist)
{
zfs_cmd_t *zc;
nvpair_t *pair, *next_pair;