summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1994-10-17 17:47:45 +0000
committerphk <phk@FreeBSD.org>1994-10-17 17:47:45 +0000
commit071d10f334b2e0094018c4b2027c8e3e73833bc1 (patch)
treec5905f4096b68df87a3f00435bec4fcc08408b18 /sys/nfsserver
parent24ec594f4ae8189490a0087923fc655e16dde331 (diff)
downloadFreeBSD-src-071d10f334b2e0094018c4b2027c8e3e73833bc1.zip
FreeBSD-src-071d10f334b2e0094018c4b2027c8e3e73833bc1.tar.gz
This is a bunch of changes from NetBSD. There are a couple of bug-fixes.
But mostly it is changes to use the list-maintenance macros instead of doing the pointer-gymnastics by hand. Obtained from: NetBSD
Diffstat (limited to 'sys/nfsserver')
-rw-r--r--sys/nfsserver/nfs.h54
-rw-r--r--sys/nfsserver/nfs_srvcache.c72
-rw-r--r--sys/nfsserver/nfs_srvsock.c42
-rw-r--r--sys/nfsserver/nfs_srvsubs.c52
-rw-r--r--sys/nfsserver/nfs_syscalls.c149
-rw-r--r--sys/nfsserver/nfsm_subs.h5
-rw-r--r--sys/nfsserver/nfsrvcache.h8
-rw-r--r--sys/nfsserver/nfsrvstats.h54
8 files changed, 196 insertions, 240 deletions
diff --git a/sys/nfsserver/nfs.h b/sys/nfsserver/nfs.h
index 844acdc..c79eefb 100644
--- a/sys/nfsserver/nfs.h
+++ b/sys/nfsserver/nfs.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.1 (Berkeley) 6/10/93
- * $Id: nfs.h,v 1.4 1994/08/21 06:50:08 paul Exp $
+ * $Id: nfs.h,v 1.5 1994/10/02 17:26:54 phk Exp $
*/
#ifndef _NFS_NFS_H_
@@ -179,8 +179,7 @@ struct nfsstats {
* Nfs outstanding request list element
*/
struct nfsreq {
- struct nfsreq *r_next;
- struct nfsreq *r_prev;
+ TAILQ_ENTRY(nfsreq) r_chain;
struct mbuf *r_mreq;
struct mbuf *r_mrep;
struct mbuf *r_md;
@@ -197,6 +196,11 @@ struct nfsreq {
struct proc *r_procp; /* Proc that did I/O system call */
};
+/*
+ * Queue head for nfsreq's
+ */
+TAILQ_HEAD(, nfsreq) nfs_reqq;
+
/* Flag values for r_flags */
#define R_TIMING 0x01 /* timing request (in mntp) */
#define R_SENT 0x02 /* request has been sent */
@@ -216,7 +220,8 @@ struct nfsstats nfsstats;
* and uid hash lists.
*/
#define NUIDHASHSIZ 32
-#define NUIDHASH(uid) ((uid) & (NUIDHASHSIZ - 1))
+#define NUIDHASH(sock, uid) \
+ (&(sock)->ns_uidhashtbl[(uid) & (sock)->ns_uidhash])
/*
* Network address hash list element
@@ -227,10 +232,8 @@ union nethostaddr {
};
struct nfsuid {
- struct nfsuid *nu_lrunext; /* MUST be first */
- struct nfsuid *nu_lruprev;
- struct nfsuid *nu_hnext;
- struct nfsuid *nu_hprev;
+ TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */
+ LIST_ENTRY(nfsuid) nu_hash; /* Hash list */
int nu_flag; /* Flags */
uid_t nu_uid; /* Uid mapped by this entry */
union nethostaddr nu_haddr; /* Host addr. for dgram sockets */
@@ -243,10 +246,11 @@ struct nfsuid {
#define NU_INETADDR 0x1
struct nfssvc_sock {
- struct nfsuid *ns_lrunext; /* MUST be first */
- struct nfsuid *ns_lruprev;
- struct nfssvc_sock *ns_next;
- struct nfssvc_sock *ns_prev;
+ TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
+ TAILQ_HEAD(, nfsuid) ns_uidlruhead;
+ LIST_HEAD(, nfsuid) *ns_uidhashtbl;
+ u_long ns_uidhash;
+
int ns_flag;
u_long ns_sref;
struct file *ns_fp;
@@ -260,7 +264,6 @@ struct nfssvc_sock {
struct mbuf *ns_rec;
struct mbuf *ns_recend;
int ns_numuids;
- struct nfsuid *ns_uidh[NUIDHASHSIZ];
};
/* Bits for "ns_flag" */
@@ -269,17 +272,18 @@ struct nfssvc_sock {
#define SLP_NEEDQ 0x04
#define SLP_DISCONN 0x08
#define SLP_GETSTREAM 0x10
-#define SLP_INIT 0x20
-#define SLP_WANTINIT 0x40
-
#define SLP_ALLFLAGS 0xff
+TAILQ_HEAD(, nfssvc_sock) nfssvc_sockhead;
+int nfssvc_sockhead_flag;
+#define SLP_INIT 0x01
+#define SLP_WANTINIT 0x02
+
/*
* One of these structures is allocated for each nfsd.
*/
struct nfsd {
- struct nfsd *nd_next; /* Must be first */
- struct nfsd *nd_prev;
+ TAILQ_ENTRY(nfsd) nd_chain; /* List of all nfsd's */
int nd_flag; /* NFSD_ flags */
struct nfssvc_sock *nd_slp; /* Current socket */
struct mbuf *nd_nam; /* Client addr for datagram req. */
@@ -297,11 +301,15 @@ struct nfsd {
struct proc *nd_procp; /* Proc ptr */
};
+/* Bits for "nd_flag" */
#define NFSD_WAITING 0x01
-#define NFSD_CHECKSLP 0x02
-#define NFSD_REQINPROG 0x04
-#define NFSD_NEEDAUTH 0x08
-#define NFSD_AUTHFAIL 0x10
+#define NFSD_REQINPROG 0x02
+#define NFSD_NEEDAUTH 0x04
+#define NFSD_AUTHFAIL 0x08
+
+TAILQ_HEAD(, nfsd) nfsd_head;
+int nfsd_head_flag;
+#define NFSD_CHECKSLP 0x01
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsd *,int));
@@ -335,7 +343,7 @@ int nfs_adv __P((struct mbuf **,caddr_t *,int,int));
int nfsrv_getstream __P((struct nfssvc_sock *,int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
-struct nfsnode ** nfs_hash __P((nfsv2fh_t *));
+struct nfsnodehashhead * nfs_hash __P((nfsv2fh_t *));
int nfssvc_iod __P((struct proc *));
int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
int nfssvc_addsock __P((struct file *,struct mbuf *));
diff --git a/sys/nfsserver/nfs_srvcache.c b/sys/nfsserver/nfs_srvcache.c
index f496ea1..0f31ae0 100644
--- a/sys/nfsserver/nfs_srvcache.c
+++ b/sys/nfsserver/nfs_srvcache.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_srvcache.c 8.1 (Berkeley) 6/10/93
- * $Id: nfs_srvcache.c,v 1.3 1994/08/02 07:52:12 davidg Exp $
+ * $Id: nfs_srvcache.c,v 1.4 1994/10/02 17:27:00 phk Exp $
*/
/*
@@ -66,10 +66,11 @@
long numnfsrvcache, desirednfsrvcache = NFSRVCACHESIZ;
-#define NFSRCHASH(xid) (((xid) + ((xid) >> 24)) & rheadhash)
-static struct nfsrvcache *nfsrvlruhead, **nfsrvlrutail = &nfsrvlruhead;
-static struct nfsrvcache **rheadhtbl;
-static u_long rheadhash;
+#define NFSRCHASH(xid) \
+ (&nfsrvhashtbl[((xid) + ((xid) >> 24)) & nfsrvhash])
+LIST_HEAD(nfsrvhash, nfsrvcache) *nfsrvhashtbl;
+TAILQ_HEAD(nfsrvlru, nfsrvcache) nfsrvlruhead;
+u_long nfsrvhash;
#define TRUE 1
#define FALSE 0
@@ -140,7 +141,8 @@ void
nfsrv_initcache()
{
- rheadhtbl = hashinit(desirednfsrvcache, M_NFSD, &rheadhash);
+ nfsrvhashtbl = hashinit(desirednfsrvcache, M_NFSD, &nfsrvhash);
+ TAILQ_INIT(&nfsrvlruhead);
}
/*
@@ -163,7 +165,7 @@ nfsrv_getcache(nam, nd, repp)
register struct nfsd *nd;
struct mbuf **repp;
{
- register struct nfsrvcache *rp, *rq, **rpp;
+ register struct nfsrvcache *rp;
struct mbuf *mb;
struct sockaddr_in *saddr;
caddr_t bpos;
@@ -171,9 +173,9 @@ nfsrv_getcache(nam, nd, repp)
if (nd->nd_nqlflag != NQL_NOVAL)
return (RC_DOIT);
- rpp = &rheadhtbl[NFSRCHASH(nd->nd_retxid)];
loop:
- for (rp = *rpp; rp; rp = rp->rc_forw) {
+ for (rp = NFSRCHASH(nd->nd_retxid)->lh_first; rp != 0;
+ rp = rp->rc_hash.le_next) {
if (nd->nd_retxid == rp->rc_xid && nd->nd_procnum == rp->rc_proc &&
netaddr_match(NETFAMILY(rp), &rp->rc_haddr, nam)) {
if ((rp->rc_flag & RC_LOCKED) != 0) {
@@ -183,15 +185,9 @@ loop:
}
rp->rc_flag |= RC_LOCKED;
/* If not at end of LRU chain, move it there */
- if (rp->rc_next) {
- /* remove from LRU chain */
- *rp->rc_prev = rp->rc_next;
- rp->rc_next->rc_prev = rp->rc_prev;
- /* and replace at end of it */
- rp->rc_next = NULL;
- rp->rc_prev = nfsrvlrutail;
- *nfsrvlrutail = rp;
- nfsrvlrutail = &rp->rc_next;
+ if (rp->rc_lru.tqe_next) {
+ TAILQ_REMOVE(&nfsrvlruhead, rp, rc_lru);
+ TAILQ_INSERT_TAIL(&nfsrvlruhead, rp, rc_lru);
}
if (rp->rc_state == RC_UNUSED)
panic("nfsrv cache");
@@ -229,32 +225,22 @@ loop:
numnfsrvcache++;
rp->rc_flag = RC_LOCKED;
} else {
- rp = nfsrvlruhead;
+ rp = nfsrvlruhead.tqh_first;
while ((rp->rc_flag & RC_LOCKED) != 0) {
rp->rc_flag |= RC_WANTED;
(void) tsleep((caddr_t)rp, PZERO-1, "nfsrc", 0);
- rp = nfsrvlruhead;
+ rp = nfsrvlruhead.tqh_first;
}
rp->rc_flag |= RC_LOCKED;
- /* remove from hash chain */
- rq = rp->rc_forw;
- if (rq)
- rq->rc_back = rp->rc_back;
- *rp->rc_back = rq;
- /* remove from LRU chain */
- *rp->rc_prev = rp->rc_next;
- rp->rc_next->rc_prev = rp->rc_prev;
+ LIST_REMOVE(rp, rc_hash);
+ TAILQ_REMOVE(&nfsrvlruhead, rp, rc_lru);
if (rp->rc_flag & RC_REPMBUF)
m_freem(rp->rc_reply);
if (rp->rc_flag & RC_NAM)
MFREE(rp->rc_nam, mb);
rp->rc_flag &= (RC_LOCKED | RC_WANTED);
}
- /* place at end of LRU list */
- rp->rc_next = NULL;
- rp->rc_prev = nfsrvlrutail;
- *nfsrvlrutail = rp;
- nfsrvlrutail = &rp->rc_next;
+ TAILQ_INSERT_TAIL(&nfsrvlruhead, rp, rc_lru);
rp->rc_state = RC_INPROG;
rp->rc_xid = nd->nd_retxid;
saddr = mtod(nam, struct sockaddr_in *);
@@ -270,13 +256,7 @@ loop:
break;
};
rp->rc_proc = nd->nd_procnum;
- /* insert into hash chain */
- rq = *rpp;
- if (rq)
- rq->rc_back = &rp->rc_forw;
- rp->rc_forw = rq;
- rp->rc_back = rpp;
- *rpp = rp;
+ LIST_INSERT_HEAD(NFSRCHASH(nd->nd_retxid), rp, rc_hash);
rp->rc_flag &= ~RC_LOCKED;
if (rp->rc_flag & RC_WANTED) {
rp->rc_flag &= ~RC_WANTED;
@@ -300,7 +280,8 @@ nfsrv_updatecache(nam, nd, repvalid, repmbuf)
if (nd->nd_nqlflag != NQL_NOVAL)
return;
loop:
- for (rp = rheadhtbl[NFSRCHASH(nd->nd_retxid)]; rp; rp = rp->rc_forw) {
+ for (rp = NFSRCHASH(nd->nd_retxid)->lh_first; rp != 0;
+ rp = rp->rc_hash.le_next) {
if (nd->nd_retxid == rp->rc_xid && nd->nd_procnum == rp->rc_proc &&
netaddr_match(NETFAMILY(rp), &rp->rc_haddr, nam)) {
if ((rp->rc_flag & RC_LOCKED) != 0) {
@@ -342,12 +323,11 @@ nfsrv_cleancache()
{
register struct nfsrvcache *rp, *nextrp;
- for (rp = nfsrvlruhead; rp; rp = nextrp) {
- nextrp = rp->rc_next;
+ for (rp = nfsrvlruhead.tqh_first; rp != 0; rp = nextrp) {
+ nextrp = rp->rc_lru.tqe_next;
+ LIST_REMOVE(rp, rc_hash);
+ TAILQ_REMOVE(&nfsrvlruhead, rp, rc_lru);
free(rp, M_NFSD);
}
- bzero((char *)rheadhtbl, (rheadhash + 1) * sizeof(void *));
- nfsrvlruhead = NULL;
- nfsrvlrutail = &nfsrvlruhead;
numnfsrvcache = 0;
}
diff --git a/sys/nfsserver/nfs_srvsock.c b/sys/nfsserver/nfs_srvsock.c
index 4cc719f..27c4561 100644
--- a/sys/nfsserver/nfs_srvsock.c
+++ b/sys/nfsserver/nfs_srvsock.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.3 (Berkeley) 1/12/94
- * $Id: nfs_socket.c,v 1.3 1994/08/02 07:52:11 davidg Exp $
+ * $Id: nfs_socket.c,v 1.4 1994/10/02 17:26:59 phk Exp $
*/
/*
@@ -57,6 +57,7 @@
#include <netinet/in.h>
#include <netinet/tcp.h>
+
#include <nfs/rpcv2.h>
#include <nfs/nfsv2.h>
#include <nfs/nfs.h>
@@ -67,6 +68,8 @@
#include <nfs/nfsrtt.h>
#include <nfs/nqnfs.h>
+#include <machine/clock.h> /* for inittodr */
+
#define TRUE 1
#define FALSE 0
@@ -158,7 +161,6 @@ void nfs_rcvunlock(), nqnfs_serverd(), nqnfs_clientlease();
struct mbuf *nfsm_rpchead();
int nfsrtton = 0;
struct nfsrtt nfsrtt;
-struct nfsd nfsd_head;
int nfsrv_null(),
nfsrv_getattr(),
@@ -208,8 +210,6 @@ int (*nfsrv_procs[NFS_NPROCS])() = {
nqnfsrv_access,
};
-struct nfsreq nfsreqh;
-
/*
* Initialize sockets and congestion for a new NFS connection.
* We do not free the sockaddr if error.
@@ -375,11 +375,9 @@ nfs_reconnect(rep)
* Loop through outstanding request list and fix up all requests
* on old socket.
*/
- rp = nfsreqh.r_next;
- while (rp != &nfsreqh) {
+ for (rp = nfs_reqq.tqh_first; rp != 0; rp = rp->r_chain.tqe_next) {
if (rp->r_nmp == nmp)
rp->r_flags |= R_MUSTRESEND;
- rp = rp->r_next;
}
return (0);
}
@@ -769,8 +767,8 @@ nfsmout:
* Loop through the request list to match up the reply
* Iff no match, just drop the datagram
*/
- rep = nfsreqh.r_next;
- while (rep != &nfsreqh) {
+ for (rep = nfs_reqq.tqh_first; rep != 0;
+ rep = rep->r_chain.tqe_next) {
if (rep->r_mrep == NULL && rxid == rep->r_xid) {
/* Found it.. */
rep->r_mrep = mrep;
@@ -832,13 +830,12 @@ nfsmout:
nmp->nm_timeouts = 0;
break;
}
- rep = rep->r_next;
}
/*
* If not matched to a request, drop it.
* If it's mine, get out.
*/
- if (rep == &nfsreqh) {
+ if (rep == 0) {
nfsstats.rpcunexpected++;
m_freem(mrep);
} else if (rep == myrep) {
@@ -878,7 +875,6 @@ nfs_request(vp, mrest, procnum, procp, cred, mrp, mdp, dposp)
register int i;
struct nfsmount *nmp;
struct mbuf *md, *mheadend;
- struct nfsreq *reph;
struct nfsnode *np;
time_t reqtime, waituntil;
caddr_t dpos, cp2;
@@ -964,11 +960,7 @@ tryagain:
* to put it LAST so timer finds oldest requests first.
*/
s = splsoftclock();
- reph = &nfsreqh;
- reph->r_prev->r_next = rep;
- rep->r_prev = reph->r_prev;
- reph->r_prev = rep;
- rep->r_next = reph;
+ TAILQ_INSERT_TAIL(&nfs_reqq, rep, r_chain);
/* Get send time for nqnfs */
reqtime = time.tv_sec;
@@ -1009,8 +1001,7 @@ tryagain:
* RPC done, unlink the request.
*/
s = splsoftclock();
- rep->r_prev->r_next = rep->r_next;
- rep->r_next->r_prev = rep->r_prev;
+ TAILQ_REMOVE(&nfs_reqq, rep, r_chain);
splx(s);
/*
@@ -1167,7 +1158,7 @@ nfs_rephead(siz, nd, err, cache, frev, mrq, mbp, bposp)
tl = mtod(mreq, u_long *);
mreq->m_len = 6*NFSX_UNSIGNED;
bpos = ((caddr_t)tl)+mreq->m_len;
- *tl++ = nd->nd_retxid;
+ *tl++ = txdr_unsigned(nd->nd_retxid);
*tl++ = rpc_reply;
if (err == ERPCMISMATCH || err == NQNFS_AUTHERR) {
*tl++ = rpc_msgdenied;
@@ -1255,7 +1246,7 @@ nfs_timer(arg)
int s, error;
s = splnet();
- for (rep = nfsreqh.r_next; rep != &nfsreqh; rep = rep->r_next) {
+ for (rep = nfs_reqq.tqh_first; rep != 0; rep = rep->r_chain.tqe_next) {
nmp = rep->r_nmp;
if (rep->r_mrep || (rep->r_flags & R_SOFTTERM))
continue;
@@ -1842,7 +1833,7 @@ nfs_getreq(nd, has_header)
dpos = nd->nd_dpos;
if (has_header) {
nfsm_dissect(tl, u_long *, 10*NFSX_UNSIGNED);
- nd->nd_retxid = *tl++;
+ nd->nd_retxid = fxdr_unsigned(u_long, *tl++);
if (*tl++ != rpc_call) {
m_freem(mrep);
return (EBADRPC);
@@ -1980,11 +1971,11 @@ void
nfsrv_wakenfsd(slp)
struct nfssvc_sock *slp;
{
- register struct nfsd *nd = nfsd_head.nd_next;
+ register struct nfsd *nd;
if ((slp->ns_flag & SLP_VALID) == 0)
return;
- while (nd != (struct nfsd *)&nfsd_head) {
+ for (nd = nfsd_head.tqh_first; nd != 0; nd = nd->nd_chain.tqe_next) {
if (nd->nd_flag & NFSD_WAITING) {
nd->nd_flag &= ~NFSD_WAITING;
if (nd->nd_slp)
@@ -1994,10 +1985,9 @@ nfsrv_wakenfsd(slp)
wakeup((caddr_t)nd);
return;
}
- nd = nd->nd_next;
}
slp->ns_flag |= SLP_DOREC;
- nfsd_head.nd_flag |= NFSD_CHECKSLP;
+ nfsd_head_flag |= NFSD_CHECKSLP;
}
int
diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c
index ee8200c..9b2ef80 100644
--- a/sys/nfsserver/nfs_srvsubs.c
+++ b/sys/nfsserver/nfs_srvsubs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.5 1994/09/22 22:10:44 wollman Exp $
+ * $Id: nfs_subs.c,v 1.6 1994/10/02 17:27:01 phk Exp $
*/
/*
@@ -94,7 +94,6 @@ u_long nfs_vers, nfs_prog, nfs_true, nfs_false;
static u_long nfs_xid = 0;
enum vtype ntov_type[7] = { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VNON };
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
-extern struct nfsreq nfsreqh;
extern int nqnfs_piggy[NFS_NPROCS];
extern struct nfsrtt nfsrtt;
extern time_t nqnfsstarttime;
@@ -110,6 +109,8 @@ struct nfssvc_args;
extern int nfssvc(struct proc *, struct nfssvc_args *, int *);
#endif
+LIST_HEAD(nfsnodehashhead, nfsnode);
+
/*
* Create the header for an rpc request packet
* The hsiz is the size of the rest of the nfs request header.
@@ -615,6 +616,7 @@ nfs_init()
nfs_prog = txdr_unsigned(NFS_PROG);
nfs_true = txdr_unsigned(TRUE);
nfs_false = txdr_unsigned(FALSE);
+ nfs_xdrneg1 = txdr_unsigned(-1);
/* Loop thru nfs procids */
for (i = 0; i < NFS_NPROCS; i++)
nfs_procids[i] = txdr_unsigned(i);
@@ -622,7 +624,6 @@ nfs_init()
for (i = 0; i < NFS_MAXASYNCDAEMON; i++)
nfs_iodwant[i] = (struct proc *)0;
TAILQ_INIT(&nfs_bufq);
- nfs_xdrneg1 = txdr_unsigned(-1);
nfs_nhinit(); /* Init the nfsnode table */
nfsrv_init(0); /* Init server data structures */
nfsrv_initcache(); /* Init the server request cache */
@@ -636,15 +637,14 @@ nfs_init()
NQLOADNOVRAM(nqnfsstarttime);
nqnfs_prog = txdr_unsigned(NQNFS_PROG);
nqnfs_vers = txdr_unsigned(NQNFS_VER1);
- nqthead.th_head[0] = &nqthead;
- nqthead.th_head[1] = &nqthead;
- nqfhead = hashinit(NQLCHSZ, M_NQLEASE, &nqfheadhash);
+ CIRCLEQ_INIT(&nqtimerhead);
+ nqfhhashtbl = hashinit(NQLCHSZ, M_NQLEASE, &nqfhhash);
}
/*
* Initialize reply list and start timer
*/
- nfsreqh.r_prev = nfsreqh.r_next = &nfsreqh;
+ TAILQ_INIT(&nfs_reqq);
nfs_timer(0);
/*
@@ -689,7 +689,8 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
register struct vattr *vap;
register struct nfsv2_fattr *fp;
extern int (**spec_nfsv2nodeop_p)();
- register struct nfsnode *np, *nq, **nhpp;
+ register struct nfsnode *np;
+ register struct nfsnodehashhead *nhpp;
register long t1;
caddr_t dpos, cp2;
int error = 0, isnq;
@@ -743,10 +744,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
/*
* Discard unneeded vnode, but save its nfsnode.
*/
- nq = np->n_forw;
- if (nq)
- nq->n_back = np->n_back;
- *np->n_back = nq;
+ LIST_REMOVE(np, n_hash);
nvp->v_data = vp->v_data;
vp->v_data = NULL;
vp->v_op = spec_vnodeop_p;
@@ -756,13 +754,8 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
* Reinitialize aliased node.
*/
np->n_vnode = nvp;
- nhpp = (struct nfsnode **)nfs_hash(&np->n_fh);
- nq = *nhpp;
- if (nq)
- nq->n_back = &np->n_forw;
- np->n_forw = nq;
- np->n_back = nhpp;
- *nhpp = np;
+ nhpp = nfs_hash(&np->n_fh);
+ LIST_INSERT_HEAD(nhpp, np, n_hash);
*vpp = vp = nvp;
}
}
@@ -794,9 +787,8 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
vap->va_fileid = fxdr_unsigned(long, fp->fa_nfsfileid);
fxdr_nfstime(&fp->fa_nfsatime, &vap->va_atime);
vap->va_flags = 0;
- vap->va_ctime.ts_sec = fxdr_unsigned(long, fp->fa_nfsctime.nfs_sec);
- vap->va_ctime.ts_nsec = 0;
- vap->va_gen = fxdr_unsigned(u_long, fp->fa_nfsctime.nfs_usec);
+ fxdr_nfstime(&fp->fa_nfsctime, &vap->va_ctime);
+ vap->va_gen = 0;
vap->va_filerev = 0;
}
if (vap->va_size != np->n_size) {
@@ -1106,24 +1098,24 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp)
* Check/setup credentials.
*/
if (exflags & MNT_EXKERB) {
- uidp = slp->ns_uidh[NUIDHASH(cred->cr_uid)];
- while (uidp) {
+ for (uidp = NUIDHASH(slp, cred->cr_uid)->lh_first; uidp != 0;
+ uidp = uidp->nu_hash.le_next) {
if (uidp->nu_uid == cred->cr_uid)
break;
- uidp = uidp->nu_hnext;
}
- if (uidp) {
- cred->cr_uid = uidp->nu_cr.cr_uid;
- for (i = 0; i < uidp->nu_cr.cr_ngroups; i++)
- cred->cr_groups[i] = uidp->nu_cr.cr_groups[i];
- } else {
+ if (uidp == 0) {
vput(*vpp);
return (NQNFS_AUTHERR);
}
+ cred->cr_uid = uidp->nu_cr.cr_uid;
+ for (i = 0; i < uidp->nu_cr.cr_ngroups; i++)
+ cred->cr_groups[i] = uidp->nu_cr.cr_groups[i];
+ cred->cr_ngroups = i;
} else if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) {
cred->cr_uid = credanon->cr_uid;
for (i = 0; i < credanon->cr_ngroups && i < NGROUPS; i++)
cred->cr_groups[i] = credanon->cr_groups[i];
+ cred->cr_ngroups = i;
}
if (exflags & MNT_EXRDONLY)
*rdonlyp = 1;
diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c
index 5645e45..8cdbfe7 100644
--- a/sys/nfsserver/nfs_syscalls.c
+++ b/sys/nfsserver/nfs_syscalls.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_syscalls.c,v 1.3 1994/08/02 07:52:15 davidg Exp $
+ * $Id: nfs_syscalls.c,v 1.4 1994/10/02 17:27:02 phk Exp $
*/
#include <sys/param.h>
@@ -78,8 +78,6 @@ extern int (*nfsrv_procs[NFS_NPROCS])();
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
extern int nfs_numasync;
extern time_t nqnfsstarttime;
-extern struct nfsrv_req nsrvq_head;
-extern struct nfsd nfsd_head;
extern int nqsrv_writeslack;
extern int nfsrtton;
struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
@@ -91,7 +89,7 @@ static int modify_flag = 0;
static struct nfsdrt nfsdrt;
void nfsrv_cleancache(), nfsrv_rcv(), nfsrv_wakenfsd(), nfs_sndunlock();
static void nfsd_rt();
-void nfsrv_slpderef(), nfsrv_init();
+void nfsrv_slpderef();
#define TRUE 1
#define FALSE 0
@@ -141,8 +139,6 @@ getfh(p, uap, retval)
return (error);
}
-static struct nfssvc_sock nfssvc_sockhead;
-
/*
* Nfs server psuedo system call for the nfsd's
* Based on the flag value it either:
@@ -168,7 +164,7 @@ nfssvc(p, uap, retval)
struct nfsd_cargs ncd;
struct nfsd *nfsd;
struct nfssvc_sock *slp;
- struct nfsuid *nuidp, **nuh;
+ struct nfsuid *nuidp;
struct nfsmount *nmp;
int error;
@@ -178,8 +174,8 @@ nfssvc(p, uap, retval)
error = suser(p->p_ucred, &p->p_acflag);
if(error)
return (error);
- while (nfssvc_sockhead.ns_flag & SLP_INIT) {
- nfssvc_sockhead.ns_flag |= SLP_WANTINIT;
+ while (nfssvc_sockhead_flag & SLP_INIT) {
+ nfssvc_sockhead_flag |= SLP_WANTINIT;
(void) tsleep((caddr_t)&nfssvc_sockhead, PSOCK, "nfsd init", 0);
}
if (uap->flag & NFSSVC_BIOD)
@@ -236,11 +232,10 @@ nfssvc(p, uap, retval)
* First check to see if another nfsd has already
* added this credential.
*/
- nuidp = slp->ns_uidh[NUIDHASH(nsd->nsd_uid)];
- while (nuidp) {
+ for (nuidp = NUIDHASH(slp, nsd->nsd_uid)->lh_first;
+ nuidp != 0; nuidp = nuidp->nu_hash.le_next) {
if (nuidp->nu_uid == nsd->nsd_uid)
break;
- nuidp = nuidp->nu_hnext;
}
if (!nuidp) {
/*
@@ -258,27 +253,21 @@ nfssvc(p, uap, retval)
free((caddr_t)nuidp, M_NFSUID);
} else {
if (nuidp == (struct nfsuid *)0) {
- nuidp = slp->ns_lruprev;
- remque(nuidp);
- if (nuidp->nu_hprev)
- nuidp->nu_hprev->nu_hnext =
- nuidp->nu_hnext;
- if (nuidp->nu_hnext)
- nuidp->nu_hnext->nu_hprev =
- nuidp->nu_hprev;
+ nuidp = slp->ns_uidlruhead.tqh_first;
+ LIST_REMOVE(nuidp, nu_hash);
+ TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp,
+ nu_lru);
}
nuidp->nu_cr = nsd->nsd_cr;
if (nuidp->nu_cr.cr_ngroups > NGROUPS)
nuidp->nu_cr.cr_ngroups = NGROUPS;
nuidp->nu_cr.cr_ref = 1;
nuidp->nu_uid = nsd->nsd_uid;
- insque(nuidp, (struct nfsuid *)slp);
- nuh = &slp->ns_uidh[NUIDHASH(nsd->nsd_uid)];
- nuidp->nu_hnext = *nuh;
- if (nuidp->nu_hnext)
- nuidp->nu_hnext->nu_hprev = nuidp;
- nuidp->nu_hprev = (struct nfsuid *)0;
- *nuh = nuidp;
+ TAILQ_INSERT_TAIL(&slp->ns_uidlruhead, nuidp,
+ nu_lru);
+ LIST_INSERT_HEAD(NUIDHASH(slp, nsd->nsd_uid),
+ nuidp, nu_hash);
+
}
}
}
@@ -364,11 +353,10 @@ nfssvc_addsock(fp, mynam)
slp = (struct nfssvc_sock *)
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
bzero((caddr_t)slp, sizeof (struct nfssvc_sock));
- slp->ns_prev = nfssvc_sockhead.ns_prev;
- slp->ns_prev->ns_next = slp;
- slp->ns_next = &nfssvc_sockhead;
- nfssvc_sockhead.ns_prev = slp;
- slp->ns_lrunext = slp->ns_lruprev = (struct nfsuid *)slp;
+ slp->ns_uidhashtbl =
+ hashinit(NUIDHASHSIZ, M_NFSSVC, &slp->ns_uidhash);
+ TAILQ_INIT(&slp->ns_uidlruhead);
+ TAILQ_INSERT_TAIL(&nfssvc_sockhead, slp, ns_chain);
}
slp->ns_so = so;
slp->ns_nam = mynam;
@@ -412,7 +400,7 @@ nfssvc_nfsd(nsd, argp, p)
bzero((caddr_t)nd, sizeof (struct nfsd));
nd->nd_procp = p;
nd->nd_cr.cr_ref = 1;
- insque(nd, &nfsd_head);
+ TAILQ_INSERT_TAIL(&nfsd_head, nd, nd_chain);
nd->nd_nqlflag = NQL_NOVAL;
nfs_numnfsd++;
}
@@ -422,7 +410,7 @@ nfssvc_nfsd(nsd, argp, p)
for (;;) {
if ((nd->nd_flag & NFSD_REQINPROG) == 0) {
while (nd->nd_slp == (struct nfssvc_sock *)0 &&
- (nfsd_head.nd_flag & NFSD_CHECKSLP) == 0) {
+ (nfsd_head_flag & NFSD_CHECKSLP) == 0) {
nd->nd_flag |= NFSD_WAITING;
nfsd_waiting++;
error = tsleep((caddr_t)nd, PSOCK | PCATCH, "nfsd", 0);
@@ -431,9 +419,9 @@ nfssvc_nfsd(nsd, argp, p)
goto done;
}
if (nd->nd_slp == (struct nfssvc_sock *)0 &&
- (nfsd_head.nd_flag & NFSD_CHECKSLP)) {
- slp = nfssvc_sockhead.ns_next;
- while (slp != &nfssvc_sockhead) {
+ (nfsd_head_flag & NFSD_CHECKSLP) != 0) {
+ for (slp = nfssvc_sockhead.tqh_first; slp != 0;
+ slp = slp->ns_chain.tqe_next) {
if ((slp->ns_flag & (SLP_VALID | SLP_DOREC))
== (SLP_VALID | SLP_DOREC)) {
slp->ns_flag &= ~SLP_DOREC;
@@ -441,10 +429,9 @@ nfssvc_nfsd(nsd, argp, p)
nd->nd_slp = slp;
break;
}
- slp = slp->ns_next;
}
- if (slp == &nfssvc_sockhead)
- nfsd_head.nd_flag &= ~NFSD_CHECKSLP;
+ if (slp == 0)
+ nfsd_head_flag &= ~NFSD_CHECKSLP;
}
if ((slp = nd->nd_slp) == (struct nfssvc_sock *)0)
continue;
@@ -504,11 +491,10 @@ nfssvc_nfsd(nsd, argp, p)
/*
* Check for a mapping already installed.
*/
- uidp = slp->ns_uidh[NUIDHASH(nd->nd_cr.cr_uid)];
- while (uidp) {
+ for (uidp = NUIDHASH(slp, nd->nd_cr.cr_uid)->lh_first;
+ uidp != 0; uidp = uidp->nu_hash.le_next) {
if (uidp->nu_uid == nd->nd_cr.cr_uid)
break;
- uidp = uidp->nu_hnext;
}
if (!uidp) {
nsd->nsd_uid = nd->nd_cr.cr_uid;
@@ -637,7 +623,7 @@ nfssvc_nfsd(nsd, argp, p)
}
}
done:
- remque(nd);
+ TAILQ_REMOVE(&nfsd_head, nd, nd_chain);
splx(s);
free((caddr_t)nd, M_NFSD);
nsd->nsd_nfsd = (struct nfsd *)0;
@@ -708,8 +694,7 @@ void
nfsrv_zapsock(slp)
register struct nfssvc_sock *slp;
{
- register struct nfsuid *nuidp, *onuidp;
- register int i;
+ register struct nfsuid *nuidp, *nnuidp;
struct socket *so;
struct file *fp;
struct mbuf *m;
@@ -726,15 +711,13 @@ nfsrv_zapsock(slp)
MFREE(slp->ns_nam, m);
m_freem(slp->ns_raw);
m_freem(slp->ns_rec);
- nuidp = slp->ns_lrunext;
- while (nuidp != (struct nfsuid *)slp) {
- onuidp = nuidp;
- nuidp = nuidp->nu_lrunext;
- free((caddr_t)onuidp, M_NFSUID);
+ for (nuidp = slp->ns_uidlruhead.tqh_first; nuidp != 0;
+ nuidp = nnuidp) {
+ nnuidp = nuidp->nu_lru.tqe_next;
+ LIST_REMOVE(nuidp, nu_hash);
+ TAILQ_REMOVE(&slp->ns_uidlruhead, nuidp, nu_lru);
+ free((caddr_t)nuidp, M_NFSUID);
}
- slp->ns_lrunext = slp->ns_lruprev = (struct nfsuid *)slp;
- for (i = 0; i < NUIDHASHSIZ; i++)
- slp->ns_uidh[i] = (struct nfsuid *)0;
}
}
@@ -804,8 +787,7 @@ nfsrv_slpderef(slp)
register struct nfssvc_sock *slp;
{
if (--(slp->ns_sref) == 0 && (slp->ns_flag & SLP_VALID) == 0) {
- slp->ns_prev->ns_next = slp->ns_next;
- slp->ns_next->ns_prev = slp->ns_prev;
+ TAILQ_REMOVE(&nfssvc_sockhead, slp, ns_chain);
free((caddr_t)slp, M_NFSSVC);
}
}
@@ -819,48 +801,47 @@ void
nfsrv_init(terminating)
int terminating;
{
- register struct nfssvc_sock *slp;
- struct nfssvc_sock *oslp;
+ register struct nfssvc_sock *slp, *nslp;
- if (nfssvc_sockhead.ns_flag & SLP_INIT)
+ if (nfssvc_sockhead_flag & SLP_INIT)
panic("nfsd init");
- nfssvc_sockhead.ns_flag |= SLP_INIT;
+ nfssvc_sockhead_flag |= SLP_INIT;
if (terminating) {
- slp = nfssvc_sockhead.ns_next;
- while (slp != &nfssvc_sockhead) {
+ for (slp = nfssvc_sockhead.tqh_first; slp != 0; slp = nslp) {
+ nslp = slp->ns_chain.tqe_next;
if (slp->ns_flag & SLP_VALID)
nfsrv_zapsock(slp);
- slp->ns_next->ns_prev = slp->ns_prev;
- slp->ns_prev->ns_next = slp->ns_next;
- oslp = slp;
- slp = slp->ns_next;
- free((caddr_t)oslp, M_NFSSVC);
+ TAILQ_REMOVE(&nfssvc_sockhead, slp, ns_chain);
+ free((caddr_t)slp, M_NFSSVC);
}
nfsrv_cleancache(); /* And clear out server cache */
}
+
+ TAILQ_INIT(&nfssvc_sockhead);
+ nfssvc_sockhead_flag &= ~SLP_INIT;
+ if (nfssvc_sockhead_flag & SLP_WANTINIT) {
+ nfssvc_sockhead_flag &= ~SLP_WANTINIT;
+ wakeup((caddr_t)&nfssvc_sockhead);
+ }
+
+ TAILQ_INIT(&nfsd_head);
+ nfsd_head_flag &= ~NFSD_CHECKSLP;
+
nfs_udpsock = (struct nfssvc_sock *)
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
bzero((caddr_t)nfs_udpsock, sizeof (struct nfssvc_sock));
+ nfs_udpsock->ns_uidhashtbl =
+ hashinit(NUIDHASHSIZ, M_NFSSVC, &nfs_udpsock->ns_uidhash);
+ TAILQ_INIT(&nfs_udpsock->ns_uidlruhead);
+ TAILQ_INSERT_HEAD(&nfssvc_sockhead, nfs_udpsock, ns_chain);
+
nfs_cltpsock = (struct nfssvc_sock *)
malloc(sizeof (struct nfssvc_sock), M_NFSSVC, M_WAITOK);
bzero((caddr_t)nfs_cltpsock, sizeof (struct nfssvc_sock));
- nfssvc_sockhead.ns_next = nfs_udpsock;
- nfs_udpsock->ns_next = nfs_cltpsock;
- nfs_cltpsock->ns_next = &nfssvc_sockhead;
- nfssvc_sockhead.ns_prev = nfs_cltpsock;
- nfs_cltpsock->ns_prev = nfs_udpsock;
- nfs_udpsock->ns_prev = &nfssvc_sockhead;
- nfs_udpsock->ns_lrunext = nfs_udpsock->ns_lruprev =
- (struct nfsuid *)nfs_udpsock;
- nfs_cltpsock->ns_lrunext = nfs_cltpsock->ns_lruprev =
- (struct nfsuid *)nfs_cltpsock;
- nfsd_head.nd_next = nfsd_head.nd_prev = &nfsd_head;
- nfsd_head.nd_flag = 0;
- nfssvc_sockhead.ns_flag &= ~SLP_INIT;
- if (nfssvc_sockhead.ns_flag & SLP_WANTINIT) {
- nfssvc_sockhead.ns_flag &= ~SLP_WANTINIT;
- wakeup((caddr_t)&nfssvc_sockhead);
- }
+ nfs_cltpsock->ns_uidhashtbl =
+ hashinit(NUIDHASHSIZ, M_NFSSVC, &nfs_cltpsock->ns_uidhash);
+ TAILQ_INIT(&nfs_cltpsock->ns_uidlruhead);
+ TAILQ_INSERT_TAIL(&nfssvc_sockhead, nfs_cltpsock, ns_chain);
}
/*
diff --git a/sys/nfsserver/nfsm_subs.h b/sys/nfsserver/nfsm_subs.h
index 954a92f..994c0b6 100644
--- a/sys/nfsserver/nfsm_subs.h
+++ b/sys/nfsserver/nfsm_subs.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsm_subs.h 8.1 (Berkeley) 6/16/93
- * $Id: nfsm_subs.h,v 1.3 1994/08/21 06:50:10 paul Exp $
+ * $Id: nfsm_subs.h,v 1.4 1994/10/02 17:27:05 phk Exp $
*/
#ifndef _NFS_NFSM_SUBS_H_
@@ -264,8 +264,7 @@ extern struct mbuf *nfsm_reqh();
fp->fa_nfsblocks = txdr_unsigned(vap->va_bytes / NFS_FABLKSIZE); \
txdr_nfstime(&vap->va_atime, &fp->fa_nfsatime); \
txdr_nfstime(&vap->va_mtime, &fp->fa_nfsmtime); \
- fp->fa_nfsctime.nfs_sec = txdr_unsigned(vap->va_ctime.ts_sec); \
- fp->fa_nfsctime.nfs_usec = txdr_unsigned(vap->va_gen); \
+ txdr_nfstime(&vap->va_ctime, &fp->fa_nfsctime); \
} else { \
fp->fa_nqblocksize = txdr_unsigned(vap->va_blocksize); \
if (vap->va_type == VFIFO) \
diff --git a/sys/nfsserver/nfsrvcache.h b/sys/nfsserver/nfsrvcache.h
index 00eac6a..b367b9f 100644
--- a/sys/nfsserver/nfsrvcache.h
+++ b/sys/nfsserver/nfsrvcache.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfsrvcache.h 8.1 (Berkeley) 6/10/93
- * $Id: nfsrvcache.h,v 1.2 1994/08/02 07:52:25 davidg Exp $
+ * $Id: nfsrvcache.h,v 1.3 1994/08/21 06:50:13 paul Exp $
*/
#ifndef _NFS_NFSRVCACHE_H_
@@ -47,10 +47,8 @@
#define NFSRVCACHESIZ 256
struct nfsrvcache {
- struct nfsrvcache *rc_forw; /* Hash chain links */
- struct nfsrvcache **rc_back; /* Hash chain links */
- struct nfsrvcache *rc_next; /* Lru list */
- struct nfsrvcache **rc_prev; /* Lru list */
+ TAILQ_ENTRY(nfsrvcache) rc_lru; /* LRU chain */
+ LIST_ENTRY(nfsrvcache) rc_hash; /* Hash chain */
u_long rc_xid; /* rpc id number */
union {
struct mbuf *ru_repmb; /* Reply mbuf list OR */
diff --git a/sys/nfsserver/nfsrvstats.h b/sys/nfsserver/nfsrvstats.h
index 844acdc..c79eefb 100644
--- a/sys/nfsserver/nfsrvstats.h
+++ b/sys/nfsserver/nfsrvstats.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.1 (Berkeley) 6/10/93
- * $Id: nfs.h,v 1.4 1994/08/21 06:50:08 paul Exp $
+ * $Id: nfs.h,v 1.5 1994/10/02 17:26:54 phk Exp $
*/
#ifndef _NFS_NFS_H_
@@ -179,8 +179,7 @@ struct nfsstats {
* Nfs outstanding request list element
*/
struct nfsreq {
- struct nfsreq *r_next;
- struct nfsreq *r_prev;
+ TAILQ_ENTRY(nfsreq) r_chain;
struct mbuf *r_mreq;
struct mbuf *r_mrep;
struct mbuf *r_md;
@@ -197,6 +196,11 @@ struct nfsreq {
struct proc *r_procp; /* Proc that did I/O system call */
};
+/*
+ * Queue head for nfsreq's
+ */
+TAILQ_HEAD(, nfsreq) nfs_reqq;
+
/* Flag values for r_flags */
#define R_TIMING 0x01 /* timing request (in mntp) */
#define R_SENT 0x02 /* request has been sent */
@@ -216,7 +220,8 @@ struct nfsstats nfsstats;
* and uid hash lists.
*/
#define NUIDHASHSIZ 32
-#define NUIDHASH(uid) ((uid) & (NUIDHASHSIZ - 1))
+#define NUIDHASH(sock, uid) \
+ (&(sock)->ns_uidhashtbl[(uid) & (sock)->ns_uidhash])
/*
* Network address hash list element
@@ -227,10 +232,8 @@ union nethostaddr {
};
struct nfsuid {
- struct nfsuid *nu_lrunext; /* MUST be first */
- struct nfsuid *nu_lruprev;
- struct nfsuid *nu_hnext;
- struct nfsuid *nu_hprev;
+ TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */
+ LIST_ENTRY(nfsuid) nu_hash; /* Hash list */
int nu_flag; /* Flags */
uid_t nu_uid; /* Uid mapped by this entry */
union nethostaddr nu_haddr; /* Host addr. for dgram sockets */
@@ -243,10 +246,11 @@ struct nfsuid {
#define NU_INETADDR 0x1
struct nfssvc_sock {
- struct nfsuid *ns_lrunext; /* MUST be first */
- struct nfsuid *ns_lruprev;
- struct nfssvc_sock *ns_next;
- struct nfssvc_sock *ns_prev;
+ TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
+ TAILQ_HEAD(, nfsuid) ns_uidlruhead;
+ LIST_HEAD(, nfsuid) *ns_uidhashtbl;
+ u_long ns_uidhash;
+
int ns_flag;
u_long ns_sref;
struct file *ns_fp;
@@ -260,7 +264,6 @@ struct nfssvc_sock {
struct mbuf *ns_rec;
struct mbuf *ns_recend;
int ns_numuids;
- struct nfsuid *ns_uidh[NUIDHASHSIZ];
};
/* Bits for "ns_flag" */
@@ -269,17 +272,18 @@ struct nfssvc_sock {
#define SLP_NEEDQ 0x04
#define SLP_DISCONN 0x08
#define SLP_GETSTREAM 0x10
-#define SLP_INIT 0x20
-#define SLP_WANTINIT 0x40
-
#define SLP_ALLFLAGS 0xff
+TAILQ_HEAD(, nfssvc_sock) nfssvc_sockhead;
+int nfssvc_sockhead_flag;
+#define SLP_INIT 0x01
+#define SLP_WANTINIT 0x02
+
/*
* One of these structures is allocated for each nfsd.
*/
struct nfsd {
- struct nfsd *nd_next; /* Must be first */
- struct nfsd *nd_prev;
+ TAILQ_ENTRY(nfsd) nd_chain; /* List of all nfsd's */
int nd_flag; /* NFSD_ flags */
struct nfssvc_sock *nd_slp; /* Current socket */
struct mbuf *nd_nam; /* Client addr for datagram req. */
@@ -297,11 +301,15 @@ struct nfsd {
struct proc *nd_procp; /* Proc ptr */
};
+/* Bits for "nd_flag" */
#define NFSD_WAITING 0x01
-#define NFSD_CHECKSLP 0x02
-#define NFSD_REQINPROG 0x04
-#define NFSD_NEEDAUTH 0x08
-#define NFSD_AUTHFAIL 0x10
+#define NFSD_REQINPROG 0x02
+#define NFSD_NEEDAUTH 0x04
+#define NFSD_AUTHFAIL 0x08
+
+TAILQ_HEAD(, nfsd) nfsd_head;
+int nfsd_head_flag;
+#define NFSD_CHECKSLP 0x01
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsd *,int));
@@ -335,7 +343,7 @@ int nfs_adv __P((struct mbuf **,caddr_t *,int,int));
int nfsrv_getstream __P((struct nfssvc_sock *,int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
-struct nfsnode ** nfs_hash __P((nfsv2fh_t *));
+struct nfsnodehashhead * nfs_hash __P((nfsv2fh_t *));
int nfssvc_iod __P((struct proc *));
int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
int nfssvc_addsock __P((struct file *,struct mbuf *));
OpenPOWER on IntegriCloud