diff options
author | delphij <delphij@FreeBSD.org> | 2007-06-29 05:23:15 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2007-06-29 05:23:15 +0000 |
commit | f5523801a379fd60b10766884cebdfc21bf8db35 (patch) | |
tree | 9a995329467ed0aa6c8c5a4ae50ea68413fc2cf5 /sys/fs/tmpfs/tmpfs_vnops.c | |
parent | 4f8f7b63aaea072afdf83c9faec421752039cbc6 (diff) | |
download | FreeBSD-src-f5523801a379fd60b10766884cebdfc21bf8db35.zip FreeBSD-src-f5523801a379fd60b10766884cebdfc21bf8db35.tar.gz |
MFp4:
- Remove unnecessary NULL checks after M_WAITOK allocations.
- Use VOP_ACCESS instead of hand-rolled suser_cred()
calls. [1]
- Use malloc(9) KPI to allocate memory for string. The
optimization taken from NetBSD is not valid for FreeBSD
because our malloc(9) already act that way. [2]
Requested by: rwatson [1]
Submitted by: Howard Su [2]
Approved by: re (tmpfs blanket)
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_vnops.c')
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vnops.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 10d515a..520fff7e 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -830,12 +830,7 @@ tmpfs_rename(struct vop_rename_args *v) * has to be changed. */ if (fcnp->cn_namelen != tcnp->cn_namelen || memcmp(fcnp->cn_nameptr, tcnp->cn_nameptr, fcnp->cn_namelen) != 0) { - newname = tmpfs_str_zone_alloc(&tmp->tm_str_pool, M_WAITOK, - tcnp->cn_namelen); - if (newname == NULL) { - error = ENOSPC; - goto out_locked; - } + newname = malloc(tcnp->cn_namelen, M_TMPFSNAME, M_WAITOK); } else newname = NULL; @@ -855,8 +850,7 @@ tmpfs_rename(struct vop_rename_args *v) if (n == fnode) { error = EINVAL; if (newname != NULL) - tmpfs_str_zone_free(&tmp->tm_str_pool, - newname, tcnp->cn_namelen); + free(newname, M_TMPFSNAME); goto out_locked; } n = n->tn_dir.tn_parent; @@ -884,8 +878,7 @@ tmpfs_rename(struct vop_rename_args *v) if (newname != NULL) { MPASS(tcnp->cn_namelen <= MAXNAMLEN); - tmpfs_str_zone_free(&tmp->tm_str_pool, de->td_name, - de->td_namelen); + free(de->td_name, M_TMPFSNAME); de->td_namelen = (uint16_t)tcnp->cn_namelen; memcpy(newname, tcnp->cn_nameptr, tcnp->cn_namelen); de->td_name = newname; |