2 * Copyright (c) 1989, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * @(#)nfs.h 8.4 (Berkeley) 5/1/95
37 * $FreeBSD: src/sys/nfs/nfs.h,v 1.53.2.5 2002/02/20 01:35:34 iedowse Exp $
38 * $DragonFly: src/sys/vfs/nfs/nfs.h,v 1.21 2008/09/17 21:44:24 dillon Exp $
48 #include <sys/vnode.h>
49 #include <sys/mutex.h>
52 * Tunable constants for nfs
55 #define NFS_MAXIOVEC 34
56 #define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */
57 #define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */
58 #define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
59 #define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
60 #define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
61 #define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/
62 #define NFS_MAXREXMIT 100 /* Stop counting after this many */
63 #define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */
64 #define NFS_RETRANS 10 /* Num of retrans for soft mounts */
65 #define NFS_MAXGRPS 16 /* Max. size of groups list */
66 #ifndef NFS_MINATTRTIMO
67 #define NFS_MINATTRTIMO 3 /* VREG attrib cache timeout in sec */
69 #ifndef NFS_DEFATTRTIMO
70 #define NFS_DEFATTRTIMO 10 /* VREG attrib cache timeout in sec */
72 #ifndef NFS_MAXATTRTIMO
73 #define NFS_MAXATTRTIMO 60
75 #ifndef NFS_MINDIRATTRTIMO
76 #define NFS_MINDIRATTRTIMO 30 /* VDIR attrib cache timeout in sec */
78 #ifndef NFS_MAXDIRATTRTIMO
79 #define NFS_MAXDIRATTRTIMO 60
81 #ifndef NFS_DEADTHRESH
82 #define NFS_DEADTHRESH NFS_NEVERDEAD
84 #define NFS_NEVERDEAD 9
85 #define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
86 #define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
87 #define NFS_READDIRSIZE 8192 /* Def. readdir size */
88 #define NFS_DEFRAHEAD 4 /* Def. read ahead # blocks */
89 #define NFS_MAXRAHEAD 32 /* Max. read ahead # blocks */
90 #define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */
91 #define NFS_MAXGATHERDELAY 100 /* Max. write gather delay (msec) */
92 #ifndef NFS_GATHERDELAY
93 #define NFS_GATHERDELAY 20 /* Default write gather delay (msec) */
95 #define NFS_DIRBLKSIZ 4096 /* Must be a multiple of DIRBLKSIZ */
97 #define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */
103 #define NMOD(a) ((a) % nfs_asyncdaemons)
104 #define NFS_CMPFH(n, f, s) \
105 ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
106 #define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
107 #define NFS_SRVMAXDATA(n) \
108 (((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \
109 NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
112 * The IO_METASYNC flag should be implemented for local file systems.
113 * (Until then, it is nothin at all.)
116 #define IO_METASYNC 0
120 * Arguments to mount NFS
122 #define NFS_ARGSVERSION 3 /* change when nfs_args changes */
124 int version; /* args structure version number */
125 struct sockaddr *addr; /* file server address */
126 int addrlen; /* length of address */
127 int sotype; /* Socket type */
128 int proto; /* and Protocol */
129 u_char *fh; /* File handle to be mounted */
130 int fhsize; /* Size, in bytes, of fh */
131 int flags; /* flags */
132 int wsize; /* write size in bytes */
133 int rsize; /* read size in bytes */
134 int readdirsize; /* readdir size in bytes */
135 int timeo; /* initial timeout in .1 secs */
136 int retrans; /* times to retry send */
137 int maxgrouplist; /* Max. size of group list */
138 int readahead; /* # of blocks to readahead */
139 int unused01; /* Term (sec) of lease */
140 int deadthresh; /* Retrans threshold */
141 char *hostname; /* server's name */
142 int acregmin; /* cache attrs for reg files min time */
143 int acregmax; /* cache attrs for reg files max time */
144 int acdirmin; /* cache attrs for dirs min time */
145 int acdirmax; /* cache attrs for dirs max time */
149 * NFS mount option flags
151 #define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
152 #define NFSMNT_WSIZE 0x00000002 /* set write size */
153 #define NFSMNT_RSIZE 0x00000004 /* set read size */
154 #define NFSMNT_TIMEO 0x00000008 /* set initial timeout */
155 #define NFSMNT_RETRANS 0x00000010 /* set number of request retries */
156 #define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */
157 #define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
158 #define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
159 #define NFSMNT_UNUSED0100 0x00000100
160 #define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */
161 #define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */
162 #define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */
163 #define NFSMNT_UNUSED1000 0x00001000 /* set lease term (nqnfs) */
164 #define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
165 #define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */
166 #define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
167 #define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
168 #define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
169 #define NFSMNT_ACREGMIN 0x00040000
170 #define NFSMNT_ACREGMAX 0x00080000
171 #define NFSMNT_ACDIRMIN 0x00100000
172 #define NFSMNT_ACDIRMAX 0x00200000
174 #define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */
175 #define NFSSTA_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */
176 #define NFSSTA_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */
177 #define NFSSTA_MNTD 0x00200000 /* Mnt server for mnt point */
178 #define NFSSTA_DISMINPROG 0x00400000 /* Dismount in progress */
179 #define NFSSTA_DISMNT 0x00800000 /* Dismounted */
180 #define NFSSTA_UNUSED24 0x01000000
181 #define NFSSTA_UNUSED25 0x02000000
182 #define NFSSTA_UNUSED26 0x04000000
183 #define NFSSTA_UNUSED27 0x08000000
184 #define NFSSTA_WAITAUTH 0x10000000 /* Wait for authentication */
185 #define NFSSTA_HASAUTH 0x20000000 /* Has authenticator */
186 #define NFSSTA_WANTAUTH 0x40000000 /* Wants an authenticator */
187 #define NFSSTA_AUTHERR 0x80000000 /* Authentication error */
190 * Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
191 * should ever try and use it.
194 int sock; /* Socket to serve */
195 caddr_t name; /* Client addr for connection based sockets */
196 int namelen; /* Length of name */
199 struct nfsd_srvargs {
200 struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */
201 uid_t nsd_uid; /* Effective uid mapped to cred */
202 u_int32_t nsd_haddr; /* Ip address of client */
203 struct ucred nsd_cr; /* Cred. uid maps to */
204 u_int nsd_authlen; /* Length of auth string (ret) */
205 u_char *nsd_authstr; /* Auth string (ret) */
206 u_int nsd_verflen; /* and the verfier */
208 struct timeval nsd_timestamp; /* timestamp from verifier */
209 u_int32_t nsd_ttl; /* credential ttl (sec) */
210 NFSKERBKEY_T nsd_key; /* Session key */
214 char *ncd_dirp; /* Mount dir path */
215 uid_t ncd_authuid; /* Effective uid */
216 int ncd_authtype; /* Type of authenticator */
217 u_int ncd_authlen; /* Length of authenticator string */
218 u_char *ncd_authstr; /* Authenticator string */
219 u_int ncd_verflen; /* and the verifier */
221 NFSKERBKEY_T ncd_key; /* Session key */
225 * XXX to allow amd to include nfs.h without nfsproto.h
233 int attrcache_misses;
234 int lookupcache_hits;
235 int lookupcache_misses;
236 int direofcache_hits;
237 int direofcache_misses;
244 int biocache_readlinks;
246 int biocache_readdirs;
248 int rpccnt[NFS_NPROCS];
250 int srvrpccnt[NFS_NPROCS];
257 int srvcache_inproghits;
258 int srvcache_idemdonehits;
259 int srvcache_nonidemdonehits;
262 int srvnqnfs_maxleases;
263 int srvnqnfs_getleases;
265 int accesscache_hits;
266 int accesscache_misses;
271 * Flags for nfssvc() system call.
273 #define NFSSVC_BIOD 0x002
274 #define NFSSVC_NFSD 0x004
275 #define NFSSVC_ADDSOCK 0x008
276 #define NFSSVC_AUTHIN 0x010
277 #define NFSSVC_GOTAUTH 0x040
278 #define NFSSVC_AUTHINFAIL 0x080
279 #define NFSSVC_MNTD 0x100
282 * fs.nfs sysctl(3) identifiers
284 #define NFS_NFSSTATS 1 /* struct: struct nfsstats */
285 #define NFS_NFSPRIVPORT 2 /* int: prohibit nfs to resvports */
287 #define FS_NFS_NAMES { \
289 { "nfsstats", CTLTYPE_STRUCT }, \
290 { "nfsprivport", CTLTYPE_INT }, \
295 #ifdef MALLOC_DECLARE
296 MALLOC_DECLARE(M_NFSREQ);
297 MALLOC_DECLARE(M_NFSDIROFF);
298 MALLOC_DECLARE(M_NFSRVDESC);
299 MALLOC_DECLARE(M_NFSUID);
300 MALLOC_DECLARE(M_NFSD);
301 MALLOC_DECLARE(M_NFSBIGFH);
302 MALLOC_DECLARE(M_NFSHASH);
305 #ifdef ZONE_INTERRUPT
306 extern vm_zone_t nfsmount_zone;
309 extern struct callout nfs_timer_handle;
310 extern int nfs_async;
319 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
320 * What should be in this set is open to debate, but I believe that since
321 * I/O system calls on ufs are never interrupted by signals the set should
322 * be minimal. My reasoning is that many current programs that use signals
323 * such as SIGALRM will not expect file I/O system calls to be interrupted
326 #define NFSINT_SIGMASK(set) \
327 (SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
328 SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
329 SIGISMEMBER(set, SIGQUIT))
332 * Socket errors ignored for connectionless sockets??
333 * For now, ignore them all
335 #define NFSIGNORE_SOERROR(s, e) \
336 ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
337 ((s) & PR_CONNREQUIRED) == 0)
342 * Nfs outstanding request list element
345 TAILQ_ENTRY(nfsreq) r_chain;
346 struct nfsm_info *r_info;
347 struct mtx_link r_link;
352 struct nfsmount *r_nmp;
355 int r_flags; /* flags on request, see below */
356 int r_retry; /* max retransmission count */
357 int r_rexmit; /* current retrans count */
358 int r_timer; /* tick counter on reply */
359 u_int32_t r_procnum; /* NFS procedure number */
360 int r_rtt; /* RTT for rpc */
361 struct thread *r_td; /* Thread that did I/O system call */
362 struct mbuf *r_mrest;
363 struct mbuf *r_mheadend;
370 struct ucred *r_cred;
374 * Flag values for r_flags
376 #define R_TIMING 0x0001 /* timing request (in mntp) */
377 #define R_SENT 0x0002 /* request has been sent */
378 #define R_SOFTTERM 0x0004 /* soft mnt, too many retries */
379 #define R_INTR 0x0008 /* intr mnt, signal pending */
380 #define R_SOCKERR 0x0010 /* Fatal error on socket */
381 #define R_TPRINTFMSG 0x0020 /* Did a tprintf msg. */
382 #define R_MUSTRESEND 0x0040 /* Must resend request */
383 #define R_UNUSED07 0x0080
384 #define R_MASKTIMER 0x0100 /* Timer should ignore this req */
385 #define R_LOCKED 0x0200 /* Locked by the timer */
388 * A list of nfssvc_sock structures is maintained with all the sockets
389 * that require service by the nfsd.
390 * The nfsuid structs hang off of the nfssvc_sock structs in both lru
391 * and uid hash lists.
393 #ifndef NFS_UIDHASHSIZ
394 #define NFS_UIDHASHSIZ 29 /* Tune the size of nfssvc_sock with this */
396 #define NUIDHASH(sock, uid) \
397 (&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ])
398 #ifndef NFS_WDELAYHASHSIZ
399 #define NFS_WDELAYHASHSIZ 16 /* and with this */
401 #define NWDELAYHASH(sock, f) \
402 (&(sock)->ns_wdelayhashtbl[(*((u_int32_t *)(f))) % NFS_WDELAYHASHSIZ])
403 #ifndef NFS_MUIDHASHSIZ
404 #define NFS_MUIDHASHSIZ 63 /* Tune the size of nfsmount with this */
406 #define NMUIDHASH(nmp, uid) \
407 (&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ])
410 * Network address hash list element
413 u_int32_t had_inetaddr;
414 struct sockaddr *had_nam;
418 TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */
419 LIST_ENTRY(nfsuid) nu_hash; /* Hash list */
420 int nu_flag; /* Flags */
421 union nethostaddr nu_haddr; /* Host addr. for dgram sockets */
422 struct ucred nu_cr; /* Cred uid mapped to */
423 int nu_expire; /* Expiry time (sec) */
424 struct timeval nu_timestamp; /* Kerb. timestamp */
425 u_int32_t nu_nickname; /* Nickname on server */
426 NFSKERBKEY_T nu_key; /* and session key */
429 #define nu_inetaddr nu_haddr.had_inetaddr
430 #define nu_nam nu_haddr.had_nam
431 /* Bits for nu_flag */
432 #define NU_INETADDR 0x1
434 #define NU_NETFAM(u) (((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO)
437 STAILQ_ENTRY(nfsrv_rec) nr_link;
438 struct sockaddr *nr_address;
439 struct mbuf *nr_packet;
443 TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
444 TAILQ_HEAD(, nfsuid) ns_uidlruhead;
446 struct socket *ns_so;
447 struct sockaddr *ns_nam;
449 struct mbuf *ns_rawend;
450 STAILQ_HEAD(, nfsrv_rec) ns_rec;
451 struct mbuf *ns_frag;
454 struct mtx ns_solock;
459 LIST_HEAD(, nfsrv_descript) ns_tq; /* Write gather lists */
460 LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ];
461 LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ];
464 /* Bits for "ns_flag" */
465 #define SLP_VALID 0x01
466 #define SLP_DOREC 0x02
467 #define SLP_NEEDQ 0x04
468 #define SLP_DISCONN 0x08
469 #define SLP_GETSTREAM 0x10
470 #define SLP_LASTFRAG 0x20
471 #define SLP_ALLFLAGS 0xff
473 extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead;
474 extern int nfssvc_sockhead_flag;
475 extern TAILQ_HEAD(nfsmount_head, nfsmount) nfs_mountq;
477 #define SLP_INIT 0x01
478 #define SLP_WANTINIT 0x02
481 * One of these structures is allocated for each nfsd.
484 TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */
485 int nfsd_flag; /* NFSD_ flags */
486 struct nfssvc_sock *nfsd_slp; /* Current socket */
487 int nfsd_authlen; /* Authenticator len */
488 u_char nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */
489 int nfsd_verflen; /* and the Verifier */
490 u_char nfsd_verfstr[RPCVERF_MAXSIZ];
491 struct thread *nfsd_td; /* thread ptr */
492 struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */
495 /* Bits for "nfsd_flag" */
496 #define NFSD_WAITING 0x01
497 #define NFSD_REQINPROG 0x02
498 #define NFSD_NEEDAUTH 0x04
499 #define NFSD_AUTHFAIL 0x08
501 /* Bits for loadattrcache */
502 #define NFS_LATTR_NOSHRINK 0x01
503 #define NFS_LATTR_NOMTIMECHECK 0x02
506 * This structure is used by the server for describing each request.
507 * Some fields are used only when write request gathering is performed.
509 struct nfsrv_descript {
510 u_quad_t nd_time; /* Write deadline (usec) */
511 off_t nd_off; /* Start byte offset */
512 off_t nd_eoff; /* and end byte offset */
513 LIST_ENTRY(nfsrv_descript) nd_hash; /* Hash list */
514 LIST_ENTRY(nfsrv_descript) nd_tq; /* and timer list */
515 LIST_HEAD(,nfsrv_descript) nd_coalesce; /* coalesced writes */
516 struct mbuf *nd_mrep; /* Request mbuf list */
517 struct mbuf *nd_md; /* Current dissect mbuf */
518 struct mbuf *nd_mreq; /* Reply mbuf list */
519 struct sockaddr *nd_nam; /* and socket addr */
520 struct sockaddr *nd_nam2; /* return socket addr */
521 caddr_t nd_dpos; /* Current dissect pos */
522 u_int32_t nd_procnum; /* RPC # */
523 int nd_stable; /* storage type */
524 int nd_flag; /* nd_flag */
525 int nd_len; /* Length of this write */
526 int nd_repstat; /* Reply status */
527 u_int32_t nd_retxid; /* Reply xid */
528 struct timeval nd_starttime; /* Time RPC initiated */
529 fhandle_t nd_fh; /* File handle */
530 struct ucred nd_cr; /* Credentials */
533 /* Bits for "nd_flag" */
535 #define ND_WRITE 0x02
536 #define ND_CHECK 0x04
537 #define ND_NFSV3 0x08
538 #define ND_UNUSED010 0x10
539 #define ND_KERBNICK 0x20
540 #define ND_KERBFULL 0x40
541 #define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL)
543 extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head;
544 extern int nfsd_head_flag;
545 extern int nfsd_waiting;
546 #define NFSD_CHECKSLP 0x01
549 * These macros compare nfsrv_descript structures.
551 #define NFSW_CONTIG(o, n) \
552 ((o)->nd_eoff >= (n)->nd_off && \
553 !bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, NFSX_V3FH))
555 #define NFSW_SAMECRED(o, n) \
556 (((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \
557 !bcmp((caddr_t)&(o)->nd_cr, (caddr_t)&(n)->nd_cr, \
558 sizeof (struct ucred)))
564 #define WEBNFS_ESC_CHAR '%'
565 #define WEBNFS_SPECCHAR_START 0x80
567 #define WEBNFS_NATIVE_CHAR 0x80
570 * Possibly more here in the future.
574 * Macro for converting escape characters in WebNFS pathnames.
575 * Should really be in libkern.
579 ((c) >= 'a' ? ((c) - ('a' - 10)) : \
580 ((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))
581 #define HEXSTRTOI(p) \
582 ((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))
586 extern int nfs_debug;
587 #define NFS_DEBUG_ASYNCIO 1 /* asynchronous i/o */
588 #define NFS_DEBUG_WG 2 /* server write gathering */
589 #define NFS_DEBUG_RC 4 /* server request caching */
591 #define NFS_DPF(cat, args) \
593 if (nfs_debug & NFS_DEBUG_##cat) kprintf args; \
598 #define NFS_DPF(cat, args)
602 extern u_int32_t nfs_xdrneg1;
603 extern u_int32_t rpc_reply, rpc_msgdenied, rpc_mismatch, rpc_vers;
604 extern u_int32_t rpc_auth_unix, rpc_msgaccepted, rpc_call, rpc_autherr;
605 extern u_int32_t rpc_auth_kerb;
606 extern u_int32_t nfs_prog, nfs_true, nfs_false;
607 extern struct nfsstats nfsstats;
608 extern nfstype nfsv2_type[9];
609 extern nfstype nfsv3_type[9];
610 extern int nfsv2_procid[NFS_NPROCS];
611 extern enum vtype nv3tov_type[8];
612 extern int nfsv3_procid[NFS_NPROCS];
613 extern int nfs_ticks;
614 extern struct nfsrtt nfsrtt;
616 extern int nfsrvw_procrastinate;
617 extern int nfsrvw_procrastinate_v3;
618 extern int32_t (*nfsrv3_procs[NFS_NPROCS]) (struct nfsrv_descript *nd,
619 struct nfssvc_sock *slp,
621 struct mbuf **mreqp);
623 extern struct nfsv3_diskless nfsv3_diskless;
625 u_quad_t nfs_curusec (void);
626 int nfs_init (struct vfsconf *vfsp);
627 int nfs_uninit (struct vfsconf *vfsp);
628 int nfs_reply (struct nfsmount *nmp, struct nfsreq *);
629 int nfs_getreq (struct nfsrv_descript *,struct nfsd *,int);
630 int nfs_send (struct socket *, struct sockaddr *, struct mbuf *,
632 int nfs_rephead (int, struct nfsrv_descript *, struct nfssvc_sock *,
633 int, struct mbuf **, struct mbuf **, caddr_t *);
634 int nfs_sndlock (struct nfsmount *, struct nfsreq *);
635 void nfs_sndunlock (struct nfsmount *);
636 int nfs_slplock (struct nfssvc_sock *, int);
637 void nfs_slpunlock (struct nfssvc_sock *);
638 int nfs_disct (struct mbuf **, caddr_t *, int, int, caddr_t *);
639 int nfs_vinvalbuf (struct vnode *, int, int);
640 int nfs_readrpc_uio (struct vnode *, struct uio *);
641 void nfs_readrpc_bio (struct vnode *, struct bio *);
642 int nfs_writerpc (struct vnode *, struct uio *, int *, int *);
643 int nfs_commit (struct vnode *vp, u_quad_t offset, int cnt,
645 int nfs_readdirrpc (struct vnode *, struct uio *);
646 void nfs_startio (struct vnode *vp, struct bio *, struct thread *);
647 void nfs_asyncio(struct vnode *vp, struct bio *bio);
648 int nfs_asyncok(struct nfsmount *nmp);
649 int nfs_iowait (struct bio *bio);
651 int nfs_readlinkrpc (struct vnode *, struct uio *);
652 int nfs_sigintr (struct nfsmount *, struct nfsreq *, struct thread *);
653 int nfs_readdirplusrpc (struct vnode *, struct uio *);
654 int netaddr_match (int, union nethostaddr *, struct sockaddr *);
656 int nfs_loadattrcache (struct vnode *, struct mbuf **, caddr_t *,
657 struct vattr *, int);
658 int nfs_namei (struct nlookupdata *, struct ucred *, int,
659 struct vnode **, struct vnode **, fhandle_t *, int,
660 struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
661 caddr_t *, struct vnode **, struct thread *, int, int);
662 void nfsrv_initcache (void);
663 int nfs_getauth (struct nfsmount *, struct nfsreq *, struct ucred *,
664 char **, int *, char *, int *, NFSKERBKEY_T);
665 int nfs_getnickauth (struct nfsmount *, struct ucred *, char **,
667 int nfs_savenickauth (struct nfsmount *, struct ucred *, int,
668 NFSKERBKEY_T, struct mbuf **, char **,
670 int nfs_adv (struct mbuf **, caddr_t *, int, int);
671 void nfs_nhinit (void);
672 int nfs_nmcancelreqs (struct nfsmount *);
673 void nfs_timer (void*);
674 int nfsrv_dorec (struct nfssvc_sock *, struct nfsd *,
675 struct nfsrv_descript **);
676 int nfsrv_getcache (struct nfsrv_descript *, struct nfssvc_sock *,
678 void nfsrv_updatecache (struct nfsrv_descript *, int, struct mbuf *);
679 void nfsrv_cleancache (void);
680 int nfs_connect (struct nfsmount *, struct nfsreq *);
681 void nfs_disconnect (struct nfsmount *);
682 void nfs_safedisconnect (struct nfsmount *);
683 int nfs_getattrcache (struct vnode *, struct vattr *);
684 int nfs_bioread (struct vnode *, struct uio *, int);
685 void nfsrv_init (int);
686 void nfs_clearcommit (struct mount *);
687 int nfsrv_errmap (struct nfsrv_descript *, int);
688 void nfsrvw_sort (gid_t *, int);
689 void nfsrv_setcred (struct ucred *, struct ucred *);
690 int nfsrv_object_create (struct vnode *);
691 void nfsrv_wakenfsd (struct nfssvc_sock *slp, int nparallel);
692 int nfsrv_writegather (struct nfsrv_descript **, struct nfssvc_sock *,
693 struct thread *, struct mbuf **);
694 int nfs_fsinfo (struct nfsmount *, struct vnode *, struct thread *p);
696 int nfsrv3_access (struct nfsrv_descript *nfsd,
697 struct nfssvc_sock *slp,
698 struct thread *td, struct mbuf **mrq);
699 int nfsrv_commit (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
700 struct thread *td, struct mbuf **mrq);
701 int nfsrv_create (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
702 struct thread *td, struct mbuf **mrq);
703 int nfsrv_fhtovp (fhandle_t *, int, struct mount **, struct vnode **,
704 struct ucred *, struct nfssvc_sock *,
705 struct sockaddr *, int *, int, int);
706 int nfsrv_setpublicfs (struct mount *, struct netexport *,
707 struct export_args *);
708 int nfs_ispublicfh (fhandle_t *);
709 int nfsrv_fsinfo (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
710 struct thread *td, struct mbuf **mrq);
711 int nfsrv_getattr (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
712 struct thread *td, struct mbuf **mrq);
713 int nfsrv_link (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
714 struct thread *td, struct mbuf **mrq);
715 int nfsrv_lookup (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
716 struct thread *td, struct mbuf **mrq);
717 int nfsrv_mkdir (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
718 struct thread *td, struct mbuf **mrq);
719 int nfsrv_mknod (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
720 struct thread *td, struct mbuf **mrq);
721 int nfsrv_noop (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
722 struct thread *td, struct mbuf **mrq);
723 int nfsrv_null (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
724 struct thread *td, struct mbuf **mrq);
725 int nfsrv_pathconf (struct nfsrv_descript *nfsd,
726 struct nfssvc_sock *slp, struct thread *td,
728 int nfsrv_read (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
729 struct thread *td, struct mbuf **mrq);
730 int nfsrv_readdir (struct nfsrv_descript *nfsd,
731 struct nfssvc_sock *slp,
732 struct thread *td, struct mbuf **mrq);
733 int nfsrv_readdirplus (struct nfsrv_descript *nfsd,
734 struct nfssvc_sock *slp, struct thread *td,
736 int nfsrv_readlink (struct nfsrv_descript *nfsd,
737 struct nfssvc_sock *slp, struct thread *td,
739 int nfsrv_remove (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
740 struct thread *td, struct mbuf **mrq);
741 int nfsrv_rename (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
742 struct thread *td, struct mbuf **mrq);
743 int nfsrv_rmdir (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
744 struct thread *td, struct mbuf **mrq);
745 int nfsrv_setattr (struct nfsrv_descript *nfsd,
746 struct nfssvc_sock *slp,
747 struct thread *td, struct mbuf **mrq);
748 int nfsrv_statfs (struct nfsrv_descript *nfsd,
749 struct nfssvc_sock *slp,
750 struct thread *td, struct mbuf **mrq);
751 int nfsrv_symlink (struct nfsrv_descript *nfsd,
752 struct nfssvc_sock *slp,
753 struct thread *td, struct mbuf **mrq);
754 int nfsrv_write (struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
755 struct thread *td, struct mbuf **mrq);
756 void nfsrv_rcv (struct socket *so, void *arg, int waitflag);
757 void nfsrv_slpderef (struct nfssvc_sock *slp);
758 int nfs_meta_setsize (struct vnode *vp, struct thread *td, u_quad_t nsize);
759 int nfs_clientd(struct nfsmount *nmp, struct ucred *cred,
760 struct nfsd_cargs *ncd, int flag, caddr_t argp,
762 void nfssvc_iod_reader(void *arg);
763 void nfssvc_iod_writer(void *arg);
764 void nfssvc_iod_stop(struct nfsmount *nmp);
765 void nfssvc_iod_writer_wakeup(struct nfsmount *nmp);
766 void nfssvc_iod_reader_wakeup(struct nfsmount *nmp);