use kmem_alloc instead of malloc.
This commit is contained in:
parent
c68e4b1c69
commit
677860cb8a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: subr_tftproot.c,v 1.1 2007/05/08 06:10:27 manu Exp $ */
|
||||
/* $NetBSD: subr_tftproot.c,v 1.2 2008/01/02 19:26:45 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 Emmanuel Dreyfus, all rights reserved.
|
||||
|
@ -39,13 +39,13 @@
|
|||
#include "opt_md.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.1 2007/05/08 06:10:27 manu Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_tftproot.c,v 1.2 2008/01/02 19:26:45 yamt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/lwp.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/timevar.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
@ -160,8 +160,7 @@ tftproot_dhcpboot(bootdv)
|
|||
|
||||
l = curlwp; /* XXX */
|
||||
|
||||
nd = malloc(sizeof(*nd), M_NFSMNT, M_WAITOK);
|
||||
bzero(nd, sizeof(nd));
|
||||
nd = kmem_zalloc(sizeof(*nd), KM_SLEEP);
|
||||
nd->nd_ifp = ifp;
|
||||
nd->nd_nomount = 1;
|
||||
|
||||
|
@ -197,7 +196,7 @@ tftproot_dhcpboot(bootdv)
|
|||
|
||||
out:
|
||||
if (nd)
|
||||
free(nd, M_NFSMNT);
|
||||
kmem_free(nd, sizeof(*nd));
|
||||
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_bio.c,v 1.172 2008/01/02 11:49:03 ad Exp $ */
|
||||
/* $NetBSD: nfs_bio.c,v 1.173 2008/01/02 19:26:45 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.172 2008/01/02 11:49:03 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.173 2008/01/02 19:26:45 yamt Exp $");
|
||||
|
||||
#include "opt_nfs.h"
|
||||
#include "opt_ddb.h"
|
||||
|
@ -51,7 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: nfs_bio.c,v 1.172 2008/01/02 11:49:03 ad Exp $");
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/namei.h>
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_bootparam.c,v 1.30 2007/03/04 06:03:36 christos Exp $ */
|
||||
/* $NetBSD: nfs_bootparam.c,v 1.31 2008/01/02 19:26:45 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bootparam.c,v 1.30 2007/03/04 06:03:36 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_bootparam.c,v 1.31 2008/01/02 19:26:45 yamt Exp $");
|
||||
|
||||
#include "opt_nfs_boot.h"
|
||||
#include "opt_inet.h"
|
||||
|
@ -199,7 +199,7 @@ nfs_bootparam(nd, lwp)
|
|||
}
|
||||
|
||||
#ifndef NFS_BOOTPARAM_NOGATEWAY
|
||||
gw_ndm = malloc(sizeof(*gw_ndm), M_NFSMNT, M_WAITOK);
|
||||
gw_ndm = kmem_alloc(sizeof(*gw_ndm), KM_SLEEP);
|
||||
memset((void *)gw_ndm, 0, sizeof(*gw_ndm));
|
||||
error = bp_getfile(sin, "gateway", gw_ndm, lwp);
|
||||
if (error) {
|
||||
|
@ -269,7 +269,7 @@ out:
|
|||
#ifndef NFS_BOOTPARAM_NOGATEWAY
|
||||
gwok:
|
||||
if (gw_ndm)
|
||||
free(gw_ndm, M_NFSMNT);
|
||||
kmem_free(gw_ndm, sizeof(*gw_ndm));
|
||||
#endif
|
||||
return (error);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_kq.c,v 1.17 2007/12/05 17:20:03 pooka Exp $ */
|
||||
/* $NetBSD: nfs_kq.c,v 1.18 2008/01/02 19:26:46 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -37,15 +37,15 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_kq.c,v 1.17 2007/12/05 17:20:03 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_kq.c,v 1.18 2008/01/02 19:26:46 yamt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/condvar.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/unistd.h>
|
||||
|
@ -195,7 +195,7 @@ filt_nfsdetach(struct knote *kn)
|
|||
/* last user, g/c */
|
||||
cv_destroy(&ke->cv);
|
||||
SLIST_REMOVE(&kevlist, ke, kevq, kev_link);
|
||||
FREE(ke, M_KEVENT);
|
||||
kmem_free(ke, sizeof(*ke));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -301,8 +301,7 @@ nfs_kqfilter(void *v)
|
|||
ke->usecount++;
|
||||
} else {
|
||||
/* need a new one */
|
||||
MALLOC(ke, struct kevq *, sizeof(struct kevq), M_KEVENT,
|
||||
M_WAITOK);
|
||||
ke = kmem_alloc(sizeof(*ke), KM_SLEEP);
|
||||
ke->vp = vp;
|
||||
ke->usecount = 1;
|
||||
ke->flags = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_node.c,v 1.97 2008/01/02 11:49:03 ad Exp $ */
|
||||
/* $NetBSD: nfs_node.c,v 1.98 2008/01/02 19:26:46 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.97 2008/01/02 11:49:03 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_node.c,v 1.98 2008/01/02 19:26:46 yamt Exp $");
|
||||
|
||||
#include "opt_nfs.h"
|
||||
|
||||
|
@ -68,7 +68,6 @@ POOL_INIT(nfs_node_pool, sizeof(struct nfsnode), 0, 0, 0, "nfsnodepl",
|
|||
POOL_INIT(nfs_vattr_pool, sizeof(struct vattr), 0, 0, 0, "nfsvapl",
|
||||
&pool_allocator_nointr, IPL_NONE);
|
||||
|
||||
MALLOC_DEFINE(M_NFSBIGFH, "NFS bigfh", "NFS big filehandle");
|
||||
MALLOC_DEFINE(M_NFSNODE, "NFS node", "NFS vnode private part");
|
||||
|
||||
extern int prtactive;
|
||||
|
@ -194,7 +193,7 @@ loop:
|
|||
|
||||
LIST_INSERT_HEAD(nhpp, np, n_hash);
|
||||
if (fhsize > NFS_SMALLFH) {
|
||||
np->n_fhp = malloc(fhsize, M_NFSBIGFH, M_WAITOK);
|
||||
np->n_fhp = kmem_alloc(fhsize, KM_SLEEP);
|
||||
} else
|
||||
np->n_fhp = &np->n_fh;
|
||||
memcpy(np->n_fhp, fhp, fhsize);
|
||||
|
@ -270,7 +269,7 @@ nfs_inactive(v)
|
|||
}
|
||||
kauth_cred_free(sp->s_cred);
|
||||
vput(sp->s_dvp);
|
||||
FREE(sp, M_NFSREQ);
|
||||
kmem_free(sp, sizeof(*sp));
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
@ -304,7 +303,7 @@ nfs_reclaim(v)
|
|||
KASSERT(np->n_dirgens == NULL);
|
||||
|
||||
if (np->n_fhsize > NFS_SMALLFH)
|
||||
free(np->n_fhp, M_NFSBIGFH);
|
||||
kmem_free(np->n_fhp, np->n_fhsize);
|
||||
|
||||
pool_put(&nfs_vattr_pool, np->n_vattr);
|
||||
if (np->n_rcred)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_socket.c,v 1.166 2008/01/02 11:49:03 ad Exp $ */
|
||||
/* $NetBSD: nfs_socket.c,v 1.167 2008/01/02 19:26:46 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1991, 1993, 1995
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.166 2008/01/02 11:49:03 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.167 2008/01/02 19:26:46 yamt Exp $");
|
||||
|
||||
#include "fs_nfs.h"
|
||||
#include "opt_nfs.h"
|
||||
|
@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.166 2008/01/02 11:49:03 ad Exp $");
|
|||
#include <sys/proc.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/domain.h>
|
||||
|
@ -80,7 +81,6 @@ __KERNEL_RCSID(0, "$NetBSD: nfs_socket.c,v 1.166 2008/01/02 11:49:03 ad Exp $");
|
|||
#include <nfs/nfsrtt.h>
|
||||
#include <nfs/nfs_var.h>
|
||||
|
||||
MALLOC_DEFINE(M_NFSREQ, "NFS req", "NFS request header");
|
||||
#ifdef MBUFTRACE
|
||||
struct mowner nfs_mowner = MOWNER_INIT("nfs","");
|
||||
#endif
|
||||
|
@ -1001,7 +1001,7 @@ nfs_request(np, mrest, procnum, lwp, cred, mrp, mdp, dposp, rexmitp)
|
|||
|
||||
tryagain_cred:
|
||||
KASSERT(cred != NULL);
|
||||
MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq), M_NFSREQ, M_WAITOK);
|
||||
rep = kmem_alloc(sizeof(*rep), KM_SLEEP);
|
||||
rep->r_nmp = nmp;
|
||||
KASSERT(lwp == NULL || lwp == curlwp);
|
||||
rep->r_lwp = lwp;
|
||||
|
@ -1029,7 +1029,7 @@ kerbauth:
|
|||
error = nfs_getauth(nmp, rep, cred, &auth_str,
|
||||
&auth_len, verf_str, &verf_len, key);
|
||||
if (error) {
|
||||
free((void *)rep, M_NFSREQ);
|
||||
kmem_free(rep, sizeof(*rep));
|
||||
m_freem(mrest);
|
||||
KASSERT(kauth_cred_getrefcnt(acred) == 1);
|
||||
kauth_cred_free(acred);
|
||||
|
@ -1263,7 +1263,7 @@ tryagain:
|
|||
break;
|
||||
m_freem(mrep);
|
||||
m_freem(rep->r_mreq);
|
||||
FREE(rep, M_NFSREQ);
|
||||
kmem_free(rep, sizeof(*rep));
|
||||
use_opencred = !use_opencred;
|
||||
if (mrest_backup == NULL) {
|
||||
/* m_copym failure */
|
||||
|
@ -1424,7 +1424,7 @@ nfsmout:
|
|||
KASSERT(kauth_cred_getrefcnt(acred) == 1);
|
||||
kauth_cred_free(acred);
|
||||
m_freem(rep->r_mreq);
|
||||
free((void *)rep, M_NFSREQ);
|
||||
kmem_free(rep, sizeof(*rep));
|
||||
m_freem(mrest_backup);
|
||||
return (error);
|
||||
}
|
||||
|
@ -1988,7 +1988,7 @@ nfs_getreq(nd, nfsd, has_header)
|
|||
*/
|
||||
if (auth_type == rpc_auth_unix) {
|
||||
uid_t uid;
|
||||
gid_t gid, *grbuf;
|
||||
gid_t gid;
|
||||
|
||||
nd->nd_cr = kauth_cred_alloc();
|
||||
len = fxdr_unsigned(int, *++tl);
|
||||
|
@ -2017,16 +2017,20 @@ nfs_getreq(nd, nfsd, has_header)
|
|||
}
|
||||
nfsm_dissect(tl, u_int32_t *, (len + 2) * NFSX_UNSIGNED);
|
||||
|
||||
grbuf = malloc(len * sizeof(gid_t), M_TEMP, M_WAITOK);
|
||||
for (i = 0; i < len; i++) {
|
||||
if (i < NGROUPS) /* XXX elad */
|
||||
grbuf[i] = fxdr_unsigned(gid_t, *tl++);
|
||||
else
|
||||
tl++;
|
||||
if (len > 0) {
|
||||
size_t grbuf_size = min(len, NGROUPS) * sizeof(gid_t);
|
||||
gid_t *grbuf = kmem_alloc(grbuf_size, KM_SLEEP);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (i < NGROUPS) /* XXX elad */
|
||||
grbuf[i] = fxdr_unsigned(gid_t, *tl++);
|
||||
else
|
||||
tl++;
|
||||
}
|
||||
kauth_cred_setgroups(nd->nd_cr, grbuf,
|
||||
min(len, NGROUPS), -1, UIO_SYSSPACE);
|
||||
kmem_free(grbuf, grbuf_size);
|
||||
}
|
||||
kauth_cred_setgroups(nd->nd_cr, grbuf, min(len, NGROUPS), -1,
|
||||
UIO_SYSSPACE);
|
||||
free(grbuf, M_TEMP);
|
||||
|
||||
len = fxdr_unsigned(int, *++tl);
|
||||
if (len < 0 || len > RPCAUTH_MAXSIZ) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_subs.c,v 1.195 2008/01/02 11:49:04 ad Exp $ */
|
||||
/* $NetBSD: nfs_subs.c,v 1.196 2008/01/02 19:26:46 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -70,7 +70,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.195 2008/01/02 11:49:04 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.196 2008/01/02 19:26:46 yamt Exp $");
|
||||
|
||||
#include "fs_nfs.h"
|
||||
#include "opt_nfs.h"
|
||||
|
@ -87,6 +87,7 @@ __KERNEL_RCSID(0, "$NetBSD: nfs_subs.c,v 1.195 2008/01/02 11:49:04 ad Exp $");
|
|||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/namei.h>
|
||||
|
@ -1197,8 +1198,7 @@ nfs_initdirxlatecookie(vp)
|
|||
|
||||
KASSERT(VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_XLATECOOKIE);
|
||||
|
||||
dirgens = malloc(NFS_DIRHASHSIZ * sizeof (unsigned), M_NFSDIROFF,
|
||||
M_WAITOK|M_ZERO);
|
||||
dirgens = kmem_zalloc(NFS_DIRHASHSIZ * sizeof(unsigned), KM_SLEEP);
|
||||
NFSDC_LOCK(np);
|
||||
if (np->n_dirgens == NULL) {
|
||||
np->n_dirgens = dirgens;
|
||||
|
@ -1206,7 +1206,7 @@ nfs_initdirxlatecookie(vp)
|
|||
}
|
||||
NFSDC_UNLOCK(np);
|
||||
if (dirgens)
|
||||
free(dirgens, M_NFSDIROFF);
|
||||
kmem_free(dirgens, NFS_DIRHASHSIZ * sizeof(unsigned));
|
||||
}
|
||||
|
||||
static const struct nfsdircache dzero;
|
||||
|
@ -1250,7 +1250,7 @@ nfs_putdircache(np, ndp)
|
|||
NFSDC_UNLOCK(np);
|
||||
|
||||
if (ref == 0)
|
||||
free(ndp, M_NFSDIROFF);
|
||||
kmem_free(ndp, sizeof(*ndp));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1266,7 +1266,7 @@ nfs_putdircache_unlocked(struct nfsnode *np, struct nfsdircache *ndp)
|
|||
KASSERT(ndp->dc_refcnt > 0);
|
||||
ref = --ndp->dc_refcnt;
|
||||
if (ref == 0)
|
||||
free(ndp, M_NFSDIROFF);
|
||||
kmem_free(ndp, sizeof(*ndp));
|
||||
}
|
||||
|
||||
struct nfsdircache *
|
||||
|
@ -1388,7 +1388,7 @@ retry:
|
|||
if (!ndp) {
|
||||
if (newndp == NULL) {
|
||||
NFSDC_UNLOCK(np);
|
||||
newndp = malloc(sizeof(*ndp), M_NFSDIROFF, M_WAITOK);
|
||||
newndp = kmem_alloc(sizeof(*newndp), KM_SLEEP);
|
||||
newndp->dc_refcnt = 1;
|
||||
LIST_NEXT(newndp, dc_hash) = (void *)-1;
|
||||
goto retry;
|
||||
|
@ -1473,7 +1473,8 @@ nfs_invaldircache(vp, flags)
|
|||
}
|
||||
np->n_dircachesize = 0;
|
||||
if (forcefree && np->n_dirgens) {
|
||||
FREE(np->n_dirgens, M_NFSDIROFF);
|
||||
kmem_free(np->n_dirgens,
|
||||
NFS_DIRHASHSIZ * sizeof(unsigned));
|
||||
np->n_dirgens = NULL;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_syscalls.c,v 1.129 2008/01/02 11:49:04 ad Exp $ */
|
||||
/* $NetBSD: nfs_syscalls.c,v 1.130 2008/01/02 19:26:46 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.129 2008/01/02 11:49:04 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_syscalls.c,v 1.130 2008/01/02 19:26:46 yamt Exp $");
|
||||
|
||||
#include "fs_nfs.h"
|
||||
#include "opt_nfs.h"
|
||||
|
@ -116,8 +116,6 @@ int nfssvc_sockhead_flag;
|
|||
int nfsd_head_flag;
|
||||
#endif
|
||||
|
||||
MALLOC_DEFINE(M_NFSUID, "NFS uid", "Nfs uid mapping structure");
|
||||
|
||||
#ifdef NFS
|
||||
/*
|
||||
* locking order:
|
||||
|
@ -279,14 +277,12 @@ sys_nfssvc(struct lwp *l, const struct sys_nfssvc_args *uap, register_t *retval)
|
|||
*/
|
||||
if (slp->ns_numuids < nuidhash_max) {
|
||||
slp->ns_numuids++;
|
||||
nuidp = (struct nfsuid *)
|
||||
malloc(sizeof (struct nfsuid), M_NFSUID,
|
||||
M_WAITOK);
|
||||
nuidp = kmem_alloc(sizeof(*nuidp), KM_SLEEP);
|
||||
} else
|
||||
nuidp = (struct nfsuid *)0;
|
||||
if ((slp->ns_flags & SLP_VALID) == 0) {
|
||||
if (nuidp)
|
||||
free((void *)nuidp, M_NFSUID);
|
||||
kmem_free(nuidp, sizeof(*nuidp));
|
||||
} else {
|
||||
if (nuidp == (struct nfsuid *)0) {
|
||||
nuidp = TAILQ_FIRST(&slp->ns_uidlruhead);
|
||||
|
@ -349,15 +345,13 @@ sys_nfssvc(struct lwp *l, const struct sys_nfssvc_args *uap, register_t *retval)
|
|||
|
||||
#ifdef NFSSERVER
|
||||
MALLOC_DEFINE(M_NFSD, "NFS daemon", "Nfs server daemon structure");
|
||||
MALLOC_DEFINE(M_NFSSVC, "NFS srvsock", "Nfs server structure");
|
||||
|
||||
static struct nfssvc_sock *
|
||||
nfsrv_sockalloc()
|
||||
{
|
||||
struct nfssvc_sock *slp;
|
||||
|
||||
slp = (struct nfssvc_sock *)
|
||||
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
|
||||
slp = kmem_alloc(sizeof(*slp), KM_SLEEP);
|
||||
memset(slp, 0, sizeof (struct nfssvc_sock));
|
||||
/* XXX could be IPL_SOFTNET */
|
||||
mutex_init(&slp->ns_lock, MUTEX_DRIVER, IPL_VM);
|
||||
|
@ -383,7 +377,7 @@ nfsrv_sockfree(struct nfssvc_sock *slp)
|
|||
mutex_destroy(&slp->ns_lock);
|
||||
mutex_destroy(&slp->ns_alock);
|
||||
cv_destroy(&slp->ns_cv);
|
||||
free(slp, M_NFSSVC);
|
||||
kmem_free(slp, sizeof(*slp));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -518,8 +512,7 @@ nfssvc_nfsd(nsd, argp, l)
|
|||
#endif
|
||||
uvm_lwp_hold(l);
|
||||
if (nfsd == NULL) {
|
||||
nsd->nsd_nfsd = nfsd =
|
||||
malloc(sizeof (struct nfsd), M_NFSD, M_WAITOK);
|
||||
nsd->nsd_nfsd = nfsd = kmem_alloc(sizeof(*nfsd), KM_SLEEP);
|
||||
memset(nfsd, 0, sizeof (struct nfsd));
|
||||
cv_init(&nfsd->nfsd_cv, "nfsd");
|
||||
nfsd->nfsd_procp = p;
|
||||
|
@ -818,7 +811,7 @@ done:
|
|||
nfssvc_sockhead_flag |= SLP_INIT;
|
||||
mutex_exit(&nfsd_lock);
|
||||
cv_destroy(&nfsd->nfsd_cv);
|
||||
free(nfsd, M_NFSD);
|
||||
kmem_free(nfsd, sizeof(*nfsd));
|
||||
nsd->nsd_nfsd = NULL;
|
||||
if (doreinit)
|
||||
nfsrv_init(true); /* Reinitialize everything */
|
||||
|
@ -884,7 +877,7 @@ nfsrv_zapsock(slp)
|
|||
TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru);
|
||||
if (nuidp->nu_flag & NU_NAM)
|
||||
m_freem(nuidp->nu_nam);
|
||||
free((void *)nuidp, M_NFSUID);
|
||||
kmem_free(nuidp, sizeof(*nuidp));
|
||||
}
|
||||
mutex_enter(&nfsd_lock);
|
||||
while ((nwp = LIST_FIRST(&slp->ns_tq)) != NULL) {
|
||||
|
@ -1373,9 +1366,7 @@ nfs_savenickauth(nmp, cred, len, key, mdp, dposp, mrep)
|
|||
if (deltasec <= NFS_KERBCLOCKSKEW) {
|
||||
if (nmp->nm_numuids < nuidhash_max) {
|
||||
nmp->nm_numuids++;
|
||||
nuidp = (struct nfsuid *)
|
||||
malloc(sizeof (struct nfsuid), M_NFSUID,
|
||||
M_WAITOK);
|
||||
nuidp = kmem_alloc(sizeof(*nuidp), KM_SLEEP);
|
||||
} else {
|
||||
nuidp = TAILQ_FIRST(&nmp->nm_uidlruhead);
|
||||
LIST_REMOVE(nuidp, nu_hash);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_var.h,v 1.76 2007/12/20 23:03:14 dsl Exp $ */
|
||||
/* $NetBSD: nfs_var.h,v 1.77 2008/01/02 19:26:46 yamt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||
|
@ -44,13 +44,8 @@
|
|||
#include <sys/mallocvar.h>
|
||||
#include <sys/pool.h>
|
||||
|
||||
MALLOC_DECLARE(M_NFSREQ);
|
||||
MALLOC_DECLARE(M_NFSMNT);
|
||||
MALLOC_DECLARE(M_NFSUID);
|
||||
MALLOC_DECLARE(M_NFSD);
|
||||
MALLOC_DECLARE(M_NFSDIROFF);
|
||||
MALLOC_DECLARE(M_NFSBIGFH);
|
||||
MALLOC_DECLARE(M_NQLEASE);
|
||||
|
||||
struct vnode;
|
||||
struct uio;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_vfsops.c,v 1.189 2008/01/02 11:49:04 ad Exp $ */
|
||||
/* $NetBSD: nfs_vfsops.c,v 1.190 2008/01/02 19:26:46 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993, 1995
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.189 2008/01/02 11:49:04 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.190 2008/01/02 19:26:46 yamt Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -84,8 +84,6 @@ extern int nfs_ticks;
|
|||
*/
|
||||
unsigned int nfs_mount_count = 0;
|
||||
|
||||
MALLOC_DEFINE(M_NFSMNT, "NFS mount", "NFS mount structure");
|
||||
|
||||
/*
|
||||
* nfs vfs operations.
|
||||
*/
|
||||
|
@ -345,11 +343,11 @@ nfs_mountroot()
|
|||
* Call nfs_boot_init() to fill in the nfs_diskless struct.
|
||||
* Side effect: Finds and configures a network interface.
|
||||
*/
|
||||
nd = malloc(sizeof(*nd), M_NFSMNT, M_WAITOK);
|
||||
nd = kmem_alloc(sizeof(*nd), KM_SLEEP);
|
||||
memset(nd, 0, sizeof(*nd));
|
||||
error = nfs_boot_init(nd, l);
|
||||
if (error) {
|
||||
free(nd, M_NFSMNT);
|
||||
kmem_free(nd, sizeof(*nd));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -384,7 +382,7 @@ nfs_mountroot()
|
|||
out:
|
||||
if (error)
|
||||
nfs_boot_cleanup(nd, l);
|
||||
free(nd, M_NFSMNT);
|
||||
kmem_free(nd, sizeof(*nd));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -716,9 +714,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp, l)
|
|||
m_freem(nam);
|
||||
return (0);
|
||||
} else {
|
||||
MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount),
|
||||
M_NFSMNT, M_WAITOK);
|
||||
memset(nmp, 0, sizeof (struct nfsmount));
|
||||
nmp = kmem_zalloc(sizeof(*nmp), KM_SLEEP);
|
||||
mp->mnt_data = nmp;
|
||||
TAILQ_INIT(&nmp->nm_uidlruhead);
|
||||
TAILQ_INIT(&nmp->nm_bufq);
|
||||
|
@ -827,7 +823,7 @@ bad:
|
|||
cv_destroy(&nmp->nm_sndcv);
|
||||
cv_destroy(&nmp->nm_aiocv);
|
||||
cv_destroy(&nmp->nm_disconcv);
|
||||
free(nmp, M_NFSMNT);
|
||||
kmem_free(nmp, sizeof(*nmp));
|
||||
m_freem(nam);
|
||||
return (error);
|
||||
}
|
||||
|
@ -904,7 +900,7 @@ nfs_unmount(struct mount *mp, int mntflags)
|
|||
cv_destroy(&nmp->nm_sndcv);
|
||||
cv_destroy(&nmp->nm_aiocv);
|
||||
cv_destroy(&nmp->nm_disconcv);
|
||||
free(nmp, M_NFSMNT);
|
||||
kmem_free(nmp, sizeof(*nmp));
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nfs_vnops.c,v 1.263 2008/01/02 11:49:04 ad Exp $ */
|
||||
/* $NetBSD: nfs_vnops.c,v 1.264 2008/01/02 19:26:47 yamt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.263 2008/01/02 11:49:04 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.264 2008/01/02 19:26:47 yamt Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_nfs.h"
|
||||
|
@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: nfs_vnops.c,v 1.263 2008/01/02 11:49:04 ad Exp $");
|
|||
#include <sys/condvar.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/namei.h>
|
||||
|
@ -2991,8 +2992,7 @@ nfs_sillyrename(dvp, vp, cnp, dolink)
|
|||
if (vp->v_type == VDIR)
|
||||
panic("nfs: sillyrename dir");
|
||||
#endif
|
||||
MALLOC(sp, struct sillyrename *, sizeof (struct sillyrename),
|
||||
M_NFSREQ, M_WAITOK);
|
||||
sp = kmem_alloc(sizeof(*sp), KM_SLEEP);
|
||||
sp->s_cred = kauth_cred_dup(cnp->cn_cred);
|
||||
sp->s_dvp = dvp;
|
||||
VREF(dvp);
|
||||
|
@ -3036,7 +3036,7 @@ nfs_sillyrename(dvp, vp, cnp, dolink)
|
|||
bad:
|
||||
vrele(sp->s_dvp);
|
||||
kauth_cred_free(sp->s_cred);
|
||||
free((void *)sp, M_NFSREQ);
|
||||
kmem_free(sp, sizeof(*sp));
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -3082,14 +3082,14 @@ nfs_lookitup(dvp, name, len, cred, l, npp)
|
|||
if (*npp) {
|
||||
np = *npp;
|
||||
if (np->n_fhsize > NFS_SMALLFH && fhlen <= NFS_SMALLFH) {
|
||||
free((void *)np->n_fhp, M_NFSBIGFH);
|
||||
kmem_free(np->n_fhp, np->n_fhsize);
|
||||
np->n_fhp = &np->n_fh;
|
||||
}
|
||||
#if NFS_SMALLFH < NFSX_V3FHMAX
|
||||
else if (np->n_fhsize <= NFS_SMALLFH && fhlen>NFS_SMALLFH)
|
||||
np->n_fhp =(nfsfh_t *)malloc(fhlen,M_NFSBIGFH,M_WAITOK);
|
||||
else if (np->n_fhsize <= NFS_SMALLFH && fhlen > NFS_SMALLFH)
|
||||
np->n_fhp = kmem_alloc(fhlen, KM_SLEEP);
|
||||
#endif
|
||||
memcpy((void *)np->n_fhp, (void *)nfhp, fhlen);
|
||||
memcpy(np->n_fhp, nfhp, fhlen);
|
||||
np->n_fhsize = fhlen;
|
||||
newvp = NFSTOV(np);
|
||||
} else if (NFS_CMPFH(dnp, nfhp, fhlen)) {
|
||||
|
|
Loading…
Reference in New Issue