aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/nvpair/fnvpair.c12
-rw-r--r--module/nvpair/nvpair.c16
-rw-r--r--module/os/freebsd/spl/spl_sysevent.c4
-rw-r--r--module/os/freebsd/zfs/zfs_znode.c2
-rw-r--r--module/os/linux/zfs/zfs_znode.c2
-rw-r--r--module/zcommon/zfs_comutil.c4
-rw-r--r--module/zcommon/zfs_deleg.c4
-rw-r--r--module/zfs/dmu_recv.c9
-rw-r--r--module/zfs/dsl_bookmark.c16
-rw-r--r--module/zfs/dsl_crypt.c2
-rw-r--r--module/zfs/dsl_dataset.c12
-rw-r--r--module/zfs/dsl_destroy.c2
-rw-r--r--module/zfs/dsl_prop.c2
-rw-r--r--module/zfs/dsl_userhold.c4
-rw-r--r--module/zfs/fm.c2
-rw-r--r--module/zfs/spa.c24
-rw-r--r--module/zfs/spa_config.c4
-rw-r--r--module/zfs/spa_history.c2
-rw-r--r--module/zfs/spa_misc.c2
-rw-r--r--module/zfs/vdev.c37
-rw-r--r--module/zfs/vdev_draid.c4
-rw-r--r--module/zfs/vdev_label.c5
-rw-r--r--module/zfs/vdev_removal.c2
-rw-r--r--module/zfs/zcp.c2
-rw-r--r--module/zfs/zcp_get.c2
-rw-r--r--module/zfs/zcp_iter.c2
-rw-r--r--module/zfs/zfs_fuid.c2
-rw-r--r--module/zfs/zfs_ioctl.c54
28 files changed, 118 insertions, 117 deletions
diff --git a/module/nvpair/fnvpair.c b/module/nvpair/fnvpair.c
index 86b0b4cdf..cc2233c40 100644
--- a/module/nvpair/fnvpair.c
+++ b/module/nvpair/fnvpair.c
@@ -402,10 +402,10 @@ fnvlist_lookup_uint64(const nvlist_t *nvl, const char *name)
return (rv);
}
-char *
-fnvlist_lookup_string(nvlist_t *nvl, const char *name)
+const char *
+fnvlist_lookup_string(const nvlist_t *nvl, const char *name)
{
- char *rv;
+ const char *rv;
VERIFY0(nvlist_lookup_string(nvl, name, &rv));
return (rv);
}
@@ -577,10 +577,10 @@ fnvpair_value_uint64(const nvpair_t *nvp)
return (rv);
}
-char *
-fnvpair_value_string(nvpair_t *nvp)
+const char *
+fnvpair_value_string(const nvpair_t *nvp)
{
- char *rv;
+ const char *rv;
VERIFY0(nvpair_value_string(nvp, &rv));
return (rv);
}
diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c
index 023d49601..d9449e47e 100644
--- a/module/nvpair/nvpair.c
+++ b/module/nvpair/nvpair.c
@@ -473,7 +473,7 @@ nvt_remove_nvpair(nvlist_t *nvl, const nvpair_t *nvp)
}
i_nvp_t **tab = priv->nvp_hashtable;
- char *name = NVP_NAME(nvp);
+ const char *name = NVP_NAME(nvp);
uint64_t hash = nvt_hash(name);
uint64_t index = hash & (priv->nvp_nbuckets - 1);
@@ -528,7 +528,7 @@ nvt_add_nvpair(nvlist_t *nvl, nvpair_t *nvp)
}
i_nvp_t **tab = priv->nvp_hashtable;
- char *name = NVP_NAME(nvp);
+ const char *name = NVP_NAME(nvp);
uint64_t hash = nvt_hash(name);
uint64_t index = hash & (priv->nvp_nbuckets - 1);
@@ -1517,7 +1517,7 @@ nvlist_empty(const nvlist_t *nvl)
return (priv->nvp_list == NULL);
}
-char *
+const char *
nvpair_name(const nvpair_t *nvp)
{
return (NVP_NAME(nvp));
@@ -1731,7 +1731,7 @@ nvlist_lookup_double(const nvlist_t *nvl, const char *name, double *val)
#endif
int
-nvlist_lookup_string(nvlist_t *nvl, const char *name, char **val)
+nvlist_lookup_string(const nvlist_t *nvl, const char *name, const char **val)
{
return (nvlist_lookup_common(nvl, name, DATA_TYPE_STRING, NULL, val));
}
@@ -1917,7 +1917,7 @@ nvlist_lookup_pairs(nvlist_t *nvl, int flag, ...)
*/
static int
nvlist_lookup_nvpair_ei_sep(nvlist_t *nvl, const char *name, const char sep,
- nvpair_t **ret, int *ip, char **ep)
+ nvpair_t **ret, int *ip, const char **ep)
{
nvpair_t *nvp;
const char *np;
@@ -2097,7 +2097,7 @@ nvlist_lookup_nvpair(nvlist_t *nvl, const char *name, nvpair_t **ret)
* description.
*/
int nvlist_lookup_nvpair_embedded_index(nvlist_t *nvl,
- const char *name, nvpair_t **ret, int *ip, char **ep)
+ const char *name, nvpair_t **ret, int *ip, const char **ep)
{
return (nvlist_lookup_nvpair_ei_sep(nvl, name, '.', ret, ip, ep));
}
@@ -2192,7 +2192,7 @@ nvpair_value_double(const nvpair_t *nvp, double *val)
#endif
int
-nvpair_value_string(nvpair_t *nvp, char **val)
+nvpair_value_string(const nvpair_t *nvp, const char **val)
{
return (nvpair_value_common(nvp, DATA_TYPE_STRING, NULL, val));
}
@@ -2264,7 +2264,7 @@ nvpair_value_uint64_array(nvpair_t *nvp, uint64_t **val, uint_t *nelem)
}
int
-nvpair_value_string_array(nvpair_t *nvp, char ***val, uint_t *nelem)
+nvpair_value_string_array(nvpair_t *nvp, const char ***val, uint_t *nelem)
{
return (nvpair_value_common(nvp, DATA_TYPE_STRING_ARRAY, nelem, val));
}
diff --git a/module/os/freebsd/spl/spl_sysevent.c b/module/os/freebsd/spl/spl_sysevent.c
index 16188c71b..4a2d02350 100644
--- a/module/os/freebsd/spl/spl_sysevent.c
+++ b/module/os/freebsd/spl/spl_sysevent.c
@@ -114,7 +114,7 @@ log_sysevent(nvlist_t *event)
}
case DATA_TYPE_STRING:
{
- char *value;
+ const char *value;
(void) nvpair_value_string(elem, &value);
sbuf_printf(sb, " %s=%s", nvpair_name(elem), value);
@@ -180,7 +180,7 @@ log_sysevent(nvlist_t *event)
}
case DATA_TYPE_STRING_ARRAY:
{
- char **strarr;
+ const char **strarr;
uint_t ii, nelem;
(void) nvpair_value_string_array(elem, &strarr, &nelem);
diff --git a/module/os/freebsd/zfs/zfs_znode.c b/module/os/freebsd/zfs/zfs_znode.c
index dc1d31e1b..d26d89544 100644
--- a/module/os/freebsd/zfs/zfs_znode.c
+++ b/module/os/freebsd/zfs/zfs_znode.c
@@ -1690,7 +1690,7 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
while ((elem = nvlist_next_nvpair(zplprops, elem)) != NULL) {
/* For the moment we expect all zpl props to be uint64_ts */
uint64_t val;
- char *name;
+ const char *name;
ASSERT3S(nvpair_type(elem), ==, DATA_TYPE_UINT64);
val = fnvpair_value_uint64(elem);
diff --git a/module/os/linux/zfs/zfs_znode.c b/module/os/linux/zfs/zfs_znode.c
index 7b802a9ba..38cdccfd8 100644
--- a/module/os/linux/zfs/zfs_znode.c
+++ b/module/os/linux/zfs/zfs_znode.c
@@ -1866,7 +1866,7 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
while ((elem = nvlist_next_nvpair(zplprops, elem)) != NULL) {
/* For the moment we expect all zpl props to be uint64_ts */
uint64_t val;
- char *name;
+ const char *name;
ASSERT(nvpair_type(elem) == DATA_TYPE_UINT64);
VERIFY(nvpair_value_uint64(elem, &val) == 0);
diff --git a/module/zcommon/zfs_comutil.c b/module/zcommon/zfs_comutil.c
index 36a9c8a35..384746bd4 100644
--- a/module/zcommon/zfs_comutil.c
+++ b/module/zcommon/zfs_comutil.c
@@ -70,7 +70,7 @@ zfs_allocatable_devs(nvlist_t *nv)
boolean_t
zfs_special_devs(nvlist_t *nv, const char *type)
{
- char *bias;
+ const char *bias;
uint_t c;
nvlist_t **child;
uint_t children;
@@ -98,7 +98,7 @@ zpool_get_load_policy(nvlist_t *nvl, zpool_load_policy_t *zlpp)
{
nvlist_t *policy;
nvpair_t *elem;
- char *nm;
+ const char *nm;
/* Defaults */
zlpp->zlp_rewind = ZPOOL_NO_REWIND;
diff --git a/module/zcommon/zfs_deleg.c b/module/zcommon/zfs_deleg.c
index 40d207b50..f977c7611 100644
--- a/module/zcommon/zfs_deleg.c
+++ b/module/zcommon/zfs_deleg.c
@@ -102,9 +102,9 @@ zfs_deleg_canonicalize_perm(const char *perm)
}
static int
-zfs_validate_who(char *who)
+zfs_validate_who(const char *who)
{
- char *p;
+ const char *p;
if (who[2] != ZFS_DELEG_FIELD_SEP_CHR)
return (-1);
diff --git a/module/zfs/dmu_recv.c b/module/zfs/dmu_recv.c
index 2647eb052..c2ce5ce00 100644
--- a/module/zfs/dmu_recv.c
+++ b/module/zfs/dmu_recv.c
@@ -1217,10 +1217,11 @@ dmu_recv_resume_begin_sync(void *arg, dmu_tx_t *tx)
* succeeds; otherwise we will leak the holds on the datasets.
*/
int
-dmu_recv_begin(char *tofs, char *tosnap, dmu_replay_record_t *drr_begin,
- boolean_t force, boolean_t heal, boolean_t resumable, nvlist_t *localprops,
- nvlist_t *hidden_args, char *origin, dmu_recv_cookie_t *drc,
- zfs_file_t *fp, offset_t *voffp)
+dmu_recv_begin(const char *tofs, const char *tosnap,
+ dmu_replay_record_t *drr_begin, boolean_t force, boolean_t heal,
+ boolean_t resumable, nvlist_t *localprops, nvlist_t *hidden_args,
+ const char *origin, dmu_recv_cookie_t *drc, zfs_file_t *fp,
+ offset_t *voffp)
{
dmu_recv_begin_arg_t drba = { 0 };
int err = 0;
diff --git a/module/zfs/dsl_bookmark.c b/module/zfs/dsl_bookmark.c
index b95c94bef..e04796a08 100644
--- a/module/zfs/dsl_bookmark.c
+++ b/module/zfs/dsl_bookmark.c
@@ -160,14 +160,14 @@ dsl_bookmark_create_nvl_validate_pair(const char *bmark, const char *source)
int
dsl_bookmark_create_nvl_validate(nvlist_t *bmarks)
{
- char *first = NULL;
+ const char *first = NULL;
size_t first_len = 0;
for (nvpair_t *pair = nvlist_next_nvpair(bmarks, NULL);
pair != NULL; pair = nvlist_next_nvpair(bmarks, pair)) {
- char *bmark = nvpair_name(pair);
- char *source;
+ const char *bmark = nvpair_name(pair);
+ const char *source;
/* list structure: values must be snapshots XOR bookmarks */
if (nvpair_value_string(pair, &source) != 0)
@@ -177,7 +177,7 @@ dsl_bookmark_create_nvl_validate(nvlist_t *bmarks)
/* same pool check */
if (first == NULL) {
- char *cp = strpbrk(bmark, "/#");
+ const char *cp = strpbrk(bmark, "/#");
if (cp == NULL)
return (-1);
first = bmark;
@@ -305,11 +305,11 @@ dsl_bookmark_create_check(void *arg, dmu_tx_t *tx)
for (nvpair_t *pair = nvlist_next_nvpair(dbca->dbca_bmarks, NULL);
pair != NULL; pair = nvlist_next_nvpair(dbca->dbca_bmarks, pair)) {
- char *new = nvpair_name(pair);
+ const char *new = nvpair_name(pair);
int error = schema_err;
if (error == 0) {
- char *source = fnvpair_value_string(pair);
+ const char *source = fnvpair_value_string(pair);
error = dsl_bookmark_create_check_impl(dp, new, source);
if (error != 0)
error = SET_ERROR(error);
@@ -589,8 +589,8 @@ dsl_bookmark_create_sync(void *arg, dmu_tx_t *tx)
for (nvpair_t *pair = nvlist_next_nvpair(dbca->dbca_bmarks, NULL);
pair != NULL; pair = nvlist_next_nvpair(dbca->dbca_bmarks, pair)) {
- char *new = nvpair_name(pair);
- char *source = fnvpair_value_string(pair);
+ const char *new = nvpair_name(pair);
+ const char *source = fnvpair_value_string(pair);
if (strchr(source, '@') != NULL) {
dsl_bookmark_create_sync_impl_snap(new, source, tx,
diff --git a/module/zfs/dsl_crypt.c b/module/zfs/dsl_crypt.c
index dd936e74b..5e6e4e3d6 100644
--- a/module/zfs/dsl_crypt.c
+++ b/module/zfs/dsl_crypt.c
@@ -143,7 +143,7 @@ dsl_crypto_params_create_nvlist(dcp_cmd_t cmd, nvlist_t *props,
dsl_wrapping_key_t *wkey = NULL;
uint8_t *wkeydata = NULL;
uint_t wkeydata_len = 0;
- char *keylocation = NULL;
+ const char *keylocation = NULL;
dcp = kmem_zalloc(sizeof (dsl_crypto_params_t), KM_SLEEP);
dcp->cp_cmd = cmd;
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index 1fa73e837..14e7ced40 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -1620,7 +1620,7 @@ dsl_dataset_snapshot_check(void *arg, dmu_tx_t *tx)
for (pair = nvlist_next_nvpair(cnt_track, NULL);
pair != NULL; pair = nvlist_next_nvpair(cnt_track, pair)) {
int error = 0;
- char *name;
+ const char *name;
uint64_t cnt = 0;
dsl_dataset_t *ds;
@@ -1652,7 +1652,7 @@ dsl_dataset_snapshot_check(void *arg, dmu_tx_t *tx)
pair != NULL; pair = nvlist_next_nvpair(ddsa->ddsa_snaps, pair)) {
int error = 0;
dsl_dataset_t *ds;
- char *name, *atp = NULL;
+ const char *name, *atp = NULL;
char dsname[ZFS_MAX_DATASET_NAME_LEN];
name = nvpair_name(pair);
@@ -1877,7 +1877,7 @@ dsl_dataset_snapshot_sync(void *arg, dmu_tx_t *tx)
for (pair = nvlist_next_nvpair(ddsa->ddsa_snaps, NULL);
pair != NULL; pair = nvlist_next_nvpair(ddsa->ddsa_snaps, pair)) {
dsl_dataset_t *ds;
- char *name, *atp;
+ const char *name, *atp;
char dsname[ZFS_MAX_DATASET_NAME_LEN];
name = nvpair_name(pair);
@@ -1906,7 +1906,7 @@ dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t *errors)
boolean_t needsuspend;
int error;
spa_t *spa;
- char *firstname;
+ const char *firstname;
nvlist_t *suspended = NULL;
pair = nvlist_next_nvpair(snaps, NULL);
@@ -1925,8 +1925,8 @@ dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, nvlist_t *errors)
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
pair = nvlist_next_nvpair(snaps, pair)) {
char fsname[ZFS_MAX_DATASET_NAME_LEN];
- char *snapname = nvpair_name(pair);
- char *atp;
+ const char *snapname = nvpair_name(pair);
+ const char *atp;
void *cookie;
atp = strchr(snapname, '@');
diff --git a/module/zfs/dsl_destroy.c b/module/zfs/dsl_destroy.c
index 100a48cb4..053f26878 100644
--- a/module/zfs/dsl_destroy.c
+++ b/module/zfs/dsl_destroy.c
@@ -658,7 +658,7 @@ dsl_destroy_snapshots_nvl(nvlist_t *snaps, boolean_t defer,
zfs_lua_max_memlimit,
fnvlist_lookup_nvpair(wrapper, ZCP_ARG_ARGLIST), result);
if (error != 0) {
- char *errorstr = NULL;
+ const char *errorstr = NULL;
(void) nvlist_lookup_string(result, ZCP_RET_ERROR, &errorstr);
if (errorstr != NULL) {
zfs_dbgmsg("%s", errorstr);
diff --git a/module/zfs/dsl_prop.c b/module/zfs/dsl_prop.c
index a1e73f97e..99f931cd8 100644
--- a/module/zfs/dsl_prop.c
+++ b/module/zfs/dsl_prop.c
@@ -956,7 +956,7 @@ dsl_props_set_check(void *arg, dmu_tx_t *tx)
return (SET_ERROR(ENAMETOOLONG));
}
if (nvpair_type(elem) == DATA_TYPE_STRING) {
- char *valstr = fnvpair_value_string(elem);
+ const char *valstr = fnvpair_value_string(elem);
if (strlen(valstr) >= (version <
SPA_VERSION_STMF_PROP ?
ZAP_OLDMAXVALUELEN : ZAP_MAXVALUELEN)) {
diff --git a/module/zfs/dsl_userhold.c b/module/zfs/dsl_userhold.c
index befb06cbd..75953f70f 100644
--- a/module/zfs/dsl_userhold.c
+++ b/module/zfs/dsl_userhold.c
@@ -115,7 +115,7 @@ dsl_dataset_user_hold_check(void *arg, dmu_tx_t *tx)
pair != NULL; pair = nvlist_next_nvpair(dduha->dduha_holds, pair)) {
dsl_dataset_t *ds;
int error = 0;
- char *htag, *name;
+ const char *htag, *name;
/* must be a snapshot */
name = nvpair_name(pair);
@@ -572,7 +572,7 @@ dsl_dataset_user_release_impl(nvlist_t *holds, nvlist_t *errlist,
{
dsl_dataset_user_release_arg_t ddura;
nvpair_t *pair;
- char *pool;
+ const char *pool;
int error;
pair = nvlist_next_nvpair(holds, NULL);
diff --git a/module/zfs/fm.c b/module/zfs/fm.c
index 52ea6262a..76956572f 100644
--- a/module/zfs/fm.c
+++ b/module/zfs/fm.c
@@ -892,7 +892,7 @@ fm_fmri_hc_create(nvlist_t *fmri, int version, const nvlist_t *auth,
uint_t n;
int i, j;
va_list ap;
- char *hcname, *hcid;
+ const char *hcname, *hcid;
if (!fm_fmri_hc_set_common(fmri, version, auth))
return;
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 98a302237..95b38f098 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -550,7 +550,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props)
elem = NULL;
while ((elem = nvlist_next_nvpair(props, elem)) != NULL) {
uint64_t intval;
- char *strval, *slash, *check, *fname;
+ const char *strval, *slash, *check, *fname;
const char *propname = nvpair_name(elem);
zpool_prop_t prop = zpool_name_to_prop(propname);
@@ -752,7 +752,7 @@ spa_prop_validate(spa_t *spa, nvlist_t *props)
void
spa_configfile_set(spa_t *spa, nvlist_t *nvp, boolean_t need_sync)
{
- char *cachefile;
+ const char *cachefile;
spa_config_dirent_t *dp;
if (nvlist_lookup_string(nvp, zpool_prop_to_name(ZPOOL_PROP_CACHEFILE),
@@ -3351,7 +3351,7 @@ static int
spa_verify_host(spa_t *spa, nvlist_t *mos_config)
{
uint64_t hostid;
- char *hostname;
+ const char *hostname;
uint64_t myhostid = 0;
if (!spa_is_root(spa) && nvlist_lookup_uint64(mos_config,
@@ -3386,8 +3386,8 @@ spa_ld_parse_config(spa_t *spa, spa_import_type_t type)
int parse;
vdev_t *rvd;
uint64_t pool_guid;
- char *comment;
- char *compatibility;
+ const char *comment;
+ const char *compatibility;
/*
* Versioning wasn't explicitly added to the label until later, so if
@@ -5797,7 +5797,7 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
nvlist_t *zplprops, dsl_crypto_params_t *dcp)
{
spa_t *spa;
- char *altroot = NULL;
+ const char *altroot = NULL;
vdev_t *rvd;
dsl_pool_t *dp;
dmu_tx_t *tx;
@@ -5810,8 +5810,8 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
boolean_t has_encryption;
boolean_t has_allocclass;
spa_feature_t feat;
- char *feat_name;
- char *poolname;
+ const char *feat_name;
+ const char *poolname;
nvlist_t *nvl;
if (props == NULL ||
@@ -6110,7 +6110,7 @@ int
spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
{
spa_t *spa;
- char *altroot = NULL;
+ const char *altroot = NULL;
spa_load_state_t state = SPA_LOAD_IMPORT;
zpool_load_policy_t policy;
spa_mode_t mode = spa_mode_global;
@@ -6290,7 +6290,7 @@ nvlist_t *
spa_tryimport(nvlist_t *tryconfig)
{
nvlist_t *config = NULL;
- char *poolname, *cachefile;
+ const char *poolname, *cachefile;
spa_t *spa;
uint64_t state;
int error;
@@ -7563,7 +7563,7 @@ spa_vdev_split_mirror(spa_t *spa, const char *newname, nvlist_t *config,
uint_t c, children, lastlog;
nvlist_t **child, *nvl, *tmp;
dmu_tx_t *tx;
- char *altroot = NULL;
+ const char *altroot = NULL;
vdev_t *rvd, **vml = NULL; /* vdev modify list */
boolean_t activate_slog;
@@ -8783,7 +8783,7 @@ spa_sync_props(void *arg, dmu_tx_t *tx)
while ((elem = nvlist_next_nvpair(nvp, elem))) {
uint64_t intval;
- char *strval, *fname;
+ const char *strval, *fname;
zpool_prop_t prop;
const char *propname;
zprop_type_t proptype;
diff --git a/module/zfs/spa_config.c b/module/zfs/spa_config.c
index bf4d1e210..636c04d9f 100644
--- a/module/zfs/spa_config.c
+++ b/module/zfs/spa_config.c
@@ -245,7 +245,7 @@ spa_write_cachefile(spa_t *target, boolean_t removing, boolean_t postsysevent,
{
spa_config_dirent_t *dp, *tdp;
nvlist_t *nvl;
- char *pool_name;
+ const char *pool_name;
boolean_t ccw_failure;
int error = 0;
@@ -418,7 +418,7 @@ spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t txg, int getstats)
unsigned long hostid = 0;
boolean_t locked = B_FALSE;
uint64_t split_guid;
- char *pool_name;
+ const char *pool_name;
if (vd == NULL) {
vd = rvd;
diff --git a/module/zfs/spa_history.c b/module/zfs/spa_history.c
index 6d468e716..de036d6c3 100644
--- a/module/zfs/spa_history.c
+++ b/module/zfs/spa_history.c
@@ -199,7 +199,7 @@ spa_history_log_notify(spa_t *spa, nvlist_t *nvl)
{
nvlist_t *hist_nvl = fnvlist_alloc();
uint64_t uint64;
- char *string;
+ const char *string;
if (nvlist_lookup_string(nvl, ZPOOL_HIST_CMD, &string) == 0)
fnvlist_add_string(hist_nvl, ZFS_EV_HIST_CMD, string);
diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c
index 8466fa80e..1475a4a53 100644
--- a/module/zfs/spa_misc.c
+++ b/module/zfs/spa_misc.c
@@ -2307,7 +2307,7 @@ spa_import_progress_add(spa_t *spa)
{
spa_history_list_t *shl = spa_import_progress_list;
spa_import_progress_t *sip;
- char *poolname = NULL;
+ const char *poolname = NULL;
sip = kmem_zalloc(sizeof (spa_import_progress_t), KM_SLEEP);
sip->pool_guid = spa_guid(spa);
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index 4922067dc..1af5baeec 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -727,11 +727,11 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
int alloctype)
{
vdev_ops_t *ops;
- char *type;
+ const char *type;
uint64_t guid = 0, islog;
vdev_t *vd;
vdev_indirect_config_t *vic;
- char *tmp = NULL;
+ const char *tmp = NULL;
int rc;
vdev_alloc_bias_t alloc_bias = VDEV_BIAS_NONE;
boolean_t top_level = (parent && !parent->vdev_parent);
@@ -786,7 +786,7 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
return (SET_ERROR(ENOTSUP));
if (top_level && alloctype == VDEV_ALLOC_ADD) {
- char *bias;
+ const char *bias;
/*
* If creating a top-level vdev, check for allocation
@@ -832,8 +832,8 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
if (top_level && alloc_bias != VDEV_BIAS_NONE)
vd->vdev_alloc_bias = alloc_bias;
- if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &vd->vdev_path) == 0)
- vd->vdev_path = spa_strdup(vd->vdev_path);
+ if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &tmp) == 0)
+ vd->vdev_path = spa_strdup(tmp);
/*
* ZPOOL_CONFIG_AUX_STATE = "external" means we previously forced a
@@ -847,18 +847,17 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
vd->vdev_label_aux = VDEV_AUX_EXTERNAL;
}
- if (nvlist_lookup_string(nv, ZPOOL_CONFIG_DEVID, &vd->vdev_devid) == 0)
- vd->vdev_devid = spa_strdup(vd->vdev_devid);
- if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PHYS_PATH,
- &vd->vdev_physpath) == 0)
- vd->vdev_physpath = spa_strdup(vd->vdev_physpath);
+ if (nvlist_lookup_string(nv, ZPOOL_CONFIG_DEVID, &tmp) == 0)
+ vd->vdev_devid = spa_strdup(tmp);
+ if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PHYS_PATH, &tmp) == 0)
+ vd->vdev_physpath = spa_strdup(tmp);
if (nvlist_lookup_string(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
- &vd->vdev_enc_sysfs_path) == 0)
- vd->vdev_enc_sysfs_path = spa_strdup(vd->vdev_enc_sysfs_path);
+ &tmp) == 0)
+ vd->vdev_enc_sysfs_path = spa_strdup(tmp);
- if (nvlist_lookup_string(nv, ZPOOL_CONFIG_FRU, &vd->vdev_fru) == 0)
- vd->vdev_fru = spa_strdup(vd->vdev_fru);
+ if (nvlist_lookup_string(nv, ZPOOL_CONFIG_FRU, &tmp) == 0)
+ vd->vdev_fru = spa_strdup(tmp);
/*
* Set the whole_disk property. If it's not specified, leave the value
@@ -989,7 +988,7 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
&vd->vdev_removed);
if (vd->vdev_faulted || vd->vdev_degraded) {
- char *aux;
+ const char *aux;
vd->vdev_label_aux =
VDEV_AUX_ERR_EXCEEDED;
@@ -5624,7 +5623,7 @@ vdev_replace_in_progress(vdev_t *vdev)
* Add a (source=src, propname=propval) list to an nvlist.
*/
static void
-vdev_prop_add_list(nvlist_t *nvl, const char *propname, char *strval,
+vdev_prop_add_list(nvlist_t *nvl, const char *propname, const char *strval,
uint64_t intval, zprop_source_t src)
{
nvlist_t *propval;
@@ -5664,7 +5663,7 @@ vdev_props_set_sync(void *arg, dmu_tx_t *tx)
while ((elem = nvlist_next_nvpair(nvprops, elem)) != NULL) {
uint64_t intval, objid = 0;
- char *strval;
+ const char *strval;
vdev_prop_t prop;
const char *propname = nvpair_name(elem);
zprop_type_t proptype;
@@ -5760,10 +5759,10 @@ vdev_prop_set(vdev_t *vd, nvlist_t *innvl, nvlist_t *outnvl)
return (SET_ERROR(EINVAL));
while ((elem = nvlist_next_nvpair(nvprops, elem)) != NULL) {
- char *propname = nvpair_name(elem);
+ const char *propname = nvpair_name(elem);
vdev_prop_t prop = vdev_name_to_prop(propname);
uint64_t intval = 0;
- char *strval = NULL;
+ const char *strval = NULL;
if (prop == VDEV_PROP_USERPROP && !vdev_prop_user(propname)) {
error = EINVAL;
diff --git a/module/zfs/vdev_draid.c b/module/zfs/vdev_draid.c
index c46dc0c5e..307e2353d 100644
--- a/module/zfs/vdev_draid.c
+++ b/module/zfs/vdev_draid.c
@@ -2720,7 +2720,7 @@ vdev_draid_spare_lookup(spa_t *spa, nvlist_t *nv, uint64_t *top_guidp,
return (SET_ERROR(ENOENT));
}
- char *spare_name;
+ const char *spare_name;
error = nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &spare_name);
if (error != 0)
return (SET_ERROR(EINVAL));
@@ -2728,7 +2728,7 @@ vdev_draid_spare_lookup(spa_t *spa, nvlist_t *nv, uint64_t *top_guidp,
for (int i = 0; i < nspares; i++) {
nvlist_t *spare = spares[i];
uint64_t top_guid, spare_id;
- char *type, *path;
+ const char *type, *path;
/* Skip non-distributed spares */
error = nvlist_lookup_string(spare, ZPOOL_CONFIG_TYPE, &type);
diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c
index 6e47c8cb6..d81bc29f2 100644
--- a/module/zfs/vdev_label.c
+++ b/module/zfs/vdev_label.c
@@ -1359,6 +1359,7 @@ vdev_label_write_bootenv(vdev_t *vd, nvlist_t *env)
int error;
size_t nvsize;
char *nvbuf;
+ const char *tmp;
error = nvlist_size(env, &nvsize, NV_ENCODE_XDR);
if (error != 0)
@@ -1398,8 +1399,8 @@ vdev_label_write_bootenv(vdev_t *vd, nvlist_t *env)
bootenv->vbe_version = fnvlist_lookup_uint64(env, BOOTENV_VERSION);
switch (bootenv->vbe_version) {
case VB_RAW:
- if (nvlist_lookup_string(env, GRUB_ENVMAP, &nvbuf) == 0) {
- (void) strlcpy(bootenv->vbe_bootenv, nvbuf, nvsize);
+ if (nvlist_lookup_string(env, GRUB_ENVMAP, &tmp) == 0) {
+ (void) strlcpy(bootenv->vbe_bootenv, tmp, nvsize);
}
error = 0;
break;
diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c
index aaa88eb89..1249657f9 100644
--- a/module/zfs/vdev_removal.c
+++ b/module/zfs/vdev_removal.c
@@ -2414,7 +2414,7 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare)
* in this pool.
*/
if (vd == NULL || unspare) {
- char *type;
+ const char *type;
boolean_t draid_spare = B_FALSE;
if (nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type)
diff --git a/module/zfs/zcp.c b/module/zfs/zcp.c
index 89ed4f91f..959404f66 100644
--- a/module/zfs/zcp.c
+++ b/module/zfs/zcp.c
@@ -544,7 +544,7 @@ zcp_nvpair_value_to_lua(lua_State *state, nvpair_t *pair,
fnvpair_value_nvlist(pair), errbuf, errbuf_len);
break;
case DATA_TYPE_STRING_ARRAY: {
- char **strarr;
+ const char **strarr;
uint_t nelem;
(void) nvpair_value_string_array(pair, &strarr, &nelem);
lua_newtable(state);
diff --git a/module/zfs/zcp_get.c b/module/zfs/zcp_get.c
index f28266b80..6fd45151d 100644
--- a/module/zfs/zcp_get.c
+++ b/module/zfs/zcp_get.c
@@ -391,7 +391,7 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, const char *dsname,
dsl_dataset_crypt_stats(ds, nvl);
if (nvlist_lookup_nvlist(nvl, zfs_prop_to_name(zfs_prop),
&propval) == 0) {
- char *source;
+ const char *source;
(void) nvlist_lookup_uint64(propval, ZPROP_VALUE,
&numval);
diff --git a/module/zfs/zcp_iter.c b/module/zfs/zcp_iter.c
index ed575738f..2da0bf974 100644
--- a/module/zfs/zcp_iter.c
+++ b/module/zfs/zcp_iter.c
@@ -333,7 +333,7 @@ zcp_user_props_list_gc(lua_State *state)
static int
zcp_user_props_iter(lua_State *state)
{
- char *source, *val;
+ const char *source, *val;
nvlist_t *nvprop;
nvlist_t **props = lua_touserdata(state, lua_upvalueindex(1));
nvpair_t *pair = lua_touserdata(state, lua_upvalueindex(2));
diff --git a/module/zfs/zfs_fuid.c b/module/zfs/zfs_fuid.c
index e2e066b0e..44aaae9c1 100644
--- a/module/zfs/zfs_fuid.c
+++ b/module/zfs/zfs_fuid.c
@@ -133,7 +133,7 @@ zfs_fuid_table_load(objset_t *os, uint64_t fuid_obj, avl_tree_t *idx_tree,
for (i = 0; i != count; i++) {
fuid_domain_t *domnode;
- char *domain;
+ const char *domain;
uint64_t idx;
VERIFY(nvlist_lookup_string(fuidnvp[i], FUID_DOMAIN,
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index 9b859adc5..22e644f75 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -604,7 +604,7 @@ static int
zfs_secpolicy_setprop(const char *dsname, zfs_prop_t prop, nvpair_t *propval,
cred_t *cr)
{
- char *strval;
+ const char *strval;
/*
* Check permissions for special properties.
@@ -935,7 +935,7 @@ zfs_secpolicy_snapshot(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
pair = nvlist_next_nvpair(snaps, pair)) {
- char *name = nvpair_name(pair);
+ char *name = (char *)nvpair_name(pair);
char *atp = strchr(name, '@');
if (atp == NULL) {
@@ -962,7 +962,7 @@ zfs_secpolicy_bookmark(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
for (nvpair_t *pair = nvlist_next_nvpair(innvl, NULL);
pair != NULL; pair = nvlist_next_nvpair(innvl, pair)) {
- char *name = nvpair_name(pair);
+ char *name = (char *)nvpair_name(pair);
char *hashp = strchr(name, '#');
if (hashp == NULL) {
@@ -988,7 +988,7 @@ zfs_secpolicy_destroy_bookmarks(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
for (pair = nvlist_next_nvpair(innvl, NULL); pair != NULL;
pair = nextpair) {
- char *name = nvpair_name(pair);
+ char *name = (char *)nvpair_name(pair);
char *hashp = strchr(name, '#');
nextpair = nvlist_next_nvpair(innvl, pair);
@@ -1036,9 +1036,9 @@ zfs_secpolicy_log_history(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
static int
zfs_secpolicy_create_clone(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
{
- char parentname[ZFS_MAX_DATASET_NAME_LEN];
- int error;
- char *origin;
+ char parentname[ZFS_MAX_DATASET_NAME_LEN];
+ int error;
+ const char *origin;
if ((error = zfs_get_parent(zc->zc_name, parentname,
sizeof (parentname))) != 0)
@@ -1460,7 +1460,7 @@ zfs_ioc_pool_create(zfs_cmd_t *zc)
nvlist_t *nvl = NULL;
nvlist_t *hidden_args = NULL;
uint64_t version = SPA_VERSION;
- char *tname;
+ const char *tname;
(void) nvlist_lookup_uint64(props,
zpool_prop_to_name(ZPOOL_PROP_VERSION), &version);
@@ -3916,7 +3916,7 @@ static int
zfs_ioc_channel_program(const char *poolname, nvlist_t *innvl,
nvlist_t *outnvl)
{
- char *program;
+ const char *program;
uint64_t instrlimit, memlimit;
boolean_t sync_flag;
nvpair_t *nvarg = NULL;
@@ -4336,7 +4336,7 @@ zfs_ioc_rollback(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl)
{
zfsvfs_t *zfsvfs;
zvol_state_handle_t *zv;
- char *target = NULL;
+ const char *target = NULL;
int error;
(void) nvlist_lookup_string(innvl, "target", &target);
@@ -4412,7 +4412,7 @@ zfs_ioc_redact(const char *snapname, nvlist_t *innvl, nvlist_t *outnvl)
{
(void) outnvl;
nvlist_t *redactnvl = NULL;
- char *redactbook = NULL;
+ const char *redactbook = NULL;
if (nvlist_lookup_nvlist(innvl, "snapnv", &redactnvl) != 0)
return (SET_ERROR(EINVAL));
@@ -4808,10 +4808,10 @@ propval_equals(nvpair_t *p1, nvpair_t *p2)
return (B_FALSE);
if (nvpair_type(p1) == DATA_TYPE_STRING) {
- char *valstr1, *valstr2;
+ const char *valstr1, *valstr2;
- VERIFY(nvpair_value_string(p1, (char **)&valstr1) == 0);
- VERIFY(nvpair_value_string(p2, (char **)&valstr2) == 0);
+ VERIFY(nvpair_value_string(p1, &valstr1) == 0);
+ VERIFY(nvpair_value_string(p2, &valstr2) == 0);
return (strcmp(valstr1, valstr2) == 0);
} else {
uint64_t intval1, intval2;
@@ -4932,9 +4932,9 @@ static boolean_t zfs_ioc_recv_inject_err;
* encountered errors, if any. It's the callers responsibility to free.
*/
static int
-zfs_ioc_recv_impl(char *tofs, char *tosnap, char *origin, nvlist_t *recvprops,
- nvlist_t *localprops, nvlist_t *hidden_args, boolean_t force,
- boolean_t heal, boolean_t resumable, int input_fd,
+zfs_ioc_recv_impl(char *tofs, char *tosnap, const char *origin,
+ nvlist_t *recvprops, nvlist_t *localprops, nvlist_t *hidden_args,
+ boolean_t force, boolean_t heal, boolean_t resumable, int input_fd,
dmu_replay_record_t *begin_record, uint64_t *read_bytes,
uint64_t *errflags, nvlist_t **errors)
{
@@ -5280,7 +5280,7 @@ zfs_ioc_recv(zfs_cmd_t *zc)
nvlist_t *errors = NULL;
nvlist_t *recvdprops = NULL;
nvlist_t *localprops = NULL;
- char *origin = NULL;
+ const char *origin = NULL;
char *tosnap;
char tofs[ZFS_MAX_DATASET_NAME_LEN];
int error = 0;
@@ -5382,8 +5382,8 @@ zfs_ioc_recv_new(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl)
nvlist_t *recvprops = NULL;
nvlist_t *localprops = NULL;
nvlist_t *hidden_args = NULL;
- char *snapname;
- char *origin = NULL;
+ const char *snapname;
+ const char *origin = NULL;
char *tosnap;
char tofs[ZFS_MAX_DATASET_NAME_LEN];
boolean_t force;
@@ -6232,7 +6232,7 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_t *errlist)
/* make sure the user didn't pass us any invalid (empty) tags */
for (pair = nvlist_next_nvpair(holds, NULL); pair != NULL;
pair = nvlist_next_nvpair(holds, pair)) {
- char *htag;
+ const char *htag;
error = nvpair_value_string(pair, &htag);
if (error != 0)
@@ -6452,7 +6452,7 @@ zfs_ioc_space_snaps(const char *lastsnap, nvlist_t *innvl, nvlist_t *outnvl)
int error;
dsl_pool_t *dp;
dsl_dataset_t *new, *old;
- char *firstsnap;
+ const char *firstsnap;
uint64_t used, comp, uncomp;
firstsnap = fnvlist_lookup_string(innvl, "firstsnap");
@@ -6533,7 +6533,7 @@ zfs_ioc_send_new(const char *snapname, nvlist_t *innvl, nvlist_t *outnvl)
(void) outnvl;
int error;
offset_t off;
- char *fromname = NULL;
+ const char *fromname = NULL;
int fd;
zfs_file_t *fp;
boolean_t largeblockok;
@@ -6543,7 +6543,7 @@ zfs_ioc_send_new(const char *snapname, nvlist_t *innvl, nvlist_t *outnvl)
boolean_t savedok;
uint64_t resumeobj = 0;
uint64_t resumeoff = 0;
- char *redactbook = NULL;
+ const char *redactbook = NULL;
fd = fnvlist_lookup_int32(innvl, "fd");
@@ -6633,8 +6633,8 @@ zfs_ioc_send_space(const char *snapname, nvlist_t *innvl, nvlist_t *outnvl)
dsl_dataset_t *tosnap;
dsl_dataset_t *fromsnap = NULL;
int error;
- char *fromname = NULL;
- char *redactlist_book = NULL;
+ const char *fromname = NULL;
+ const char *redactlist_book = NULL;
boolean_t largeblockok;
boolean_t embedok;
boolean_t compressok;
@@ -7378,7 +7378,7 @@ zfs_check_input_nvpairs(nvlist_t *innvl, const zfs_ioc_vec_t *vec)
*/
for (nvpair_t *pair = nvlist_next_nvpair(innvl, NULL);
pair != NULL; pair = nvlist_next_nvpair(innvl, pair)) {
- char *name = nvpair_name(pair);
+ const char *name = nvpair_name(pair);
data_type_t type = nvpair_type(pair);
boolean_t identified = B_FALSE;