summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>2005-04-02 01:00:38 +0000
committermickey <mickey@openbsd.org>2005-04-02 01:00:38 +0000
commit08d8f08f522b4c89d83cc3a7f33432ccd04d2546 (patch)
treeae766a1bc7f40b730f50e1f2eff9c72761bdcb48
parentmake one out of hppa w/ old pdc sections deleted (diff)
downloadwireguard-openbsd-08d8f08f522b4c89d83cc3a7f33432ccd04d2546.tar.xz
wireguard-openbsd-08d8f08f522b4c89d83cc3a7f33432ccd04d2546.zip
use pool for struct nfsreq; tedu@ pedro@ ok and testing by mark patruck <mark@2ls4agd.net> on several archs
-rw-r--r--sys/nfs/nfs.h3
-rw-r--r--sys/nfs/nfs_socket.c16
-rw-r--r--sys/nfs/nfs_subs.c7
3 files changed, 16 insertions, 10 deletions
diff --git a/sys/nfs/nfs.h b/sys/nfs/nfs.h
index c52429d25cc..e632fe0171d 100644
--- a/sys/nfs/nfs.h
+++ b/sys/nfs/nfs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs.h,v 1.22 2004/06/21 23:50:37 tholo Exp $ */
+/* $OpenBSD: nfs.h,v 1.23 2005/04/02 01:00:38 mickey Exp $ */
/* $NetBSD: nfs.h,v 1.10.4.1 1996/05/27 11:23:56 fvdl Exp $ */
/*
@@ -435,6 +435,7 @@ struct nfsrv_descript {
#define ND_KERBFULL 0x40
#define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL)
+extern struct pool nfsreqpl;
extern TAILQ_HEAD(nfsdhead, nfsd) nfsd_head;
extern int nfsd_head_flag;
#define NFSD_CHECKSLP 0x01
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index 794a37c07c8..5e2e1401ef1 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.41 2004/12/26 21:22:13 miod Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.42 2005/04/02 01:00:38 mickey Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -848,7 +848,7 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
NFSKERBKEY_T key; /* save session key */
nmp = VFSTONFS(vp->v_mount);
- MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq), M_NFSREQ, M_WAITOK);
+ rep = pool_get(&nfsreqpl, PR_WAITOK);
rep->r_nmp = nmp;
rep->r_vp = vp;
rep->r_procp = procp;
@@ -876,7 +876,7 @@ kerbauth:
error = nfs_getauth(nmp, rep, cred, &auth_str,
&auth_len, verf_str, &verf_len, key);
if (error) {
- free((caddr_t)rep, M_NFSREQ);
+ pool_put(&nfsreqpl, rep);
m_freem(mrest);
return (error);
}
@@ -988,7 +988,7 @@ tryagain:
dpos = rep->r_dpos;
if (error) {
m_freem(rep->r_mreq);
- free((caddr_t)rep, M_NFSREQ);
+ pool_put(&nfsreqpl, rep);
return (error);
}
@@ -1012,7 +1012,7 @@ tryagain:
error = EACCES;
m_freem(mrep);
m_freem(rep->r_mreq);
- free((caddr_t)rep, M_NFSREQ);
+ pool_put(&nfsreqpl, rep);
return (error);
}
@@ -1061,7 +1061,7 @@ tryagain:
} else
m_freem(mrep);
m_freem(rep->r_mreq);
- free((caddr_t)rep, M_NFSREQ);
+ pool_put(&nfsreqpl, rep);
return (error);
}
@@ -1069,14 +1069,14 @@ tryagain:
*mdp = md;
*dposp = dpos;
m_freem(rep->r_mreq);
- FREE((caddr_t)rep, M_NFSREQ);
+ pool_put(&nfsreqpl, rep);
return (0);
}
m_freem(mrep);
error = EPROTONOSUPPORT;
nfsmout:
m_freem(rep->r_mreq);
- free((caddr_t)rep, M_NFSREQ);
+ pool_put(&nfsreqpl, rep);
return (error);
}
#endif /* NFSCLIENT */
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index ee9ef17a8d7..c2126f66843 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_subs.c,v 1.53 2005/03/31 21:47:49 deraadt Exp $ */
+/* $OpenBSD: nfs_subs.c,v 1.54 2005/04/02 01:00:38 mickey Exp $ */
/* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */
/*
@@ -534,6 +534,8 @@ extern u_long nfsnodehash;
LIST_HEAD(nfsnodehashhead, nfsnode);
+struct pool nfsreqpl;
+
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@@ -1064,6 +1066,9 @@ nfs_init()
nfsrv_initcache(); /* Init the server request cache */
#endif /* NFSSERVER */
+ pool_init(&nfsreqpl, sizeof(struct nfsreq), 0, 0, 0, "nfsreqpl",
+ &pool_allocator_nointr);
+
/*
* Initialize reply list and start timer
*/