xref: /freebsd/sys/nfsclient/nfs.h (revision 473e9734a8e4e5f48fb69f19f33ca16e5ec15ca2)
1df8bae1dSRodney W. Grimes /*
2df8bae1dSRodney W. Grimes  * Copyright (c) 1989, 1993
3df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4df8bae1dSRodney W. Grimes  *
5df8bae1dSRodney W. Grimes  * This code is derived from software contributed to Berkeley by
6df8bae1dSRodney W. Grimes  * Rick Macklem at The University of Guelph.
7df8bae1dSRodney W. Grimes  *
8df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
9df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
10df8bae1dSRodney W. Grimes  * are met:
11df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
12df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
13df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
14df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
15df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
16df8bae1dSRodney W. Grimes  * 3. All advertising materials mentioning features or use of this software
17df8bae1dSRodney W. Grimes  *    must display the following acknowledgement:
18df8bae1dSRodney W. Grimes  *	This product includes software developed by the University of
19df8bae1dSRodney W. Grimes  *	California, Berkeley and its contributors.
20df8bae1dSRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
21df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
22df8bae1dSRodney W. Grimes  *    without specific prior written permission.
23df8bae1dSRodney W. Grimes  *
24df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
35df8bae1dSRodney W. Grimes  *
36df8bae1dSRodney W. Grimes  *	@(#)nfs.h	8.1 (Berkeley) 6/10/93
37473e9734SPoul-Henning Kamp  * $Id: nfs.h,v 1.8 1994/11/02 00:11:00 wollman Exp $
38df8bae1dSRodney W. Grimes  */
39df8bae1dSRodney W. Grimes 
4033420ec6SPaul Richards #ifndef _NFS_NFS_H_
4133420ec6SPaul Richards #define _NFS_NFS_H_
4233420ec6SPaul Richards 
43df8bae1dSRodney W. Grimes /*
44df8bae1dSRodney W. Grimes  * Tunable constants for nfs
45df8bae1dSRodney W. Grimes  */
46df8bae1dSRodney W. Grimes 
47df8bae1dSRodney W. Grimes #define	NFS_MAXIOVEC	34
48df8bae1dSRodney W. Grimes #define NFS_HZ		25		/* Ticks per second for NFS timeouts */
49df8bae1dSRodney W. Grimes #define	NFS_TIMEO	(1*NFS_HZ)	/* Default timeout = 1 second */
50df8bae1dSRodney W. Grimes #define	NFS_MINTIMEO	(1*NFS_HZ)	/* Min timeout to use */
51df8bae1dSRodney W. Grimes #define	NFS_MAXTIMEO	(60*NFS_HZ)	/* Max timeout to backoff to */
52df8bae1dSRodney W. Grimes #define	NFS_MINIDEMTIMEO (5*NFS_HZ)	/* Min timeout for non-idempotent ops*/
53df8bae1dSRodney W. Grimes #define	NFS_MAXREXMIT	100		/* Stop counting after this many */
54df8bae1dSRodney W. Grimes #define	NFS_MAXWINDOW	1024		/* Max number of outstanding requests */
55df8bae1dSRodney W. Grimes #define	NFS_RETRANS	10		/* Num of retrans for soft mounts */
56df8bae1dSRodney W. Grimes #define	NFS_MAXGRPS	16		/* Max. size of groups list */
57b1b76581SDavid Greenman #ifndef NFS_MINATTRTIMO
58df8bae1dSRodney W. Grimes #define	NFS_MINATTRTIMO 5		/* Attribute cache timeout in sec */
59b1b76581SDavid Greenman #endif
60b1b76581SDavid Greenman #ifndef NFS_MAXATTRTIMO
61df8bae1dSRodney W. Grimes #define	NFS_MAXATTRTIMO 60
62b1b76581SDavid Greenman #endif
63df8bae1dSRodney W. Grimes #define	NFS_WSIZE	8192		/* Def. write data size <= 8192 */
64df8bae1dSRodney W. Grimes #define	NFS_RSIZE	8192		/* Def. read data size <= 8192 */
65df8bae1dSRodney W. Grimes #define	NFS_DEFRAHEAD	1		/* Def. read ahead # blocks */
66df8bae1dSRodney W. Grimes #define	NFS_MAXRAHEAD	4		/* Max. read ahead # blocks */
67df8bae1dSRodney W. Grimes #define	NFS_MAXREADDIR	NFS_MAXDATA	/* Max. size of directory read */
68df8bae1dSRodney W. Grimes #define	NFS_MAXUIDHASH	64		/* Max. # of hashed uid entries/mp */
69df8bae1dSRodney W. Grimes #define	NFS_MAXASYNCDAEMON 20	/* Max. number async_daemons runable */
70df8bae1dSRodney W. Grimes #define	NFS_DIRBLKSIZ	1024		/* Size of an NFS directory block */
71df8bae1dSRodney W. Grimes #define	NMOD(a)		((a) % nfs_asyncdaemons)
72df8bae1dSRodney W. Grimes 
73df8bae1dSRodney W. Grimes /*
74df8bae1dSRodney W. Grimes  * Set the attribute timeout based on how recently the file has been modified.
75df8bae1dSRodney W. Grimes  */
76df8bae1dSRodney W. Grimes #define	NFS_ATTRTIMEO(np) \
77df8bae1dSRodney W. Grimes 	((((np)->n_flag & NMODIFIED) || \
78df8bae1dSRodney W. Grimes 	 (time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
79df8bae1dSRodney W. Grimes 	 ((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
80df8bae1dSRodney W. Grimes 	  (time.tv_sec - (np)->n_mtime) / 10))
81df8bae1dSRodney W. Grimes 
82df8bae1dSRodney W. Grimes /*
83df8bae1dSRodney W. Grimes  * Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
84df8bae1dSRodney W. Grimes  * should ever try and use it.
85df8bae1dSRodney W. Grimes  */
86df8bae1dSRodney W. Grimes struct nfsd_args {
87df8bae1dSRodney W. Grimes 	int	sock;		/* Socket to serve */
88df8bae1dSRodney W. Grimes 	caddr_t	name;		/* Client address for connection based sockets */
89df8bae1dSRodney W. Grimes 	int	namelen;	/* Length of name */
90df8bae1dSRodney W. Grimes };
91df8bae1dSRodney W. Grimes 
92df8bae1dSRodney W. Grimes struct nfsd_srvargs {
93df8bae1dSRodney W. Grimes 	struct nfsd	*nsd_nfsd;	/* Pointer to in kernel nfsd struct */
94df8bae1dSRodney W. Grimes 	uid_t		nsd_uid;	/* Effective uid mapped to cred */
95df8bae1dSRodney W. Grimes 	u_long		nsd_haddr;	/* Ip address of client */
96df8bae1dSRodney W. Grimes 	struct ucred	nsd_cr;		/* Cred. uid maps to */
97df8bae1dSRodney W. Grimes 	int		nsd_authlen;	/* Length of auth string (ret) */
98df8bae1dSRodney W. Grimes 	char		*nsd_authstr;	/* Auth string (ret) */
99df8bae1dSRodney W. Grimes };
100df8bae1dSRodney W. Grimes 
101df8bae1dSRodney W. Grimes struct nfsd_cargs {
102df8bae1dSRodney W. Grimes 	char		*ncd_dirp;	/* Mount dir path */
103df8bae1dSRodney W. Grimes 	uid_t		ncd_authuid;	/* Effective uid */
104df8bae1dSRodney W. Grimes 	int		ncd_authtype;	/* Type of authenticator */
105df8bae1dSRodney W. Grimes 	int		ncd_authlen;	/* Length of authenticator string */
106df8bae1dSRodney W. Grimes 	char		*ncd_authstr;	/* Authenticator string */
107df8bae1dSRodney W. Grimes };
108df8bae1dSRodney W. Grimes 
109df8bae1dSRodney W. Grimes /*
110df8bae1dSRodney W. Grimes  * Stats structure
111df8bae1dSRodney W. Grimes  */
112df8bae1dSRodney W. Grimes struct nfsstats {
113df8bae1dSRodney W. Grimes 	int	attrcache_hits;
114df8bae1dSRodney W. Grimes 	int	attrcache_misses;
115df8bae1dSRodney W. Grimes 	int	lookupcache_hits;
116df8bae1dSRodney W. Grimes 	int	lookupcache_misses;
117df8bae1dSRodney W. Grimes 	int	direofcache_hits;
118df8bae1dSRodney W. Grimes 	int	direofcache_misses;
119df8bae1dSRodney W. Grimes 	int	biocache_reads;
120df8bae1dSRodney W. Grimes 	int	read_bios;
121df8bae1dSRodney W. Grimes 	int	read_physios;
122df8bae1dSRodney W. Grimes 	int	biocache_writes;
123df8bae1dSRodney W. Grimes 	int	write_bios;
124df8bae1dSRodney W. Grimes 	int	write_physios;
125df8bae1dSRodney W. Grimes 	int	biocache_readlinks;
126df8bae1dSRodney W. Grimes 	int	readlink_bios;
127df8bae1dSRodney W. Grimes 	int	biocache_readdirs;
128df8bae1dSRodney W. Grimes 	int	readdir_bios;
129df8bae1dSRodney W. Grimes 	int	rpccnt[NFS_NPROCS];
130df8bae1dSRodney W. Grimes 	int	rpcretries;
131df8bae1dSRodney W. Grimes 	int	srvrpccnt[NFS_NPROCS];
132df8bae1dSRodney W. Grimes 	int	srvrpc_errs;
133df8bae1dSRodney W. Grimes 	int	srv_errs;
134df8bae1dSRodney W. Grimes 	int	rpcrequests;
135df8bae1dSRodney W. Grimes 	int	rpctimeouts;
136df8bae1dSRodney W. Grimes 	int	rpcunexpected;
137df8bae1dSRodney W. Grimes 	int	rpcinvalid;
138df8bae1dSRodney W. Grimes 	int	srvcache_inproghits;
139df8bae1dSRodney W. Grimes 	int	srvcache_idemdonehits;
140df8bae1dSRodney W. Grimes 	int	srvcache_nonidemdonehits;
141df8bae1dSRodney W. Grimes 	int	srvcache_misses;
142df8bae1dSRodney W. Grimes 	int	srvnqnfs_leases;
143df8bae1dSRodney W. Grimes 	int	srvnqnfs_maxleases;
144df8bae1dSRodney W. Grimes 	int	srvnqnfs_getleases;
145df8bae1dSRodney W. Grimes };
146df8bae1dSRodney W. Grimes 
147df8bae1dSRodney W. Grimes /*
148df8bae1dSRodney W. Grimes  * Flags for nfssvc() system call.
149df8bae1dSRodney W. Grimes  */
150df8bae1dSRodney W. Grimes #define	NFSSVC_BIOD	0x002
151df8bae1dSRodney W. Grimes #define	NFSSVC_NFSD	0x004
152df8bae1dSRodney W. Grimes #define	NFSSVC_ADDSOCK	0x008
153df8bae1dSRodney W. Grimes #define	NFSSVC_AUTHIN	0x010
154df8bae1dSRodney W. Grimes #define	NFSSVC_GOTAUTH	0x040
155df8bae1dSRodney W. Grimes #define	NFSSVC_AUTHINFAIL 0x080
156df8bae1dSRodney W. Grimes #define	NFSSVC_MNTD	0x100
157df8bae1dSRodney W. Grimes 
158df8bae1dSRodney W. Grimes /*
159b43e29afSGarrett Wollman  * fs.nfs sysctl(3) identifiers
160b43e29afSGarrett Wollman  */
161b43e29afSGarrett Wollman #define NFS_NFSSTATS	1		/* struct: struct nfsstats */
162b43e29afSGarrett Wollman 
163b43e29afSGarrett Wollman #define FS_NFS_NAMES { \
164b43e29afSGarrett Wollman 		       { 0, 0 }, \
165b43e29afSGarrett Wollman 		       { "nfsstats", CTLTYPE_STRUCT }, \
166b43e29afSGarrett Wollman }
167b43e29afSGarrett Wollman 
168b43e29afSGarrett Wollman /*
169df8bae1dSRodney W. Grimes  * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
170df8bae1dSRodney W. Grimes  * What should be in this set is open to debate, but I believe that since
171df8bae1dSRodney W. Grimes  * I/O system calls on ufs are never interrupted by signals the set should
172df8bae1dSRodney W. Grimes  * be minimal. My reasoning is that many current programs that use signals
173df8bae1dSRodney W. Grimes  * such as SIGALRM will not expect file I/O system calls to be interrupted
174df8bae1dSRodney W. Grimes  * by them and break.
175df8bae1dSRodney W. Grimes  */
176df8bae1dSRodney W. Grimes #ifdef KERNEL
177d9e91095SGarrett Wollman 
178d9e91095SGarrett Wollman struct uio; struct buf; struct vattr; struct nameidata;	/* XXX */
179d9e91095SGarrett Wollman 
180df8bae1dSRodney W. Grimes #define	NFSINT_SIGMASK	(sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
181df8bae1dSRodney W. Grimes 			 sigmask(SIGHUP)|sigmask(SIGQUIT))
182df8bae1dSRodney W. Grimes 
183df8bae1dSRodney W. Grimes /*
184df8bae1dSRodney W. Grimes  * Socket errors ignored for connectionless sockets??
185df8bae1dSRodney W. Grimes  * For now, ignore them all
186df8bae1dSRodney W. Grimes  */
187df8bae1dSRodney W. Grimes #define	NFSIGNORE_SOERROR(s, e) \
188df8bae1dSRodney W. Grimes 		((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
189df8bae1dSRodney W. Grimes 		((s) & PR_CONNREQUIRED) == 0)
190df8bae1dSRodney W. Grimes 
191df8bae1dSRodney W. Grimes /*
192df8bae1dSRodney W. Grimes  * Nfs outstanding request list element
193df8bae1dSRodney W. Grimes  */
194df8bae1dSRodney W. Grimes struct nfsreq {
1956ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfsreq) r_chain;
196df8bae1dSRodney W. Grimes 	struct mbuf	*r_mreq;
197df8bae1dSRodney W. Grimes 	struct mbuf	*r_mrep;
198df8bae1dSRodney W. Grimes 	struct mbuf	*r_md;
199df8bae1dSRodney W. Grimes 	caddr_t		r_dpos;
200df8bae1dSRodney W. Grimes 	struct nfsmount *r_nmp;
201df8bae1dSRodney W. Grimes 	struct vnode	*r_vp;
202df8bae1dSRodney W. Grimes 	u_long		r_xid;
203df8bae1dSRodney W. Grimes 	int		r_flags;	/* flags on request, see below */
204df8bae1dSRodney W. Grimes 	int		r_retry;	/* max retransmission count */
205df8bae1dSRodney W. Grimes 	int		r_rexmit;	/* current retrans count */
206df8bae1dSRodney W. Grimes 	int		r_timer;	/* tick counter on reply */
207df8bae1dSRodney W. Grimes 	int		r_procnum;	/* NFS procedure number */
208df8bae1dSRodney W. Grimes 	int		r_rtt;		/* RTT for rpc */
209df8bae1dSRodney W. Grimes 	struct proc	*r_procp;	/* Proc that did I/O system call */
210df8bae1dSRodney W. Grimes };
211df8bae1dSRodney W. Grimes 
2126ae32407SPoul-Henning Kamp /*
2136ae32407SPoul-Henning Kamp  * Queue head for nfsreq's
2146ae32407SPoul-Henning Kamp  */
2156ae32407SPoul-Henning Kamp TAILQ_HEAD(, nfsreq) nfs_reqq;
2166ae32407SPoul-Henning Kamp 
217df8bae1dSRodney W. Grimes /* Flag values for r_flags */
218df8bae1dSRodney W. Grimes #define R_TIMING	0x01		/* timing request (in mntp) */
219df8bae1dSRodney W. Grimes #define R_SENT		0x02		/* request has been sent */
220df8bae1dSRodney W. Grimes #define	R_SOFTTERM	0x04		/* soft mnt, too many retries */
221df8bae1dSRodney W. Grimes #define	R_INTR		0x08		/* intr mnt, signal pending */
222df8bae1dSRodney W. Grimes #define	R_SOCKERR	0x10		/* Fatal error on socket */
223df8bae1dSRodney W. Grimes #define	R_TPRINTFMSG	0x20		/* Did a tprintf msg. */
224df8bae1dSRodney W. Grimes #define	R_MUSTRESEND	0x40		/* Must resend request */
225df8bae1dSRodney W. Grimes #define	R_GETONEREP	0x80		/* Probe for one reply only */
226df8bae1dSRodney W. Grimes 
227b43e29afSGarrett Wollman extern struct nfsstats nfsstats;
228df8bae1dSRodney W. Grimes 
229df8bae1dSRodney W. Grimes /*
230df8bae1dSRodney W. Grimes  * A list of nfssvc_sock structures is maintained with all the sockets
231df8bae1dSRodney W. Grimes  * that require service by the nfsd.
232df8bae1dSRodney W. Grimes  * The nfsuid structs hang off of the nfssvc_sock structs in both lru
233df8bae1dSRodney W. Grimes  * and uid hash lists.
234df8bae1dSRodney W. Grimes  */
235df8bae1dSRodney W. Grimes #define	NUIDHASHSIZ	32
2366ae32407SPoul-Henning Kamp #define	NUIDHASH(sock, uid) \
2376ae32407SPoul-Henning Kamp 	(&(sock)->ns_uidhashtbl[(uid) & (sock)->ns_uidhash])
238df8bae1dSRodney W. Grimes 
239df8bae1dSRodney W. Grimes /*
240df8bae1dSRodney W. Grimes  * Network address hash list element
241df8bae1dSRodney W. Grimes  */
242df8bae1dSRodney W. Grimes union nethostaddr {
243df8bae1dSRodney W. Grimes 	u_long had_inetaddr;
244df8bae1dSRodney W. Grimes 	struct mbuf *had_nam;
245df8bae1dSRodney W. Grimes };
246df8bae1dSRodney W. Grimes 
247df8bae1dSRodney W. Grimes struct nfsuid {
2486ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfsuid) nu_lru;	/* LRU chain */
2496ae32407SPoul-Henning Kamp 	LIST_ENTRY(nfsuid) nu_hash;	/* Hash list */
250df8bae1dSRodney W. Grimes 	int		nu_flag;	/* Flags */
251df8bae1dSRodney W. Grimes 	uid_t		nu_uid;		/* Uid mapped by this entry */
252df8bae1dSRodney W. Grimes 	union nethostaddr nu_haddr;	/* Host addr. for dgram sockets */
253df8bae1dSRodney W. Grimes 	struct ucred	nu_cr;		/* Cred uid mapped to */
254df8bae1dSRodney W. Grimes };
255df8bae1dSRodney W. Grimes 
256df8bae1dSRodney W. Grimes #define	nu_inetaddr	nu_haddr.had_inetaddr
257df8bae1dSRodney W. Grimes #define	nu_nam		nu_haddr.had_nam
258df8bae1dSRodney W. Grimes /* Bits for nu_flag */
259df8bae1dSRodney W. Grimes #define	NU_INETADDR	0x1
260df8bae1dSRodney W. Grimes 
261df8bae1dSRodney W. Grimes struct nfssvc_sock {
2626ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfssvc_sock) ns_chain;	/* List of all nfssvc_sock's */
2636ae32407SPoul-Henning Kamp 	TAILQ_HEAD(, nfsuid) ns_uidlruhead;
2646ae32407SPoul-Henning Kamp 	LIST_HEAD(, nfsuid) *ns_uidhashtbl;
2656ae32407SPoul-Henning Kamp 	u_long		ns_uidhash;
2666ae32407SPoul-Henning Kamp 
267df8bae1dSRodney W. Grimes 	int		ns_flag;
268df8bae1dSRodney W. Grimes 	u_long		ns_sref;
269df8bae1dSRodney W. Grimes 	struct file	*ns_fp;
270df8bae1dSRodney W. Grimes 	struct socket	*ns_so;
271df8bae1dSRodney W. Grimes 	int		ns_solock;
272df8bae1dSRodney W. Grimes 	struct mbuf	*ns_nam;
273df8bae1dSRodney W. Grimes 	int		ns_cc;
274df8bae1dSRodney W. Grimes 	struct mbuf	*ns_raw;
275df8bae1dSRodney W. Grimes 	struct mbuf	*ns_rawend;
276df8bae1dSRodney W. Grimes 	int		ns_reclen;
277df8bae1dSRodney W. Grimes 	struct mbuf	*ns_rec;
278df8bae1dSRodney W. Grimes 	struct mbuf	*ns_recend;
279df8bae1dSRodney W. Grimes 	int		ns_numuids;
280df8bae1dSRodney W. Grimes };
281df8bae1dSRodney W. Grimes 
282df8bae1dSRodney W. Grimes /* Bits for "ns_flag" */
283df8bae1dSRodney W. Grimes #define	SLP_VALID	0x01
284df8bae1dSRodney W. Grimes #define	SLP_DOREC	0x02
285df8bae1dSRodney W. Grimes #define	SLP_NEEDQ	0x04
286df8bae1dSRodney W. Grimes #define	SLP_DISCONN	0x08
287df8bae1dSRodney W. Grimes #define	SLP_GETSTREAM	0x10
288df8bae1dSRodney W. Grimes #define SLP_ALLFLAGS	0xff
289df8bae1dSRodney W. Grimes 
2906ae32407SPoul-Henning Kamp TAILQ_HEAD(, nfssvc_sock) nfssvc_sockhead;
2916ae32407SPoul-Henning Kamp int nfssvc_sockhead_flag;
2926ae32407SPoul-Henning Kamp #define	SLP_INIT	0x01
2936ae32407SPoul-Henning Kamp #define	SLP_WANTINIT	0x02
2946ae32407SPoul-Henning Kamp 
295df8bae1dSRodney W. Grimes /*
296df8bae1dSRodney W. Grimes  * One of these structures is allocated for each nfsd.
297df8bae1dSRodney W. Grimes  */
298df8bae1dSRodney W. Grimes struct nfsd {
2996ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfsd) nd_chain;	/* List of all nfsd's */
300df8bae1dSRodney W. Grimes 	int		nd_flag;	/* NFSD_ flags */
301df8bae1dSRodney W. Grimes 	struct nfssvc_sock *nd_slp;	/* Current socket */
302df8bae1dSRodney W. Grimes 	struct mbuf	*nd_nam;	/* Client addr for datagram req. */
303df8bae1dSRodney W. Grimes 	struct mbuf	*nd_mrep;	/* Req. mbuf list */
304df8bae1dSRodney W. Grimes 	struct mbuf	*nd_md;
305df8bae1dSRodney W. Grimes 	caddr_t		nd_dpos;	/* Position in list */
306df8bae1dSRodney W. Grimes 	int		nd_procnum;	/* RPC procedure number */
307df8bae1dSRodney W. Grimes 	u_long		nd_retxid;	/* RPC xid */
308df8bae1dSRodney W. Grimes 	int		nd_repstat;	/* Reply status value */
309df8bae1dSRodney W. Grimes 	struct ucred	nd_cr;		/* Credentials for req. */
310df8bae1dSRodney W. Grimes 	int		nd_nqlflag;	/* Leasing flag */
31148fbb6ccSPoul-Henning Kamp 	u_long		nd_duration;	/* Lease duration */
312df8bae1dSRodney W. Grimes 	int		nd_authlen;	/* Authenticator len */
313df8bae1dSRodney W. Grimes 	u_char		nd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */
314df8bae1dSRodney W. Grimes 	struct proc	*nd_procp;	/* Proc ptr */
315df8bae1dSRodney W. Grimes };
316df8bae1dSRodney W. Grimes 
3176ae32407SPoul-Henning Kamp /* Bits for "nd_flag" */
318df8bae1dSRodney W. Grimes #define	NFSD_WAITING	0x01
3196ae32407SPoul-Henning Kamp #define	NFSD_REQINPROG	0x02
3206ae32407SPoul-Henning Kamp #define	NFSD_NEEDAUTH	0x04
3216ae32407SPoul-Henning Kamp #define	NFSD_AUTHFAIL	0x08
3226ae32407SPoul-Henning Kamp 
3236ae32407SPoul-Henning Kamp TAILQ_HEAD(, nfsd) nfsd_head;
3246ae32407SPoul-Henning Kamp int nfsd_head_flag;
3256ae32407SPoul-Henning Kamp #define	NFSD_CHECKSLP	0x01
32648fbb6ccSPoul-Henning Kamp 
32748fbb6ccSPoul-Henning Kamp int	nfs_reply __P((struct nfsreq *));
32848fbb6ccSPoul-Henning Kamp int	nfs_getreq __P((struct nfsd *,int));
32948fbb6ccSPoul-Henning Kamp int	nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *));
33048fbb6ccSPoul-Henning Kamp int	nfs_rephead __P((int,struct nfsd *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *));
33148fbb6ccSPoul-Henning Kamp int	nfs_sndlock __P((int *,struct nfsreq *));
33248fbb6ccSPoul-Henning Kamp int	nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
33348fbb6ccSPoul-Henning Kamp int	nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int));
33448fbb6ccSPoul-Henning Kamp int	nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *));
33548fbb6ccSPoul-Henning Kamp int	nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int));
33648fbb6ccSPoul-Henning Kamp int	nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *));
33748fbb6ccSPoul-Henning Kamp int	nfs_asyncio __P((struct buf *,struct ucred *));
33848fbb6ccSPoul-Henning Kamp int	nfs_doio __P((struct buf *,struct ucred *,struct proc *));
33948fbb6ccSPoul-Henning Kamp int	nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *));
34048fbb6ccSPoul-Henning Kamp int	nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *));
34148fbb6ccSPoul-Henning Kamp int	nfs_readdirlookrpc __P((struct vnode *,register struct uio *,struct ucred *));
34248fbb6ccSPoul-Henning Kamp int	nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
34348fbb6ccSPoul-Henning Kamp int	nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,struct ucred *,struct nfssvc_sock *,struct mbuf *,int *));
34448fbb6ccSPoul-Henning Kamp int	nfsrv_access __P((struct vnode *,int,struct ucred *,int,struct proc *));
34548fbb6ccSPoul-Henning Kamp int	netaddr_match __P((int,union nethostaddr *,struct mbuf *));
34648fbb6ccSPoul-Henning Kamp int	nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *));
34748fbb6ccSPoul-Henning Kamp int	nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *));
34848fbb6ccSPoul-Henning Kamp int	nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct proc *));
34948fbb6ccSPoul-Henning Kamp void	nfsm_adj __P((struct mbuf *,int,int));
35048fbb6ccSPoul-Henning Kamp int	nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *));
35148fbb6ccSPoul-Henning Kamp void	nfsrv_initcache __P((void));
35248fbb6ccSPoul-Henning Kamp int	nfs_rcvlock __P((struct nfsreq *));
35348fbb6ccSPoul-Henning Kamp int	nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,int *,char **,int *));
35448fbb6ccSPoul-Henning Kamp int	nfs_msg __P((struct proc *,char *,char *));
35548fbb6ccSPoul-Henning Kamp int	nfs_adv __P((struct mbuf **,caddr_t *,int,int));
35648fbb6ccSPoul-Henning Kamp int	nfsrv_getstream __P((struct nfssvc_sock *,int));
35748fbb6ccSPoul-Henning Kamp void	nfs_nhinit __P((void));
35848fbb6ccSPoul-Henning Kamp void	nfs_timer __P((void*));
3596ae32407SPoul-Henning Kamp struct nfsnodehashhead * nfs_hash __P((nfsv2fh_t *));
36048fbb6ccSPoul-Henning Kamp int	nfssvc_iod __P((struct proc *));
36148fbb6ccSPoul-Henning Kamp int	nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
36248fbb6ccSPoul-Henning Kamp int	nfssvc_addsock __P((struct file *,struct mbuf *));
36348fbb6ccSPoul-Henning Kamp int	nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *));
36448fbb6ccSPoul-Henning Kamp int	nfsrv_getcache __P((struct mbuf *,struct nfsd *,struct mbuf **));
36548fbb6ccSPoul-Henning Kamp void	nfsrv_updatecache __P((struct mbuf *,struct nfsd *,int,struct mbuf *));
36648fbb6ccSPoul-Henning Kamp int	mountnfs __P((struct nfs_args *,struct mount *,struct mbuf *,char *,char *,struct vnode **));
36748fbb6ccSPoul-Henning Kamp int	nfs_connect __P((struct nfsmount *,struct nfsreq *));
36848fbb6ccSPoul-Henning Kamp int	nfs_getattrcache __P((struct vnode *,struct vattr *));
36948fbb6ccSPoul-Henning Kamp int	nfsm_strtmbuf __P((struct mbuf **,char **,char *,long));
37048fbb6ccSPoul-Henning Kamp int	nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *));
37148fbb6ccSPoul-Henning Kamp int	nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *));
37248fbb6ccSPoul-Henning Kamp void	nfsrv_init __P((int));
373473e9734SPoul-Henning Kamp int	nfsrv_vput __P(( struct vnode * ));
374473e9734SPoul-Henning Kamp int	nfsrv_vrele __P(( struct vnode * ));
375473e9734SPoul-Henning Kamp int	nfsrv_vmio __P(( struct vnode * ));
376473e9734SPoul-Henning Kamp 
377df8bae1dSRodney W. Grimes #endif	/* KERNEL */
37833420ec6SPaul Richards 
37933420ec6SPaul Richards #endif
380