xref: /freebsd/sys/nfsserver/nfs.h (revision c447342094276b4d604449bb776063c7b88c4992)
1df8bae1dSRodney W. Grimes /*
2996c772fSJohn Dyson  * Copyright (c) 1989, 1993, 1995
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  *
36996c772fSJohn Dyson  *	@(#)nfs.h	8.4 (Berkeley) 5/1/95
37c3aac50fSPeter Wemm  * $FreeBSD$
38df8bae1dSRodney W. Grimes  */
39df8bae1dSRodney W. Grimes 
4033420ec6SPaul Richards #ifndef _NFS_NFS_H_
4133420ec6SPaul Richards #define _NFS_NFS_H_
4233420ec6SPaul Richards 
43c4473420SPeter Wemm #ifdef _KERNEL
44df394affSJohn-Mark Gurney #include "opt_nfs.h"
4556786ee9SJohn-Mark Gurney #endif
46df394affSJohn-Mark Gurney 
47df8bae1dSRodney W. Grimes /*
48df8bae1dSRodney W. Grimes  * Tunable constants for nfs
49df8bae1dSRodney W. Grimes  */
50df8bae1dSRodney W. Grimes 
51df8bae1dSRodney W. Grimes #define	NFS_MAXIOVEC	34
52a62dc406SDoug Rabson #define NFS_TICKINTVL	5		/* Desired time for a tick (msec) */
53a62dc406SDoug Rabson #define NFS_HZ		(hz / nfs_ticks) /* Ticks/sec */
54df8bae1dSRodney W. Grimes #define	NFS_TIMEO	(1 * NFS_HZ)	/* Default timeout = 1 second */
55df8bae1dSRodney W. Grimes #define	NFS_MINTIMEO	(1 * NFS_HZ)	/* Min timeout to use */
56df8bae1dSRodney W. Grimes #define	NFS_MAXTIMEO	(60 * NFS_HZ)	/* Max timeout to backoff to */
57df8bae1dSRodney W. Grimes #define	NFS_MINIDEMTIMEO (5 * NFS_HZ)	/* Min timeout for non-idempotent ops*/
58df8bae1dSRodney W. Grimes #define	NFS_MAXREXMIT	100		/* Stop counting after this many */
59df8bae1dSRodney W. Grimes #define	NFS_MAXWINDOW	1024		/* Max number of outstanding requests */
60df8bae1dSRodney W. Grimes #define	NFS_RETRANS	10		/* Num of retrans for soft mounts */
61df8bae1dSRodney W. Grimes #define	NFS_MAXGRPS	16		/* Max. size of groups list */
62b1b76581SDavid Greenman #ifndef NFS_MINATTRTIMO
63fe6c0d45SPeter Wemm #define	NFS_MINATTRTIMO 3		/* VREG attrib cache timeout in sec */
64b1b76581SDavid Greenman #endif
65b1b76581SDavid Greenman #ifndef NFS_MAXATTRTIMO
66df8bae1dSRodney W. Grimes #define	NFS_MAXATTRTIMO 60
67b1b76581SDavid Greenman #endif
68fe6c0d45SPeter Wemm #ifndef NFS_MINDIRATTRTIMO
69fe6c0d45SPeter Wemm #define	NFS_MINDIRATTRTIMO 30		/* VDIR attrib cache timeout in sec */
70fe6c0d45SPeter Wemm #endif
71fe6c0d45SPeter Wemm #ifndef NFS_MAXDIRATTRTIMO
72fe6c0d45SPeter Wemm #define	NFS_MAXDIRATTRTIMO 60
73fe6c0d45SPeter Wemm #endif
74df8bae1dSRodney W. Grimes #define	NFS_WSIZE	8192		/* Def. write data size <= 8192 */
75df8bae1dSRodney W. Grimes #define	NFS_RSIZE	8192		/* Def. read data size <= 8192 */
76a62dc406SDoug Rabson #define NFS_READDIRSIZE	8192		/* Def. readdir size */
77df8bae1dSRodney W. Grimes #define	NFS_DEFRAHEAD	1		/* Def. read ahead # blocks */
78df8bae1dSRodney W. Grimes #define	NFS_MAXRAHEAD	4		/* Max. read ahead # blocks */
79df8bae1dSRodney W. Grimes #define	NFS_MAXUIDHASH	64		/* Max. # of hashed uid entries/mp */
8000780cefSBruce Evans #define	NFS_MAXASYNCDAEMON 	20	/* Max. number async_daemons runnable */
81a62dc406SDoug Rabson #define NFS_MAXGATHERDELAY	100	/* Max. write gather delay (msec) */
82a62dc406SDoug Rabson #ifndef NFS_GATHERDELAY
83a62dc406SDoug Rabson #define NFS_GATHERDELAY		10	/* Default write gather delay (msec) */
84a62dc406SDoug Rabson #endif
85a62dc406SDoug Rabson #define	NFS_DIRBLKSIZ	4096		/* Must be a multiple of DIRBLKSIZ */
86c4473420SPeter Wemm #ifdef _KERNEL
8700780cefSBruce Evans #define	DIRBLKSIZ	512		/* XXX we used to use ufs's DIRBLKSIZ */
8800780cefSBruce Evans #endif
89a62dc406SDoug Rabson 
90a62dc406SDoug Rabson /*
91a62dc406SDoug Rabson  * Oddballs
92a62dc406SDoug Rabson  */
93df8bae1dSRodney W. Grimes #define	NMOD(a)		((a) % nfs_asyncdaemons)
94a62dc406SDoug Rabson #define NFS_CMPFH(n, f, s) \
95a62dc406SDoug Rabson 	((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
96a62dc406SDoug Rabson #define NFS_ISV3(v)	(VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
97a62dc406SDoug Rabson #define NFS_SRVMAXDATA(n) \
98a62dc406SDoug Rabson 		(((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \
99a62dc406SDoug Rabson 		 NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
100a62dc406SDoug Rabson 
101a62dc406SDoug Rabson /*
102a62dc406SDoug Rabson  * XXX
103a62dc406SDoug Rabson  * The B_INVAFTERWRITE flag should be set to whatever is required by the
104a62dc406SDoug Rabson  * buffer cache code to say "Invalidate the block after it is written back".
105a62dc406SDoug Rabson  */
106a62dc406SDoug Rabson #define	B_INVAFTERWRITE	B_NOCACHE
107a62dc406SDoug Rabson 
108a62dc406SDoug Rabson /*
109a62dc406SDoug Rabson  * The IO_METASYNC flag should be implemented for local file systems.
110a62dc406SDoug Rabson  * (Until then, it is nothin at all.)
111a62dc406SDoug Rabson  */
112a62dc406SDoug Rabson #ifndef IO_METASYNC
113a62dc406SDoug Rabson #define IO_METASYNC	0
114a62dc406SDoug Rabson #endif
115df8bae1dSRodney W. Grimes 
116df8bae1dSRodney W. Grimes /*
117a62dc406SDoug Rabson  * Expected allocation sizes for major data structures. If the actual size
118a62dc406SDoug Rabson  * of the structure exceeds these sizes, then malloc() will be allocating
119a62dc406SDoug Rabson  * almost twice the memory required. This is used in nfs_init() to warn
120a62dc406SDoug Rabson  * the sysadmin that the size of a structure should be reduced.
121a62dc406SDoug Rabson  * (These sizes are always a power of 2. If the kernel malloc() changes
122a62dc406SDoug Rabson  *  to one that does not allocate space in powers of 2 size, then this all
123a62dc406SDoug Rabson  *  becomes bunk!)
124a62dc406SDoug Rabson  */
125a62dc406SDoug Rabson #define NFS_SVCALLOC	256
126a62dc406SDoug Rabson #define NFS_UIDALLOC	128
127a62dc406SDoug Rabson 
128996c772fSJohn Dyson /*
129996c772fSJohn Dyson  * Arguments to mount NFS
130996c772fSJohn Dyson  */
131996c772fSJohn Dyson #define NFS_ARGSVERSION	3		/* change when nfs_args changes */
132996c772fSJohn Dyson struct nfs_args {
133996c772fSJohn Dyson 	int		version;	/* args structure version number */
134996c772fSJohn Dyson 	struct sockaddr	*addr;		/* file server address */
135996c772fSJohn Dyson 	int		addrlen;	/* length of address */
136996c772fSJohn Dyson 	int		sotype;		/* Socket type */
137996c772fSJohn Dyson 	int		proto;		/* and Protocol */
138996c772fSJohn Dyson 	u_char		*fh;		/* File handle to be mounted */
139996c772fSJohn Dyson 	int		fhsize;		/* Size, in bytes, of fh */
140996c772fSJohn Dyson 	int		flags;		/* flags */
141996c772fSJohn Dyson 	int		wsize;		/* write size in bytes */
142996c772fSJohn Dyson 	int		rsize;		/* read size in bytes */
143996c772fSJohn Dyson 	int		readdirsize;	/* readdir size in bytes */
144996c772fSJohn Dyson 	int		timeo;		/* initial timeout in .1 secs */
145996c772fSJohn Dyson 	int		retrans;	/* times to retry send */
146996c772fSJohn Dyson 	int		maxgrouplist;	/* Max. size of group list */
147996c772fSJohn Dyson 	int		readahead;	/* # of blocks to readahead */
148996c772fSJohn Dyson 	int		leaseterm;	/* Term (sec) of lease */
149996c772fSJohn Dyson 	int		deadthresh;	/* Retrans threshold */
150996c772fSJohn Dyson 	char		*hostname;	/* server's name */
151fe6c0d45SPeter Wemm 	int		acregmin;	/* cache attrs for reg files min time */
152fe6c0d45SPeter Wemm 	int		acregmax;	/* cache attrs for reg files max time */
153fe6c0d45SPeter Wemm 	int		acdirmin;	/* cache attrs for dirs min time */
154fe6c0d45SPeter Wemm 	int		acdirmax;	/* cache attrs for dirs max time */
155996c772fSJohn Dyson };
156996c772fSJohn Dyson 
157996c772fSJohn Dyson /*
158996c772fSJohn Dyson  * NFS mount option flags
159996c772fSJohn Dyson  */
160996c772fSJohn Dyson #define	NFSMNT_SOFT		0x00000001  /* soft mount (hard is default) */
161996c772fSJohn Dyson #define	NFSMNT_WSIZE		0x00000002  /* set write size */
162996c772fSJohn Dyson #define	NFSMNT_RSIZE		0x00000004  /* set read size */
163996c772fSJohn Dyson #define	NFSMNT_TIMEO		0x00000008  /* set initial timeout */
164996c772fSJohn Dyson #define	NFSMNT_RETRANS		0x00000010  /* set number of request retries */
165996c772fSJohn Dyson #define	NFSMNT_MAXGRPS		0x00000020  /* set maximum grouplist size */
166996c772fSJohn Dyson #define	NFSMNT_INT		0x00000040  /* allow interrupts on hard mount */
167996c772fSJohn Dyson #define	NFSMNT_NOCONN		0x00000080  /* Don't Connect the socket */
168996c772fSJohn Dyson #define	NFSMNT_NQNFS		0x00000100  /* Use Nqnfs protocol */
169996c772fSJohn Dyson #define	NFSMNT_NFSV3		0x00000200  /* Use NFS Version 3 protocol */
170996c772fSJohn Dyson #define	NFSMNT_KERB		0x00000400  /* Use Kerberos authentication */
171996c772fSJohn Dyson #define	NFSMNT_DUMBTIMR		0x00000800  /* Don't estimate rtt dynamically */
172996c772fSJohn Dyson #define	NFSMNT_LEASETERM	0x00001000  /* set lease term (nqnfs) */
173996c772fSJohn Dyson #define	NFSMNT_READAHEAD	0x00002000  /* set read ahead */
174996c772fSJohn Dyson #define	NFSMNT_DEADTHRESH	0x00004000  /* set dead server retry thresh */
175996c772fSJohn Dyson #define	NFSMNT_RESVPORT		0x00008000  /* Allocate a reserved port */
176996c772fSJohn Dyson #define	NFSMNT_RDIRPLUS		0x00010000  /* Use Readdirplus for V3 */
177996c772fSJohn Dyson #define	NFSMNT_READDIRSIZE	0x00020000  /* Set readdir size */
178fe6c0d45SPeter Wemm #define	NFSMNT_ACREGMIN		0x00040000
179fe6c0d45SPeter Wemm #define	NFSMNT_ACREGMAX		0x00080000
180fe6c0d45SPeter Wemm #define	NFSMNT_ACDIRMIN		0x00100000
181fe6c0d45SPeter Wemm #define	NFSMNT_ACDIRMAX		0x00200000
182fe6c0d45SPeter Wemm 
183fe6c0d45SPeter Wemm #define NFSSTA_HASWRITEVERF	0x00040000  /* Has write verifier for V3 */
184fe6c0d45SPeter Wemm #define NFSSTA_GOTPATHCONF	0x00080000  /* Got the V3 pathconf info */
185fe6c0d45SPeter Wemm #define NFSSTA_GOTFSINFO	0x00100000  /* Got the V3 fsinfo */
186fe6c0d45SPeter Wemm #define	NFSSTA_MNTD		0x00200000  /* Mnt server for mnt point */
187fe6c0d45SPeter Wemm #define	NFSSTA_DISMINPROG	0x00400000  /* Dismount in progress */
188fe6c0d45SPeter Wemm #define	NFSSTA_DISMNT		0x00800000  /* Dismounted */
189fe6c0d45SPeter Wemm #define	NFSSTA_SNDLOCK		0x01000000  /* Send socket lock */
190fe6c0d45SPeter Wemm #define	NFSSTA_WANTSND		0x02000000  /* Want above */
191fe6c0d45SPeter Wemm #define	NFSSTA_RCVLOCK		0x04000000  /* Rcv socket lock */
192fe6c0d45SPeter Wemm #define	NFSSTA_WANTRCV		0x08000000  /* Want above */
193fe6c0d45SPeter Wemm #define	NFSSTA_WAITAUTH		0x10000000  /* Wait for authentication */
194fe6c0d45SPeter Wemm #define	NFSSTA_HASAUTH		0x20000000  /* Has authenticator */
195fe6c0d45SPeter Wemm #define	NFSSTA_WANTAUTH		0x40000000  /* Wants an authenticator */
196fe6c0d45SPeter Wemm #define	NFSSTA_AUTHERR		0x80000000  /* Authentication error */
197996c772fSJohn Dyson 
198a62dc406SDoug Rabson /*
199df8bae1dSRodney W. Grimes  * Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
200df8bae1dSRodney W. Grimes  * should ever try and use it.
201df8bae1dSRodney W. Grimes  */
202df8bae1dSRodney W. Grimes struct nfsd_args {
203df8bae1dSRodney W. Grimes 	int	sock;		/* Socket to serve */
204996c772fSJohn Dyson 	caddr_t	name;		/* Client addr for connection based sockets */
205df8bae1dSRodney W. Grimes 	int	namelen;	/* Length of name */
206df8bae1dSRodney W. Grimes };
207df8bae1dSRodney W. Grimes 
208df8bae1dSRodney W. Grimes struct nfsd_srvargs {
209df8bae1dSRodney W. Grimes 	struct nfsd	*nsd_nfsd;	/* Pointer to in kernel nfsd struct */
210df8bae1dSRodney W. Grimes 	uid_t		nsd_uid;	/* Effective uid mapped to cred */
2114152886fSPeter Wemm 	u_int32_t	nsd_haddr;	/* Ip address of client */
212df8bae1dSRodney W. Grimes 	struct ucred	nsd_cr;		/* Cred. uid maps to */
213df8bae1dSRodney W. Grimes 	int		nsd_authlen;	/* Length of auth string (ret) */
214a62dc406SDoug Rabson 	u_char		*nsd_authstr;	/* Auth string (ret) */
215a62dc406SDoug Rabson 	int		nsd_verflen;	/* and the verfier */
216a62dc406SDoug Rabson 	u_char		*nsd_verfstr;
217a62dc406SDoug Rabson 	struct timeval	nsd_timestamp;	/* timestamp from verifier */
2184152886fSPeter Wemm 	u_int32_t	nsd_ttl;	/* credential ttl (sec) */
219a62dc406SDoug Rabson 	NFSKERBKEY_T	nsd_key;	/* Session key */
220df8bae1dSRodney W. Grimes };
221df8bae1dSRodney W. Grimes 
222df8bae1dSRodney W. Grimes struct nfsd_cargs {
223df8bae1dSRodney W. Grimes 	char		*ncd_dirp;	/* Mount dir path */
224df8bae1dSRodney W. Grimes 	uid_t		ncd_authuid;	/* Effective uid */
225df8bae1dSRodney W. Grimes 	int		ncd_authtype;	/* Type of authenticator */
226df8bae1dSRodney W. Grimes 	int		ncd_authlen;	/* Length of authenticator string */
227a62dc406SDoug Rabson 	u_char		*ncd_authstr;	/* Authenticator string */
228a62dc406SDoug Rabson 	int		ncd_verflen;	/* and the verifier */
229a62dc406SDoug Rabson 	u_char		*ncd_verfstr;
230a62dc406SDoug Rabson 	NFSKERBKEY_T	ncd_key;	/* Session key */
231df8bae1dSRodney W. Grimes };
232df8bae1dSRodney W. Grimes 
233df8bae1dSRodney W. Grimes /*
234996c772fSJohn Dyson  * XXX to allow amd to include nfs.h without nfsproto.h
235996c772fSJohn Dyson  */
236996c772fSJohn Dyson #ifdef NFS_NPROCS
237996c772fSJohn Dyson /*
238df8bae1dSRodney W. Grimes  * Stats structure
239df8bae1dSRodney W. Grimes  */
240df8bae1dSRodney W. Grimes struct nfsstats {
241df8bae1dSRodney W. Grimes 	int	attrcache_hits;
242df8bae1dSRodney W. Grimes 	int	attrcache_misses;
243df8bae1dSRodney W. Grimes 	int	lookupcache_hits;
244df8bae1dSRodney W. Grimes 	int	lookupcache_misses;
245df8bae1dSRodney W. Grimes 	int	direofcache_hits;
246df8bae1dSRodney W. Grimes 	int	direofcache_misses;
247df8bae1dSRodney W. Grimes 	int	biocache_reads;
248df8bae1dSRodney W. Grimes 	int	read_bios;
249df8bae1dSRodney W. Grimes 	int	read_physios;
250df8bae1dSRodney W. Grimes 	int	biocache_writes;
251df8bae1dSRodney W. Grimes 	int	write_bios;
252df8bae1dSRodney W. Grimes 	int	write_physios;
253df8bae1dSRodney W. Grimes 	int	biocache_readlinks;
254df8bae1dSRodney W. Grimes 	int	readlink_bios;
255df8bae1dSRodney W. Grimes 	int	biocache_readdirs;
256df8bae1dSRodney W. Grimes 	int	readdir_bios;
257df8bae1dSRodney W. Grimes 	int	rpccnt[NFS_NPROCS];
258df8bae1dSRodney W. Grimes 	int	rpcretries;
259df8bae1dSRodney W. Grimes 	int	srvrpccnt[NFS_NPROCS];
260df8bae1dSRodney W. Grimes 	int	srvrpc_errs;
261df8bae1dSRodney W. Grimes 	int	srv_errs;
262df8bae1dSRodney W. Grimes 	int	rpcrequests;
263df8bae1dSRodney W. Grimes 	int	rpctimeouts;
264df8bae1dSRodney W. Grimes 	int	rpcunexpected;
265df8bae1dSRodney W. Grimes 	int	rpcinvalid;
266df8bae1dSRodney W. Grimes 	int	srvcache_inproghits;
267df8bae1dSRodney W. Grimes 	int	srvcache_idemdonehits;
268df8bae1dSRodney W. Grimes 	int	srvcache_nonidemdonehits;
269df8bae1dSRodney W. Grimes 	int	srvcache_misses;
270df8bae1dSRodney W. Grimes 	int	srvnqnfs_leases;
271df8bae1dSRodney W. Grimes 	int	srvnqnfs_maxleases;
272df8bae1dSRodney W. Grimes 	int	srvnqnfs_getleases;
273a62dc406SDoug Rabson 	int	srvvop_writes;
274a5d3fe3fSMatthew Dillon 	int	accesscache_hits;
275a5d3fe3fSMatthew Dillon 	int	accesscache_misses;
276df8bae1dSRodney W. Grimes };
277996c772fSJohn Dyson #endif
278df8bae1dSRodney W. Grimes 
279df8bae1dSRodney W. Grimes /*
280df8bae1dSRodney W. Grimes  * Flags for nfssvc() system call.
281df8bae1dSRodney W. Grimes  */
282df8bae1dSRodney W. Grimes #define	NFSSVC_BIOD	0x002
283df8bae1dSRodney W. Grimes #define	NFSSVC_NFSD	0x004
284df8bae1dSRodney W. Grimes #define	NFSSVC_ADDSOCK	0x008
285df8bae1dSRodney W. Grimes #define	NFSSVC_AUTHIN	0x010
286df8bae1dSRodney W. Grimes #define	NFSSVC_GOTAUTH	0x040
287df8bae1dSRodney W. Grimes #define	NFSSVC_AUTHINFAIL 0x080
288df8bae1dSRodney W. Grimes #define	NFSSVC_MNTD	0x100
289df8bae1dSRodney W. Grimes 
290df8bae1dSRodney W. Grimes /*
291b43e29afSGarrett Wollman  * fs.nfs sysctl(3) identifiers
292b43e29afSGarrett Wollman  */
293b43e29afSGarrett Wollman #define NFS_NFSSTATS	1		/* struct: struct nfsstats */
294394da4c1SGuido van Rooij #define NFS_NFSPRIVPORT	2		/* int: prohibit nfs to resvports */
295b43e29afSGarrett Wollman 
296b43e29afSGarrett Wollman #define FS_NFS_NAMES { \
297b43e29afSGarrett Wollman 		       { 0, 0 }, \
298b43e29afSGarrett Wollman 		       { "nfsstats", CTLTYPE_STRUCT }, \
299394da4c1SGuido van Rooij 		       { "nfsprivport", CTLTYPE_INT }, \
300b43e29afSGarrett Wollman }
301b43e29afSGarrett Wollman 
302c4473420SPeter Wemm #ifdef _KERNEL
303d9e91095SGarrett Wollman 
304a1c995b6SPoul-Henning Kamp #ifdef MALLOC_DECLARE
305a1c995b6SPoul-Henning Kamp MALLOC_DECLARE(M_NFSREQ);
306a1c995b6SPoul-Henning Kamp MALLOC_DECLARE(M_NFSDIROFF);
307a1c995b6SPoul-Henning Kamp MALLOC_DECLARE(M_NFSRVDESC);
308a1c995b6SPoul-Henning Kamp MALLOC_DECLARE(M_NFSUID);
309a1c995b6SPoul-Henning Kamp MALLOC_DECLARE(M_NQLEASE);
310a1c995b6SPoul-Henning Kamp MALLOC_DECLARE(M_NFSD);
311a1c995b6SPoul-Henning Kamp MALLOC_DECLARE(M_NFSBIGFH);
3120d7d0fcfSPeter Wemm MALLOC_DECLARE(M_NFSHASH);
3130d7d0fcfSPeter Wemm #endif
3140d7d0fcfSPeter Wemm 
3150d7d0fcfSPeter Wemm #ifdef ZONE_INTERRUPT
3160d7d0fcfSPeter Wemm extern vm_zone_t nfsmount_zone;
317a1c995b6SPoul-Henning Kamp #endif
318a1c995b6SPoul-Henning Kamp 
319cae300beSBruce Evans extern struct callout_handle nfs_timer_handle;
320cae300beSBruce Evans 
321d9e91095SGarrett Wollman struct uio; struct buf; struct vattr; struct nameidata;	/* XXX */
322d9e91095SGarrett Wollman 
323bc3de552SBruce Evans /*
324bc3de552SBruce Evans  * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
325bc3de552SBruce Evans  * What should be in this set is open to debate, but I believe that since
326bc3de552SBruce Evans  * I/O system calls on ufs are never interrupted by signals the set should
327bc3de552SBruce Evans  * be minimal. My reasoning is that many current programs that use signals
328bc3de552SBruce Evans  * such as SIGALRM will not expect file I/O system calls to be interrupted
329bc3de552SBruce Evans  * by them and break.
330bc3de552SBruce Evans  */
3312c42a146SMarcel Moolenaar #define	NFSINT_SIGMASK(set) 						\
3322c42a146SMarcel Moolenaar 	(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) ||	\
3332c42a146SMarcel Moolenaar 	 SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) ||	\
3342c42a146SMarcel Moolenaar 	 SIGISMEMBER(set, SIGQUIT))
335df8bae1dSRodney W. Grimes 
336df8bae1dSRodney W. Grimes /*
337df8bae1dSRodney W. Grimes  * Socket errors ignored for connectionless sockets??
338df8bae1dSRodney W. Grimes  * For now, ignore them all
339df8bae1dSRodney W. Grimes  */
340df8bae1dSRodney W. Grimes #define	NFSIGNORE_SOERROR(s, e) \
341df8bae1dSRodney W. Grimes 		((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
342df8bae1dSRodney W. Grimes 		((s) & PR_CONNREQUIRED) == 0)
343df8bae1dSRodney W. Grimes 
344df8bae1dSRodney W. Grimes /*
345df8bae1dSRodney W. Grimes  * Nfs outstanding request list element
346df8bae1dSRodney W. Grimes  */
347df8bae1dSRodney W. Grimes struct nfsreq {
3486ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfsreq) r_chain;
349df8bae1dSRodney W. Grimes 	struct mbuf	*r_mreq;
350df8bae1dSRodney W. Grimes 	struct mbuf	*r_mrep;
351df8bae1dSRodney W. Grimes 	struct mbuf	*r_md;
352df8bae1dSRodney W. Grimes 	caddr_t		r_dpos;
353df8bae1dSRodney W. Grimes 	struct nfsmount *r_nmp;
354df8bae1dSRodney W. Grimes 	struct vnode	*r_vp;
3554152886fSPeter Wemm 	u_int32_t	r_xid;
356df8bae1dSRodney W. Grimes 	int		r_flags;	/* flags on request, see below */
357df8bae1dSRodney W. Grimes 	int		r_retry;	/* max retransmission count */
358df8bae1dSRodney W. Grimes 	int		r_rexmit;	/* current retrans count */
359df8bae1dSRodney W. Grimes 	int		r_timer;	/* tick counter on reply */
3607d6b68c4SDoug Rabson 	u_int32_t	r_procnum;	/* NFS procedure number */
361df8bae1dSRodney W. Grimes 	int		r_rtt;		/* RTT for rpc */
362df8bae1dSRodney W. Grimes 	struct proc	*r_procp;	/* Proc that did I/O system call */
363df8bae1dSRodney W. Grimes };
364df8bae1dSRodney W. Grimes 
3656ae32407SPoul-Henning Kamp /*
3666ae32407SPoul-Henning Kamp  * Queue head for nfsreq's
3676ae32407SPoul-Henning Kamp  */
36828f8db14SBruce Evans extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
3696ae32407SPoul-Henning Kamp 
370df8bae1dSRodney W. Grimes /* Flag values for r_flags */
371df8bae1dSRodney W. Grimes #define R_TIMING	0x01		/* timing request (in mntp) */
372df8bae1dSRodney W. Grimes #define R_SENT		0x02		/* request has been sent */
373df8bae1dSRodney W. Grimes #define	R_SOFTTERM	0x04		/* soft mnt, too many retries */
374df8bae1dSRodney W. Grimes #define	R_INTR		0x08		/* intr mnt, signal pending */
375df8bae1dSRodney W. Grimes #define	R_SOCKERR	0x10		/* Fatal error on socket */
376df8bae1dSRodney W. Grimes #define	R_TPRINTFMSG	0x20		/* Did a tprintf msg. */
377df8bae1dSRodney W. Grimes #define	R_MUSTRESEND	0x40		/* Must resend request */
378df8bae1dSRodney W. Grimes #define	R_GETONEREP	0x80		/* Probe for one reply only */
379df8bae1dSRodney W. Grimes 
380df8bae1dSRodney W. Grimes /*
381df8bae1dSRodney W. Grimes  * A list of nfssvc_sock structures is maintained with all the sockets
382df8bae1dSRodney W. Grimes  * that require service by the nfsd.
383df8bae1dSRodney W. Grimes  * The nfsuid structs hang off of the nfssvc_sock structs in both lru
384df8bae1dSRodney W. Grimes  * and uid hash lists.
385df8bae1dSRodney W. Grimes  */
386a62dc406SDoug Rabson #ifndef NFS_UIDHASHSIZ
387a62dc406SDoug Rabson #define	NFS_UIDHASHSIZ	29	/* Tune the size of nfssvc_sock with this */
388a62dc406SDoug Rabson #endif
3896ae32407SPoul-Henning Kamp #define	NUIDHASH(sock, uid) \
390a62dc406SDoug Rabson 	(&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ])
391a62dc406SDoug Rabson #ifndef NFS_WDELAYHASHSIZ
392a62dc406SDoug Rabson #define	NFS_WDELAYHASHSIZ 16	/* and with this */
393a62dc406SDoug Rabson #endif
394a62dc406SDoug Rabson #define	NWDELAYHASH(sock, f) \
3954152886fSPeter Wemm 	(&(sock)->ns_wdelayhashtbl[(*((u_int32_t *)(f))) % NFS_WDELAYHASHSIZ])
396a62dc406SDoug Rabson #ifndef NFS_MUIDHASHSIZ
397f438ae02SDoug Rabson #define NFS_MUIDHASHSIZ	63	/* Tune the size of nfsmount with this */
398a62dc406SDoug Rabson #endif
399a62dc406SDoug Rabson #define	NMUIDHASH(nmp, uid) \
400a62dc406SDoug Rabson 	(&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ])
401a62dc406SDoug Rabson #define	NFSNOHASH(fhsum) \
402a62dc406SDoug Rabson 	(&nfsnodehashtbl[(fhsum) & nfsnodehash])
403df8bae1dSRodney W. Grimes 
404e8cf20c8SPeter Wemm /*
405e8cf20c8SPeter Wemm  * Network address hash list element
406e8cf20c8SPeter Wemm  */
407e8cf20c8SPeter Wemm union nethostaddr {
4084152886fSPeter Wemm 	u_int32_t had_inetaddr;
409e8cf20c8SPeter Wemm 	struct sockaddr *had_nam;
410e8cf20c8SPeter Wemm };
411e8cf20c8SPeter Wemm 
412df8bae1dSRodney W. Grimes struct nfsuid {
4136ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfsuid) nu_lru;	/* LRU chain */
4146ae32407SPoul-Henning Kamp 	LIST_ENTRY(nfsuid) nu_hash;	/* Hash list */
415df8bae1dSRodney W. Grimes 	int		nu_flag;	/* Flags */
416df8bae1dSRodney W. Grimes 	union nethostaddr nu_haddr;	/* Host addr. for dgram sockets */
417df8bae1dSRodney W. Grimes 	struct ucred	nu_cr;		/* Cred uid mapped to */
418a62dc406SDoug Rabson 	int		nu_expire;	/* Expiry time (sec) */
419a62dc406SDoug Rabson 	struct timeval	nu_timestamp;	/* Kerb. timestamp */
4204152886fSPeter Wemm 	u_int32_t	nu_nickname;	/* Nickname on server */
421a62dc406SDoug Rabson 	NFSKERBKEY_T	nu_key;		/* and session key */
422df8bae1dSRodney W. Grimes };
423df8bae1dSRodney W. Grimes 
424df8bae1dSRodney W. Grimes #define	nu_inetaddr	nu_haddr.had_inetaddr
425df8bae1dSRodney W. Grimes #define	nu_nam		nu_haddr.had_nam
426df8bae1dSRodney W. Grimes /* Bits for nu_flag */
427df8bae1dSRodney W. Grimes #define	NU_INETADDR	0x1
428a62dc406SDoug Rabson #define NU_NAM		0x2
429a62dc406SDoug Rabson #define NU_NETFAM(u)	(((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO)
430df8bae1dSRodney W. Grimes 
431cb934d56SDoug Rabson struct nfsrv_rec {
432cb934d56SDoug Rabson 	STAILQ_ENTRY(nfsrv_rec) nr_link;
43357bf258eSGarrett Wollman 	struct sockaddr	*nr_address;
434cb934d56SDoug Rabson 	struct mbuf	*nr_packet;
435cb934d56SDoug Rabson };
436cb934d56SDoug Rabson 
437df8bae1dSRodney W. Grimes struct nfssvc_sock {
4386ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfssvc_sock) ns_chain;	/* List of all nfssvc_sock's */
4396ae32407SPoul-Henning Kamp 	TAILQ_HEAD(, nfsuid) ns_uidlruhead;
440df8bae1dSRodney W. Grimes 	struct file	*ns_fp;
441df8bae1dSRodney W. Grimes 	struct socket	*ns_so;
44257bf258eSGarrett Wollman 	struct sockaddr	*ns_nam;
443df8bae1dSRodney W. Grimes 	struct mbuf	*ns_raw;
444df8bae1dSRodney W. Grimes 	struct mbuf	*ns_rawend;
445cb934d56SDoug Rabson 	STAILQ_HEAD(, nfsrv_rec) ns_rec;
446a62dc406SDoug Rabson 	struct mbuf	*ns_frag;
447a62dc406SDoug Rabson 	int		ns_flag;
448a62dc406SDoug Rabson 	int		ns_solock;
449a62dc406SDoug Rabson 	int		ns_cc;
450a62dc406SDoug Rabson 	int		ns_reclen;
451df8bae1dSRodney W. Grimes 	int		ns_numuids;
4524152886fSPeter Wemm 	u_int32_t	ns_sref;
453a62dc406SDoug Rabson 	LIST_HEAD(, nfsrv_descript) ns_tq;	/* Write gather lists */
454a62dc406SDoug Rabson 	LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ];
455a62dc406SDoug Rabson 	LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ];
456df8bae1dSRodney W. Grimes };
457df8bae1dSRodney W. Grimes 
458df8bae1dSRodney W. Grimes /* Bits for "ns_flag" */
459df8bae1dSRodney W. Grimes #define	SLP_VALID	0x01
460df8bae1dSRodney W. Grimes #define	SLP_DOREC	0x02
461df8bae1dSRodney W. Grimes #define	SLP_NEEDQ	0x04
462df8bae1dSRodney W. Grimes #define	SLP_DISCONN	0x08
463df8bae1dSRodney W. Grimes #define	SLP_GETSTREAM	0x10
464a62dc406SDoug Rabson #define	SLP_LASTFRAG	0x20
465df8bae1dSRodney W. Grimes #define SLP_ALLFLAGS	0xff
466df8bae1dSRodney W. Grimes 
46728f8db14SBruce Evans extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead;
46828f8db14SBruce Evans extern int nfssvc_sockhead_flag;
4696ae32407SPoul-Henning Kamp #define	SLP_INIT	0x01
4706ae32407SPoul-Henning Kamp #define	SLP_WANTINIT	0x02
4716ae32407SPoul-Henning Kamp 
472df8bae1dSRodney W. Grimes /*
473df8bae1dSRodney W. Grimes  * One of these structures is allocated for each nfsd.
474df8bae1dSRodney W. Grimes  */
475df8bae1dSRodney W. Grimes struct nfsd {
476a62dc406SDoug Rabson 	TAILQ_ENTRY(nfsd) nfsd_chain;	/* List of all nfsd's */
477a62dc406SDoug Rabson 	int		nfsd_flag;	/* NFSD_ flags */
478a62dc406SDoug Rabson 	struct nfssvc_sock *nfsd_slp;	/* Current socket */
479a62dc406SDoug Rabson 	int		nfsd_authlen;	/* Authenticator len */
480a62dc406SDoug Rabson 	u_char		nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */
481a62dc406SDoug Rabson 	int		nfsd_verflen;	/* and the Verifier */
482a62dc406SDoug Rabson 	u_char		nfsd_verfstr[RPCVERF_MAXSIZ];
483a62dc406SDoug Rabson 	struct proc	*nfsd_procp;	/* Proc ptr */
484a62dc406SDoug Rabson 	struct nfsrv_descript *nfsd_nd;	/* Associated nfsrv_descript */
485df8bae1dSRodney W. Grimes };
486df8bae1dSRodney W. Grimes 
487a62dc406SDoug Rabson /* Bits for "nfsd_flag" */
488df8bae1dSRodney W. Grimes #define	NFSD_WAITING	0x01
4896ae32407SPoul-Henning Kamp #define	NFSD_REQINPROG	0x02
4906ae32407SPoul-Henning Kamp #define	NFSD_NEEDAUTH	0x04
4916ae32407SPoul-Henning Kamp #define	NFSD_AUTHFAIL	0x08
4926ae32407SPoul-Henning Kamp 
493a62dc406SDoug Rabson /*
494a62dc406SDoug Rabson  * This structure is used by the server for describing each request.
495a62dc406SDoug Rabson  * Some fields are used only when write request gathering is performed.
496a62dc406SDoug Rabson  */
497a62dc406SDoug Rabson struct nfsrv_descript {
498a62dc406SDoug Rabson 	u_quad_t		nd_time;	/* Write deadline (usec) */
499a62dc406SDoug Rabson 	off_t			nd_off;		/* Start byte offset */
500a62dc406SDoug Rabson 	off_t			nd_eoff;	/* and end byte offset */
501a62dc406SDoug Rabson 	LIST_ENTRY(nfsrv_descript) nd_hash;	/* Hash list */
502a62dc406SDoug Rabson 	LIST_ENTRY(nfsrv_descript) nd_tq;		/* and timer list */
503a62dc406SDoug Rabson 	LIST_HEAD(,nfsrv_descript) nd_coalesce;	/* coalesced writes */
504a62dc406SDoug Rabson 	struct mbuf		*nd_mrep;	/* Request mbuf list */
505a62dc406SDoug Rabson 	struct mbuf		*nd_md;		/* Current dissect mbuf */
506a62dc406SDoug Rabson 	struct mbuf		*nd_mreq;	/* Reply mbuf list */
50757bf258eSGarrett Wollman 	struct sockaddr		*nd_nam;	/* and socket addr */
50857bf258eSGarrett Wollman 	struct sockaddr		*nd_nam2;	/* return socket addr */
509a62dc406SDoug Rabson 	caddr_t			nd_dpos;	/* Current dissect pos */
5107d6b68c4SDoug Rabson 	u_int32_t		nd_procnum;	/* RPC # */
511a62dc406SDoug Rabson 	int			nd_stable;	/* storage type */
512a62dc406SDoug Rabson 	int			nd_flag;	/* nd_flag */
513a62dc406SDoug Rabson 	int			nd_len;		/* Length of this write */
514a62dc406SDoug Rabson 	int			nd_repstat;	/* Reply status */
5154152886fSPeter Wemm 	u_int32_t		nd_retxid;	/* Reply xid */
5164152886fSPeter Wemm 	u_int32_t		nd_duration;	/* Lease duration */
517a62dc406SDoug Rabson 	struct timeval		nd_starttime;	/* Time RPC initiated */
518a62dc406SDoug Rabson 	fhandle_t		nd_fh;		/* File handle */
519a62dc406SDoug Rabson 	struct ucred		nd_cr;		/* Credentials */
520a62dc406SDoug Rabson };
521a62dc406SDoug Rabson 
522a62dc406SDoug Rabson /* Bits for "nd_flag" */
523a62dc406SDoug Rabson #define	ND_READ		LEASE_READ
524a62dc406SDoug Rabson #define ND_WRITE	LEASE_WRITE
525a62dc406SDoug Rabson #define ND_CHECK	0x04
526a62dc406SDoug Rabson #define ND_LEASE	(ND_READ | ND_WRITE | ND_CHECK)
527a62dc406SDoug Rabson #define ND_NFSV3	0x08
528a62dc406SDoug Rabson #define ND_NQNFS	0x10
529a62dc406SDoug Rabson #define ND_KERBNICK	0x20
530a62dc406SDoug Rabson #define ND_KERBFULL	0x40
531a62dc406SDoug Rabson #define ND_KERBAUTH	(ND_KERBNICK | ND_KERBFULL)
532a62dc406SDoug Rabson 
53328f8db14SBruce Evans extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head;
53428f8db14SBruce Evans extern int nfsd_head_flag;
5356ae32407SPoul-Henning Kamp #define	NFSD_CHECKSLP	0x01
53648fbb6ccSPoul-Henning Kamp 
537a62dc406SDoug Rabson /*
538a62dc406SDoug Rabson  * These macros compare nfsrv_descript structures.
539a62dc406SDoug Rabson  */
540a62dc406SDoug Rabson #define NFSW_CONTIG(o, n) \
541a62dc406SDoug Rabson 		((o)->nd_eoff >= (n)->nd_off && \
542a62dc406SDoug Rabson 		 !bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, NFSX_V3FH))
543a62dc406SDoug Rabson 
544a62dc406SDoug Rabson #define NFSW_SAMECRED(o, n) \
545a62dc406SDoug Rabson 	(((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \
546a62dc406SDoug Rabson  	 !bcmp((caddr_t)&(o)->nd_cr, (caddr_t)&(n)->nd_cr, \
547a62dc406SDoug Rabson 		sizeof (struct ucred)))
548a62dc406SDoug Rabson 
549e7756081SDoug Rabson /*
550e7756081SDoug Rabson  * Defines for WebNFS
551e7756081SDoug Rabson  */
552e7756081SDoug Rabson 
553e7756081SDoug Rabson #define WEBNFS_ESC_CHAR		'%'
554e7756081SDoug Rabson #define WEBNFS_SPECCHAR_START	0x80
555e7756081SDoug Rabson 
556e7756081SDoug Rabson #define WEBNFS_NATIVE_CHAR	0x80
557e7756081SDoug Rabson /*
558e7756081SDoug Rabson  * ..
559e7756081SDoug Rabson  * Possibly more here in the future.
560e7756081SDoug Rabson  */
561e7756081SDoug Rabson 
562e7756081SDoug Rabson /*
563e7756081SDoug Rabson  * Macro for converting escape characters in WebNFS pathnames.
564e7756081SDoug Rabson  * Should really be in libkern.
565e7756081SDoug Rabson  */
566e7756081SDoug Rabson 
567e7756081SDoug Rabson #define HEXTOC(c) \
568e7756081SDoug Rabson 	((c) >= 'a' ? ((c) - ('a' - 10)) : \
569e7756081SDoug Rabson 	    ((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))
570e7756081SDoug Rabson #define HEXSTRTOI(p) \
571e7756081SDoug Rabson 	((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))
572e7756081SDoug Rabson 
5735ae0f718SDoug Rabson #ifdef NFS_DEBUG
5745ae0f718SDoug Rabson 
5755ae0f718SDoug Rabson extern int nfs_debug;
5765ae0f718SDoug Rabson #define NFS_DEBUG_ASYNCIO	1 /* asynchronous i/o */
5775ae0f718SDoug Rabson #define NFS_DEBUG_WG		2 /* server write gathering */
5785ae0f718SDoug Rabson #define NFS_DEBUG_RC		4 /* server request caching */
5795ae0f718SDoug Rabson 
5805ae0f718SDoug Rabson #define NFS_DPF(cat, args)					\
5815ae0f718SDoug Rabson 	do {							\
5825ae0f718SDoug Rabson 		if (nfs_debug & NFS_DEBUG_##cat) printf args;	\
5835ae0f718SDoug Rabson 	} while (0)
5845ae0f718SDoug Rabson 
5855ae0f718SDoug Rabson #else
5865ae0f718SDoug Rabson 
5875ae0f718SDoug Rabson #define NFS_DPF(cat, args)
5885ae0f718SDoug Rabson 
5895ae0f718SDoug Rabson #endif
590996c772fSJohn Dyson 
591227ee8a1SPoul-Henning Kamp u_quad_t nfs_curusec __P((void));
592996c772fSJohn Dyson int	nfs_init __P((struct vfsconf *vfsp));
593cae300beSBruce Evans int	nfs_uninit __P((struct vfsconf *vfsp));
59448fbb6ccSPoul-Henning Kamp int	nfs_reply __P((struct nfsreq *));
595a62dc406SDoug Rabson int	nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
59657bf258eSGarrett Wollman int	nfs_send __P((struct socket *, struct sockaddr *, struct mbuf *,
59757bf258eSGarrett Wollman 		      struct nfsreq *));
59857bf258eSGarrett Wollman int	nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
59957bf258eSGarrett Wollman 			 int, int, u_quad_t *, struct mbuf **, struct mbuf **,
60057bf258eSGarrett Wollman 			 caddr_t *));
601803870b4SPeter Wemm int	nfs_sndlock __P((struct nfsreq *));
602803870b4SPeter Wemm void	nfs_sndunlock __P((struct nfsreq *));
603803870b4SPeter Wemm int	nfs_slplock __P((struct nfssvc_sock *, int));
604803870b4SPeter Wemm void	nfs_slpunlock __P((struct nfssvc_sock *));
60548fbb6ccSPoul-Henning Kamp int	nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
60657bf258eSGarrett Wollman int	nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
60757bf258eSGarrett Wollman 			   int));
60848fbb6ccSPoul-Henning Kamp int	nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
60957bf258eSGarrett Wollman int	nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
61057bf258eSGarrett Wollman 			  int *));
611b5acbc8bSMatthew Dillon int	nfs_commit __P((struct vnode *vp, u_quad_t offset, int cnt,
612b5acbc8bSMatthew Dillon 			struct ucred *cred, struct proc *procp));
61357bf258eSGarrett Wollman int	nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
614b0eeea20SPoul-Henning Kamp int	nfs_asyncio __P((struct buf *, struct ucred *, struct proc *));
61548fbb6ccSPoul-Henning Kamp int	nfs_doio __P((struct buf *, struct ucred *, struct proc *));
61648fbb6ccSPoul-Henning Kamp int	nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
61757bf258eSGarrett Wollman int	nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
61857bf258eSGarrett Wollman int	nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
61948fbb6ccSPoul-Henning Kamp int	nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
62057bf258eSGarrett Wollman void	nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
62157bf258eSGarrett Wollman 			   struct nfs_fattr *));
62257bf258eSGarrett Wollman void	nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
62357bf258eSGarrett Wollman 			 struct vattr *, struct mbuf **, char **));
62457bf258eSGarrett Wollman void	nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
62557bf258eSGarrett Wollman 				struct mbuf **, char **));
62657bf258eSGarrett Wollman int	netaddr_match __P((int, union nethostaddr *, struct sockaddr *));
62757bf258eSGarrett Wollman int	nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
62857bf258eSGarrett Wollman 			 struct ucred *, struct mbuf **, struct mbuf **,
62957bf258eSGarrett Wollman 			 caddr_t *));
63057bf258eSGarrett Wollman int	nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
63157bf258eSGarrett Wollman 			       struct vattr *));
63257bf258eSGarrett Wollman int	nfs_namei __P((struct nameidata *, fhandle_t *, int,
63357bf258eSGarrett Wollman 		       struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
63457bf258eSGarrett Wollman 		       caddr_t *, struct vnode **, struct proc *, int, int));
63548fbb6ccSPoul-Henning Kamp void	nfsm_adj __P((struct mbuf *, int, int));
63648fbb6ccSPoul-Henning Kamp int	nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
63748fbb6ccSPoul-Henning Kamp void	nfsrv_initcache __P((void));
63857bf258eSGarrett Wollman int	nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
63957bf258eSGarrett Wollman 			 char **, int *, char *, int *, NFSKERBKEY_T));
64057bf258eSGarrett Wollman int	nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **,
64157bf258eSGarrett Wollman 			     int *, char *, int));
64257bf258eSGarrett Wollman int	nfs_savenickauth __P((struct nfsmount *, struct ucred *, int,
64357bf258eSGarrett Wollman 			      NFSKERBKEY_T, struct mbuf **, char **,
64457bf258eSGarrett Wollman 			      struct mbuf *));
64548fbb6ccSPoul-Henning Kamp int	nfs_adv __P((struct mbuf **, caddr_t *, int, int));
64648fbb6ccSPoul-Henning Kamp void	nfs_nhinit __P((void));
64748fbb6ccSPoul-Henning Kamp void	nfs_timer __P((void*));
648a62dc406SDoug Rabson u_long	nfs_hash __P((nfsfh_t *, int));
64957bf258eSGarrett Wollman int	nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
65057bf258eSGarrett Wollman 			 struct nfsrv_descript **));
65157bf258eSGarrett Wollman int	nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
65257bf258eSGarrett Wollman 			    struct mbuf **));
653a62dc406SDoug Rabson void	nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
654996c772fSJohn Dyson void	nfsrv_cleancache __P((void));
65548fbb6ccSPoul-Henning Kamp int	nfs_connect __P((struct nfsmount *, struct nfsreq *));
656996c772fSJohn Dyson void	nfs_disconnect __P((struct nfsmount *));
65775c6892cSPeter Wemm void	nfs_safedisconnect __P((struct nfsmount *));
65848fbb6ccSPoul-Henning Kamp int	nfs_getattrcache __P((struct vnode *, struct vattr *));
659c489c83eSPeter Wemm int	nfsm_strtmbuf __P((struct mbuf **, char **, const char *, long));
6604221e284SAlan Cox int	nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *));
66148fbb6ccSPoul-Henning Kamp int	nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
66248fbb6ccSPoul-Henning Kamp void	nfsrv_init __P((int));
663a62dc406SDoug Rabson void	nfs_clearcommit __P((struct mount *));
664a62dc406SDoug Rabson int	nfsrv_errmap __P((struct nfsrv_descript *, int));
66557bf258eSGarrett Wollman void	nfsrvw_sort __P((gid_t *, int));
666a62dc406SDoug Rabson void	nfsrv_setcred __P((struct ucred *, struct ucred *));
667b0eeea20SPoul-Henning Kamp int	nfs_writebp __P((struct buf *, int, struct proc *));
6686476c0d2SJohn Dyson int	nfsrv_object_create __P((struct vnode *));
669dee6b0abSBruce Evans void	nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
670a62dc406SDoug Rabson int	nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
671a62dc406SDoug Rabson 			       struct proc *, struct mbuf **));
672a62dc406SDoug Rabson int	nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
673a62dc406SDoug Rabson 			struct proc *p));
674473e9734SPoul-Henning Kamp 
67557bf258eSGarrett Wollman int	nfsrv3_access __P((struct nfsrv_descript *nfsd,
67657bf258eSGarrett Wollman 			   struct nfssvc_sock *slp,
677dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
678dee6b0abSBruce Evans int	nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
679dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
680dee6b0abSBruce Evans int	nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
681dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
68257bf258eSGarrett Wollman int	nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
68357bf258eSGarrett Wollman 			  struct nfssvc_sock *, struct sockaddr *, int *,
68457bf258eSGarrett Wollman 			  int, int));
685e7756081SDoug Rabson int	nfsrv_setpublicfs __P((struct mount *, struct netexport *,
686e7756081SDoug Rabson 			       struct export_args *));
687e7756081SDoug Rabson int	nfs_ispublicfh __P((fhandle_t *));
688dee6b0abSBruce Evans int	nfsrv_fsinfo __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
689dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
690dee6b0abSBruce Evans int	nfsrv_getattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
691dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
692dee6b0abSBruce Evans int	nfsrv_link __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
693dee6b0abSBruce Evans 			struct proc *procp, struct mbuf **mrq));
694dee6b0abSBruce Evans int	nfsrv_lookup __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
695dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
696dee6b0abSBruce Evans int	nfsrv_mkdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
697dee6b0abSBruce Evans 			 struct proc *procp, struct mbuf **mrq));
698dee6b0abSBruce Evans int	nfsrv_mknod __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
699dee6b0abSBruce Evans 			 struct proc *procp, struct mbuf **mrq));
700dee6b0abSBruce Evans int	nfsrv_noop __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
701dee6b0abSBruce Evans 			struct proc *procp, struct mbuf **mrq));
702dee6b0abSBruce Evans int	nfsrv_null __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
703dee6b0abSBruce Evans 			struct proc *procp, struct mbuf **mrq));
704dee6b0abSBruce Evans int	nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
705dee6b0abSBruce Evans 			    struct nfssvc_sock *slp, struct proc *procp,
706dee6b0abSBruce Evans 			    struct mbuf **mrq));
707dee6b0abSBruce Evans int	nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
708dee6b0abSBruce Evans 			struct proc *procp, struct mbuf **mrq));
70957bf258eSGarrett Wollman int	nfsrv_readdir __P((struct nfsrv_descript *nfsd,
71057bf258eSGarrett Wollman 			   struct nfssvc_sock *slp,
711dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
712dee6b0abSBruce Evans int	nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
713dee6b0abSBruce Evans 			       struct nfssvc_sock *slp, struct proc *procp,
714dee6b0abSBruce Evans 			       struct mbuf **mrq));
715dee6b0abSBruce Evans int	nfsrv_readlink __P((struct nfsrv_descript *nfsd,
716dee6b0abSBruce Evans 			    struct nfssvc_sock *slp, struct proc *procp,
717dee6b0abSBruce Evans 			    struct mbuf **mrq));
718dee6b0abSBruce Evans int	nfsrv_remove __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
719dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
720dee6b0abSBruce Evans int	nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
721dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
722dee6b0abSBruce Evans int	nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
723dee6b0abSBruce Evans 			 struct proc *procp, struct mbuf **mrq));
72457bf258eSGarrett Wollman int	nfsrv_setattr __P((struct nfsrv_descript *nfsd,
72557bf258eSGarrett Wollman 			   struct nfssvc_sock *slp,
726dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
72757bf258eSGarrett Wollman int	nfsrv_statfs __P((struct nfsrv_descript *nfsd,
72857bf258eSGarrett Wollman 			  struct nfssvc_sock *slp,
729dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
73057bf258eSGarrett Wollman int	nfsrv_symlink __P((struct nfsrv_descript *nfsd,
73157bf258eSGarrett Wollman 			   struct nfssvc_sock *slp,
732dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
733dee6b0abSBruce Evans int	nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
734dee6b0abSBruce Evans 			 struct proc *procp, struct mbuf **mrq));
735cfe8b629SGarrett Wollman void	nfsrv_rcv __P((struct socket *so, void *arg, int waitflag));
736996c772fSJohn Dyson void	nfsrv_slpderef __P((struct nfssvc_sock *slp));
737c4473420SPeter Wemm #endif	/* _KERNEL */
73833420ec6SPaul Richards 
73933420ec6SPaul Richards #endif
740