aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-10-10 09:47:06 -0700
committerBrian Behlendorf <[email protected]>2019-10-10 09:47:06 -0700
commite4f5fa12290016b2f1fd6a5b4c7e5733c788c863 (patch)
tree51a33853a1161198daf1195ec09da33e9a905392 /module/zfs
parentc5858ff9462719be60b2ffb0065dd01508a63162 (diff)
Fix strdup conflict on other platforms
In the FreeBSD kernel the strdup signature is: ``` char *strdup(const char *__restrict, struct malloc_type *); ``` It's unfortunate that the developers have chosen to change the signature of libc functions - but it's what I have to deal with. Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9433
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/dmu_objset.c6
-rw-r--r--module/zfs/dsl_dataset.c8
-rw-r--r--module/zfs/dsl_pool.c2
-rw-r--r--module/zfs/dsl_prop.c16
-rw-r--r--module/zfs/dsl_userhold.c2
-rw-r--r--module/zfs/spa_history.c2
-rw-r--r--module/zfs/zcp_get.c10
-rw-r--r--module/zfs/zfs_ioctl.c16
-rw-r--r--module/zfs/zvol.c8
9 files changed, 35 insertions, 35 deletions
diff --git a/module/zfs/dmu_objset.c b/module/zfs/dmu_objset.c
index f7498854a..2a9464e2a 100644
--- a/module/zfs/dmu_objset.c
+++ b/module/zfs/dmu_objset.c
@@ -1404,7 +1404,7 @@ dmu_objset_snapshot_one(const char *fsname, const char *snapname)
nvlist_t *snaps = fnvlist_alloc();
fnvlist_add_boolean(snaps, longsnap);
- strfree(longsnap);
+ kmem_strfree(longsnap);
err = dsl_dataset_snapshot(snaps, NULL, NULL);
fnvlist_free(snaps);
return (err);
@@ -2795,7 +2795,7 @@ dmu_objset_find_impl(spa_t *spa, const char *name,
err = dmu_objset_find_impl(spa, child,
func, arg, flags);
dsl_pool_config_enter(dp, FTAG);
- strfree(child);
+ kmem_strfree(child);
if (err != 0)
break;
}
@@ -2833,7 +2833,7 @@ dmu_objset_find_impl(spa_t *spa, const char *name,
dsl_pool_config_exit(dp, FTAG);
err = func(child, arg);
dsl_pool_config_enter(dp, FTAG);
- strfree(child);
+ kmem_strfree(child);
if (err != 0)
break;
}
diff --git a/module/zfs/dsl_dataset.c b/module/zfs/dsl_dataset.c
index 8673c6d31..aa37214d0 100644
--- a/module/zfs/dsl_dataset.c
+++ b/module/zfs/dsl_dataset.c
@@ -2435,7 +2435,7 @@ get_receive_resume_stats_impl(dsl_dataset_t *ds)
kmem_free(compressed, packed_size);
return (propval);
}
- return (strdup(""));
+ return (kmem_strdup(""));
}
/*
@@ -2458,7 +2458,7 @@ get_child_receive_stats(dsl_dataset_t *ds)
dsl_dataset_rele(recv_ds, FTAG);
return (propval);
}
- return (strdup(""));
+ return (kmem_strdup(""));
}
static void
@@ -2474,9 +2474,9 @@ get_receive_resume_stats(dsl_dataset_t *ds, nvlist_t *nv)
dsl_prop_nvlist_add_string(nv,
ZFS_PROP_RECEIVE_RESUME_TOKEN, childval);
}
- strfree(childval);
+ kmem_strfree(childval);
}
- strfree(propval);
+ kmem_strfree(propval);
}
uint64_t
diff --git a/module/zfs/dsl_pool.c b/module/zfs/dsl_pool.c
index 4fffe4cb5..59104e6d1 100644
--- a/module/zfs/dsl_pool.c
+++ b/module/zfs/dsl_pool.c
@@ -1200,7 +1200,7 @@ dsl_pool_user_hold_rele_impl(dsl_pool_t *dp, uint64_t dsobj,
error = zap_add(mos, zapobj, name, 8, 1, &now, tx);
else
error = zap_remove(mos, zapobj, name, tx);
- strfree(name);
+ kmem_strfree(name);
return (error);
}
diff --git a/module/zfs/dsl_prop.c b/module/zfs/dsl_prop.c
index 9f892acdb..df199cf6a 100644
--- a/module/zfs/dsl_prop.c
+++ b/module/zfs/dsl_prop.c
@@ -150,8 +150,8 @@ dsl_prop_get_dd(dsl_dir_t *dd, const char *propname,
if (err == ENOENT)
err = dodefault(prop, intsz, numints, buf);
- strfree(inheritstr);
- strfree(recvdstr);
+ kmem_strfree(inheritstr);
+ kmem_strfree(recvdstr);
return (err);
}
@@ -190,7 +190,7 @@ dsl_prop_get_ds(dsl_dataset_t *ds, const char *propname,
char *inheritstr = kmem_asprintf("%s%s", propname,
ZPROP_INHERIT_SUFFIX);
err = zap_contains(mos, zapobj, inheritstr);
- strfree(inheritstr);
+ kmem_strfree(inheritstr);
if (err != 0 && err != ENOENT)
return (err);
}
@@ -201,7 +201,7 @@ dsl_prop_get_ds(dsl_dataset_t *ds, const char *propname,
ZPROP_RECVD_SUFFIX);
err = zap_lookup(mos, zapobj, recvdstr,
intsz, numints, buf);
- strfree(recvdstr);
+ kmem_strfree(recvdstr);
if (err != ENOENT) {
if (setpoint != NULL && err == 0)
(void) strcpy(setpoint,
@@ -424,7 +424,7 @@ dsl_prop_predict(dsl_dir_t *dd, const char *propname,
panic("unexpected property source: %d", source);
}
- strfree(recvdstr);
+ kmem_strfree(recvdstr);
if (err == ENOENT)
return (0);
@@ -752,8 +752,8 @@ dsl_prop_set_sync_impl(dsl_dataset_t *ds, const char *propname,
cmn_err(CE_PANIC, "unexpected property source: %d", source);
}
- strfree(inheritstr);
- strfree(recvdstr);
+ kmem_strfree(inheritstr);
+ kmem_strfree(recvdstr);
if (isint) {
VERIFY0(dsl_prop_get_int_ds(ds, propname, &intval));
@@ -1020,7 +1020,7 @@ dsl_prop_get_all_impl(objset_t *mos, uint64_t propobj,
valstr = kmem_asprintf("%s%s", propname,
ZPROP_INHERIT_SUFFIX);
err = zap_contains(mos, propobj, valstr);
- strfree(valstr);
+ kmem_strfree(valstr);
if (err == 0)
continue;
if (err != ENOENT)
diff --git a/module/zfs/dsl_userhold.c b/module/zfs/dsl_userhold.c
index ba850c2f7..181fc3946 100644
--- a/module/zfs/dsl_userhold.c
+++ b/module/zfs/dsl_userhold.c
@@ -406,7 +406,7 @@ dsl_dataset_user_release_check_one(dsl_dataset_user_release_arg_t *ddura,
snapname, holdname);
fnvlist_add_int32(ddura->ddura_errlist, errtag,
ENOENT);
- strfree(errtag);
+ kmem_strfree(errtag);
}
continue;
}
diff --git a/module/zfs/spa_history.c b/module/zfs/spa_history.c
index d2839b97f..67847b6d1 100644
--- a/module/zfs/spa_history.c
+++ b/module/zfs/spa_history.c
@@ -533,7 +533,7 @@ log_internal(nvlist_t *nvl, const char *operation, spa_t *spa,
msg = kmem_vasprintf(fmt, adx);
fnvlist_add_string(nvl, ZPOOL_HIST_INT_STR, msg);
- strfree(msg);
+ kmem_strfree(msg);
fnvlist_add_string(nvl, ZPOOL_HIST_INT_NAME, operation);
fnvlist_add_uint64(nvl, ZPOOL_HIST_TXG, tx->tx_txg);
diff --git a/module/zfs/zcp_get.c b/module/zfs/zcp_get.c
index 42c125d48..974d3328c 100644
--- a/module/zfs/zcp_get.c
+++ b/module/zfs/zcp_get.c
@@ -431,9 +431,9 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, const char *dsname,
if (strcmp(strval, "") == 0)
error = ENOENT;
- strfree(childval);
+ kmem_strfree(childval);
}
- strfree(token);
+ kmem_strfree(token);
break;
}
case ZFS_PROP_VOLSIZE:
@@ -661,7 +661,7 @@ get_userquota_prop(const char *prop_name)
* prop type as well as the numeric group/user ids based on the string
* following the '@' in the property name. On success, returns 0. On failure,
* returns a non-zero error.
- * 'domain' must be free'd by caller using strfree()
+ * 'domain' must be free'd by caller using kmem_strfree()
*/
static int
parse_userquota_prop(const char *prop_name, zfs_userquota_prop_t *type,
@@ -688,7 +688,7 @@ parse_userquota_prop(const char *prop_name, zfs_userquota_prop_t *type,
(void) ddi_strtoll(cp, &end, 10, (longlong_t *)rid);
if (*end != '\0') {
- strfree(domain_val);
+ kmem_strfree(domain_val);
return (EINVAL);
}
} else {
@@ -736,7 +736,7 @@ zcp_get_userquota_prop(lua_State *state, dsl_pool_t *dp,
}
}
if (domain != NULL)
- strfree(domain);
+ kmem_strfree(domain);
}
dsl_dataset_rele(ds, FTAG);
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index dfd0b693e..90bc607e2 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -3493,7 +3493,7 @@ zfs_ioc_log_history(const char *unused, nvlist_t *innvl, nvlist_t *outnvl)
return (SET_ERROR(EINVAL));
(void) tsd_set(zfs_allow_log_key, NULL);
error = spa_open(poolname, &spa, FTAG);
- strfree(poolname);
+ kmem_strfree(poolname);
if (error != 0)
return (error);
@@ -4152,7 +4152,7 @@ recursive_unmount(const char *fsname, void *arg)
fullname = kmem_asprintf("%s@%s", fsname, snapname);
zfs_unmount_snap(fullname);
- strfree(fullname);
+ kmem_strfree(fullname);
return (0);
}
@@ -4688,7 +4688,7 @@ zfs_allow_log_destroy(void *arg)
char *poolname = arg;
if (poolname != NULL)
- strfree(poolname);
+ kmem_strfree(poolname);
}
#ifdef DEBUG
@@ -5907,8 +5907,8 @@ zfs_ioc_tmp_snapshot(zfs_cmd_t *zc)
if (error == 0)
(void) strlcpy(zc->zc_value, snap_name,
sizeof (zc->zc_value));
- strfree(snap_name);
- strfree(hold_name);
+ kmem_strfree(snap_name);
+ kmem_strfree(hold_name);
zfs_onexit_fd_rele(zc->zc_cleanup_fd);
return (error);
}
@@ -7335,7 +7335,7 @@ zfsdev_ioctl_common(uint_t vecnum, unsigned long arg)
goto out;
/* legacy ioctls can modify zc_name */
- saved_poolname = strdup(zc->zc_name);
+ saved_poolname = kmem_strdup(zc->zc_name);
if (saved_poolname == NULL) {
error = SET_ERROR(ENOMEM);
goto out;
@@ -7420,11 +7420,11 @@ out:
if (error == 0 && vec->zvec_allow_log) {
char *s = tsd_get(zfs_allow_log_key);
if (s != NULL)
- strfree(s);
+ kmem_strfree(s);
(void) tsd_set(zfs_allow_log_key, saved_poolname);
} else {
if (saved_poolname != NULL)
- strfree(saved_poolname);
+ kmem_strfree(saved_poolname);
}
kmem_free(zc, sizeof (zfs_cmd_t));
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
index ebd0fa70a..19c20afe7 100644
--- a/module/zfs/zvol.c
+++ b/module/zfs/zvol.c
@@ -1009,7 +1009,7 @@ zvol_create_snap_minor_cb(const char *dsname, void *arg)
"%s is not a snapshot name\n", dsname);
} else {
minors_job_t *job;
- char *n = strdup(dsname);
+ char *n = kmem_strdup(dsname);
if (n == NULL)
return (0);
@@ -1051,7 +1051,7 @@ zvol_create_minors_cb(const char *dsname, void *arg)
*/
if (strchr(dsname, '@') == 0) {
minors_job_t *job;
- char *n = strdup(dsname);
+ char *n = kmem_strdup(dsname);
if (n == NULL)
return (0);
@@ -1152,7 +1152,7 @@ zvol_create_minors_impl(const char *name)
list_remove(&minors_list, job);
if (!job->error)
ops->zv_create_minor(job->name);
- strfree(job->name);
+ kmem_strfree(job->name);
kmem_free(job, sizeof (minors_job_t));
}
@@ -1305,7 +1305,7 @@ zvol_rename_minors_impl(const char *oldname, const char *newname)
zv->zv_name[oldnamelen],
zv->zv_name + oldnamelen + 1);
ops->zv_rename_minor(zv, name);
- strfree(name);
+ kmem_strfree(name);
}
mutex_exit(&zv->zv_state_lock);