mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 02:44:41 +03:00
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 <lundman@lundman.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9433
This commit is contained in:
committed by
Brian Behlendorf
parent
c5858ff946
commit
e4f5fa1229
@@ -138,7 +138,7 @@ spa_read_history_init(spa_t *spa)
|
||||
spa_read_history_clear,
|
||||
offsetof(spa_read_history_t, srh_node));
|
||||
|
||||
strfree(module);
|
||||
kmem_strfree(module);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -309,7 +309,7 @@ spa_txg_history_init(spa_t *spa)
|
||||
spa_txg_history_clear,
|
||||
offsetof(spa_txg_history_t, sth_node));
|
||||
|
||||
strfree(module);
|
||||
kmem_strfree(module);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -529,7 +529,7 @@ spa_tx_assign_init(spa_t *spa)
|
||||
ksp->ks_update = spa_tx_assign_update;
|
||||
kstat_install(ksp);
|
||||
}
|
||||
strfree(name);
|
||||
kmem_strfree(name);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -592,7 +592,7 @@ spa_io_history_init(spa_t *spa)
|
||||
ksp->ks_update = spa_io_history_update;
|
||||
kstat_install(ksp);
|
||||
}
|
||||
strfree(name);
|
||||
kmem_strfree(name);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -675,7 +675,7 @@ spa_mmp_history_truncate(spa_history_list_t *shl, unsigned int size)
|
||||
while (shl->size > size) {
|
||||
smh = list_remove_head(&shl->procfs_list.pl_list);
|
||||
if (smh->vdev_path)
|
||||
strfree(smh->vdev_path);
|
||||
kmem_strfree(smh->vdev_path);
|
||||
kmem_free(smh, sizeof (spa_mmp_history_t));
|
||||
shl->size--;
|
||||
}
|
||||
@@ -715,7 +715,7 @@ spa_mmp_history_init(spa_t *spa)
|
||||
spa_mmp_history_clear,
|
||||
offsetof(spa_mmp_history_t, smh_node));
|
||||
|
||||
strfree(module);
|
||||
kmem_strfree(module);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -814,7 +814,7 @@ spa_mmp_history_add(spa_t *spa, uint64_t txg, uint64_t timestamp,
|
||||
if (vd) {
|
||||
smh->vdev_guid = vd->vdev_guid;
|
||||
if (vd->vdev_path)
|
||||
smh->vdev_path = strdup(vd->vdev_path);
|
||||
smh->vdev_path = kmem_strdup(vd->vdev_path);
|
||||
}
|
||||
smh->vdev_label = label;
|
||||
smh->mmp_node_id = mmp_node_id;
|
||||
@@ -876,7 +876,7 @@ spa_state_init(spa_t *spa)
|
||||
kstat_install(ksp);
|
||||
}
|
||||
|
||||
strfree(name);
|
||||
kmem_strfree(name);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -973,7 +973,7 @@ spa_iostats_init(spa_t *spa)
|
||||
kstat_install(ksp);
|
||||
}
|
||||
|
||||
strfree(name);
|
||||
kmem_strfree(name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -220,7 +220,7 @@ vdev_elevator_switch(vdev_t *v, char *elevator)
|
||||
|
||||
argv[2] = kmem_asprintf(SET_SCHEDULER_CMD, device, elevator);
|
||||
error = call_usermodehelper(argv[0], argv, envp, UMH_NO_WAIT);
|
||||
strfree(argv[2]);
|
||||
kmem_strfree(argv[2]);
|
||||
#endif /* HAVE_ELEVATOR_CHANGE */
|
||||
if (error) {
|
||||
zfs_dbgmsg("Unable to set \"%s\" scheduler for %s (%s): %d",
|
||||
|
||||
@@ -137,8 +137,8 @@ zfsctl_snapshot_alloc(char *full_name, char *full_path, spa_t *spa,
|
||||
|
||||
se = kmem_zalloc(sizeof (zfs_snapentry_t), KM_SLEEP);
|
||||
|
||||
se->se_name = strdup(full_name);
|
||||
se->se_path = strdup(full_path);
|
||||
se->se_name = kmem_strdup(full_name);
|
||||
se->se_path = kmem_strdup(full_path);
|
||||
se->se_spa = spa;
|
||||
se->se_objsetid = objsetid;
|
||||
se->se_root_dentry = root_dentry;
|
||||
@@ -157,8 +157,8 @@ static void
|
||||
zfsctl_snapshot_free(zfs_snapentry_t *se)
|
||||
{
|
||||
zfs_refcount_destroy(&se->se_refcount);
|
||||
strfree(se->se_name);
|
||||
strfree(se->se_path);
|
||||
kmem_strfree(se->se_name);
|
||||
kmem_strfree(se->se_path);
|
||||
|
||||
kmem_free(se, sizeof (zfs_snapentry_t));
|
||||
}
|
||||
@@ -311,8 +311,8 @@ zfsctl_snapshot_rename(char *old_snapname, char *new_snapname)
|
||||
return (SET_ERROR(ENOENT));
|
||||
|
||||
zfsctl_snapshot_remove(se);
|
||||
strfree(se->se_name);
|
||||
se->se_name = strdup(new_snapname);
|
||||
kmem_strfree(se->se_name);
|
||||
se->se_name = kmem_strdup(new_snapname);
|
||||
zfsctl_snapshot_add(se);
|
||||
zfsctl_snapshot_rele(se);
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ zfsvfs_vfs_free(vfs_t *vfsp)
|
||||
{
|
||||
if (vfsp != NULL) {
|
||||
if (vfsp->vfs_mntpoint != NULL)
|
||||
strfree(vfsp->vfs_mntpoint);
|
||||
kmem_strfree(vfsp->vfs_mntpoint);
|
||||
|
||||
kmem_free(vfsp, sizeof (vfs_t));
|
||||
}
|
||||
@@ -222,7 +222,7 @@ zfsvfs_parse_options(char *mntopts, vfs_t **vfsp)
|
||||
char *tmp_mntopts, *p, *t;
|
||||
int token;
|
||||
|
||||
tmp_mntopts = t = strdup(mntopts);
|
||||
tmp_mntopts = t = kmem_strdup(mntopts);
|
||||
if (tmp_mntopts == NULL)
|
||||
return (SET_ERROR(ENOMEM));
|
||||
|
||||
@@ -234,13 +234,13 @@ zfsvfs_parse_options(char *mntopts, vfs_t **vfsp)
|
||||
token = match_token(p, zpl_tokens, args);
|
||||
error = zfsvfs_parse_option(p, token, args, tmp_vfsp);
|
||||
if (error) {
|
||||
strfree(tmp_mntopts);
|
||||
kmem_strfree(tmp_mntopts);
|
||||
zfsvfs_vfs_free(tmp_vfsp);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
strfree(tmp_mntopts);
|
||||
kmem_strfree(tmp_mntopts);
|
||||
}
|
||||
|
||||
*vfsp = tmp_vfsp;
|
||||
|
||||
@@ -707,7 +707,7 @@ __zpl_xattr_user_get(struct inode *ip, const char *name,
|
||||
|
||||
xattr_name = kmem_asprintf("%s%s", XATTR_USER_PREFIX, name);
|
||||
error = zpl_xattr_get(ip, xattr_name, value, size);
|
||||
strfree(xattr_name);
|
||||
kmem_strfree(xattr_name);
|
||||
|
||||
return (error);
|
||||
}
|
||||
@@ -729,7 +729,7 @@ __zpl_xattr_user_set(struct inode *ip, const char *name,
|
||||
|
||||
xattr_name = kmem_asprintf("%s%s", XATTR_USER_PREFIX, name);
|
||||
error = zpl_xattr_set(ip, xattr_name, value, size, flags);
|
||||
strfree(xattr_name);
|
||||
kmem_strfree(xattr_name);
|
||||
|
||||
return (error);
|
||||
}
|
||||
@@ -776,7 +776,7 @@ __zpl_xattr_trusted_get(struct inode *ip, const char *name,
|
||||
#endif
|
||||
xattr_name = kmem_asprintf("%s%s", XATTR_TRUSTED_PREFIX, name);
|
||||
error = zpl_xattr_get(ip, xattr_name, value, size);
|
||||
strfree(xattr_name);
|
||||
kmem_strfree(xattr_name);
|
||||
|
||||
return (error);
|
||||
}
|
||||
@@ -798,7 +798,7 @@ __zpl_xattr_trusted_set(struct inode *ip, const char *name,
|
||||
#endif
|
||||
xattr_name = kmem_asprintf("%s%s", XATTR_TRUSTED_PREFIX, name);
|
||||
error = zpl_xattr_set(ip, xattr_name, value, size, flags);
|
||||
strfree(xattr_name);
|
||||
kmem_strfree(xattr_name);
|
||||
|
||||
return (error);
|
||||
}
|
||||
@@ -845,7 +845,7 @@ __zpl_xattr_security_get(struct inode *ip, const char *name,
|
||||
#endif
|
||||
xattr_name = kmem_asprintf("%s%s", XATTR_SECURITY_PREFIX, name);
|
||||
error = zpl_xattr_get(ip, xattr_name, value, size);
|
||||
strfree(xattr_name);
|
||||
kmem_strfree(xattr_name);
|
||||
|
||||
return (error);
|
||||
}
|
||||
@@ -864,7 +864,7 @@ __zpl_xattr_security_set(struct inode *ip, const char *name,
|
||||
#endif
|
||||
xattr_name = kmem_asprintf("%s%s", XATTR_SECURITY_PREFIX, name);
|
||||
error = zpl_xattr_set(ip, xattr_name, value, size, flags);
|
||||
strfree(xattr_name);
|
||||
kmem_strfree(xattr_name);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user