xref: /freebsd/sys/nfsserver/nfs.h (revision 394da4c167c955c9f60e490b51a8b6705242341f)
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
37394da4c1SGuido van Rooij  * $Id: nfs.h,v 1.22 1997/02/22 09:42:34 peter 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 
47996c772fSJohn Dyson #ifdef KERNEL
48996c772fSJohn Dyson 
49df8bae1dSRodney W. Grimes #define	NFS_MAXIOVEC	34
50a62dc406SDoug Rabson #define NFS_TICKINTVL	5		/* Desired time for a tick (msec) */
51a62dc406SDoug Rabson #define NFS_HZ		(hz / nfs_ticks) /* Ticks/sec */
52df8bae1dSRodney W. Grimes #define	NFS_TIMEO	(1 * NFS_HZ)	/* Default timeout = 1 second */
53df8bae1dSRodney W. Grimes #define	NFS_MINTIMEO	(1 * NFS_HZ)	/* Min timeout to use */
54df8bae1dSRodney W. Grimes #define	NFS_MAXTIMEO	(60 * NFS_HZ)	/* Max timeout to backoff to */
55df8bae1dSRodney W. Grimes #define	NFS_MINIDEMTIMEO (5 * NFS_HZ)	/* Min timeout for non-idempotent ops*/
56df8bae1dSRodney W. Grimes #define	NFS_MAXREXMIT	100		/* Stop counting after this many */
57df8bae1dSRodney W. Grimes #define	NFS_MAXWINDOW	1024		/* Max number of outstanding requests */
58df8bae1dSRodney W. Grimes #define	NFS_RETRANS	10		/* Num of retrans for soft mounts */
59df8bae1dSRodney W. Grimes #define	NFS_MAXGRPS	16		/* Max. size of groups list */
60b1b76581SDavid Greenman #ifndef NFS_MINATTRTIMO
61df8bae1dSRodney W. Grimes #define	NFS_MINATTRTIMO 5		/* Attribute cache timeout in sec */
62b1b76581SDavid Greenman #endif
63b1b76581SDavid Greenman #ifndef NFS_MAXATTRTIMO
64df8bae1dSRodney W. Grimes #define	NFS_MAXATTRTIMO 60
65b1b76581SDavid Greenman #endif
66df8bae1dSRodney W. Grimes #define	NFS_WSIZE	8192		/* Def. write data size <= 8192 */
67df8bae1dSRodney W. Grimes #define	NFS_RSIZE	8192		/* Def. read data size <= 8192 */
68a62dc406SDoug Rabson #define NFS_READDIRSIZE	8192		/* Def. readdir size */
69df8bae1dSRodney W. Grimes #define	NFS_DEFRAHEAD	1		/* Def. read ahead # blocks */
70df8bae1dSRodney W. Grimes #define	NFS_MAXRAHEAD	4		/* Max. read ahead # blocks */
71df8bae1dSRodney W. Grimes #define	NFS_MAXUIDHASH	64		/* Max. # of hashed uid entries/mp */
72996c772fSJohn Dyson #define	NFS_MAXASYNCDAEMON 	20	/* Max. number async_daemons runable */
73a62dc406SDoug Rabson #define NFS_MAXGATHERDELAY	100	/* Max. write gather delay (msec) */
74a62dc406SDoug Rabson #ifndef NFS_GATHERDELAY
75a62dc406SDoug Rabson #define NFS_GATHERDELAY		10	/* Default write gather delay (msec) */
76a62dc406SDoug Rabson #endif
77a62dc406SDoug Rabson #define	NFS_DIRBLKSIZ	4096		/* Must be a multiple of DIRBLKSIZ */
78a62dc406SDoug Rabson 
79a62dc406SDoug Rabson /*
80a62dc406SDoug Rabson  * Oddballs
81a62dc406SDoug Rabson  */
82df8bae1dSRodney W. Grimes #define	NMOD(a)		((a) % nfs_asyncdaemons)
83a62dc406SDoug Rabson #define NFS_CMPFH(n, f, s) \
84a62dc406SDoug Rabson 	((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
85a62dc406SDoug Rabson #define NFS_ISV3(v)	(VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
86a62dc406SDoug Rabson #define NFS_SRVMAXDATA(n) \
87a62dc406SDoug Rabson 		(((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \
88a62dc406SDoug Rabson 		 NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
89a62dc406SDoug Rabson 
90a62dc406SDoug Rabson /*
91a62dc406SDoug Rabson  * XXX
92a62dc406SDoug Rabson  * The B_INVAFTERWRITE flag should be set to whatever is required by the
93a62dc406SDoug Rabson  * buffer cache code to say "Invalidate the block after it is written back".
94a62dc406SDoug Rabson  */
95a62dc406SDoug Rabson #ifdef __FreeBSD__
96a62dc406SDoug Rabson #define	B_INVAFTERWRITE	B_NOCACHE
97a62dc406SDoug Rabson #else
98a62dc406SDoug Rabson #define	B_INVAFTERWRITE	B_INVAL
99a62dc406SDoug Rabson #endif
100a62dc406SDoug Rabson 
101a62dc406SDoug Rabson /*
102a62dc406SDoug Rabson  * The IO_METASYNC flag should be implemented for local file systems.
103a62dc406SDoug Rabson  * (Until then, it is nothin at all.)
104a62dc406SDoug Rabson  */
105a62dc406SDoug Rabson #ifndef IO_METASYNC
106a62dc406SDoug Rabson #define IO_METASYNC	0
107a62dc406SDoug Rabson #endif
108df8bae1dSRodney W. Grimes 
109df8bae1dSRodney W. Grimes /*
110df8bae1dSRodney W. Grimes  * Set the attribute timeout based on how recently the file has been modified.
111df8bae1dSRodney W. Grimes  */
112df8bae1dSRodney W. Grimes #define	NFS_ATTRTIMEO(np) \
113df8bae1dSRodney W. Grimes 	((((np)->n_flag & NMODIFIED) || \
114df8bae1dSRodney W. Grimes 	 (time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
115df8bae1dSRodney W. Grimes 	 ((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
116df8bae1dSRodney W. Grimes 	  (time.tv_sec - (np)->n_mtime) / 10))
117df8bae1dSRodney W. Grimes 
118df8bae1dSRodney W. Grimes /*
119a62dc406SDoug Rabson  * Expected allocation sizes for major data structures. If the actual size
120a62dc406SDoug Rabson  * of the structure exceeds these sizes, then malloc() will be allocating
121a62dc406SDoug Rabson  * almost twice the memory required. This is used in nfs_init() to warn
122a62dc406SDoug Rabson  * the sysadmin that the size of a structure should be reduced.
123a62dc406SDoug Rabson  * (These sizes are always a power of 2. If the kernel malloc() changes
124a62dc406SDoug Rabson  *  to one that does not allocate space in powers of 2 size, then this all
125a62dc406SDoug Rabson  *  becomes bunk!)
126a62dc406SDoug Rabson  */
127a62dc406SDoug Rabson #define NFS_NODEALLOC	256
128a62dc406SDoug Rabson #define NFS_MNTALLOC	512
129a62dc406SDoug Rabson #define NFS_SVCALLOC	256
130a62dc406SDoug Rabson #define NFS_UIDALLOC	128
131a62dc406SDoug Rabson 
132996c772fSJohn Dyson #endif /* KERNEL */
133996c772fSJohn Dyson 
134996c772fSJohn Dyson /*
135996c772fSJohn Dyson  * NFS mount option flags
136996c772fSJohn Dyson  */
137996c772fSJohn Dyson #define	NFSMNT_SOFT		0x00000001  /* soft mount (hard is default) */
138996c772fSJohn Dyson #define	NFSMNT_WSIZE		0x00000002  /* set write size */
139996c772fSJohn Dyson #define	NFSMNT_RSIZE		0x00000004  /* set read size */
140996c772fSJohn Dyson #define	NFSMNT_TIMEO		0x00000008  /* set initial timeout */
141996c772fSJohn Dyson #define	NFSMNT_RETRANS		0x00000010  /* set number of request retries */
142996c772fSJohn Dyson #define	NFSMNT_MAXGRPS		0x00000020  /* set maximum grouplist size */
143996c772fSJohn Dyson #define	NFSMNT_INT		0x00000040  /* allow interrupts on hard mount */
144996c772fSJohn Dyson #define	NFSMNT_NOCONN		0x00000080  /* Don't Connect the socket */
145996c772fSJohn Dyson #define	NFSMNT_NQNFS		0x00000100  /* Use Nqnfs protocol */
146996c772fSJohn Dyson #define	NFSMNT_NFSV3		0x00000200  /* Use NFS Version 3 protocol */
147996c772fSJohn Dyson #define	NFSMNT_KERB		0x00000400  /* Use Kerberos authentication */
148996c772fSJohn Dyson #define	NFSMNT_DUMBTIMR		0x00000800  /* Don't estimate rtt dynamically */
149996c772fSJohn Dyson #define	NFSMNT_LEASETERM	0x00001000  /* set lease term (nqnfs) */
150996c772fSJohn Dyson #define	NFSMNT_READAHEAD	0x00002000  /* set read ahead */
151996c772fSJohn Dyson #define	NFSMNT_DEADTHRESH	0x00004000  /* set dead server retry thresh */
152996c772fSJohn Dyson #define	NFSMNT_RESVPORT		0x00008000  /* Allocate a reserved port */
153996c772fSJohn Dyson #define	NFSMNT_RDIRPLUS		0x00010000  /* Use Readdirplus for V3 */
154996c772fSJohn Dyson #define	NFSMNT_READDIRSIZE	0x00020000  /* Set readdir size */
155996c772fSJohn Dyson #define	NFSMNT_INTERNAL		0xfffc0000  /* Bits set internally */
156996c772fSJohn Dyson #define NFSMNT_HASWRITEVERF	0x00040000  /* Has write verifier for V3 */
157996c772fSJohn Dyson #define NFSMNT_GOTPATHCONF	0x00080000  /* Got the V3 pathconf info */
158996c772fSJohn Dyson #define NFSMNT_GOTFSINFO	0x00100000  /* Got the V3 fsinfo */
159996c772fSJohn Dyson #define	NFSMNT_MNTD		0x00200000  /* Mnt server for mnt point */
160996c772fSJohn Dyson #define	NFSMNT_DISMINPROG	0x00400000  /* Dismount in progress */
161996c772fSJohn Dyson #define	NFSMNT_DISMNT		0x00800000  /* Dismounted */
162996c772fSJohn Dyson #define	NFSMNT_SNDLOCK		0x01000000  /* Send socket lock */
163996c772fSJohn Dyson #define	NFSMNT_WANTSND		0x02000000  /* Want above */
164996c772fSJohn Dyson #define	NFSMNT_RCVLOCK		0x04000000  /* Rcv socket lock */
165996c772fSJohn Dyson #define	NFSMNT_WANTRCV		0x08000000  /* Want above */
166996c772fSJohn Dyson #define	NFSMNT_WAITAUTH		0x10000000  /* Wait for authentication */
167996c772fSJohn Dyson #define	NFSMNT_HASAUTH		0x20000000  /* Has authenticator */
168996c772fSJohn Dyson #define	NFSMNT_WANTAUTH		0x40000000  /* Wants an authenticator */
169996c772fSJohn Dyson #define	NFSMNT_AUTHERR		0x80000000  /* Authentication error */
170996c772fSJohn Dyson 
171996c772fSJohn Dyson /*
172996c772fSJohn Dyson  * Arguments to mount NFS
173996c772fSJohn Dyson  */
174996c772fSJohn Dyson #define NFS_ARGSVERSION	3		/* change when nfs_args changes */
175996c772fSJohn Dyson struct nfs_args {
176996c772fSJohn Dyson 	int		version;	/* args structure version number */
177996c772fSJohn Dyson 	struct sockaddr	*addr;		/* file server address */
178996c772fSJohn Dyson 	int		addrlen;	/* length of address */
179996c772fSJohn Dyson 	int		sotype;		/* Socket type */
180996c772fSJohn Dyson 	int		proto;		/* and Protocol */
181996c772fSJohn Dyson 	u_char		*fh;		/* File handle to be mounted */
182996c772fSJohn Dyson 	int		fhsize;		/* Size, in bytes, of fh */
183996c772fSJohn Dyson 	int		flags;		/* flags */
184996c772fSJohn Dyson 	int		wsize;		/* write size in bytes */
185996c772fSJohn Dyson 	int		rsize;		/* read size in bytes */
186996c772fSJohn Dyson 	int		readdirsize;	/* readdir size in bytes */
187996c772fSJohn Dyson 	int		timeo;		/* initial timeout in .1 secs */
188996c772fSJohn Dyson 	int		retrans;	/* times to retry send */
189996c772fSJohn Dyson 	int		maxgrouplist;	/* Max. size of group list */
190996c772fSJohn Dyson 	int		readahead;	/* # of blocks to readahead */
191996c772fSJohn Dyson 	int		leaseterm;	/* Term (sec) of lease */
192996c772fSJohn Dyson 	int		deadthresh;	/* Retrans threshold */
193996c772fSJohn Dyson 	char		*hostname;	/* server's name */
194996c772fSJohn Dyson };
195996c772fSJohn Dyson 
196996c772fSJohn Dyson /*
197996c772fSJohn Dyson  * NFS mount option flags
198996c772fSJohn Dyson  */
199996c772fSJohn Dyson #define	NFSMNT_SOFT		0x00000001  /* soft mount (hard is default) */
200996c772fSJohn Dyson #define	NFSMNT_WSIZE		0x00000002  /* set write size */
201996c772fSJohn Dyson #define	NFSMNT_RSIZE		0x00000004  /* set read size */
202996c772fSJohn Dyson #define	NFSMNT_TIMEO		0x00000008  /* set initial timeout */
203996c772fSJohn Dyson #define	NFSMNT_RETRANS		0x00000010  /* set number of request retries */
204996c772fSJohn Dyson #define	NFSMNT_MAXGRPS		0x00000020  /* set maximum grouplist size */
205996c772fSJohn Dyson #define	NFSMNT_INT		0x00000040  /* allow interrupts on hard mount */
206996c772fSJohn Dyson #define	NFSMNT_NOCONN		0x00000080  /* Don't Connect the socket */
207996c772fSJohn Dyson #define	NFSMNT_NQNFS		0x00000100  /* Use Nqnfs protocol */
208996c772fSJohn Dyson #define	NFSMNT_NFSV3		0x00000200  /* Use NFS Version 3 protocol */
209996c772fSJohn Dyson #define	NFSMNT_KERB		0x00000400  /* Use Kerberos authentication */
210996c772fSJohn Dyson #define	NFSMNT_DUMBTIMR		0x00000800  /* Don't estimate rtt dynamically */
211996c772fSJohn Dyson #define	NFSMNT_LEASETERM	0x00001000  /* set lease term (nqnfs) */
212996c772fSJohn Dyson #define	NFSMNT_READAHEAD	0x00002000  /* set read ahead */
213996c772fSJohn Dyson #define	NFSMNT_DEADTHRESH	0x00004000  /* set dead server retry thresh */
214996c772fSJohn Dyson #define	NFSMNT_RESVPORT		0x00008000  /* Allocate a reserved port */
215996c772fSJohn Dyson #define	NFSMNT_RDIRPLUS		0x00010000  /* Use Readdirplus for V3 */
216996c772fSJohn Dyson #define	NFSMNT_READDIRSIZE	0x00020000  /* Set readdir size */
217996c772fSJohn Dyson #define	NFSMNT_INTERNAL		0xfffc0000  /* Bits set internally */
218996c772fSJohn Dyson #define NFSMNT_HASWRITEVERF	0x00040000  /* Has write verifier for V3 */
219996c772fSJohn Dyson #define NFSMNT_GOTPATHCONF	0x00080000  /* Got the V3 pathconf info */
220996c772fSJohn Dyson #define NFSMNT_GOTFSINFO	0x00100000  /* Got the V3 fsinfo */
221996c772fSJohn Dyson #define	NFSMNT_MNTD		0x00200000  /* Mnt server for mnt point */
222996c772fSJohn Dyson #define	NFSMNT_DISMINPROG	0x00400000  /* Dismount in progress */
223996c772fSJohn Dyson #define	NFSMNT_DISMNT		0x00800000  /* Dismounted */
224996c772fSJohn Dyson #define	NFSMNT_SNDLOCK		0x01000000  /* Send socket lock */
225996c772fSJohn Dyson #define	NFSMNT_WANTSND		0x02000000  /* Want above */
226996c772fSJohn Dyson #define	NFSMNT_RCVLOCK		0x04000000  /* Rcv socket lock */
227996c772fSJohn Dyson #define	NFSMNT_WANTRCV		0x08000000  /* Want above */
228996c772fSJohn Dyson #define	NFSMNT_WAITAUTH		0x10000000  /* Wait for authentication */
229996c772fSJohn Dyson #define	NFSMNT_HASAUTH		0x20000000  /* Has authenticator */
230996c772fSJohn Dyson #define	NFSMNT_WANTAUTH		0x40000000  /* Wants an authenticator */
231996c772fSJohn Dyson #define	NFSMNT_AUTHERR		0x80000000  /* Authentication error */
232996c772fSJohn Dyson 
233a62dc406SDoug Rabson /*
234df8bae1dSRodney W. Grimes  * Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
235df8bae1dSRodney W. Grimes  * should ever try and use it.
236df8bae1dSRodney W. Grimes  */
237df8bae1dSRodney W. Grimes struct nfsd_args {
238df8bae1dSRodney W. Grimes 	int	sock;		/* Socket to serve */
239996c772fSJohn Dyson 	caddr_t	name;		/* Client addr for connection based sockets */
240df8bae1dSRodney W. Grimes 	int	namelen;	/* Length of name */
241df8bae1dSRodney W. Grimes };
242df8bae1dSRodney W. Grimes 
243df8bae1dSRodney W. Grimes struct nfsd_srvargs {
244df8bae1dSRodney W. Grimes 	struct nfsd	*nsd_nfsd;	/* Pointer to in kernel nfsd struct */
245df8bae1dSRodney W. Grimes 	uid_t		nsd_uid;	/* Effective uid mapped to cred */
246df8bae1dSRodney W. Grimes 	u_long		nsd_haddr;	/* Ip address of client */
247df8bae1dSRodney W. Grimes 	struct ucred	nsd_cr;		/* Cred. uid maps to */
248df8bae1dSRodney W. Grimes 	int		nsd_authlen;	/* Length of auth string (ret) */
249a62dc406SDoug Rabson 	u_char		*nsd_authstr;	/* Auth string (ret) */
250a62dc406SDoug Rabson 	int		nsd_verflen;	/* and the verfier */
251a62dc406SDoug Rabson 	u_char		*nsd_verfstr;
252a62dc406SDoug Rabson 	struct timeval	nsd_timestamp;	/* timestamp from verifier */
253a62dc406SDoug Rabson 	u_long		nsd_ttl;	/* credential ttl (sec) */
254a62dc406SDoug Rabson 	NFSKERBKEY_T	nsd_key;	/* Session key */
255df8bae1dSRodney W. Grimes };
256df8bae1dSRodney W. Grimes 
257df8bae1dSRodney W. Grimes struct nfsd_cargs {
258df8bae1dSRodney W. Grimes 	char		*ncd_dirp;	/* Mount dir path */
259df8bae1dSRodney W. Grimes 	uid_t		ncd_authuid;	/* Effective uid */
260df8bae1dSRodney W. Grimes 	int		ncd_authtype;	/* Type of authenticator */
261df8bae1dSRodney W. Grimes 	int		ncd_authlen;	/* Length of authenticator string */
262a62dc406SDoug Rabson 	u_char		*ncd_authstr;	/* Authenticator string */
263a62dc406SDoug Rabson 	int		ncd_verflen;	/* and the verifier */
264a62dc406SDoug Rabson 	u_char		*ncd_verfstr;
265a62dc406SDoug Rabson 	NFSKERBKEY_T	ncd_key;	/* Session key */
266df8bae1dSRodney W. Grimes };
267df8bae1dSRodney W. Grimes 
268df8bae1dSRodney W. Grimes /*
269996c772fSJohn Dyson  * XXX to allow amd to include nfs.h without nfsproto.h
270996c772fSJohn Dyson  */
271996c772fSJohn Dyson #ifdef NFS_NPROCS
272996c772fSJohn Dyson /*
273df8bae1dSRodney W. Grimes  * Stats structure
274df8bae1dSRodney W. Grimes  */
275df8bae1dSRodney W. Grimes struct nfsstats {
276df8bae1dSRodney W. Grimes 	int	attrcache_hits;
277df8bae1dSRodney W. Grimes 	int	attrcache_misses;
278df8bae1dSRodney W. Grimes 	int	lookupcache_hits;
279df8bae1dSRodney W. Grimes 	int	lookupcache_misses;
280df8bae1dSRodney W. Grimes 	int	direofcache_hits;
281df8bae1dSRodney W. Grimes 	int	direofcache_misses;
282df8bae1dSRodney W. Grimes 	int	biocache_reads;
283df8bae1dSRodney W. Grimes 	int	read_bios;
284df8bae1dSRodney W. Grimes 	int	read_physios;
285df8bae1dSRodney W. Grimes 	int	biocache_writes;
286df8bae1dSRodney W. Grimes 	int	write_bios;
287df8bae1dSRodney W. Grimes 	int	write_physios;
288df8bae1dSRodney W. Grimes 	int	biocache_readlinks;
289df8bae1dSRodney W. Grimes 	int	readlink_bios;
290df8bae1dSRodney W. Grimes 	int	biocache_readdirs;
291df8bae1dSRodney W. Grimes 	int	readdir_bios;
292df8bae1dSRodney W. Grimes 	int	rpccnt[NFS_NPROCS];
293df8bae1dSRodney W. Grimes 	int	rpcretries;
294df8bae1dSRodney W. Grimes 	int	srvrpccnt[NFS_NPROCS];
295df8bae1dSRodney W. Grimes 	int	srvrpc_errs;
296df8bae1dSRodney W. Grimes 	int	srv_errs;
297df8bae1dSRodney W. Grimes 	int	rpcrequests;
298df8bae1dSRodney W. Grimes 	int	rpctimeouts;
299df8bae1dSRodney W. Grimes 	int	rpcunexpected;
300df8bae1dSRodney W. Grimes 	int	rpcinvalid;
301df8bae1dSRodney W. Grimes 	int	srvcache_inproghits;
302df8bae1dSRodney W. Grimes 	int	srvcache_idemdonehits;
303df8bae1dSRodney W. Grimes 	int	srvcache_nonidemdonehits;
304df8bae1dSRodney W. Grimes 	int	srvcache_misses;
305df8bae1dSRodney W. Grimes 	int	srvnqnfs_leases;
306df8bae1dSRodney W. Grimes 	int	srvnqnfs_maxleases;
307df8bae1dSRodney W. Grimes 	int	srvnqnfs_getleases;
308a62dc406SDoug Rabson 	int	srvvop_writes;
309df8bae1dSRodney W. Grimes };
310996c772fSJohn Dyson #endif
311df8bae1dSRodney W. Grimes 
312df8bae1dSRodney W. Grimes /*
313df8bae1dSRodney W. Grimes  * Flags for nfssvc() system call.
314df8bae1dSRodney W. Grimes  */
315df8bae1dSRodney W. Grimes #define	NFSSVC_BIOD	0x002
316df8bae1dSRodney W. Grimes #define	NFSSVC_NFSD	0x004
317df8bae1dSRodney W. Grimes #define	NFSSVC_ADDSOCK	0x008
318df8bae1dSRodney W. Grimes #define	NFSSVC_AUTHIN	0x010
319df8bae1dSRodney W. Grimes #define	NFSSVC_GOTAUTH	0x040
320df8bae1dSRodney W. Grimes #define	NFSSVC_AUTHINFAIL 0x080
321df8bae1dSRodney W. Grimes #define	NFSSVC_MNTD	0x100
322df8bae1dSRodney W. Grimes 
323df8bae1dSRodney W. Grimes /*
324b43e29afSGarrett Wollman  * fs.nfs sysctl(3) identifiers
325b43e29afSGarrett Wollman  */
326b43e29afSGarrett Wollman #define NFS_NFSSTATS	1		/* struct: struct nfsstats */
327394da4c1SGuido van Rooij #define NFS_NFSPRIVPORT	2		/* int: prohibit nfs to resvports */
328b43e29afSGarrett Wollman 
329b43e29afSGarrett Wollman #define FS_NFS_NAMES { \
330b43e29afSGarrett Wollman 		       { 0, 0 }, \
331b43e29afSGarrett Wollman 		       { "nfsstats", CTLTYPE_STRUCT }, \
332394da4c1SGuido van Rooij 		       { "nfsprivport", CTLTYPE_INT }, \
333b43e29afSGarrett Wollman }
334b43e29afSGarrett Wollman 
335b43e29afSGarrett Wollman /*
336df8bae1dSRodney W. Grimes  * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
337df8bae1dSRodney W. Grimes  * What should be in this set is open to debate, but I believe that since
338df8bae1dSRodney W. Grimes  * I/O system calls on ufs are never interrupted by signals the set should
339df8bae1dSRodney W. Grimes  * be minimal. My reasoning is that many current programs that use signals
340df8bae1dSRodney W. Grimes  * such as SIGALRM will not expect file I/O system calls to be interrupted
341df8bae1dSRodney W. Grimes  * by them and break.
342df8bae1dSRodney W. Grimes  */
343996c772fSJohn Dyson #ifdef KERNEL
344d9e91095SGarrett Wollman 
345d9e91095SGarrett Wollman struct uio; struct buf; struct vattr; struct nameidata;	/* XXX */
346d9e91095SGarrett Wollman 
347df8bae1dSRodney W. Grimes #define	NFSINT_SIGMASK	(sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
348df8bae1dSRodney W. Grimes 			 sigmask(SIGHUP)|sigmask(SIGQUIT))
349df8bae1dSRodney W. Grimes 
350df8bae1dSRodney W. Grimes /*
351df8bae1dSRodney W. Grimes  * Socket errors ignored for connectionless sockets??
352df8bae1dSRodney W. Grimes  * For now, ignore them all
353df8bae1dSRodney W. Grimes  */
354df8bae1dSRodney W. Grimes #define	NFSIGNORE_SOERROR(s, e) \
355df8bae1dSRodney W. Grimes 		((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
356df8bae1dSRodney W. Grimes 		((s) & PR_CONNREQUIRED) == 0)
357df8bae1dSRodney W. Grimes 
358df8bae1dSRodney W. Grimes /*
359df8bae1dSRodney W. Grimes  * Nfs outstanding request list element
360df8bae1dSRodney W. Grimes  */
361df8bae1dSRodney W. Grimes struct nfsreq {
3626ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfsreq) r_chain;
363df8bae1dSRodney W. Grimes 	struct mbuf	*r_mreq;
364df8bae1dSRodney W. Grimes 	struct mbuf	*r_mrep;
365df8bae1dSRodney W. Grimes 	struct mbuf	*r_md;
366df8bae1dSRodney W. Grimes 	caddr_t		r_dpos;
367df8bae1dSRodney W. Grimes 	struct nfsmount *r_nmp;
368df8bae1dSRodney W. Grimes 	struct vnode	*r_vp;
369df8bae1dSRodney W. Grimes 	u_long		r_xid;
370df8bae1dSRodney W. Grimes 	int		r_flags;	/* flags on request, see below */
371df8bae1dSRodney W. Grimes 	int		r_retry;	/* max retransmission count */
372df8bae1dSRodney W. Grimes 	int		r_rexmit;	/* current retrans count */
373df8bae1dSRodney W. Grimes 	int		r_timer;	/* tick counter on reply */
374df8bae1dSRodney W. Grimes 	int		r_procnum;	/* NFS procedure number */
375df8bae1dSRodney W. Grimes 	int		r_rtt;		/* RTT for rpc */
376df8bae1dSRodney W. Grimes 	struct proc	*r_procp;	/* Proc that did I/O system call */
377df8bae1dSRodney W. Grimes };
378df8bae1dSRodney W. Grimes 
3796ae32407SPoul-Henning Kamp /*
3806ae32407SPoul-Henning Kamp  * Queue head for nfsreq's
3816ae32407SPoul-Henning Kamp  */
38228f8db14SBruce Evans extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
3836ae32407SPoul-Henning Kamp 
384df8bae1dSRodney W. Grimes /* Flag values for r_flags */
385df8bae1dSRodney W. Grimes #define R_TIMING	0x01		/* timing request (in mntp) */
386df8bae1dSRodney W. Grimes #define R_SENT		0x02		/* request has been sent */
387df8bae1dSRodney W. Grimes #define	R_SOFTTERM	0x04		/* soft mnt, too many retries */
388df8bae1dSRodney W. Grimes #define	R_INTR		0x08		/* intr mnt, signal pending */
389df8bae1dSRodney W. Grimes #define	R_SOCKERR	0x10		/* Fatal error on socket */
390df8bae1dSRodney W. Grimes #define	R_TPRINTFMSG	0x20		/* Did a tprintf msg. */
391df8bae1dSRodney W. Grimes #define	R_MUSTRESEND	0x40		/* Must resend request */
392df8bae1dSRodney W. Grimes #define	R_GETONEREP	0x80		/* Probe for one reply only */
393df8bae1dSRodney W. Grimes 
394df8bae1dSRodney W. Grimes /*
395df8bae1dSRodney W. Grimes  * A list of nfssvc_sock structures is maintained with all the sockets
396df8bae1dSRodney W. Grimes  * that require service by the nfsd.
397df8bae1dSRodney W. Grimes  * The nfsuid structs hang off of the nfssvc_sock structs in both lru
398df8bae1dSRodney W. Grimes  * and uid hash lists.
399df8bae1dSRodney W. Grimes  */
400a62dc406SDoug Rabson #ifndef NFS_UIDHASHSIZ
401a62dc406SDoug Rabson #define	NFS_UIDHASHSIZ	29	/* Tune the size of nfssvc_sock with this */
402a62dc406SDoug Rabson #endif
4036ae32407SPoul-Henning Kamp #define	NUIDHASH(sock, uid) \
404a62dc406SDoug Rabson 	(&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ])
405a62dc406SDoug Rabson #ifndef NFS_WDELAYHASHSIZ
406a62dc406SDoug Rabson #define	NFS_WDELAYHASHSIZ 16	/* and with this */
407a62dc406SDoug Rabson #endif
408a62dc406SDoug Rabson #define	NWDELAYHASH(sock, f) \
409a62dc406SDoug Rabson 	(&(sock)->ns_wdelayhashtbl[(*((u_long *)(f))) % NFS_WDELAYHASHSIZ])
410a62dc406SDoug Rabson #ifndef NFS_MUIDHASHSIZ
411f438ae02SDoug Rabson #define NFS_MUIDHASHSIZ	63	/* Tune the size of nfsmount with this */
412a62dc406SDoug Rabson #endif
413a62dc406SDoug Rabson #define	NMUIDHASH(nmp, uid) \
414a62dc406SDoug Rabson 	(&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ])
415a62dc406SDoug Rabson #define	NFSNOHASH(fhsum) \
416a62dc406SDoug Rabson 	(&nfsnodehashtbl[(fhsum) & nfsnodehash])
417df8bae1dSRodney W. Grimes 
418df8bae1dSRodney W. Grimes /*
419df8bae1dSRodney W. Grimes  * Network address hash list element
420df8bae1dSRodney W. Grimes  */
421df8bae1dSRodney W. Grimes union nethostaddr {
422df8bae1dSRodney W. Grimes 	u_long had_inetaddr;
423df8bae1dSRodney W. Grimes 	struct mbuf *had_nam;
424df8bae1dSRodney W. Grimes };
425df8bae1dSRodney W. Grimes 
426df8bae1dSRodney W. Grimes struct nfsuid {
4276ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfsuid) nu_lru;	/* LRU chain */
4286ae32407SPoul-Henning Kamp 	LIST_ENTRY(nfsuid) nu_hash;	/* Hash list */
429df8bae1dSRodney W. Grimes 	int		nu_flag;	/* Flags */
430df8bae1dSRodney W. Grimes 	union nethostaddr nu_haddr;	/* Host addr. for dgram sockets */
431df8bae1dSRodney W. Grimes 	struct ucred	nu_cr;		/* Cred uid mapped to */
432a62dc406SDoug Rabson 	int		nu_expire;	/* Expiry time (sec) */
433a62dc406SDoug Rabson 	struct timeval	nu_timestamp;	/* Kerb. timestamp */
434a62dc406SDoug Rabson 	u_long		nu_nickname;	/* Nickname on server */
435a62dc406SDoug Rabson 	NFSKERBKEY_T	nu_key;		/* and session key */
436df8bae1dSRodney W. Grimes };
437df8bae1dSRodney W. Grimes 
438df8bae1dSRodney W. Grimes #define	nu_inetaddr	nu_haddr.had_inetaddr
439df8bae1dSRodney W. Grimes #define	nu_nam		nu_haddr.had_nam
440df8bae1dSRodney W. Grimes /* Bits for nu_flag */
441df8bae1dSRodney W. Grimes #define	NU_INETADDR	0x1
442a62dc406SDoug Rabson #define NU_NAM		0x2
443a62dc406SDoug Rabson #define NU_NETFAM(u)	(((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO)
444df8bae1dSRodney W. Grimes 
445df8bae1dSRodney W. Grimes struct nfssvc_sock {
4466ae32407SPoul-Henning Kamp 	TAILQ_ENTRY(nfssvc_sock) ns_chain;	/* List of all nfssvc_sock's */
4476ae32407SPoul-Henning Kamp 	TAILQ_HEAD(, nfsuid) ns_uidlruhead;
448df8bae1dSRodney W. Grimes 	struct file	*ns_fp;
449df8bae1dSRodney W. Grimes 	struct socket	*ns_so;
450df8bae1dSRodney W. Grimes 	struct mbuf	*ns_nam;
451df8bae1dSRodney W. Grimes 	struct mbuf	*ns_raw;
452df8bae1dSRodney W. Grimes 	struct mbuf	*ns_rawend;
453df8bae1dSRodney W. Grimes 	struct mbuf	*ns_rec;
454df8bae1dSRodney W. Grimes 	struct mbuf	*ns_recend;
455a62dc406SDoug Rabson 	struct mbuf	*ns_frag;
456a62dc406SDoug Rabson 	int		ns_flag;
457a62dc406SDoug Rabson 	int		ns_solock;
458a62dc406SDoug Rabson 	int		ns_cc;
459a62dc406SDoug Rabson 	int		ns_reclen;
460df8bae1dSRodney W. Grimes 	int		ns_numuids;
461a62dc406SDoug Rabson 	u_long		ns_sref;
462a62dc406SDoug Rabson 	LIST_HEAD(, nfsrv_descript) ns_tq;	/* Write gather lists */
463a62dc406SDoug Rabson 	LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ];
464a62dc406SDoug Rabson 	LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ];
465df8bae1dSRodney W. Grimes };
466df8bae1dSRodney W. Grimes 
467df8bae1dSRodney W. Grimes /* Bits for "ns_flag" */
468df8bae1dSRodney W. Grimes #define	SLP_VALID	0x01
469df8bae1dSRodney W. Grimes #define	SLP_DOREC	0x02
470df8bae1dSRodney W. Grimes #define	SLP_NEEDQ	0x04
471df8bae1dSRodney W. Grimes #define	SLP_DISCONN	0x08
472df8bae1dSRodney W. Grimes #define	SLP_GETSTREAM	0x10
473a62dc406SDoug Rabson #define	SLP_LASTFRAG	0x20
474df8bae1dSRodney W. Grimes #define SLP_ALLFLAGS	0xff
475df8bae1dSRodney W. Grimes 
47628f8db14SBruce Evans extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead;
47728f8db14SBruce Evans extern int nfssvc_sockhead_flag;
4786ae32407SPoul-Henning Kamp #define	SLP_INIT	0x01
4796ae32407SPoul-Henning Kamp #define	SLP_WANTINIT	0x02
4806ae32407SPoul-Henning Kamp 
481df8bae1dSRodney W. Grimes /*
482df8bae1dSRodney W. Grimes  * One of these structures is allocated for each nfsd.
483df8bae1dSRodney W. Grimes  */
484df8bae1dSRodney W. Grimes struct nfsd {
485a62dc406SDoug Rabson 	TAILQ_ENTRY(nfsd) nfsd_chain;	/* List of all nfsd's */
486a62dc406SDoug Rabson 	int		nfsd_flag;	/* NFSD_ flags */
487a62dc406SDoug Rabson 	struct nfssvc_sock *nfsd_slp;	/* Current socket */
488a62dc406SDoug Rabson 	int		nfsd_authlen;	/* Authenticator len */
489a62dc406SDoug Rabson 	u_char		nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */
490a62dc406SDoug Rabson 	int		nfsd_verflen;	/* and the Verifier */
491a62dc406SDoug Rabson 	u_char		nfsd_verfstr[RPCVERF_MAXSIZ];
492a62dc406SDoug Rabson 	struct proc	*nfsd_procp;	/* Proc ptr */
493a62dc406SDoug Rabson 	struct nfsrv_descript *nfsd_nd;	/* Associated nfsrv_descript */
494df8bae1dSRodney W. Grimes };
495df8bae1dSRodney W. Grimes 
496a62dc406SDoug Rabson /* Bits for "nfsd_flag" */
497df8bae1dSRodney W. Grimes #define	NFSD_WAITING	0x01
4986ae32407SPoul-Henning Kamp #define	NFSD_REQINPROG	0x02
4996ae32407SPoul-Henning Kamp #define	NFSD_NEEDAUTH	0x04
5006ae32407SPoul-Henning Kamp #define	NFSD_AUTHFAIL	0x08
5016ae32407SPoul-Henning Kamp 
502a62dc406SDoug Rabson /*
503a62dc406SDoug Rabson  * This structure is used by the server for describing each request.
504a62dc406SDoug Rabson  * Some fields are used only when write request gathering is performed.
505a62dc406SDoug Rabson  */
506a62dc406SDoug Rabson struct nfsrv_descript {
507a62dc406SDoug Rabson 	u_quad_t		nd_time;	/* Write deadline (usec) */
508a62dc406SDoug Rabson 	off_t			nd_off;		/* Start byte offset */
509a62dc406SDoug Rabson 	off_t			nd_eoff;	/* and end byte offset */
510a62dc406SDoug Rabson 	LIST_ENTRY(nfsrv_descript) nd_hash;	/* Hash list */
511a62dc406SDoug Rabson 	LIST_ENTRY(nfsrv_descript) nd_tq;		/* and timer list */
512a62dc406SDoug Rabson 	LIST_HEAD(,nfsrv_descript) nd_coalesce;	/* coalesced writes */
513a62dc406SDoug Rabson 	struct mbuf		*nd_mrep;	/* Request mbuf list */
514a62dc406SDoug Rabson 	struct mbuf		*nd_md;		/* Current dissect mbuf */
515a62dc406SDoug Rabson 	struct mbuf		*nd_mreq;	/* Reply mbuf list */
516a62dc406SDoug Rabson 	struct mbuf		*nd_nam;	/* and socket addr */
517a62dc406SDoug Rabson 	struct mbuf		*nd_nam2;	/* return socket addr */
518a62dc406SDoug Rabson 	caddr_t			nd_dpos;	/* Current dissect pos */
519a62dc406SDoug Rabson 	int			nd_procnum;	/* RPC # */
520a62dc406SDoug Rabson 	int			nd_stable;	/* storage type */
521a62dc406SDoug Rabson 	int			nd_flag;	/* nd_flag */
522a62dc406SDoug Rabson 	int			nd_len;		/* Length of this write */
523a62dc406SDoug Rabson 	int			nd_repstat;	/* Reply status */
524a62dc406SDoug Rabson 	u_long			nd_retxid;	/* Reply xid */
525a62dc406SDoug Rabson 	u_long			nd_duration;	/* Lease duration */
526a62dc406SDoug Rabson 	struct timeval		nd_starttime;	/* Time RPC initiated */
527a62dc406SDoug Rabson 	fhandle_t		nd_fh;		/* File handle */
528a62dc406SDoug Rabson 	struct ucred		nd_cr;		/* Credentials */
529a62dc406SDoug Rabson };
530a62dc406SDoug Rabson 
531a62dc406SDoug Rabson /* Bits for "nd_flag" */
532a62dc406SDoug Rabson #define	ND_READ		LEASE_READ
533a62dc406SDoug Rabson #define ND_WRITE	LEASE_WRITE
534a62dc406SDoug Rabson #define ND_CHECK	0x04
535a62dc406SDoug Rabson #define ND_LEASE	(ND_READ | ND_WRITE | ND_CHECK)
536a62dc406SDoug Rabson #define ND_NFSV3	0x08
537a62dc406SDoug Rabson #define ND_NQNFS	0x10
538a62dc406SDoug Rabson #define ND_KERBNICK	0x20
539a62dc406SDoug Rabson #define ND_KERBFULL	0x40
540a62dc406SDoug Rabson #define ND_KERBAUTH	(ND_KERBNICK | ND_KERBFULL)
541a62dc406SDoug Rabson 
54228f8db14SBruce Evans extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head;
54328f8db14SBruce Evans extern int nfsd_head_flag;
5446ae32407SPoul-Henning Kamp #define	NFSD_CHECKSLP	0x01
54548fbb6ccSPoul-Henning Kamp 
546a62dc406SDoug Rabson /*
547a62dc406SDoug Rabson  * These macros compare nfsrv_descript structures.
548a62dc406SDoug Rabson  */
549a62dc406SDoug Rabson #define NFSW_CONTIG(o, n) \
550a62dc406SDoug Rabson 		((o)->nd_eoff >= (n)->nd_off && \
551a62dc406SDoug Rabson 		 !bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, NFSX_V3FH))
552a62dc406SDoug Rabson 
553a62dc406SDoug Rabson #define NFSW_SAMECRED(o, n) \
554a62dc406SDoug Rabson 	(((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \
555a62dc406SDoug Rabson  	 !bcmp((caddr_t)&(o)->nd_cr, (caddr_t)&(n)->nd_cr, \
556a62dc406SDoug Rabson 		sizeof (struct ucred)))
557a62dc406SDoug Rabson 
558996c772fSJohn Dyson 
559996c772fSJohn Dyson int	nfs_init __P((struct vfsconf *vfsp));
56048fbb6ccSPoul-Henning Kamp int	nfs_reply __P((struct nfsreq *));
561a62dc406SDoug Rabson int	nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
56248fbb6ccSPoul-Henning Kamp int	nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *));
563a62dc406SDoug Rabson int	nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *));
56448fbb6ccSPoul-Henning Kamp int	nfs_sndlock __P((int *,struct nfsreq *));
565512fef80SBruce Evans void	nfs_sndunlock __P((int *flagp));
56648fbb6ccSPoul-Henning Kamp int	nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
56748fbb6ccSPoul-Henning Kamp int	nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int));
56848fbb6ccSPoul-Henning Kamp int	nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *));
569a62dc406SDoug Rabson int	nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *));
57048fbb6ccSPoul-Henning Kamp int	nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *));
57148fbb6ccSPoul-Henning Kamp int	nfs_asyncio __P((struct buf *,struct ucred *));
57248fbb6ccSPoul-Henning Kamp int	nfs_doio __P((struct buf *,struct ucred *,struct proc *));
57348fbb6ccSPoul-Henning Kamp int	nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *));
57448fbb6ccSPoul-Henning Kamp int	nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *));
575a62dc406SDoug Rabson int	nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *));
57648fbb6ccSPoul-Henning Kamp int	nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *));
577a62dc406SDoug Rabson void	nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *));
578a62dc406SDoug Rabson void	nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **));
579a62dc406SDoug Rabson void	nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **));
58048fbb6ccSPoul-Henning Kamp int	netaddr_match __P((int,union nethostaddr *,struct mbuf *));
58148fbb6ccSPoul-Henning Kamp int	nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *));
58248fbb6ccSPoul-Henning Kamp int	nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *));
583a62dc406SDoug Rabson int	nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int));
58448fbb6ccSPoul-Henning Kamp void	nfsm_adj __P((struct mbuf *,int,int));
58548fbb6ccSPoul-Henning Kamp int	nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *));
58648fbb6ccSPoul-Henning Kamp void	nfsrv_initcache __P((void));
587a62dc406SDoug Rabson int	nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T));
588a62dc406SDoug Rabson int	nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int));
589a62dc406SDoug Rabson int	nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *));
59048fbb6ccSPoul-Henning Kamp int	nfs_adv __P((struct mbuf **,caddr_t *,int,int));
59148fbb6ccSPoul-Henning Kamp void	nfs_nhinit __P((void));
59248fbb6ccSPoul-Henning Kamp void	nfs_timer __P((void*));
593a62dc406SDoug Rabson u_long nfs_hash __P((nfsfh_t *,int));
594a62dc406SDoug Rabson int	nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **));
595a62dc406SDoug Rabson int	nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **));
596a62dc406SDoug Rabson void	nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *));
597996c772fSJohn Dyson void	nfsrv_cleancache __P((void));
59848fbb6ccSPoul-Henning Kamp int	nfs_connect __P((struct nfsmount *,struct nfsreq *));
599996c772fSJohn Dyson void	nfs_disconnect __P((struct nfsmount *));
60048fbb6ccSPoul-Henning Kamp int	nfs_getattrcache __P((struct vnode *,struct vattr *));
60148fbb6ccSPoul-Henning Kamp int	nfsm_strtmbuf __P((struct mbuf **,char **,char *,long));
60248fbb6ccSPoul-Henning Kamp int	nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *));
60348fbb6ccSPoul-Henning Kamp int	nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *));
60448fbb6ccSPoul-Henning Kamp void	nfsrv_init __P((int));
605a62dc406SDoug Rabson void	nfs_clearcommit __P((struct mount *));
606a62dc406SDoug Rabson int	nfsrv_errmap __P((struct nfsrv_descript *, int));
607a62dc406SDoug Rabson void	nfsrvw_sort __P((gid_t [],int));
608a62dc406SDoug Rabson void	nfsrv_setcred __P((struct ucred *,struct ucred *));
609a62dc406SDoug Rabson int	nfs_writebp __P((struct buf *,int));
6106476c0d2SJohn Dyson int	nfsrv_object_create __P(( struct vnode * ));
611dee6b0abSBruce Evans void	nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
612a62dc406SDoug Rabson int	nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
613a62dc406SDoug Rabson 			       struct proc *, struct mbuf **));
614a62dc406SDoug Rabson int	nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
615a62dc406SDoug Rabson 			struct proc *p));
616473e9734SPoul-Henning Kamp 
617dee6b0abSBruce Evans int	nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
618dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
619dee6b0abSBruce Evans int	nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
620dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
621dee6b0abSBruce Evans int	nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
622dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
623b8dce649SPoul-Henning Kamp int	nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,
624b8dce649SPoul-Henning Kamp 			struct ucred *,struct nfssvc_sock *,struct mbuf *,
625b8dce649SPoul-Henning Kamp 			int *,int));
626dee6b0abSBruce Evans int	nfsrv_fsinfo __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
627dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
628dee6b0abSBruce Evans int	nfsrv_getattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
629dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
630dee6b0abSBruce Evans int	nfsrv_link __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
631dee6b0abSBruce Evans 			struct proc *procp, struct mbuf **mrq));
632dee6b0abSBruce Evans int	nfsrv_lookup __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
633dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
634dee6b0abSBruce Evans int	nfsrv_mkdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
635dee6b0abSBruce Evans 			 struct proc *procp, struct mbuf **mrq));
636dee6b0abSBruce Evans int	nfsrv_mknod __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
637dee6b0abSBruce Evans 			 struct proc *procp, struct mbuf **mrq));
638dee6b0abSBruce Evans int	nfsrv_noop __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
639dee6b0abSBruce Evans 			struct proc *procp, struct mbuf **mrq));
640dee6b0abSBruce Evans int	nfsrv_null __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
641dee6b0abSBruce Evans 			struct proc *procp, struct mbuf **mrq));
642dee6b0abSBruce Evans int	nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
643dee6b0abSBruce Evans 			    struct nfssvc_sock *slp, struct proc *procp,
644dee6b0abSBruce Evans 			    struct mbuf **mrq));
645dee6b0abSBruce Evans int	nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
646dee6b0abSBruce Evans 			struct proc *procp, struct mbuf **mrq));
647dee6b0abSBruce Evans int	nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
648dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
649dee6b0abSBruce Evans int	nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
650dee6b0abSBruce Evans 			       struct nfssvc_sock *slp, struct proc *procp,
651dee6b0abSBruce Evans 			       struct mbuf **mrq));
652dee6b0abSBruce Evans int	nfsrv_readlink __P((struct nfsrv_descript *nfsd,
653dee6b0abSBruce Evans 			    struct nfssvc_sock *slp, struct proc *procp,
654dee6b0abSBruce Evans 			    struct mbuf **mrq));
655dee6b0abSBruce Evans int	nfsrv_remove __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
656dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
657dee6b0abSBruce Evans int	nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
658dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
659dee6b0abSBruce Evans int	nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
660dee6b0abSBruce Evans 			 struct proc *procp, struct mbuf **mrq));
661dee6b0abSBruce Evans int	nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
662dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
663dee6b0abSBruce Evans int	nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
664dee6b0abSBruce Evans 			  struct proc *procp, struct mbuf **mrq));
665dee6b0abSBruce Evans int	nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
666dee6b0abSBruce Evans 			   struct proc *procp, struct mbuf **mrq));
667dee6b0abSBruce Evans int	nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
668dee6b0abSBruce Evans 			 struct proc *procp, struct mbuf **mrq));
669996c772fSJohn Dyson void	nfsrv_rcv __P((struct socket *so, caddr_t arg, int waitflag));
670996c772fSJohn Dyson void	nfsrv_slpderef __P((struct nfssvc_sock *slp));
671df8bae1dSRodney W. Grimes #endif	/* KERNEL */
67233420ec6SPaul Richards 
67333420ec6SPaul Richards #endif
674