Change the M_NAMEI allocations to use the zone allocator. This change
plus the previous changes to use the zone allocator decrease the useage of malloc by half. The Zone allocator will be upgradeable to be able to use per CPU-pools, and has more intelligent usage of SPLs. Additionally, it has reasonable stats gathering capabilities, while making most calls inline.
This commit is contained in:
parent
71eed6962e
commit
99448ed11d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29653
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
|
||||
* $Id: cd9660_vnops.c,v 1.37 1997/08/26 07:32:32 phk Exp $
|
||||
* $Id: cd9660_vnops.c,v 1.38 1997/09/14 02:57:43 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -782,14 +782,14 @@ cd9660_readlink(ap)
|
||||
if (uio->uio_segflg == UIO_SYSSPACE)
|
||||
symname = uio->uio_iov->iov_base;
|
||||
else
|
||||
MALLOC(symname, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
symname = zalloc(namei_zone);
|
||||
|
||||
/*
|
||||
* Ok, we just gathering a symbolic name in SL record.
|
||||
*/
|
||||
if (cd9660_rrip_getsymname(dirp, symname, &symlen, imp) == 0) {
|
||||
if (uio->uio_segflg != UIO_SYSSPACE)
|
||||
FREE(symname, M_NAMEI);
|
||||
zfree(namei_zone, symname);
|
||||
brelse(bp);
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -803,7 +803,7 @@ cd9660_readlink(ap)
|
||||
*/
|
||||
if (uio->uio_segflg != UIO_SYSSPACE) {
|
||||
error = uiomove(symname, symlen, uio);
|
||||
FREE(symname, M_NAMEI);
|
||||
zfree(namei_zone, symname);
|
||||
return (error);
|
||||
}
|
||||
uio->uio_resid -= symlen;
|
||||
@ -824,7 +824,7 @@ cd9660_abortop(ap)
|
||||
} */ *ap;
|
||||
{
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: msdosfs_vnops.c,v 1.43 1997/08/26 07:32:39 phk Exp $ */
|
||||
/* $Id: msdosfs_vnops.c,v 1.44 1997/09/14 02:57:44 peter Exp $ */
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */
|
||||
|
||||
/*-
|
||||
@ -177,9 +177,9 @@ msdosfs_create(ap)
|
||||
if ((error = createde(&ndirent, pdep, &dep)) == 0) {
|
||||
*ap->a_vpp = DETOV(dep);
|
||||
if ((cnp->cn_flags & SAVESTART) == 0)
|
||||
free(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
} else {
|
||||
free(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
}
|
||||
vput(ap->a_dvp); /* release parent dir */
|
||||
return error;
|
||||
@ -207,7 +207,7 @@ msdosfs_mknod(ap)
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
break;
|
||||
}
|
||||
@ -1336,7 +1336,7 @@ msdosfs_mkdir(ap)
|
||||
* change size.
|
||||
*/
|
||||
if (pdep->de_StartCluster == MSDOSFSROOT && pdep->de_fndclust == (u_long)-1) {
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
return ENOSPC;
|
||||
}
|
||||
@ -1348,7 +1348,7 @@ msdosfs_mkdir(ap)
|
||||
*/
|
||||
error = clusteralloc(pmp, 0, 1, CLUST_EOFE, &newcluster, NULL);
|
||||
if (error) {
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
return error;
|
||||
}
|
||||
@ -1376,7 +1376,7 @@ msdosfs_mkdir(ap)
|
||||
error = bwrite(bp);
|
||||
if (error) {
|
||||
clusterfree(pmp, newcluster, NULL);
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
return error;
|
||||
}
|
||||
@ -1401,7 +1401,7 @@ msdosfs_mkdir(ap)
|
||||
} else {
|
||||
*ap->a_vpp = DETOV(ndep);
|
||||
}
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_mkdir(): vput(%08x)\n", ap->a_dvp);
|
||||
#endif
|
||||
@ -1479,7 +1479,7 @@ msdosfs_symlink(ap)
|
||||
char *a_target;
|
||||
} */ *ap;
|
||||
{
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
return EINVAL;
|
||||
}
|
||||
@ -1794,7 +1794,7 @@ msdosfs_abortop(ap)
|
||||
} */ *ap;
|
||||
{
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95
|
||||
*
|
||||
* $Id: procfs_vnops.c,v 1.31 1997/08/12 04:34:30 sef Exp $
|
||||
* $Id: procfs_vnops.c,v 1.32 1997/09/14 02:57:58 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -351,7 +351,7 @@ procfs_abortop(ap)
|
||||
{
|
||||
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)union_subr.c 8.20 (Berkeley) 5/20/95
|
||||
* $Id: union_subr.c,v 1.19 1997/08/02 14:32:28 bde Exp $
|
||||
* $Id: union_subr.c,v 1.20 1997/08/14 03:57:46 kato Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -740,7 +740,7 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen)
|
||||
* The pathname buffer will be FREEed by VOP_MKDIR.
|
||||
*/
|
||||
cn->cn_namelen = pathlen;
|
||||
cn->cn_pnbuf = malloc(cn->cn_namelen+1, M_NAMEI, M_WAITOK);
|
||||
cn->cn_pnbuf = zalloc(namei_zone);
|
||||
bcopy(path, cn->cn_pnbuf, cn->cn_namelen);
|
||||
cn->cn_pnbuf[cn->cn_namelen] = '\0';
|
||||
|
||||
@ -760,7 +760,7 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen)
|
||||
if (!error)
|
||||
vrele(dvp);
|
||||
else {
|
||||
free(cn->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cn->cn_pnbuf);
|
||||
cn->cn_pnbuf = '\0';
|
||||
}
|
||||
|
||||
@ -906,7 +906,7 @@ union_vn_create(vpp, un, p)
|
||||
* copied in the first place).
|
||||
*/
|
||||
cn.cn_namelen = strlen(un->un_path);
|
||||
cn.cn_pnbuf = (caddr_t) malloc(cn.cn_namelen+1, M_NAMEI, M_WAITOK);
|
||||
cn.cn_pnbuf = zalloc(namei_zone);
|
||||
bcopy(un->un_path, cn.cn_pnbuf, cn.cn_namelen+1);
|
||||
cn.cn_nameiop = CREATE;
|
||||
cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
|
||||
|
@ -26,7 +26,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: imgact_coff.c,v 1.25 1997/07/20 09:39:51 bde Exp $
|
||||
* $Id: imgact_coff.c,v 1.26 1997/08/25 22:14:57 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -277,8 +277,8 @@ coff_load_file(struct proc *p, char *name)
|
||||
panic(__FUNCTION__ " vm_map_remove failed");
|
||||
|
||||
fail:
|
||||
vput(nd.ni_vp);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
vput(nd.ni_vp);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
|
||||
* $Id: cd9660_vnops.c,v 1.37 1997/08/26 07:32:32 phk Exp $
|
||||
* $Id: cd9660_vnops.c,v 1.38 1997/09/14 02:57:43 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -782,14 +782,14 @@ cd9660_readlink(ap)
|
||||
if (uio->uio_segflg == UIO_SYSSPACE)
|
||||
symname = uio->uio_iov->iov_base;
|
||||
else
|
||||
MALLOC(symname, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
symname = zalloc(namei_zone);
|
||||
|
||||
/*
|
||||
* Ok, we just gathering a symbolic name in SL record.
|
||||
*/
|
||||
if (cd9660_rrip_getsymname(dirp, symname, &symlen, imp) == 0) {
|
||||
if (uio->uio_segflg != UIO_SYSSPACE)
|
||||
FREE(symname, M_NAMEI);
|
||||
zfree(namei_zone, symname);
|
||||
brelse(bp);
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -803,7 +803,7 @@ cd9660_readlink(ap)
|
||||
*/
|
||||
if (uio->uio_segflg != UIO_SYSSPACE) {
|
||||
error = uiomove(symname, symlen, uio);
|
||||
FREE(symname, M_NAMEI);
|
||||
zfree(namei_zone, symname);
|
||||
return (error);
|
||||
}
|
||||
uio->uio_resid -= symlen;
|
||||
@ -824,7 +824,7 @@ cd9660_abortop(ap)
|
||||
} */ *ap;
|
||||
{
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: kern_exec.c,v 1.64 1997/08/04 05:39:24 davidg Exp $
|
||||
* $Id: kern_exec.c,v 1.65 1997/09/02 20:05:38 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -224,7 +224,7 @@ execve(p, uap, retval)
|
||||
}
|
||||
/* free old vnode and name buffer */
|
||||
vrele(ndp->ni_vp);
|
||||
FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ndp->ni_cnd.cn_pnbuf);
|
||||
/* set new name to that of the interpreter */
|
||||
NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME,
|
||||
UIO_SYSSPACE, imgp->interpreter_name, p);
|
||||
@ -356,7 +356,7 @@ execve(p, uap, retval)
|
||||
else if (imgp->image_header != NULL)
|
||||
free((void *)imgp->image_header, M_TEMP);
|
||||
vrele(ndp->ni_vp);
|
||||
FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ndp->ni_cnd.cn_pnbuf);
|
||||
|
||||
return (0);
|
||||
|
||||
@ -369,7 +369,7 @@ execve(p, uap, retval)
|
||||
free((void *)imgp->image_header, M_TEMP);
|
||||
if (ndp->ni_vp) {
|
||||
vrele(ndp->ni_vp);
|
||||
FREE(ndp->ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ndp->ni_cnd.cn_pnbuf);
|
||||
}
|
||||
|
||||
exec_fail:
|
||||
|
@ -38,7 +38,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_lock.c 8.18 (Berkeley) 5/21/95
|
||||
* $Id: kern_lock.c,v 1.10 1997/08/19 00:27:07 dyson Exp $
|
||||
* $Id: kern_lock.c,v 1.11 1997/08/22 07:16:46 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -70,7 +70,12 @@
|
||||
#define LOCK_INLINE inline
|
||||
#endif
|
||||
|
||||
#define LK_ALL (LK_HAVE_EXCL | LK_WANT_EXCL | LK_WANT_UPGRADE | \
|
||||
LK_SHARE_NONZERO | LK_WAIT_NONZERO)
|
||||
|
||||
static int acquire(struct lock *lkp, int extflags, int wanted);
|
||||
static int apause(struct lock *lkp, int flags);
|
||||
static int acquiredrain(struct lock *lkp, int extflags) ;
|
||||
|
||||
static LOCK_INLINE void
|
||||
sharelock(struct lock *lkp, int incr) {
|
||||
@ -94,6 +99,11 @@ shareunlock(struct lock *lkp, int decr) {
|
||||
lkp->lk_flags &= ~LK_SHARE_NONZERO;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the waitloop optimization, and note for this to work
|
||||
* simple_lock and simple_unlock should be subroutines to avoid
|
||||
* optimization troubles.
|
||||
*/
|
||||
static int
|
||||
apause(struct lock *lkp, int flags) {
|
||||
int lock_wait;
|
||||
@ -115,7 +125,6 @@ apause(struct lock *lkp, int flags) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
acquire(struct lock *lkp, int extflags, int wanted) {
|
||||
int error;
|
||||
@ -125,9 +134,11 @@ acquire(struct lock *lkp, int extflags, int wanted) {
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
error = apause(lkp, wanted);
|
||||
if (error == 0)
|
||||
return 0;
|
||||
if (((lkp->lk_flags | extflags) & LK_NOPAUSE) == 0) {
|
||||
error = apause(lkp, wanted);
|
||||
if (error == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((lkp->lk_flags & wanted) != 0) {
|
||||
lkp->lk_flags |= LK_WAIT_NONZERO;
|
||||
@ -147,78 +158,6 @@ acquire(struct lock *lkp, int extflags, int wanted) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define LK_ALL (LK_HAVE_EXCL | LK_WANT_EXCL | LK_WANT_UPGRADE | \
|
||||
LK_SHARE_NONZERO | LK_WAIT_NONZERO)
|
||||
|
||||
static int
|
||||
acquiredrain(struct lock *lkp, int extflags) {
|
||||
int error;
|
||||
int lock_wait;
|
||||
|
||||
if ((extflags & LK_NOWAIT) && (lkp->lk_flags & LK_ALL)) {
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
error = apause(lkp, LK_ALL);
|
||||
if (error == 0)
|
||||
return 0;
|
||||
|
||||
while (lkp->lk_flags & LK_ALL) {
|
||||
lkp->lk_flags |= LK_WAITDRAIN;
|
||||
simple_unlock(&lkp->lk_interlock);
|
||||
error = tsleep(&lkp->lk_flags, lkp->lk_prio,
|
||||
lkp->lk_wmesg, lkp->lk_timo);
|
||||
simple_lock(&lkp->lk_interlock);
|
||||
if (error)
|
||||
return error;
|
||||
if (extflags & LK_SLEEPFAIL) {
|
||||
return ENOLCK;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize a lock; required before use.
|
||||
*/
|
||||
void
|
||||
lockinit(lkp, prio, wmesg, timo, flags)
|
||||
struct lock *lkp;
|
||||
int prio;
|
||||
char *wmesg;
|
||||
int timo;
|
||||
int flags;
|
||||
{
|
||||
|
||||
simple_lock_init(&lkp->lk_interlock);
|
||||
lkp->lk_flags = (flags & LK_EXTFLG_MASK);
|
||||
lkp->lk_sharecount = 0;
|
||||
lkp->lk_waitcount = 0;
|
||||
lkp->lk_exclusivecount = 0;
|
||||
lkp->lk_prio = prio;
|
||||
lkp->lk_wmesg = wmesg;
|
||||
lkp->lk_timo = timo;
|
||||
lkp->lk_lockholder = LK_NOPROC;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine the status of a lock.
|
||||
*/
|
||||
int
|
||||
lockstatus(lkp)
|
||||
struct lock *lkp;
|
||||
{
|
||||
int lock_type = 0;
|
||||
|
||||
simple_lock(&lkp->lk_interlock);
|
||||
if (lkp->lk_exclusivecount != 0)
|
||||
lock_type = LK_EXCLUSIVE;
|
||||
else if (lkp->lk_sharecount != 0)
|
||||
lock_type = LK_SHARED;
|
||||
simple_unlock(&lkp->lk_interlock);
|
||||
return (lock_type);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set, change, or release a lock.
|
||||
*
|
||||
@ -441,6 +380,75 @@ lockmgr(lkp, flags, interlkp, p)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
acquiredrain(struct lock *lkp, int extflags) {
|
||||
int error;
|
||||
int lock_wait;
|
||||
|
||||
if ((extflags & LK_NOWAIT) && (lkp->lk_flags & LK_ALL)) {
|
||||
return EBUSY;
|
||||
}
|
||||
|
||||
error = apause(lkp, LK_ALL);
|
||||
if (error == 0)
|
||||
return 0;
|
||||
|
||||
while (lkp->lk_flags & LK_ALL) {
|
||||
lkp->lk_flags |= LK_WAITDRAIN;
|
||||
simple_unlock(&lkp->lk_interlock);
|
||||
error = tsleep(&lkp->lk_flags, lkp->lk_prio,
|
||||
lkp->lk_wmesg, lkp->lk_timo);
|
||||
simple_lock(&lkp->lk_interlock);
|
||||
if (error)
|
||||
return error;
|
||||
if (extflags & LK_SLEEPFAIL) {
|
||||
return ENOLCK;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize a lock; required before use.
|
||||
*/
|
||||
void
|
||||
lockinit(lkp, prio, wmesg, timo, flags)
|
||||
struct lock *lkp;
|
||||
int prio;
|
||||
char *wmesg;
|
||||
int timo;
|
||||
int flags;
|
||||
{
|
||||
|
||||
simple_lock_init(&lkp->lk_interlock);
|
||||
lkp->lk_flags = (flags & LK_EXTFLG_MASK);
|
||||
lkp->lk_sharecount = 0;
|
||||
lkp->lk_waitcount = 0;
|
||||
lkp->lk_exclusivecount = 0;
|
||||
lkp->lk_prio = prio;
|
||||
lkp->lk_wmesg = wmesg;
|
||||
lkp->lk_timo = timo;
|
||||
lkp->lk_lockholder = LK_NOPROC;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine the status of a lock.
|
||||
*/
|
||||
int
|
||||
lockstatus(lkp)
|
||||
struct lock *lkp;
|
||||
{
|
||||
int lock_type = 0;
|
||||
|
||||
simple_lock(&lkp->lk_interlock);
|
||||
if (lkp->lk_exclusivecount != 0)
|
||||
lock_type = LK_EXCLUSIVE;
|
||||
else if (lkp->lk_sharecount != 0)
|
||||
lock_type = LK_SHARED;
|
||||
simple_unlock(&lkp->lk_interlock);
|
||||
return (lock_type);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out information about state of a lock. Used by VOP_PRINT
|
||||
* routines to display status about contained locks.
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
|
||||
* $Id: vfs_syscalls.c,v 1.70 1997/09/15 19:11:07 phk Exp $
|
||||
* $Id: vfs_syscalls.c,v 1.71 1997/09/16 08:05:09 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1157,7 +1157,7 @@ symlink(p, uap, retval)
|
||||
int error;
|
||||
struct nameidata nd;
|
||||
|
||||
MALLOC(path, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
path = zalloc(namei_zone);
|
||||
if (error = copyinstr(SCARG(uap, path), path, MAXPATHLEN, NULL))
|
||||
goto out;
|
||||
NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, link), p);
|
||||
@ -1180,7 +1180,7 @@ symlink(p, uap, retval)
|
||||
ASSERT_VOP_UNLOCKED(nd.ni_dvp, "symlink");
|
||||
ASSERT_VOP_UNLOCKED(nd.ni_vp, "symlink");
|
||||
out:
|
||||
FREE(path, M_NAMEI);
|
||||
zfree(namei_zone, path);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -2288,11 +2288,11 @@ rename(p, uap, retval)
|
||||
ASSERT_VOP_UNLOCKED(fromnd.ni_vp, "rename");
|
||||
ASSERT_VOP_UNLOCKED(tond.ni_dvp, "rename");
|
||||
ASSERT_VOP_UNLOCKED(tond.ni_vp, "rename");
|
||||
FREE(tond.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
|
||||
out1:
|
||||
if (fromnd.ni_startdir)
|
||||
vrele(fromnd.ni_startdir);
|
||||
FREE(fromnd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
|
||||
if (error == -1)
|
||||
return (0);
|
||||
return (error);
|
||||
@ -2616,6 +2616,7 @@ getdirentries(p, uap, retval)
|
||||
auio.uio_segflg = UIO_USERSPACE;
|
||||
auio.uio_procp = p;
|
||||
auio.uio_resid = SCARG(uap, count);
|
||||
/* vn_lock(vp, LK_SHARED | LK_RETRY, p); */
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
|
||||
loff = auio.uio_offset = fp->f_offset;
|
||||
error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL, NULL);
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_init.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: vfs_init.c,v 1.26 1997/08/02 14:31:44 bde Exp $
|
||||
* $Id: vfs_init.c,v 1.27 1997/09/10 20:11:01 phk Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
#include <sys/mount.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <vm/vm_zone.h>
|
||||
|
||||
static void vfs_op_init __P((void));
|
||||
|
||||
@ -71,6 +72,11 @@ extern struct linker_set vfs_set;
|
||||
extern struct vnodeop_desc *vfs_op_descs[];
|
||||
/* and the operations they perform */
|
||||
|
||||
/*
|
||||
* Zone for namei
|
||||
*/
|
||||
struct vm_zone *namei_zone;
|
||||
|
||||
/*
|
||||
* A miscellaneous routine.
|
||||
* A generic "default" routine that just returns an error.
|
||||
@ -234,6 +240,8 @@ vfsinit(dummy)
|
||||
struct vfsconf **vfc;
|
||||
int maxtypenum;
|
||||
|
||||
namei_zone = zinit("NAMEI", MAXPATHLEN, 0, 0, 2);
|
||||
|
||||
/*
|
||||
* Initialize the vnode table
|
||||
*/
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94
|
||||
* $Id: vfs_lookup.c,v 1.18 1997/04/04 17:47:43 dfr Exp $
|
||||
* $Id: vfs_lookup.c,v 1.19 1997/09/02 20:06:01 bde Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
@ -103,7 +103,7 @@ namei(ndp)
|
||||
* name into the buffer.
|
||||
*/
|
||||
if ((cnp->cn_flags & HASBUF) == 0)
|
||||
MALLOC(cnp->cn_pnbuf, caddr_t, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cnp->cn_pnbuf = zalloc(namei_zone);
|
||||
if (ndp->ni_segflg == UIO_SYSSPACE)
|
||||
error = copystr(ndp->ni_dirp, cnp->cn_pnbuf,
|
||||
MAXPATHLEN, (u_int *)&ndp->ni_pathlen);
|
||||
@ -118,7 +118,7 @@ namei(ndp)
|
||||
error = ENOENT;
|
||||
|
||||
if (error) {
|
||||
free(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
ndp->ni_vp = NULL;
|
||||
return (error);
|
||||
}
|
||||
@ -153,7 +153,7 @@ namei(ndp)
|
||||
ndp->ni_startdir = dp;
|
||||
error = lookup(ndp);
|
||||
if (error) {
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
return (error);
|
||||
}
|
||||
/*
|
||||
@ -161,7 +161,7 @@ namei(ndp)
|
||||
*/
|
||||
if ((cnp->cn_flags & ISSYMLINK) == 0) {
|
||||
if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0)
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
else
|
||||
cnp->cn_flags |= HASBUF;
|
||||
return (0);
|
||||
@ -173,7 +173,7 @@ namei(ndp)
|
||||
break;
|
||||
}
|
||||
if (ndp->ni_pathlen > 1)
|
||||
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cp = zalloc(namei_zone);
|
||||
else
|
||||
cp = cnp->cn_pnbuf;
|
||||
aiov.iov_base = cp;
|
||||
@ -188,19 +188,19 @@ namei(ndp)
|
||||
error = VOP_READLINK(ndp->ni_vp, &auio, cnp->cn_cred);
|
||||
if (error) {
|
||||
if (ndp->ni_pathlen > 1)
|
||||
free(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
break;
|
||||
}
|
||||
linklen = MAXPATHLEN - auio.uio_resid;
|
||||
if (linklen + ndp->ni_pathlen >= MAXPATHLEN) {
|
||||
if (ndp->ni_pathlen > 1)
|
||||
free(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
error = ENAMETOOLONG;
|
||||
break;
|
||||
}
|
||||
if (ndp->ni_pathlen > 1) {
|
||||
bcopy(ndp->ni_next, cp + linklen, ndp->ni_pathlen);
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_pnbuf = cp;
|
||||
} else
|
||||
cnp->cn_pnbuf[linklen] = '\0';
|
||||
@ -208,7 +208,7 @@ namei(ndp)
|
||||
vput(ndp->ni_vp);
|
||||
dp = ndp->ni_dvp;
|
||||
}
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
vrele(ndp->ni_dvp);
|
||||
vput(ndp->ni_vp);
|
||||
ndp->ni_vp = NULL;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
|
||||
* $Id: vfs_syscalls.c,v 1.70 1997/09/15 19:11:07 phk Exp $
|
||||
* $Id: vfs_syscalls.c,v 1.71 1997/09/16 08:05:09 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1157,7 +1157,7 @@ symlink(p, uap, retval)
|
||||
int error;
|
||||
struct nameidata nd;
|
||||
|
||||
MALLOC(path, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
path = zalloc(namei_zone);
|
||||
if (error = copyinstr(SCARG(uap, path), path, MAXPATHLEN, NULL))
|
||||
goto out;
|
||||
NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, link), p);
|
||||
@ -1180,7 +1180,7 @@ symlink(p, uap, retval)
|
||||
ASSERT_VOP_UNLOCKED(nd.ni_dvp, "symlink");
|
||||
ASSERT_VOP_UNLOCKED(nd.ni_vp, "symlink");
|
||||
out:
|
||||
FREE(path, M_NAMEI);
|
||||
zfree(namei_zone, path);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -2288,11 +2288,11 @@ rename(p, uap, retval)
|
||||
ASSERT_VOP_UNLOCKED(fromnd.ni_vp, "rename");
|
||||
ASSERT_VOP_UNLOCKED(tond.ni_dvp, "rename");
|
||||
ASSERT_VOP_UNLOCKED(tond.ni_vp, "rename");
|
||||
FREE(tond.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
|
||||
out1:
|
||||
if (fromnd.ni_startdir)
|
||||
vrele(fromnd.ni_startdir);
|
||||
FREE(fromnd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
|
||||
if (error == -1)
|
||||
return (0);
|
||||
return (error);
|
||||
@ -2616,6 +2616,7 @@ getdirentries(p, uap, retval)
|
||||
auio.uio_segflg = UIO_USERSPACE;
|
||||
auio.uio_procp = p;
|
||||
auio.uio_resid = SCARG(uap, count);
|
||||
/* vn_lock(vp, LK_SHARED | LK_RETRY, p); */
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
|
||||
loff = auio.uio_offset = fp->f_offset;
|
||||
error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, NULL, NULL);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Written by Julian Elischer (julian@DIALix.oz.au)
|
||||
*
|
||||
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.38 1997/08/27 02:58:40 julian Exp $
|
||||
* $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v 1.39 1997/09/14 02:57:48 peter Exp $
|
||||
*
|
||||
* symlinks can wait 'til later.
|
||||
*/
|
||||
@ -1432,7 +1432,7 @@ devfs_abortop(struct vop_abortop_args *ap)
|
||||
{
|
||||
DBPRINT(("abortop\n"));
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return 0;
|
||||
}
|
||||
#endif /* notyet */
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
* @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95
|
||||
*
|
||||
* $Id: procfs_vnops.c,v 1.31 1997/08/12 04:34:30 sef Exp $
|
||||
* $Id: procfs_vnops.c,v 1.32 1997/09/14 02:57:58 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -351,7 +351,7 @@ procfs_abortop(ap)
|
||||
{
|
||||
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)union_subr.c 8.20 (Berkeley) 5/20/95
|
||||
* $Id: union_subr.c,v 1.19 1997/08/02 14:32:28 bde Exp $
|
||||
* $Id: union_subr.c,v 1.20 1997/08/14 03:57:46 kato Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -740,7 +740,7 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen)
|
||||
* The pathname buffer will be FREEed by VOP_MKDIR.
|
||||
*/
|
||||
cn->cn_namelen = pathlen;
|
||||
cn->cn_pnbuf = malloc(cn->cn_namelen+1, M_NAMEI, M_WAITOK);
|
||||
cn->cn_pnbuf = zalloc(namei_zone);
|
||||
bcopy(path, cn->cn_pnbuf, cn->cn_namelen);
|
||||
cn->cn_pnbuf[cn->cn_namelen] = '\0';
|
||||
|
||||
@ -760,7 +760,7 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen)
|
||||
if (!error)
|
||||
vrele(dvp);
|
||||
else {
|
||||
free(cn->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cn->cn_pnbuf);
|
||||
cn->cn_pnbuf = '\0';
|
||||
}
|
||||
|
||||
@ -906,7 +906,7 @@ union_vn_create(vpp, un, p)
|
||||
* copied in the first place).
|
||||
*/
|
||||
cn.cn_namelen = strlen(un->un_path);
|
||||
cn.cn_pnbuf = (caddr_t) malloc(cn.cn_namelen+1, M_NAMEI, M_WAITOK);
|
||||
cn.cn_pnbuf = zalloc(namei_zone);
|
||||
bcopy(un->un_path, cn.cn_pnbuf, cn.cn_namelen+1);
|
||||
cn.cn_nameiop = CREATE;
|
||||
cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: msdosfs_vnops.c,v 1.43 1997/08/26 07:32:39 phk Exp $ */
|
||||
/* $Id: msdosfs_vnops.c,v 1.44 1997/09/14 02:57:44 peter Exp $ */
|
||||
/* $NetBSD: msdosfs_vnops.c,v 1.20 1994/08/21 18:44:13 ws Exp $ */
|
||||
|
||||
/*-
|
||||
@ -177,9 +177,9 @@ msdosfs_create(ap)
|
||||
if ((error = createde(&ndirent, pdep, &dep)) == 0) {
|
||||
*ap->a_vpp = DETOV(dep);
|
||||
if ((cnp->cn_flags & SAVESTART) == 0)
|
||||
free(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
} else {
|
||||
free(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
}
|
||||
vput(ap->a_dvp); /* release parent dir */
|
||||
return error;
|
||||
@ -207,7 +207,7 @@ msdosfs_mknod(ap)
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
break;
|
||||
}
|
||||
@ -1336,7 +1336,7 @@ msdosfs_mkdir(ap)
|
||||
* change size.
|
||||
*/
|
||||
if (pdep->de_StartCluster == MSDOSFSROOT && pdep->de_fndclust == (u_long)-1) {
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
return ENOSPC;
|
||||
}
|
||||
@ -1348,7 +1348,7 @@ msdosfs_mkdir(ap)
|
||||
*/
|
||||
error = clusteralloc(pmp, 0, 1, CLUST_EOFE, &newcluster, NULL);
|
||||
if (error) {
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
return error;
|
||||
}
|
||||
@ -1376,7 +1376,7 @@ msdosfs_mkdir(ap)
|
||||
error = bwrite(bp);
|
||||
if (error) {
|
||||
clusterfree(pmp, newcluster, NULL);
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
return error;
|
||||
}
|
||||
@ -1401,7 +1401,7 @@ msdosfs_mkdir(ap)
|
||||
} else {
|
||||
*ap->a_vpp = DETOV(ndep);
|
||||
}
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("msdosfs_mkdir(): vput(%08x)\n", ap->a_dvp);
|
||||
#endif
|
||||
@ -1479,7 +1479,7 @@ msdosfs_symlink(ap)
|
||||
char *a_target;
|
||||
} */ *ap;
|
||||
{
|
||||
free(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
vput(ap->a_dvp);
|
||||
return EINVAL;
|
||||
}
|
||||
@ -1794,7 +1794,7 @@ msdosfs_abortop(ap)
|
||||
} */ *ap;
|
||||
{
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: nfs_subs.c,v 1.41 1997/08/16 19:15:59 wollman Exp $
|
||||
* $Id: nfs_subs.c,v 1.42 1997/09/10 19:52:26 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1444,7 +1444,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
struct componentname *cnp = &ndp->ni_cnd;
|
||||
|
||||
*retdirp = (struct vnode *)0;
|
||||
MALLOC(cnp->cn_pnbuf, char *, len + 1, M_NAMEI, M_WAITOK);
|
||||
cnp->cn_pnbuf = zalloc(namei_zone);
|
||||
|
||||
/*
|
||||
* Copy the name from the mbuf list to ndp->ni_pnbuf
|
||||
* and set the various ndp fields appropriately.
|
||||
@ -1506,7 +1507,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
* Oh joy. For WebNFS, handle those pesky '%' escapes,
|
||||
* and the 'native path' indicator.
|
||||
*/
|
||||
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cp = zalloc(namei_zone);
|
||||
fromcp = cnp->cn_pnbuf;
|
||||
tocp = cp;
|
||||
if ((unsigned char)*fromcp >= WEBNFS_SPECCHAR_START) {
|
||||
@ -1524,7 +1525,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
*/
|
||||
default:
|
||||
error = EIO;
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -1540,14 +1541,14 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
continue;
|
||||
} else {
|
||||
error = ENOENT;
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
goto out;
|
||||
}
|
||||
} else
|
||||
*tocp++ = *fromcp++;
|
||||
}
|
||||
*tocp = '\0';
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_pnbuf = cp;
|
||||
}
|
||||
|
||||
@ -1601,7 +1602,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
break;
|
||||
}
|
||||
if (ndp->ni_pathlen > 1)
|
||||
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cp = zalloc(namei_zone);
|
||||
else
|
||||
cp = cnp->cn_pnbuf;
|
||||
aiov.iov_base = cp;
|
||||
@ -1617,7 +1618,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
if (error) {
|
||||
badlink:
|
||||
if (ndp->ni_pathlen > 1)
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
break;
|
||||
}
|
||||
linklen = MAXPATHLEN - auio.uio_resid;
|
||||
@ -1631,7 +1632,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
}
|
||||
if (ndp->ni_pathlen > 1) {
|
||||
bcopy(ndp->ni_next, cp + linklen, ndp->ni_pathlen);
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_pnbuf = cp;
|
||||
} else
|
||||
cnp->cn_pnbuf[linklen] = '\0';
|
||||
@ -1649,7 +1650,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
}
|
||||
}
|
||||
out:
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_node.c 8.6 (Berkeley) 5/22/95
|
||||
* $Id: nfs_node.c,v 1.17 1997/05/09 13:04:43 dfr Exp $
|
||||
* $Id: nfs_node.c,v 1.18 1997/08/02 14:33:07 bde Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -373,6 +373,6 @@ nfs_abortop(ap)
|
||||
{
|
||||
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return (0);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
|
||||
* $Id: nfs_serv.c,v 1.49 1997/09/10 19:52:25 phk Exp $
|
||||
* $Id: nfs_serv.c,v 1.50 1997/09/10 20:22:28 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -448,7 +448,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
|
||||
|
||||
nqsrv_getl(ndp->ni_startdir, ND_READ);
|
||||
vrele(ndp->ni_startdir);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
vp = ndp->ni_vp;
|
||||
bzero((caddr_t)fhp, sizeof(nfh));
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
@ -1460,7 +1460,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (!error) {
|
||||
nfsrv_object_create(nd.ni_vp);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
if (exclusive_flag) {
|
||||
exclusive_flag = 0;
|
||||
VATTR_NULL(vap);
|
||||
@ -1477,7 +1477,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
if (vap->va_type != VFIFO &&
|
||||
(error = suser(cred, (u_short *)0))) {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
nfsm_reply(0);
|
||||
@ -1494,11 +1494,11 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
nd.ni_cnd.cn_proc = procp;
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
if (error = lookup(&nd)) {
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
nfsrv_object_create(nd.ni_vp);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
if (nd.ni_cnd.cn_flags & ISSYMLINK) {
|
||||
vrele(nd.ni_dvp);
|
||||
vput(nd.ni_vp);
|
||||
@ -1508,7 +1508,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
}
|
||||
} else {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
error = ENXIO;
|
||||
@ -1516,7 +1516,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
vp = nd.ni_vp;
|
||||
} else {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
vp = nd.ni_vp;
|
||||
if (nd.ni_dvp == vp)
|
||||
vrele(nd.ni_dvp);
|
||||
@ -1571,7 +1571,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
vrele(dirp);
|
||||
if (nd.ni_cnd.cn_nameiop) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
if (nd.ni_dvp == nd.ni_vp)
|
||||
@ -1635,7 +1635,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
vtyp = nfsv3tov_type(*tl);
|
||||
if (vtyp != VCHR && vtyp != VBLK && vtyp != VSOCK && vtyp != VFIFO) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
error = NFSERR_BADTYPE;
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
@ -1655,7 +1655,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
*/
|
||||
if (nd.ni_vp) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
error = EEXIST;
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
@ -1667,11 +1667,11 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
nqsrv_getl(nd.ni_dvp, ND_WRITE);
|
||||
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (!error)
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
} else {
|
||||
if (vtyp != VFIFO && (error = suser(cred, (u_short *)0))) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
goto out;
|
||||
@ -1686,7 +1686,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
nd.ni_cnd.cn_proc = procp;
|
||||
nd.ni_cnd.cn_cred = procp->p_ucred;
|
||||
error = lookup(&nd);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
if (error)
|
||||
goto out;
|
||||
if (nd.ni_cnd.cn_flags & ISSYMLINK) {
|
||||
@ -1720,7 +1720,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
vrele(dirp);
|
||||
if (nd.ni_cnd.cn_nameiop) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
if (nd.ni_dvp == nd.ni_vp)
|
||||
@ -1989,7 +1989,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
|
||||
error = 0;
|
||||
}
|
||||
vrele(tond.ni_startdir);
|
||||
FREE(tond.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
|
||||
out1:
|
||||
if (fdirp) {
|
||||
fdiraft_ret = VOP_GETATTR(fdirp, &fdiraft, cred, procp);
|
||||
@ -2000,7 +2000,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
|
||||
vrele(tdirp);
|
||||
}
|
||||
vrele(fromnd.ni_startdir);
|
||||
FREE(fromnd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
|
||||
nfsm_reply(2 * NFSX_WCCDATA(v3));
|
||||
if (v3) {
|
||||
nfsm_srvwcc_data(fdirfor_ret, &fdirfor, fdiraft_ret, &fdiraft);
|
||||
@ -2015,11 +2015,11 @@ nfsrv_rename(nfsd, slp, procp, mrq)
|
||||
vrele(tdirp);
|
||||
if (tond.ni_cnd.cn_nameiop) {
|
||||
vrele(tond.ni_startdir);
|
||||
FREE(tond.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
if (fromnd.ni_cnd.cn_nameiop) {
|
||||
vrele(fromnd.ni_startdir);
|
||||
FREE(fromnd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
@ -2199,7 +2199,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
|
||||
*(pathcp + len2) = '\0';
|
||||
if (nd.ni_vp) {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
if (nd.ni_dvp == nd.ni_vp)
|
||||
vrele(nd.ni_dvp);
|
||||
@ -2232,7 +2232,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
|
||||
}
|
||||
} else
|
||||
vrele(nd.ni_startdir);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
out:
|
||||
if (pathcp)
|
||||
@ -2253,7 +2253,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
|
||||
nfsmout:
|
||||
if (nd.ni_cnd.cn_nameiop) {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
if (dirp)
|
||||
vrele(dirp);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: nfs_subs.c,v 1.41 1997/08/16 19:15:59 wollman Exp $
|
||||
* $Id: nfs_subs.c,v 1.42 1997/09/10 19:52:26 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1444,7 +1444,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
struct componentname *cnp = &ndp->ni_cnd;
|
||||
|
||||
*retdirp = (struct vnode *)0;
|
||||
MALLOC(cnp->cn_pnbuf, char *, len + 1, M_NAMEI, M_WAITOK);
|
||||
cnp->cn_pnbuf = zalloc(namei_zone);
|
||||
|
||||
/*
|
||||
* Copy the name from the mbuf list to ndp->ni_pnbuf
|
||||
* and set the various ndp fields appropriately.
|
||||
@ -1506,7 +1507,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
* Oh joy. For WebNFS, handle those pesky '%' escapes,
|
||||
* and the 'native path' indicator.
|
||||
*/
|
||||
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cp = zalloc(namei_zone);
|
||||
fromcp = cnp->cn_pnbuf;
|
||||
tocp = cp;
|
||||
if ((unsigned char)*fromcp >= WEBNFS_SPECCHAR_START) {
|
||||
@ -1524,7 +1525,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
*/
|
||||
default:
|
||||
error = EIO;
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -1540,14 +1541,14 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
continue;
|
||||
} else {
|
||||
error = ENOENT;
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
goto out;
|
||||
}
|
||||
} else
|
||||
*tocp++ = *fromcp++;
|
||||
}
|
||||
*tocp = '\0';
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_pnbuf = cp;
|
||||
}
|
||||
|
||||
@ -1601,7 +1602,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
break;
|
||||
}
|
||||
if (ndp->ni_pathlen > 1)
|
||||
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cp = zalloc(namei_zone);
|
||||
else
|
||||
cp = cnp->cn_pnbuf;
|
||||
aiov.iov_base = cp;
|
||||
@ -1617,7 +1618,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
if (error) {
|
||||
badlink:
|
||||
if (ndp->ni_pathlen > 1)
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
break;
|
||||
}
|
||||
linklen = MAXPATHLEN - auio.uio_resid;
|
||||
@ -1631,7 +1632,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
}
|
||||
if (ndp->ni_pathlen > 1) {
|
||||
bcopy(ndp->ni_next, cp + linklen, ndp->ni_pathlen);
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_pnbuf = cp;
|
||||
} else
|
||||
cnp->cn_pnbuf[linklen] = '\0';
|
||||
@ -1649,7 +1650,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
}
|
||||
}
|
||||
out:
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
|
||||
* $Id: nfs_vnops.c,v 1.59 1997/09/10 21:27:40 phk Exp $
|
||||
* $Id: nfs_vnops.c,v 1.60 1997/09/14 03:00:44 peter Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -1302,7 +1302,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
|
||||
cache_enter(dvp, newvp, cnp);
|
||||
*vpp = newvp;
|
||||
}
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
VTONFS(dvp)->n_attrstamp = 0;
|
||||
@ -1437,7 +1437,7 @@ nfs_create(ap)
|
||||
cache_enter(dvp, newvp, cnp);
|
||||
*ap->a_vpp = newvp;
|
||||
}
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
VTONFS(dvp)->n_attrstamp = 0;
|
||||
@ -1508,7 +1508,7 @@ nfs_remove(ap)
|
||||
error = 0;
|
||||
} else if (!np->n_sillyrename)
|
||||
error = nfs_sillyrename(dvp, vp, cnp);
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
np->n_attrstamp = 0;
|
||||
vput(dvp);
|
||||
if (vp == dvp)
|
||||
@ -1743,7 +1743,7 @@ nfs_link(ap)
|
||||
nfsm_wcc_data(tdvp, wccflag);
|
||||
}
|
||||
nfsm_reqdone;
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(tdvp)->n_flag |= NMODIFIED;
|
||||
if (!attrflag)
|
||||
VTONFS(vp)->n_attrstamp = 0;
|
||||
@ -1815,7 +1815,7 @@ nfs_symlink(ap)
|
||||
nfsm_reqdone;
|
||||
if (newvp)
|
||||
vput(newvp);
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
VTONFS(dvp)->n_attrstamp = 0;
|
||||
@ -1912,7 +1912,7 @@ nfs_mkdir(ap)
|
||||
vrele(newvp);
|
||||
} else
|
||||
*ap->a_vpp = newvp;
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
vput(dvp);
|
||||
return (error);
|
||||
}
|
||||
@ -1948,7 +1948,7 @@ nfs_rmdir(ap)
|
||||
if (v3)
|
||||
nfsm_wcc_data(dvp, wccflag);
|
||||
nfsm_reqdone;
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
VTONFS(dvp)->n_attrstamp = 0;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_node.c 8.6 (Berkeley) 5/22/95
|
||||
* $Id: nfs_node.c,v 1.17 1997/05/09 13:04:43 dfr Exp $
|
||||
* $Id: nfs_node.c,v 1.18 1997/08/02 14:33:07 bde Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -373,6 +373,6 @@ nfs_abortop(ap)
|
||||
{
|
||||
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return (0);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: nfs_subs.c,v 1.41 1997/08/16 19:15:59 wollman Exp $
|
||||
* $Id: nfs_subs.c,v 1.42 1997/09/10 19:52:26 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1444,7 +1444,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
struct componentname *cnp = &ndp->ni_cnd;
|
||||
|
||||
*retdirp = (struct vnode *)0;
|
||||
MALLOC(cnp->cn_pnbuf, char *, len + 1, M_NAMEI, M_WAITOK);
|
||||
cnp->cn_pnbuf = zalloc(namei_zone);
|
||||
|
||||
/*
|
||||
* Copy the name from the mbuf list to ndp->ni_pnbuf
|
||||
* and set the various ndp fields appropriately.
|
||||
@ -1506,7 +1507,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
* Oh joy. For WebNFS, handle those pesky '%' escapes,
|
||||
* and the 'native path' indicator.
|
||||
*/
|
||||
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cp = zalloc(namei_zone);
|
||||
fromcp = cnp->cn_pnbuf;
|
||||
tocp = cp;
|
||||
if ((unsigned char)*fromcp >= WEBNFS_SPECCHAR_START) {
|
||||
@ -1524,7 +1525,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
*/
|
||||
default:
|
||||
error = EIO;
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -1540,14 +1541,14 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
continue;
|
||||
} else {
|
||||
error = ENOENT;
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
goto out;
|
||||
}
|
||||
} else
|
||||
*tocp++ = *fromcp++;
|
||||
}
|
||||
*tocp = '\0';
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_pnbuf = cp;
|
||||
}
|
||||
|
||||
@ -1601,7 +1602,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
break;
|
||||
}
|
||||
if (ndp->ni_pathlen > 1)
|
||||
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cp = zalloc(namei_zone);
|
||||
else
|
||||
cp = cnp->cn_pnbuf;
|
||||
aiov.iov_base = cp;
|
||||
@ -1617,7 +1618,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
if (error) {
|
||||
badlink:
|
||||
if (ndp->ni_pathlen > 1)
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
break;
|
||||
}
|
||||
linklen = MAXPATHLEN - auio.uio_resid;
|
||||
@ -1631,7 +1632,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
}
|
||||
if (ndp->ni_pathlen > 1) {
|
||||
bcopy(ndp->ni_next, cp + linklen, ndp->ni_pathlen);
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_pnbuf = cp;
|
||||
} else
|
||||
cnp->cn_pnbuf[linklen] = '\0';
|
||||
@ -1649,7 +1650,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
}
|
||||
}
|
||||
out:
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
|
||||
* $Id: nfs_vnops.c,v 1.59 1997/09/10 21:27:40 phk Exp $
|
||||
* $Id: nfs_vnops.c,v 1.60 1997/09/14 03:00:44 peter Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -1302,7 +1302,7 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
|
||||
cache_enter(dvp, newvp, cnp);
|
||||
*vpp = newvp;
|
||||
}
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
VTONFS(dvp)->n_attrstamp = 0;
|
||||
@ -1437,7 +1437,7 @@ nfs_create(ap)
|
||||
cache_enter(dvp, newvp, cnp);
|
||||
*ap->a_vpp = newvp;
|
||||
}
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
VTONFS(dvp)->n_attrstamp = 0;
|
||||
@ -1508,7 +1508,7 @@ nfs_remove(ap)
|
||||
error = 0;
|
||||
} else if (!np->n_sillyrename)
|
||||
error = nfs_sillyrename(dvp, vp, cnp);
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
np->n_attrstamp = 0;
|
||||
vput(dvp);
|
||||
if (vp == dvp)
|
||||
@ -1743,7 +1743,7 @@ nfs_link(ap)
|
||||
nfsm_wcc_data(tdvp, wccflag);
|
||||
}
|
||||
nfsm_reqdone;
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(tdvp)->n_flag |= NMODIFIED;
|
||||
if (!attrflag)
|
||||
VTONFS(vp)->n_attrstamp = 0;
|
||||
@ -1815,7 +1815,7 @@ nfs_symlink(ap)
|
||||
nfsm_reqdone;
|
||||
if (newvp)
|
||||
vput(newvp);
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
VTONFS(dvp)->n_attrstamp = 0;
|
||||
@ -1912,7 +1912,7 @@ nfs_mkdir(ap)
|
||||
vrele(newvp);
|
||||
} else
|
||||
*ap->a_vpp = newvp;
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
vput(dvp);
|
||||
return (error);
|
||||
}
|
||||
@ -1948,7 +1948,7 @@ nfs_rmdir(ap)
|
||||
if (v3)
|
||||
nfsm_wcc_data(dvp, wccflag);
|
||||
nfsm_reqdone;
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VTONFS(dvp)->n_flag |= NMODIFIED;
|
||||
if (!wccflag)
|
||||
VTONFS(dvp)->n_attrstamp = 0;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
|
||||
* $Id: nfs_serv.c,v 1.49 1997/09/10 19:52:25 phk Exp $
|
||||
* $Id: nfs_serv.c,v 1.50 1997/09/10 20:22:28 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -448,7 +448,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
|
||||
|
||||
nqsrv_getl(ndp->ni_startdir, ND_READ);
|
||||
vrele(ndp->ni_startdir);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
vp = ndp->ni_vp;
|
||||
bzero((caddr_t)fhp, sizeof(nfh));
|
||||
fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
@ -1460,7 +1460,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (!error) {
|
||||
nfsrv_object_create(nd.ni_vp);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
if (exclusive_flag) {
|
||||
exclusive_flag = 0;
|
||||
VATTR_NULL(vap);
|
||||
@ -1477,7 +1477,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
if (vap->va_type != VFIFO &&
|
||||
(error = suser(cred, (u_short *)0))) {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
nfsm_reply(0);
|
||||
@ -1494,11 +1494,11 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
nd.ni_cnd.cn_proc = procp;
|
||||
nd.ni_cnd.cn_cred = cred;
|
||||
if (error = lookup(&nd)) {
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
nfsm_reply(0);
|
||||
}
|
||||
nfsrv_object_create(nd.ni_vp);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
if (nd.ni_cnd.cn_flags & ISSYMLINK) {
|
||||
vrele(nd.ni_dvp);
|
||||
vput(nd.ni_vp);
|
||||
@ -1508,7 +1508,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
}
|
||||
} else {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
error = ENXIO;
|
||||
@ -1516,7 +1516,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
vp = nd.ni_vp;
|
||||
} else {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
vp = nd.ni_vp;
|
||||
if (nd.ni_dvp == vp)
|
||||
vrele(nd.ni_dvp);
|
||||
@ -1571,7 +1571,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
|
||||
vrele(dirp);
|
||||
if (nd.ni_cnd.cn_nameiop) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
if (nd.ni_dvp == nd.ni_vp)
|
||||
@ -1635,7 +1635,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
vtyp = nfsv3tov_type(*tl);
|
||||
if (vtyp != VCHR && vtyp != VBLK && vtyp != VSOCK && vtyp != VFIFO) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
error = NFSERR_BADTYPE;
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
@ -1655,7 +1655,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
*/
|
||||
if (nd.ni_vp) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
error = EEXIST;
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
@ -1667,11 +1667,11 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
nqsrv_getl(nd.ni_dvp, ND_WRITE);
|
||||
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
|
||||
if (!error)
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
} else {
|
||||
if (vtyp != VFIFO && (error = suser(cred, (u_short *)0))) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
vput(nd.ni_dvp);
|
||||
goto out;
|
||||
@ -1686,7 +1686,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
nd.ni_cnd.cn_proc = procp;
|
||||
nd.ni_cnd.cn_cred = procp->p_ucred;
|
||||
error = lookup(&nd);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
if (error)
|
||||
goto out;
|
||||
if (nd.ni_cnd.cn_flags & ISSYMLINK) {
|
||||
@ -1720,7 +1720,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
|
||||
vrele(dirp);
|
||||
if (nd.ni_cnd.cn_nameiop) {
|
||||
vrele(nd.ni_startdir);
|
||||
free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
if (nd.ni_dvp == nd.ni_vp)
|
||||
@ -1989,7 +1989,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
|
||||
error = 0;
|
||||
}
|
||||
vrele(tond.ni_startdir);
|
||||
FREE(tond.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
|
||||
out1:
|
||||
if (fdirp) {
|
||||
fdiraft_ret = VOP_GETATTR(fdirp, &fdiraft, cred, procp);
|
||||
@ -2000,7 +2000,7 @@ nfsrv_rename(nfsd, slp, procp, mrq)
|
||||
vrele(tdirp);
|
||||
}
|
||||
vrele(fromnd.ni_startdir);
|
||||
FREE(fromnd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
|
||||
nfsm_reply(2 * NFSX_WCCDATA(v3));
|
||||
if (v3) {
|
||||
nfsm_srvwcc_data(fdirfor_ret, &fdirfor, fdiraft_ret, &fdiraft);
|
||||
@ -2015,11 +2015,11 @@ nfsrv_rename(nfsd, slp, procp, mrq)
|
||||
vrele(tdirp);
|
||||
if (tond.ni_cnd.cn_nameiop) {
|
||||
vrele(tond.ni_startdir);
|
||||
FREE(tond.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
if (fromnd.ni_cnd.cn_nameiop) {
|
||||
vrele(fromnd.ni_startdir);
|
||||
FREE(fromnd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
|
||||
vrele(fromnd.ni_dvp);
|
||||
vrele(fvp);
|
||||
@ -2199,7 +2199,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
|
||||
*(pathcp + len2) = '\0';
|
||||
if (nd.ni_vp) {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
|
||||
if (nd.ni_dvp == nd.ni_vp)
|
||||
vrele(nd.ni_dvp);
|
||||
@ -2232,7 +2232,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
|
||||
}
|
||||
} else
|
||||
vrele(nd.ni_startdir);
|
||||
FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
out:
|
||||
if (pathcp)
|
||||
@ -2253,7 +2253,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
|
||||
nfsmout:
|
||||
if (nd.ni_cnd.cn_nameiop) {
|
||||
vrele(nd.ni_startdir);
|
||||
free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
|
||||
}
|
||||
if (dirp)
|
||||
vrele(dirp);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: nfs_subs.c,v 1.41 1997/08/16 19:15:59 wollman Exp $
|
||||
* $Id: nfs_subs.c,v 1.42 1997/09/10 19:52:26 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1444,7 +1444,8 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
struct componentname *cnp = &ndp->ni_cnd;
|
||||
|
||||
*retdirp = (struct vnode *)0;
|
||||
MALLOC(cnp->cn_pnbuf, char *, len + 1, M_NAMEI, M_WAITOK);
|
||||
cnp->cn_pnbuf = zalloc(namei_zone);
|
||||
|
||||
/*
|
||||
* Copy the name from the mbuf list to ndp->ni_pnbuf
|
||||
* and set the various ndp fields appropriately.
|
||||
@ -1506,7 +1507,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
* Oh joy. For WebNFS, handle those pesky '%' escapes,
|
||||
* and the 'native path' indicator.
|
||||
*/
|
||||
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cp = zalloc(namei_zone);
|
||||
fromcp = cnp->cn_pnbuf;
|
||||
tocp = cp;
|
||||
if ((unsigned char)*fromcp >= WEBNFS_SPECCHAR_START) {
|
||||
@ -1524,7 +1525,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
*/
|
||||
default:
|
||||
error = EIO;
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -1540,14 +1541,14 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
continue;
|
||||
} else {
|
||||
error = ENOENT;
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
goto out;
|
||||
}
|
||||
} else
|
||||
*tocp++ = *fromcp++;
|
||||
}
|
||||
*tocp = '\0';
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_pnbuf = cp;
|
||||
}
|
||||
|
||||
@ -1601,7 +1602,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
break;
|
||||
}
|
||||
if (ndp->ni_pathlen > 1)
|
||||
MALLOC(cp, char *, MAXPATHLEN, M_NAMEI, M_WAITOK);
|
||||
cp = zalloc(namei_zone);
|
||||
else
|
||||
cp = cnp->cn_pnbuf;
|
||||
aiov.iov_base = cp;
|
||||
@ -1617,7 +1618,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
if (error) {
|
||||
badlink:
|
||||
if (ndp->ni_pathlen > 1)
|
||||
FREE(cp, M_NAMEI);
|
||||
zfree(namei_zone, cp);
|
||||
break;
|
||||
}
|
||||
linklen = MAXPATHLEN - auio.uio_resid;
|
||||
@ -1631,7 +1632,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
}
|
||||
if (ndp->ni_pathlen > 1) {
|
||||
bcopy(ndp->ni_next, cp + linklen, ndp->ni_pathlen);
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_pnbuf = cp;
|
||||
} else
|
||||
cnp->cn_pnbuf[linklen] = '\0';
|
||||
@ -1649,7 +1650,7 @@ nfs_namei(ndp, fhp, len, slp, nam, mdp, dposp, retdirp, p, kerbflag, pubflag)
|
||||
}
|
||||
}
|
||||
out:
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)lock.h 8.12 (Berkeley) 5/19/95
|
||||
* $Id: lock.h,v 1.8 1997/08/18 02:06:30 dyson Exp $
|
||||
* $Id: lock.h,v 1.9 1997/08/30 07:59:47 fsmp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _LOCK_H_
|
||||
@ -108,11 +108,12 @@ struct lock {
|
||||
* or passed in as arguments to the lock manager. The LK_REENABLE flag may be
|
||||
* set only at the release of a lock obtained by drain.
|
||||
*/
|
||||
#define LK_EXTFLG_MASK 0x00000070 /* mask of external flags */
|
||||
#define LK_EXTFLG_MASK 0x01000070 /* mask of external flags */
|
||||
#define LK_NOWAIT 0x00000010 /* do not sleep to await lock */
|
||||
#define LK_SLEEPFAIL 0x00000020 /* sleep, then return failure */
|
||||
#define LK_CANRECURSE 0x00000040 /* allow recursive exclusive lock */
|
||||
#define LK_REENABLE 0x00000080 /* lock is be reenabled after drain */
|
||||
#define LK_NOPAUSE 0x01000000 /* no spinloop */
|
||||
/*
|
||||
* Internal lock flags.
|
||||
*
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)lock.h 8.12 (Berkeley) 5/19/95
|
||||
* $Id: lock.h,v 1.8 1997/08/18 02:06:30 dyson Exp $
|
||||
* $Id: lock.h,v 1.9 1997/08/30 07:59:47 fsmp Exp $
|
||||
*/
|
||||
|
||||
#ifndef _LOCK_H_
|
||||
@ -108,11 +108,12 @@ struct lock {
|
||||
* or passed in as arguments to the lock manager. The LK_REENABLE flag may be
|
||||
* set only at the release of a lock obtained by drain.
|
||||
*/
|
||||
#define LK_EXTFLG_MASK 0x00000070 /* mask of external flags */
|
||||
#define LK_EXTFLG_MASK 0x01000070 /* mask of external flags */
|
||||
#define LK_NOWAIT 0x00000010 /* do not sleep to await lock */
|
||||
#define LK_SLEEPFAIL 0x00000020 /* sleep, then return failure */
|
||||
#define LK_CANRECURSE 0x00000040 /* allow recursive exclusive lock */
|
||||
#define LK_REENABLE 0x00000080 /* lock is be reenabled after drain */
|
||||
#define LK_NOPAUSE 0x01000000 /* no spinloop */
|
||||
/*
|
||||
* Internal lock flags.
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)malloc.h 8.5 (Berkeley) 5/3/95
|
||||
* $Id: malloc.h,v 1.23 1997/08/16 19:16:10 wollman Exp $
|
||||
* $Id: malloc.h,v 1.24 1997/09/16 13:52:04 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MALLOC_H_
|
||||
@ -272,6 +272,12 @@ struct kmembuckets {
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
#include <vm/vm_zone.h>
|
||||
|
||||
|
||||
#include <vm/vm_zone.h>
|
||||
|
||||
#define MINALLOCSIZE (1 << MINBUCKET)
|
||||
#define BUCKETINDX(size) \
|
||||
((size) <= (MINALLOCSIZE * 128) \
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vnode.h 8.7 (Berkeley) 2/4/94
|
||||
* $Id: vnode.h,v 1.47 1997/08/31 07:32:35 phk Exp $
|
||||
* $Id: vnode.h,v 1.48 1997/09/14 02:25:41 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VNODE_H_
|
||||
@ -453,6 +453,9 @@ struct uio;
|
||||
struct vattr;
|
||||
struct vnode;
|
||||
struct vop_bwrite_args;
|
||||
struct vm_zone;
|
||||
|
||||
extern struct vm_zone *namei_zone;
|
||||
|
||||
extern int (*lease_check_hook) __P((struct vop_lease_args *));
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
|
||||
* $Id: ufs_vnops.c,v 1.56 1997/09/02 20:06:59 bde Exp $
|
||||
* $Id: ufs_vnops.c,v 1.57 1997/09/14 02:58:12 peter Exp $
|
||||
*/
|
||||
|
||||
#include "opt_quota.h"
|
||||
@ -740,7 +740,7 @@ ufs_link(ap)
|
||||
ip->i_nlink--;
|
||||
ip->i_flag |= IN_CHANGE;
|
||||
}
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
out1:
|
||||
if (tdvp != vp)
|
||||
VOP_UNLOCK(vp, 0, p);
|
||||
@ -800,7 +800,7 @@ ufs_whiteout(ap)
|
||||
break;
|
||||
}
|
||||
if (cnp->cn_flags & HASBUF) {
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
cnp->cn_flags &= ~HASBUF;
|
||||
}
|
||||
return (error);
|
||||
@ -1342,7 +1342,7 @@ ufs_mkdir(ap)
|
||||
#ifdef QUOTA
|
||||
if ((error = getinoquota(ip)) ||
|
||||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
|
||||
free(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VOP_VFREE(tvp, ip->i_number, dmode);
|
||||
vput(tvp);
|
||||
vput(dvp);
|
||||
@ -1434,7 +1434,7 @@ ufs_mkdir(ap)
|
||||
} else
|
||||
*ap->a_vpp = tvp;
|
||||
out:
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
vput(dvp);
|
||||
return (error);
|
||||
#ifdef EXT2FS
|
||||
@ -1718,7 +1718,7 @@ ufs_abortop(ap)
|
||||
} */ *ap;
|
||||
{
|
||||
if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
|
||||
FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, ap->a_cnp->cn_pnbuf);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2093,7 +2093,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
|
||||
|
||||
error = VOP_VALLOC(dvp, mode, cnp->cn_cred, &tvp);
|
||||
if (error) {
|
||||
free(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
vput(dvp);
|
||||
return (error);
|
||||
}
|
||||
@ -2103,7 +2103,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
|
||||
#ifdef QUOTA
|
||||
if ((error = getinoquota(ip)) ||
|
||||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
|
||||
free(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
VOP_VFREE(tvp, ip->i_number, mode);
|
||||
vput(tvp);
|
||||
vput(dvp);
|
||||
@ -2141,7 +2141,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
|
||||
goto bad;
|
||||
|
||||
if ((cnp->cn_flags & SAVESTART) == 0)
|
||||
FREE(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
vput(dvp);
|
||||
*vpp = tvp;
|
||||
return (0);
|
||||
@ -2151,7 +2151,7 @@ ufs_makeinode(mode, dvp, vpp, cnp)
|
||||
* Write error occurred trying to update the inode
|
||||
* or the directory so must deallocate the inode.
|
||||
*/
|
||||
free(cnp->cn_pnbuf, M_NAMEI);
|
||||
zfree(namei_zone, cnp->cn_pnbuf);
|
||||
vput(dvp);
|
||||
ip->i_nlink = 0;
|
||||
ip->i_flag |= IN_CHANGE;
|
||||
|
@ -61,7 +61,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_map.c,v 1.89 1997/09/01 03:17:18 bde Exp $
|
||||
* $Id: vm_map.c,v 1.90 1997/09/12 15:58:47 jlemon Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -214,8 +214,9 @@ vm_init2(void) {
|
||||
zinitna(mapentzone, &mapentobj,
|
||||
NULL, 0, 0, 0, 4);
|
||||
zinitna(mapzone, &mapobj,
|
||||
NULL, 0, 0, 0, 1);
|
||||
NULL, 0, 0, 0, 2);
|
||||
pmap_init2();
|
||||
vm_object_init2();
|
||||
}
|
||||
|
||||
void
|
||||
@ -684,8 +685,12 @@ vm_map_findspace(map, start, length, addr)
|
||||
}
|
||||
SAVE_HINT(map, entry);
|
||||
*addr = start;
|
||||
if (map == kernel_map && round_page(start + length) > kernel_vm_end)
|
||||
pmap_growkernel(round_page(start + length));
|
||||
if (map == kernel_map) {
|
||||
vm_offset_t ksize;
|
||||
if ((ksize = round_page(start + length)) > kernel_vm_end) {
|
||||
pmap_growkernel(ksize);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_object.c,v 1.96 1997/09/01 02:55:48 bde Exp $
|
||||
* $Id: vm_object.c,v 1.97 1997/09/01 03:17:22 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -89,6 +89,7 @@
|
||||
#include <vm/swap_pager.h>
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_extern.h>
|
||||
#include <vm/vm_zone.h>
|
||||
|
||||
static void vm_object_qcollapse __P((vm_object_t object));
|
||||
#ifdef not_used
|
||||
@ -138,6 +139,10 @@ extern int vm_pageout_page_count;
|
||||
static long object_collapses;
|
||||
static long object_bypasses;
|
||||
static int next_index;
|
||||
static vm_zone_t obj_zone;
|
||||
static struct vm_zone obj_zone_store;
|
||||
#define VM_OBJECTS_INIT 256
|
||||
struct vm_object vm_objects_init[VM_OBJECTS_INIT];
|
||||
|
||||
void
|
||||
_vm_object_allocate(type, size, object)
|
||||
@ -145,6 +150,7 @@ _vm_object_allocate(type, size, object)
|
||||
vm_size_t size;
|
||||
register vm_object_t object;
|
||||
{
|
||||
int incr;
|
||||
TAILQ_INIT(&object->memq);
|
||||
TAILQ_INIT(&object->shadow_head);
|
||||
|
||||
@ -157,7 +163,11 @@ _vm_object_allocate(type, size, object)
|
||||
object->resident_page_count = 0;
|
||||
object->shadow_count = 0;
|
||||
object->pg_color = next_index;
|
||||
next_index = (next_index + PQ_PRIME1) & PQ_L2_MASK;
|
||||
if ( size > (PQ_L2_SIZE / 3 + PQ_PRIME1))
|
||||
incr = PQ_L2_SIZE / 3 + PQ_PRIME1;
|
||||
else
|
||||
incr = size;
|
||||
next_index = (next_index + incr) & PQ_L2_MASK;
|
||||
object->handle = NULL;
|
||||
object->paging_offset = (vm_ooffset_t) 0;
|
||||
object->backing_object = NULL;
|
||||
@ -194,6 +204,15 @@ vm_object_init()
|
||||
kmem_object = &kmem_object_store;
|
||||
_vm_object_allocate(OBJT_DEFAULT, OFF_TO_IDX(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS),
|
||||
kmem_object);
|
||||
|
||||
obj_zone = &obj_zone_store;
|
||||
zbootinit(obj_zone, "VM OBJECT", sizeof (struct vm_object),
|
||||
vm_objects_init, VM_OBJECTS_INIT);
|
||||
}
|
||||
|
||||
void
|
||||
vm_object_init2() {
|
||||
zinitna(obj_zone, NULL, NULL, 0, 0, 0, 4);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -208,10 +227,7 @@ vm_object_allocate(type, size)
|
||||
vm_size_t size;
|
||||
{
|
||||
register vm_object_t result;
|
||||
|
||||
result = (vm_object_t)
|
||||
malloc((u_long) sizeof *result, M_VMOBJ, M_WAITOK);
|
||||
|
||||
result = (vm_object_t) zalloc(obj_zone);
|
||||
|
||||
_vm_object_allocate(type, size, result);
|
||||
|
||||
@ -429,7 +445,7 @@ vm_object_terminate(object)
|
||||
/*
|
||||
* Free the space for the object.
|
||||
*/
|
||||
free((caddr_t) object, M_VMOBJ);
|
||||
zfree(obj_zone, object);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1102,7 +1118,7 @@ vm_object_collapse(object)
|
||||
object_list);
|
||||
vm_object_count--;
|
||||
|
||||
free((caddr_t) backing_object, M_VMOBJ);
|
||||
zfree(obj_zone, backing_object);
|
||||
|
||||
object_collapses++;
|
||||
} else {
|
||||
|
@ -61,7 +61,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_object.h,v 1.36 1997/08/05 00:02:06 dyson Exp $
|
||||
* $Id: vm_object.h,v 1.37 1997/09/01 02:55:50 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -183,6 +183,7 @@ void vm_object_pmap_remove __P((vm_object_t, vm_pindex_t, vm_pindex_t));
|
||||
void vm_object_reference __P((vm_object_t));
|
||||
void vm_object_shadow __P((vm_object_t *, vm_ooffset_t *, vm_size_t));
|
||||
void vm_object_madvise __P((vm_object_t, vm_pindex_t, int, int));
|
||||
void vm_object_init2 __P((void));
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _VM_OBJECT_ */
|
||||
|
@ -18,7 +18,7 @@
|
||||
* 5. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: vm_zone.c,v 1.5 1997/08/18 03:29:21 fsmp Exp $
|
||||
* $Id: vm_zone.c,v 1.6 1997/09/01 03:17:32 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -79,13 +79,14 @@ zinitna(vm_zone_t z, vm_object_t obj, char *name, int size,
|
||||
int totsize;
|
||||
|
||||
if ((z->zflags & ZONE_BOOT) == 0) {
|
||||
z->zsize = size;
|
||||
z->zsize = (size + 32 - 1) & ~(32 - 1);
|
||||
simple_lock_init(&z->zlock);
|
||||
z->zfreecnt = 0;
|
||||
z->ztotal = 0;
|
||||
z->zmax = 0;
|
||||
z->zname = name;
|
||||
z->znalloc = 0;
|
||||
z->zitems = NULL;
|
||||
|
||||
if (zlist == 0) {
|
||||
zlist = z;
|
||||
@ -183,8 +184,12 @@ zbootinit(vm_zone_t z, char *name, int size, void *item, int nitems) {
|
||||
z->znalloc = 0;
|
||||
simple_lock_init(&z->zlock);
|
||||
|
||||
z->zitems = NULL;
|
||||
for (i = 0; i < nitems; i++) {
|
||||
* (void **) item = z->zitems;
|
||||
((void **) item)[0] = z->zitems;
|
||||
#if defined(DIAGNOSTIC)
|
||||
((void **) item)[1] = (void *) ZENTRY_FREE;
|
||||
#endif
|
||||
z->zitems = item;
|
||||
(char *) item += z->zsize;
|
||||
}
|
||||
@ -263,9 +268,12 @@ void *
|
||||
_zget(vm_zone_t z) {
|
||||
int i;
|
||||
vm_page_t m;
|
||||
int nitems;
|
||||
int nitems, nbytes;
|
||||
void *item;
|
||||
|
||||
if (z == NULL)
|
||||
panic("zget: null zone");
|
||||
|
||||
if (z->zflags & ZONE_INTERRUPT) {
|
||||
item = (char *) z->zkva + z->zpagecount * PAGE_SIZE;
|
||||
for( i = 0; ((i < z->zalloc) && (z->zpagecount < z->zpagemax)); i++) {
|
||||
@ -280,11 +288,26 @@ _zget(vm_zone_t z) {
|
||||
}
|
||||
nitems = (i * PAGE_SIZE) / z->zsize;
|
||||
} else {
|
||||
nbytes = z->zalloc * PAGE_SIZE;
|
||||
/*
|
||||
* We can wait, so just do normal kernel map allocation
|
||||
*/
|
||||
item = (void *) kmem_alloc(kernel_map, z->zalloc * PAGE_SIZE);
|
||||
nitems = (z->zalloc * PAGE_SIZE) / z->zsize;
|
||||
item = (void *) kmem_alloc(kernel_map, nbytes);
|
||||
|
||||
#if 0
|
||||
if (z->zname)
|
||||
printf("zalloc: %s, %d (0x%x --> 0x%x)\n",
|
||||
z->zname, z->zalloc, item, (char *)item + nbytes);
|
||||
else
|
||||
printf("zalloc: XXX(%d), %d (0x%x --> 0x%x)\n",
|
||||
z->zsize, z->zalloc, item, (char *)item + nbytes);
|
||||
|
||||
for(i=0;i<nbytes;i+=PAGE_SIZE) {
|
||||
printf("(%x, %x)", (char *) item + i, pmap_kextract( (char *) item + i));
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
nitems = nbytes / z->zsize;
|
||||
}
|
||||
z->ztotal += nitems;
|
||||
|
||||
@ -294,14 +317,22 @@ _zget(vm_zone_t z) {
|
||||
if (nitems != 0) {
|
||||
nitems -= 1;
|
||||
for (i = 0; i < nitems; i++) {
|
||||
* (void **) item = z->zitems;
|
||||
((void **) item)[0] = z->zitems;
|
||||
#if defined(DIAGNOSTIC)
|
||||
((void **) item)[1] = (void *) ZENTRY_FREE;
|
||||
#endif
|
||||
z->zitems = item;
|
||||
(char *) item += z->zsize;
|
||||
}
|
||||
z->zfreecnt += nitems;
|
||||
} else if (z->zfreecnt > 0) {
|
||||
item = z->zitems;
|
||||
z->zitems = *(void **) item;
|
||||
z->zitems = ((void **) item)[0];
|
||||
#if defined(DIAGNOSTIC)
|
||||
if (((void **) item)[1] != (void *) ZENTRY_FREE)
|
||||
zerror(ZONE_ERROR_NOTFREE);
|
||||
((void **) item)[1] = 0;
|
||||
#endif
|
||||
z->zfreecnt--;
|
||||
} else {
|
||||
item = NULL;
|
||||
@ -356,5 +387,28 @@ sysctl_vm_zone SYSCTL_HANDLER_ARGS
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(DIAGNOSTIC)
|
||||
void
|
||||
zerror(int error) {
|
||||
char *msg;
|
||||
switch (error) {
|
||||
case ZONE_ERROR_INVALID:
|
||||
msg = "zone: invalid zone";
|
||||
break;
|
||||
case ZONE_ERROR_NOTFREE:
|
||||
msg = "zone: entry not free";
|
||||
break;
|
||||
case ZONE_ERROR_ALREADYFREE:
|
||||
msg = "zone: freeing free entry";
|
||||
break;
|
||||
default:
|
||||
msg = "zone: invalid error";
|
||||
break;
|
||||
}
|
||||
|
||||
panic(msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
SYSCTL_OID(_kern, OID_AUTO, zone, CTLTYPE_STRING|CTLFLAG_RD, \
|
||||
NULL, 0, sysctl_vm_zone, "A", "Zone Info");
|
||||
|
@ -19,7 +19,7 @@
|
||||
* 5. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: vm_zone.h,v 1.4 1997/08/07 03:52:55 dyson Exp $
|
||||
* $Id: vm_zone.h,v 1.5 1997/08/10 00:12:13 dyson Exp $
|
||||
*/
|
||||
|
||||
#if !defined(_SYS_ZONE_H)
|
||||
@ -54,6 +54,7 @@ typedef struct vm_zone {
|
||||
} *vm_zone_t;
|
||||
|
||||
|
||||
void zerror __P((int)) __dead2;
|
||||
vm_zone_t zinit __P((char *name, int size, int nentries, int flags, int zalloc));
|
||||
int zinitna __P((vm_zone_t z, struct vm_object *obj, char *name, int size,
|
||||
int nentries, int flags, int zalloc));
|
||||
@ -64,6 +65,12 @@ void zfreei __P((vm_zone_t z, void *item));
|
||||
void zbootinit __P((vm_zone_t z, char *name, int size, void *item, int nitems));
|
||||
void * _zget __P((vm_zone_t z));
|
||||
|
||||
#define ZONE_ERROR_INVALID 0
|
||||
#define ZONE_ERROR_NOTFREE 1
|
||||
#define ZONE_ERROR_ALREADYFREE 2
|
||||
|
||||
|
||||
#define ZENTRY_FREE 0x12342378
|
||||
/*
|
||||
* void *zalloc(vm_zone_t zone) --
|
||||
* Returns an item from a specified zone.
|
||||
@ -75,12 +82,23 @@ static __inline__ void *
|
||||
_zalloc(vm_zone_t z) {
|
||||
void *item;
|
||||
|
||||
#if defined(DIAGNOSTIC)
|
||||
if (z == 0)
|
||||
zerror(ZONE_ERROR_INVALID);
|
||||
#endif
|
||||
|
||||
if (z->zfreecnt <= z->zfreemin) {
|
||||
return _zget(z);
|
||||
}
|
||||
|
||||
item = z->zitems;
|
||||
z->zitems = *(void **) item;
|
||||
z->zitems = ((void **) item)[0];
|
||||
#if defined(DIAGNOSTIC)
|
||||
if (((void **) item)[1] != (void *) ZENTRY_FREE)
|
||||
zerror(ZONE_ERROR_NOTFREE);
|
||||
((void **) item)[1] = 0;
|
||||
#endif
|
||||
|
||||
z->zfreecnt--;
|
||||
z->znalloc++;
|
||||
return item;
|
||||
@ -88,14 +106,19 @@ _zalloc(vm_zone_t z) {
|
||||
|
||||
static __inline__ void
|
||||
_zfree(vm_zone_t z, void *item) {
|
||||
* (void **) item = z->zitems;
|
||||
((void **) item)[0] = z->zitems;
|
||||
#if defined(DIAGNOSTIC)
|
||||
if ((( void **) item)[1] == (void *) ZENTRY_FREE)
|
||||
zerror(ZONE_ERROR_ALREADYFREE);
|
||||
((void **) item)[1] = (void *) ZENTRY_FREE;
|
||||
#endif
|
||||
z->zitems = item;
|
||||
z->zfreecnt++;
|
||||
}
|
||||
|
||||
static __inline__ void *
|
||||
zalloc(vm_zone_t z) {
|
||||
#if NCPU > 1
|
||||
#if defined(SMP)
|
||||
return zalloci(z);
|
||||
#else
|
||||
return _zalloc(z);
|
||||
@ -104,7 +127,7 @@ zalloc(vm_zone_t z) {
|
||||
|
||||
static __inline__ void
|
||||
zfree(vm_zone_t z, void *item) {
|
||||
#if NCPU > 1
|
||||
#if defined(SMP)
|
||||
zfreei(z, item);
|
||||
#else
|
||||
_zfree(z, item);
|
||||
|
Loading…
Reference in New Issue
Block a user