38 */ 39 40#ifndef _NFS_NFS_H_ 41#define _NFS_NFS_H_ 42 43/* 44 * Tunable constants for nfs 45 */ 46 47#define NFS_MAXIOVEC 34 48#define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */ 49#define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */ 50#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */ 51#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */ 52#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */ 53#define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/ 54#define NFS_MAXREXMIT 100 /* Stop counting after this many */ 55#define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */ 56#define NFS_RETRANS 10 /* Num of retrans for soft mounts */ 57#define NFS_MAXGRPS 16 /* Max. size of groups list */ 58#ifndef NFS_MINATTRTIMO 59#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */ 60#endif 61#ifndef NFS_MAXATTRTIMO 62#define NFS_MAXATTRTIMO 60 63#endif 64#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */ 65#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */ 66#define NFS_READDIRSIZE 8192 /* Def. readdir size */ 67#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */ 68#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */ 69#define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */ 70#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runnable */ 71#define NFS_MAXGATHERDELAY 100 /* Max. write gather delay (msec) */ 72#ifndef NFS_GATHERDELAY 73#define NFS_GATHERDELAY 10 /* Default write gather delay (msec) */ 74#endif 75#define NFS_DIRBLKSIZ 4096 /* Must be a multiple of DIRBLKSIZ */ 76#ifdef KERNEL 77#define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */ 78#endif 79 80/* 81 * Oddballs 82 */ 83#define NMOD(a) ((a) % nfs_asyncdaemons) 84#define NFS_CMPFH(n, f, s) \ 85 ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s))) 86#define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3) 87#define NFS_SRVMAXDATA(n) \ 88 (((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \ 89 NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA) 90 91/* 92 * XXX 93 * The B_INVAFTERWRITE flag should be set to whatever is required by the 94 * buffer cache code to say "Invalidate the block after it is written back". 95 */ 96#ifdef __FreeBSD__ 97#define B_INVAFTERWRITE B_NOCACHE 98#else 99#define B_INVAFTERWRITE B_INVAL 100#endif 101 102/* 103 * The IO_METASYNC flag should be implemented for local file systems. 104 * (Until then, it is nothin at all.) 105 */ 106#ifndef IO_METASYNC 107#define IO_METASYNC 0 108#endif 109 110/* 111 * Set the attribute timeout based on how recently the file has been modified. 112 */ 113#define NFS_ATTRTIMEO(np) \ 114 ((((np)->n_flag & NMODIFIED) || \ 115 (time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \ 116 ((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \ 117 (time.tv_sec - (np)->n_mtime) / 10)) 118 119/* 120 * Expected allocation sizes for major data structures. If the actual size 121 * of the structure exceeds these sizes, then malloc() will be allocating 122 * almost twice the memory required. This is used in nfs_init() to warn 123 * the sysadmin that the size of a structure should be reduced. 124 * (These sizes are always a power of 2. If the kernel malloc() changes 125 * to one that does not allocate space in powers of 2 size, then this all 126 * becomes bunk!) 127 */ 128#define NFS_NODEALLOC 256 129#define NFS_MNTALLOC 512 130#define NFS_SVCALLOC 256 131#define NFS_UIDALLOC 128 132 133/* 134 * Arguments to mount NFS 135 */ 136#define NFS_ARGSVERSION 3 /* change when nfs_args changes */ 137struct nfs_args { 138 int version; /* args structure version number */ 139 struct sockaddr *addr; /* file server address */ 140 int addrlen; /* length of address */ 141 int sotype; /* Socket type */ 142 int proto; /* and Protocol */ 143 u_char *fh; /* File handle to be mounted */ 144 int fhsize; /* Size, in bytes, of fh */ 145 int flags; /* flags */ 146 int wsize; /* write size in bytes */ 147 int rsize; /* read size in bytes */ 148 int readdirsize; /* readdir size in bytes */ 149 int timeo; /* initial timeout in .1 secs */ 150 int retrans; /* times to retry send */ 151 int maxgrouplist; /* Max. size of group list */ 152 int readahead; /* # of blocks to readahead */ 153 int leaseterm; /* Term (sec) of lease */ 154 int deadthresh; /* Retrans threshold */ 155 char *hostname; /* server's name */ 156}; 157 158/* 159 * NFS mount option flags 160 */ 161#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */ 162#define NFSMNT_WSIZE 0x00000002 /* set write size */ 163#define NFSMNT_RSIZE 0x00000004 /* set read size */ 164#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */ 165#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */ 166#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */ 167#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */ 168#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ 169#define NFSMNT_NQNFS 0x00000100 /* Use Nqnfs protocol */ 170#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ 171#define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */ 172#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ 173#define NFSMNT_LEASETERM 0x00001000 /* set lease term (nqnfs) */ 174#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ 175#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */ 176#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */ 177#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */ 178#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */ 179#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */ 180#define NFSMNT_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */ 181#define NFSMNT_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */ 182#define NFSMNT_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */ 183#define NFSMNT_MNTD 0x00200000 /* Mnt server for mnt point */ 184#define NFSMNT_DISMINPROG 0x00400000 /* Dismount in progress */ 185#define NFSMNT_DISMNT 0x00800000 /* Dismounted */ 186#define NFSMNT_SNDLOCK 0x01000000 /* Send socket lock */ 187#define NFSMNT_WANTSND 0x02000000 /* Want above */ 188#define NFSMNT_RCVLOCK 0x04000000 /* Rcv socket lock */ 189#define NFSMNT_WANTRCV 0x08000000 /* Want above */ 190#define NFSMNT_WAITAUTH 0x10000000 /* Wait for authentication */ 191#define NFSMNT_HASAUTH 0x20000000 /* Has authenticator */ 192#define NFSMNT_WANTAUTH 0x40000000 /* Wants an authenticator */ 193#define NFSMNT_AUTHERR 0x80000000 /* Authentication error */ 194 195/* 196 * Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs 197 * should ever try and use it. 198 */ 199struct nfsd_args { 200 int sock; /* Socket to serve */ 201 caddr_t name; /* Client addr for connection based sockets */ 202 int namelen; /* Length of name */ 203}; 204 205struct nfsd_srvargs { 206 struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */ 207 uid_t nsd_uid; /* Effective uid mapped to cred */ 208 u_long nsd_haddr; /* Ip address of client */ 209 struct ucred nsd_cr; /* Cred. uid maps to */ 210 int nsd_authlen; /* Length of auth string (ret) */ 211 u_char *nsd_authstr; /* Auth string (ret) */ 212 int nsd_verflen; /* and the verfier */ 213 u_char *nsd_verfstr; 214 struct timeval nsd_timestamp; /* timestamp from verifier */ 215 u_long nsd_ttl; /* credential ttl (sec) */ 216 NFSKERBKEY_T nsd_key; /* Session key */ 217}; 218 219struct nfsd_cargs { 220 char *ncd_dirp; /* Mount dir path */ 221 uid_t ncd_authuid; /* Effective uid */ 222 int ncd_authtype; /* Type of authenticator */ 223 int ncd_authlen; /* Length of authenticator string */ 224 u_char *ncd_authstr; /* Authenticator string */ 225 int ncd_verflen; /* and the verifier */ 226 u_char *ncd_verfstr; 227 NFSKERBKEY_T ncd_key; /* Session key */ 228}; 229 230/* 231 * XXX to allow amd to include nfs.h without nfsproto.h 232 */ 233#ifdef NFS_NPROCS 234/* 235 * Stats structure 236 */ 237struct nfsstats { 238 int attrcache_hits; 239 int attrcache_misses; 240 int lookupcache_hits; 241 int lookupcache_misses; 242 int direofcache_hits; 243 int direofcache_misses; 244 int biocache_reads; 245 int read_bios; 246 int read_physios; 247 int biocache_writes; 248 int write_bios; 249 int write_physios; 250 int biocache_readlinks; 251 int readlink_bios; 252 int biocache_readdirs; 253 int readdir_bios; 254 int rpccnt[NFS_NPROCS]; 255 int rpcretries; 256 int srvrpccnt[NFS_NPROCS]; 257 int srvrpc_errs; 258 int srv_errs; 259 int rpcrequests; 260 int rpctimeouts; 261 int rpcunexpected; 262 int rpcinvalid; 263 int srvcache_inproghits; 264 int srvcache_idemdonehits; 265 int srvcache_nonidemdonehits; 266 int srvcache_misses; 267 int srvnqnfs_leases; 268 int srvnqnfs_maxleases; 269 int srvnqnfs_getleases; 270 int srvvop_writes; 271}; 272#endif 273 274/* 275 * Flags for nfssvc() system call. 276 */ 277#define NFSSVC_BIOD 0x002 278#define NFSSVC_NFSD 0x004 279#define NFSSVC_ADDSOCK 0x008 280#define NFSSVC_AUTHIN 0x010 281#define NFSSVC_GOTAUTH 0x040 282#define NFSSVC_AUTHINFAIL 0x080 283#define NFSSVC_MNTD 0x100 284 285/* 286 * fs.nfs sysctl(3) identifiers 287 */ 288#define NFS_NFSSTATS 1 /* struct: struct nfsstats */ 289#define NFS_NFSPRIVPORT 2 /* int: prohibit nfs to resvports */ 290 291#define FS_NFS_NAMES { \ 292 { 0, 0 }, \ 293 { "nfsstats", CTLTYPE_STRUCT }, \ 294 { "nfsprivport", CTLTYPE_INT }, \ 295} 296 297/* 298 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts. 299 * What should be in this set is open to debate, but I believe that since 300 * I/O system calls on ufs are never interrupted by signals the set should 301 * be minimal. My reasoning is that many current programs that use signals 302 * such as SIGALRM will not expect file I/O system calls to be interrupted 303 * by them and break. 304 */ 305#ifdef KERNEL 306 307struct uio; struct buf; struct vattr; struct nameidata; /* XXX */ 308 309#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \ 310 sigmask(SIGHUP)|sigmask(SIGQUIT)) 311 312/* 313 * Socket errors ignored for connectionless sockets?? 314 * For now, ignore them all 315 */ 316#define NFSIGNORE_SOERROR(s, e) \ 317 ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \ 318 ((s) & PR_CONNREQUIRED) == 0) 319 320/* 321 * Nfs outstanding request list element 322 */ 323struct nfsreq { 324 TAILQ_ENTRY(nfsreq) r_chain; 325 struct mbuf *r_mreq; 326 struct mbuf *r_mrep; 327 struct mbuf *r_md; 328 caddr_t r_dpos; 329 struct nfsmount *r_nmp; 330 struct vnode *r_vp; 331 u_long r_xid; 332 int r_flags; /* flags on request, see below */ 333 int r_retry; /* max retransmission count */ 334 int r_rexmit; /* current retrans count */ 335 int r_timer; /* tick counter on reply */ 336 int r_procnum; /* NFS procedure number */ 337 int r_rtt; /* RTT for rpc */ 338 struct proc *r_procp; /* Proc that did I/O system call */ 339}; 340 341/* 342 * Queue head for nfsreq's 343 */ 344extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq; 345 346/* Flag values for r_flags */ 347#define R_TIMING 0x01 /* timing request (in mntp) */ 348#define R_SENT 0x02 /* request has been sent */ 349#define R_SOFTTERM 0x04 /* soft mnt, too many retries */ 350#define R_INTR 0x08 /* intr mnt, signal pending */ 351#define R_SOCKERR 0x10 /* Fatal error on socket */ 352#define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */ 353#define R_MUSTRESEND 0x40 /* Must resend request */ 354#define R_GETONEREP 0x80 /* Probe for one reply only */ 355 356/* 357 * A list of nfssvc_sock structures is maintained with all the sockets 358 * that require service by the nfsd. 359 * The nfsuid structs hang off of the nfssvc_sock structs in both lru 360 * and uid hash lists. 361 */ 362#ifndef NFS_UIDHASHSIZ 363#define NFS_UIDHASHSIZ 29 /* Tune the size of nfssvc_sock with this */ 364#endif 365#define NUIDHASH(sock, uid) \ 366 (&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ]) 367#ifndef NFS_WDELAYHASHSIZ 368#define NFS_WDELAYHASHSIZ 16 /* and with this */ 369#endif 370#define NWDELAYHASH(sock, f) \ 371 (&(sock)->ns_wdelayhashtbl[(*((u_long *)(f))) % NFS_WDELAYHASHSIZ]) 372#ifndef NFS_MUIDHASHSIZ 373#define NFS_MUIDHASHSIZ 63 /* Tune the size of nfsmount with this */ 374#endif 375#define NMUIDHASH(nmp, uid) \ 376 (&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ]) 377#define NFSNOHASH(fhsum) \ 378 (&nfsnodehashtbl[(fhsum) & nfsnodehash]) 379 380/* 381 * Network address hash list element 382 */ 383union nethostaddr { 384 u_long had_inetaddr; 385 struct mbuf *had_nam; 386}; 387 388struct nfsuid { 389 TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */ 390 LIST_ENTRY(nfsuid) nu_hash; /* Hash list */ 391 int nu_flag; /* Flags */ 392 union nethostaddr nu_haddr; /* Host addr. for dgram sockets */ 393 struct ucred nu_cr; /* Cred uid mapped to */ 394 int nu_expire; /* Expiry time (sec) */ 395 struct timeval nu_timestamp; /* Kerb. timestamp */ 396 u_long nu_nickname; /* Nickname on server */ 397 NFSKERBKEY_T nu_key; /* and session key */ 398}; 399 400#define nu_inetaddr nu_haddr.had_inetaddr 401#define nu_nam nu_haddr.had_nam 402/* Bits for nu_flag */ 403#define NU_INETADDR 0x1 404#define NU_NAM 0x2 405#define NU_NETFAM(u) (((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO) 406 407struct nfssvc_sock { 408 TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */ 409 TAILQ_HEAD(, nfsuid) ns_uidlruhead; 410 struct file *ns_fp; 411 struct socket *ns_so; 412 struct mbuf *ns_nam; 413 struct mbuf *ns_raw; 414 struct mbuf *ns_rawend; 415 struct mbuf *ns_rec; 416 struct mbuf *ns_recend; 417 struct mbuf *ns_frag; 418 int ns_flag; 419 int ns_solock; 420 int ns_cc; 421 int ns_reclen; 422 int ns_numuids; 423 u_long ns_sref; 424 LIST_HEAD(, nfsrv_descript) ns_tq; /* Write gather lists */ 425 LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ]; 426 LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ]; 427}; 428 429/* Bits for "ns_flag" */ 430#define SLP_VALID 0x01 431#define SLP_DOREC 0x02 432#define SLP_NEEDQ 0x04 433#define SLP_DISCONN 0x08 434#define SLP_GETSTREAM 0x10 435#define SLP_LASTFRAG 0x20 436#define SLP_ALLFLAGS 0xff 437 438extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead; 439extern int nfssvc_sockhead_flag; 440#define SLP_INIT 0x01 441#define SLP_WANTINIT 0x02 442 443/* 444 * One of these structures is allocated for each nfsd. 445 */ 446struct nfsd { 447 TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */ 448 int nfsd_flag; /* NFSD_ flags */ 449 struct nfssvc_sock *nfsd_slp; /* Current socket */ 450 int nfsd_authlen; /* Authenticator len */ 451 u_char nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */ 452 int nfsd_verflen; /* and the Verifier */ 453 u_char nfsd_verfstr[RPCVERF_MAXSIZ]; 454 struct proc *nfsd_procp; /* Proc ptr */ 455 struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */ 456}; 457 458/* Bits for "nfsd_flag" */ 459#define NFSD_WAITING 0x01 460#define NFSD_REQINPROG 0x02 461#define NFSD_NEEDAUTH 0x04 462#define NFSD_AUTHFAIL 0x08 463 464/* 465 * This structure is used by the server for describing each request. 466 * Some fields are used only when write request gathering is performed. 467 */ 468struct nfsrv_descript { 469 u_quad_t nd_time; /* Write deadline (usec) */ 470 off_t nd_off; /* Start byte offset */ 471 off_t nd_eoff; /* and end byte offset */ 472 LIST_ENTRY(nfsrv_descript) nd_hash; /* Hash list */ 473 LIST_ENTRY(nfsrv_descript) nd_tq; /* and timer list */ 474 LIST_HEAD(,nfsrv_descript) nd_coalesce; /* coalesced writes */ 475 struct mbuf *nd_mrep; /* Request mbuf list */ 476 struct mbuf *nd_md; /* Current dissect mbuf */ 477 struct mbuf *nd_mreq; /* Reply mbuf list */ 478 struct mbuf *nd_nam; /* and socket addr */ 479 struct mbuf *nd_nam2; /* return socket addr */ 480 caddr_t nd_dpos; /* Current dissect pos */ 481 int nd_procnum; /* RPC # */ 482 int nd_stable; /* storage type */ 483 int nd_flag; /* nd_flag */ 484 int nd_len; /* Length of this write */ 485 int nd_repstat; /* Reply status */ 486 u_long nd_retxid; /* Reply xid */ 487 u_long nd_duration; /* Lease duration */ 488 struct timeval nd_starttime; /* Time RPC initiated */ 489 fhandle_t nd_fh; /* File handle */ 490 struct ucred nd_cr; /* Credentials */ 491}; 492 493/* Bits for "nd_flag" */ 494#define ND_READ LEASE_READ 495#define ND_WRITE LEASE_WRITE 496#define ND_CHECK 0x04 497#define ND_LEASE (ND_READ | ND_WRITE | ND_CHECK) 498#define ND_NFSV3 0x08 499#define ND_NQNFS 0x10 500#define ND_KERBNICK 0x20 501#define ND_KERBFULL 0x40 502#define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL) 503 504extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head; 505extern int nfsd_head_flag; 506#define NFSD_CHECKSLP 0x01 507 508/* 509 * These macros compare nfsrv_descript structures. 510 */ 511#define NFSW_CONTIG(o, n) \ 512 ((o)->nd_eoff >= (n)->nd_off && \ 513 !bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, NFSX_V3FH)) 514 515#define NFSW_SAMECRED(o, n) \ 516 (((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \ 517 !bcmp((caddr_t)&(o)->nd_cr, (caddr_t)&(n)->nd_cr, \ 518 sizeof (struct ucred))) 519
| 38 */ 39 40#ifndef _NFS_NFS_H_ 41#define _NFS_NFS_H_ 42 43/* 44 * Tunable constants for nfs 45 */ 46 47#define NFS_MAXIOVEC 34 48#define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */ 49#define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */ 50#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */ 51#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */ 52#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */ 53#define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/ 54#define NFS_MAXREXMIT 100 /* Stop counting after this many */ 55#define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */ 56#define NFS_RETRANS 10 /* Num of retrans for soft mounts */ 57#define NFS_MAXGRPS 16 /* Max. size of groups list */ 58#ifndef NFS_MINATTRTIMO 59#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */ 60#endif 61#ifndef NFS_MAXATTRTIMO 62#define NFS_MAXATTRTIMO 60 63#endif 64#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */ 65#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */ 66#define NFS_READDIRSIZE 8192 /* Def. readdir size */ 67#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */ 68#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */ 69#define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */ 70#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runnable */ 71#define NFS_MAXGATHERDELAY 100 /* Max. write gather delay (msec) */ 72#ifndef NFS_GATHERDELAY 73#define NFS_GATHERDELAY 10 /* Default write gather delay (msec) */ 74#endif 75#define NFS_DIRBLKSIZ 4096 /* Must be a multiple of DIRBLKSIZ */ 76#ifdef KERNEL 77#define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */ 78#endif 79 80/* 81 * Oddballs 82 */ 83#define NMOD(a) ((a) % nfs_asyncdaemons) 84#define NFS_CMPFH(n, f, s) \ 85 ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s))) 86#define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3) 87#define NFS_SRVMAXDATA(n) \ 88 (((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \ 89 NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA) 90 91/* 92 * XXX 93 * The B_INVAFTERWRITE flag should be set to whatever is required by the 94 * buffer cache code to say "Invalidate the block after it is written back". 95 */ 96#ifdef __FreeBSD__ 97#define B_INVAFTERWRITE B_NOCACHE 98#else 99#define B_INVAFTERWRITE B_INVAL 100#endif 101 102/* 103 * The IO_METASYNC flag should be implemented for local file systems. 104 * (Until then, it is nothin at all.) 105 */ 106#ifndef IO_METASYNC 107#define IO_METASYNC 0 108#endif 109 110/* 111 * Set the attribute timeout based on how recently the file has been modified. 112 */ 113#define NFS_ATTRTIMEO(np) \ 114 ((((np)->n_flag & NMODIFIED) || \ 115 (time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \ 116 ((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \ 117 (time.tv_sec - (np)->n_mtime) / 10)) 118 119/* 120 * Expected allocation sizes for major data structures. If the actual size 121 * of the structure exceeds these sizes, then malloc() will be allocating 122 * almost twice the memory required. This is used in nfs_init() to warn 123 * the sysadmin that the size of a structure should be reduced. 124 * (These sizes are always a power of 2. If the kernel malloc() changes 125 * to one that does not allocate space in powers of 2 size, then this all 126 * becomes bunk!) 127 */ 128#define NFS_NODEALLOC 256 129#define NFS_MNTALLOC 512 130#define NFS_SVCALLOC 256 131#define NFS_UIDALLOC 128 132 133/* 134 * Arguments to mount NFS 135 */ 136#define NFS_ARGSVERSION 3 /* change when nfs_args changes */ 137struct nfs_args { 138 int version; /* args structure version number */ 139 struct sockaddr *addr; /* file server address */ 140 int addrlen; /* length of address */ 141 int sotype; /* Socket type */ 142 int proto; /* and Protocol */ 143 u_char *fh; /* File handle to be mounted */ 144 int fhsize; /* Size, in bytes, of fh */ 145 int flags; /* flags */ 146 int wsize; /* write size in bytes */ 147 int rsize; /* read size in bytes */ 148 int readdirsize; /* readdir size in bytes */ 149 int timeo; /* initial timeout in .1 secs */ 150 int retrans; /* times to retry send */ 151 int maxgrouplist; /* Max. size of group list */ 152 int readahead; /* # of blocks to readahead */ 153 int leaseterm; /* Term (sec) of lease */ 154 int deadthresh; /* Retrans threshold */ 155 char *hostname; /* server's name */ 156}; 157 158/* 159 * NFS mount option flags 160 */ 161#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */ 162#define NFSMNT_WSIZE 0x00000002 /* set write size */ 163#define NFSMNT_RSIZE 0x00000004 /* set read size */ 164#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */ 165#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */ 166#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */ 167#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */ 168#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ 169#define NFSMNT_NQNFS 0x00000100 /* Use Nqnfs protocol */ 170#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ 171#define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */ 172#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ 173#define NFSMNT_LEASETERM 0x00001000 /* set lease term (nqnfs) */ 174#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ 175#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */ 176#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */ 177#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */ 178#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */ 179#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */ 180#define NFSMNT_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */ 181#define NFSMNT_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */ 182#define NFSMNT_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */ 183#define NFSMNT_MNTD 0x00200000 /* Mnt server for mnt point */ 184#define NFSMNT_DISMINPROG 0x00400000 /* Dismount in progress */ 185#define NFSMNT_DISMNT 0x00800000 /* Dismounted */ 186#define NFSMNT_SNDLOCK 0x01000000 /* Send socket lock */ 187#define NFSMNT_WANTSND 0x02000000 /* Want above */ 188#define NFSMNT_RCVLOCK 0x04000000 /* Rcv socket lock */ 189#define NFSMNT_WANTRCV 0x08000000 /* Want above */ 190#define NFSMNT_WAITAUTH 0x10000000 /* Wait for authentication */ 191#define NFSMNT_HASAUTH 0x20000000 /* Has authenticator */ 192#define NFSMNT_WANTAUTH 0x40000000 /* Wants an authenticator */ 193#define NFSMNT_AUTHERR 0x80000000 /* Authentication error */ 194 195/* 196 * Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs 197 * should ever try and use it. 198 */ 199struct nfsd_args { 200 int sock; /* Socket to serve */ 201 caddr_t name; /* Client addr for connection based sockets */ 202 int namelen; /* Length of name */ 203}; 204 205struct nfsd_srvargs { 206 struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */ 207 uid_t nsd_uid; /* Effective uid mapped to cred */ 208 u_long nsd_haddr; /* Ip address of client */ 209 struct ucred nsd_cr; /* Cred. uid maps to */ 210 int nsd_authlen; /* Length of auth string (ret) */ 211 u_char *nsd_authstr; /* Auth string (ret) */ 212 int nsd_verflen; /* and the verfier */ 213 u_char *nsd_verfstr; 214 struct timeval nsd_timestamp; /* timestamp from verifier */ 215 u_long nsd_ttl; /* credential ttl (sec) */ 216 NFSKERBKEY_T nsd_key; /* Session key */ 217}; 218 219struct nfsd_cargs { 220 char *ncd_dirp; /* Mount dir path */ 221 uid_t ncd_authuid; /* Effective uid */ 222 int ncd_authtype; /* Type of authenticator */ 223 int ncd_authlen; /* Length of authenticator string */ 224 u_char *ncd_authstr; /* Authenticator string */ 225 int ncd_verflen; /* and the verifier */ 226 u_char *ncd_verfstr; 227 NFSKERBKEY_T ncd_key; /* Session key */ 228}; 229 230/* 231 * XXX to allow amd to include nfs.h without nfsproto.h 232 */ 233#ifdef NFS_NPROCS 234/* 235 * Stats structure 236 */ 237struct nfsstats { 238 int attrcache_hits; 239 int attrcache_misses; 240 int lookupcache_hits; 241 int lookupcache_misses; 242 int direofcache_hits; 243 int direofcache_misses; 244 int biocache_reads; 245 int read_bios; 246 int read_physios; 247 int biocache_writes; 248 int write_bios; 249 int write_physios; 250 int biocache_readlinks; 251 int readlink_bios; 252 int biocache_readdirs; 253 int readdir_bios; 254 int rpccnt[NFS_NPROCS]; 255 int rpcretries; 256 int srvrpccnt[NFS_NPROCS]; 257 int srvrpc_errs; 258 int srv_errs; 259 int rpcrequests; 260 int rpctimeouts; 261 int rpcunexpected; 262 int rpcinvalid; 263 int srvcache_inproghits; 264 int srvcache_idemdonehits; 265 int srvcache_nonidemdonehits; 266 int srvcache_misses; 267 int srvnqnfs_leases; 268 int srvnqnfs_maxleases; 269 int srvnqnfs_getleases; 270 int srvvop_writes; 271}; 272#endif 273 274/* 275 * Flags for nfssvc() system call. 276 */ 277#define NFSSVC_BIOD 0x002 278#define NFSSVC_NFSD 0x004 279#define NFSSVC_ADDSOCK 0x008 280#define NFSSVC_AUTHIN 0x010 281#define NFSSVC_GOTAUTH 0x040 282#define NFSSVC_AUTHINFAIL 0x080 283#define NFSSVC_MNTD 0x100 284 285/* 286 * fs.nfs sysctl(3) identifiers 287 */ 288#define NFS_NFSSTATS 1 /* struct: struct nfsstats */ 289#define NFS_NFSPRIVPORT 2 /* int: prohibit nfs to resvports */ 290 291#define FS_NFS_NAMES { \ 292 { 0, 0 }, \ 293 { "nfsstats", CTLTYPE_STRUCT }, \ 294 { "nfsprivport", CTLTYPE_INT }, \ 295} 296 297/* 298 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts. 299 * What should be in this set is open to debate, but I believe that since 300 * I/O system calls on ufs are never interrupted by signals the set should 301 * be minimal. My reasoning is that many current programs that use signals 302 * such as SIGALRM will not expect file I/O system calls to be interrupted 303 * by them and break. 304 */ 305#ifdef KERNEL 306 307struct uio; struct buf; struct vattr; struct nameidata; /* XXX */ 308 309#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \ 310 sigmask(SIGHUP)|sigmask(SIGQUIT)) 311 312/* 313 * Socket errors ignored for connectionless sockets?? 314 * For now, ignore them all 315 */ 316#define NFSIGNORE_SOERROR(s, e) \ 317 ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \ 318 ((s) & PR_CONNREQUIRED) == 0) 319 320/* 321 * Nfs outstanding request list element 322 */ 323struct nfsreq { 324 TAILQ_ENTRY(nfsreq) r_chain; 325 struct mbuf *r_mreq; 326 struct mbuf *r_mrep; 327 struct mbuf *r_md; 328 caddr_t r_dpos; 329 struct nfsmount *r_nmp; 330 struct vnode *r_vp; 331 u_long r_xid; 332 int r_flags; /* flags on request, see below */ 333 int r_retry; /* max retransmission count */ 334 int r_rexmit; /* current retrans count */ 335 int r_timer; /* tick counter on reply */ 336 int r_procnum; /* NFS procedure number */ 337 int r_rtt; /* RTT for rpc */ 338 struct proc *r_procp; /* Proc that did I/O system call */ 339}; 340 341/* 342 * Queue head for nfsreq's 343 */ 344extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq; 345 346/* Flag values for r_flags */ 347#define R_TIMING 0x01 /* timing request (in mntp) */ 348#define R_SENT 0x02 /* request has been sent */ 349#define R_SOFTTERM 0x04 /* soft mnt, too many retries */ 350#define R_INTR 0x08 /* intr mnt, signal pending */ 351#define R_SOCKERR 0x10 /* Fatal error on socket */ 352#define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */ 353#define R_MUSTRESEND 0x40 /* Must resend request */ 354#define R_GETONEREP 0x80 /* Probe for one reply only */ 355 356/* 357 * A list of nfssvc_sock structures is maintained with all the sockets 358 * that require service by the nfsd. 359 * The nfsuid structs hang off of the nfssvc_sock structs in both lru 360 * and uid hash lists. 361 */ 362#ifndef NFS_UIDHASHSIZ 363#define NFS_UIDHASHSIZ 29 /* Tune the size of nfssvc_sock with this */ 364#endif 365#define NUIDHASH(sock, uid) \ 366 (&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ]) 367#ifndef NFS_WDELAYHASHSIZ 368#define NFS_WDELAYHASHSIZ 16 /* and with this */ 369#endif 370#define NWDELAYHASH(sock, f) \ 371 (&(sock)->ns_wdelayhashtbl[(*((u_long *)(f))) % NFS_WDELAYHASHSIZ]) 372#ifndef NFS_MUIDHASHSIZ 373#define NFS_MUIDHASHSIZ 63 /* Tune the size of nfsmount with this */ 374#endif 375#define NMUIDHASH(nmp, uid) \ 376 (&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ]) 377#define NFSNOHASH(fhsum) \ 378 (&nfsnodehashtbl[(fhsum) & nfsnodehash]) 379 380/* 381 * Network address hash list element 382 */ 383union nethostaddr { 384 u_long had_inetaddr; 385 struct mbuf *had_nam; 386}; 387 388struct nfsuid { 389 TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */ 390 LIST_ENTRY(nfsuid) nu_hash; /* Hash list */ 391 int nu_flag; /* Flags */ 392 union nethostaddr nu_haddr; /* Host addr. for dgram sockets */ 393 struct ucred nu_cr; /* Cred uid mapped to */ 394 int nu_expire; /* Expiry time (sec) */ 395 struct timeval nu_timestamp; /* Kerb. timestamp */ 396 u_long nu_nickname; /* Nickname on server */ 397 NFSKERBKEY_T nu_key; /* and session key */ 398}; 399 400#define nu_inetaddr nu_haddr.had_inetaddr 401#define nu_nam nu_haddr.had_nam 402/* Bits for nu_flag */ 403#define NU_INETADDR 0x1 404#define NU_NAM 0x2 405#define NU_NETFAM(u) (((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO) 406 407struct nfssvc_sock { 408 TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */ 409 TAILQ_HEAD(, nfsuid) ns_uidlruhead; 410 struct file *ns_fp; 411 struct socket *ns_so; 412 struct mbuf *ns_nam; 413 struct mbuf *ns_raw; 414 struct mbuf *ns_rawend; 415 struct mbuf *ns_rec; 416 struct mbuf *ns_recend; 417 struct mbuf *ns_frag; 418 int ns_flag; 419 int ns_solock; 420 int ns_cc; 421 int ns_reclen; 422 int ns_numuids; 423 u_long ns_sref; 424 LIST_HEAD(, nfsrv_descript) ns_tq; /* Write gather lists */ 425 LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ]; 426 LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ]; 427}; 428 429/* Bits for "ns_flag" */ 430#define SLP_VALID 0x01 431#define SLP_DOREC 0x02 432#define SLP_NEEDQ 0x04 433#define SLP_DISCONN 0x08 434#define SLP_GETSTREAM 0x10 435#define SLP_LASTFRAG 0x20 436#define SLP_ALLFLAGS 0xff 437 438extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead; 439extern int nfssvc_sockhead_flag; 440#define SLP_INIT 0x01 441#define SLP_WANTINIT 0x02 442 443/* 444 * One of these structures is allocated for each nfsd. 445 */ 446struct nfsd { 447 TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */ 448 int nfsd_flag; /* NFSD_ flags */ 449 struct nfssvc_sock *nfsd_slp; /* Current socket */ 450 int nfsd_authlen; /* Authenticator len */ 451 u_char nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */ 452 int nfsd_verflen; /* and the Verifier */ 453 u_char nfsd_verfstr[RPCVERF_MAXSIZ]; 454 struct proc *nfsd_procp; /* Proc ptr */ 455 struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */ 456}; 457 458/* Bits for "nfsd_flag" */ 459#define NFSD_WAITING 0x01 460#define NFSD_REQINPROG 0x02 461#define NFSD_NEEDAUTH 0x04 462#define NFSD_AUTHFAIL 0x08 463 464/* 465 * This structure is used by the server for describing each request. 466 * Some fields are used only when write request gathering is performed. 467 */ 468struct nfsrv_descript { 469 u_quad_t nd_time; /* Write deadline (usec) */ 470 off_t nd_off; /* Start byte offset */ 471 off_t nd_eoff; /* and end byte offset */ 472 LIST_ENTRY(nfsrv_descript) nd_hash; /* Hash list */ 473 LIST_ENTRY(nfsrv_descript) nd_tq; /* and timer list */ 474 LIST_HEAD(,nfsrv_descript) nd_coalesce; /* coalesced writes */ 475 struct mbuf *nd_mrep; /* Request mbuf list */ 476 struct mbuf *nd_md; /* Current dissect mbuf */ 477 struct mbuf *nd_mreq; /* Reply mbuf list */ 478 struct mbuf *nd_nam; /* and socket addr */ 479 struct mbuf *nd_nam2; /* return socket addr */ 480 caddr_t nd_dpos; /* Current dissect pos */ 481 int nd_procnum; /* RPC # */ 482 int nd_stable; /* storage type */ 483 int nd_flag; /* nd_flag */ 484 int nd_len; /* Length of this write */ 485 int nd_repstat; /* Reply status */ 486 u_long nd_retxid; /* Reply xid */ 487 u_long nd_duration; /* Lease duration */ 488 struct timeval nd_starttime; /* Time RPC initiated */ 489 fhandle_t nd_fh; /* File handle */ 490 struct ucred nd_cr; /* Credentials */ 491}; 492 493/* Bits for "nd_flag" */ 494#define ND_READ LEASE_READ 495#define ND_WRITE LEASE_WRITE 496#define ND_CHECK 0x04 497#define ND_LEASE (ND_READ | ND_WRITE | ND_CHECK) 498#define ND_NFSV3 0x08 499#define ND_NQNFS 0x10 500#define ND_KERBNICK 0x20 501#define ND_KERBFULL 0x40 502#define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL) 503 504extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head; 505extern int nfsd_head_flag; 506#define NFSD_CHECKSLP 0x01 507 508/* 509 * These macros compare nfsrv_descript structures. 510 */ 511#define NFSW_CONTIG(o, n) \ 512 ((o)->nd_eoff >= (n)->nd_off && \ 513 !bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, NFSX_V3FH)) 514 515#define NFSW_SAMECRED(o, n) \ 516 (((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \ 517 !bcmp((caddr_t)&(o)->nd_cr, (caddr_t)&(n)->nd_cr, \ 518 sizeof (struct ucred))) 519
|
521int nfs_init __P((struct vfsconf *vfsp)); 522int nfs_reply __P((struct nfsreq *)); 523int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int)); 524int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *)); 525int nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *)); 526int nfs_sndlock __P((int *,struct nfsreq *)); 527void nfs_sndunlock __P((int *flagp)); 528int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); 529int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int)); 530int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *)); 531int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *)); 532int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *)); 533int nfs_asyncio __P((struct buf *,struct ucred *)); 534int nfs_doio __P((struct buf *,struct ucred *,struct proc *)); 535int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *)); 536int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *)); 537int nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *)); 538int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); 539void nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *)); 540void nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **)); 541void nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **)); 542int netaddr_match __P((int,union nethostaddr *,struct mbuf *)); 543int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *)); 544int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *)); 545int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int)); 546void nfsm_adj __P((struct mbuf *,int,int)); 547int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *)); 548void nfsrv_initcache __P((void)); 549int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T)); 550int nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int)); 551int nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *)); 552int nfs_adv __P((struct mbuf **,caddr_t *,int,int)); 553void nfs_nhinit __P((void)); 554void nfs_timer __P((void*)); 555u_long nfs_hash __P((nfsfh_t *,int)); 556int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **)); 557int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **)); 558void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *)); 559void nfsrv_cleancache __P((void)); 560int nfs_connect __P((struct nfsmount *,struct nfsreq *)); 561void nfs_disconnect __P((struct nfsmount *)); 562int nfs_getattrcache __P((struct vnode *,struct vattr *)); 563int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long)); 564int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *)); 565int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *)); 566void nfsrv_init __P((int)); 567void nfs_clearcommit __P((struct mount *)); 568int nfsrv_errmap __P((struct nfsrv_descript *, int)); 569void nfsrvw_sort __P((gid_t [],int)); 570void nfsrv_setcred __P((struct ucred *,struct ucred *)); 571int nfs_writebp __P((struct buf *,int)); 572int nfsrv_object_create __P(( struct vnode * )); 573void nfsrv_wakenfsd __P((struct nfssvc_sock *slp)); 574int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *, 575 struct proc *, struct mbuf **)); 576int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *, 577 struct proc *p)); 578 579int nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 580 struct proc *procp, struct mbuf **mrq)); 581int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 582 struct proc *procp, struct mbuf **mrq)); 583int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 584 struct proc *procp, struct mbuf **mrq)); 585int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **, 586 struct ucred *,struct nfssvc_sock *,struct mbuf *, 587 int *,int)); 588int nfsrv_fsinfo __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 589 struct proc *procp, struct mbuf **mrq)); 590int nfsrv_getattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 591 struct proc *procp, struct mbuf **mrq)); 592int nfsrv_link __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 593 struct proc *procp, struct mbuf **mrq)); 594int nfsrv_lookup __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 595 struct proc *procp, struct mbuf **mrq)); 596int nfsrv_mkdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 597 struct proc *procp, struct mbuf **mrq)); 598int nfsrv_mknod __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 599 struct proc *procp, struct mbuf **mrq)); 600int nfsrv_noop __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 601 struct proc *procp, struct mbuf **mrq)); 602int nfsrv_null __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 603 struct proc *procp, struct mbuf **mrq)); 604int nfsrv_pathconf __P((struct nfsrv_descript *nfsd, 605 struct nfssvc_sock *slp, struct proc *procp, 606 struct mbuf **mrq)); 607int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 608 struct proc *procp, struct mbuf **mrq)); 609int nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 610 struct proc *procp, struct mbuf **mrq)); 611int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd, 612 struct nfssvc_sock *slp, struct proc *procp, 613 struct mbuf **mrq)); 614int nfsrv_readlink __P((struct nfsrv_descript *nfsd, 615 struct nfssvc_sock *slp, struct proc *procp, 616 struct mbuf **mrq)); 617int nfsrv_remove __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 618 struct proc *procp, struct mbuf **mrq)); 619int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 620 struct proc *procp, struct mbuf **mrq)); 621int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 622 struct proc *procp, struct mbuf **mrq)); 623int nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 624 struct proc *procp, struct mbuf **mrq)); 625int nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 626 struct proc *procp, struct mbuf **mrq)); 627int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 628 struct proc *procp, struct mbuf **mrq)); 629int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 630 struct proc *procp, struct mbuf **mrq)); 631void nfsrv_rcv __P((struct socket *so, caddr_t arg, int waitflag)); 632void nfsrv_slpderef __P((struct nfssvc_sock *slp)); 633#endif /* KERNEL */ 634 635#endif
| 538int nfs_init __P((struct vfsconf *vfsp)); 539int nfs_reply __P((struct nfsreq *)); 540int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int)); 541int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *)); 542int nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *)); 543int nfs_sndlock __P((int *,struct nfsreq *)); 544void nfs_sndunlock __P((int *flagp)); 545int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); 546int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int)); 547int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *)); 548int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *)); 549int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *)); 550int nfs_asyncio __P((struct buf *,struct ucred *)); 551int nfs_doio __P((struct buf *,struct ucred *,struct proc *)); 552int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *)); 553int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *)); 554int nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *)); 555int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); 556void nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *)); 557void nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **)); 558void nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **)); 559int netaddr_match __P((int,union nethostaddr *,struct mbuf *)); 560int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *)); 561int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *)); 562int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int)); 563void nfsm_adj __P((struct mbuf *,int,int)); 564int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *)); 565void nfsrv_initcache __P((void)); 566int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T)); 567int nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int)); 568int nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *)); 569int nfs_adv __P((struct mbuf **,caddr_t *,int,int)); 570void nfs_nhinit __P((void)); 571void nfs_timer __P((void*)); 572u_long nfs_hash __P((nfsfh_t *,int)); 573int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **)); 574int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **)); 575void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *)); 576void nfsrv_cleancache __P((void)); 577int nfs_connect __P((struct nfsmount *,struct nfsreq *)); 578void nfs_disconnect __P((struct nfsmount *)); 579int nfs_getattrcache __P((struct vnode *,struct vattr *)); 580int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long)); 581int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *)); 582int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *)); 583void nfsrv_init __P((int)); 584void nfs_clearcommit __P((struct mount *)); 585int nfsrv_errmap __P((struct nfsrv_descript *, int)); 586void nfsrvw_sort __P((gid_t [],int)); 587void nfsrv_setcred __P((struct ucred *,struct ucred *)); 588int nfs_writebp __P((struct buf *,int)); 589int nfsrv_object_create __P(( struct vnode * )); 590void nfsrv_wakenfsd __P((struct nfssvc_sock *slp)); 591int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *, 592 struct proc *, struct mbuf **)); 593int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *, 594 struct proc *p)); 595 596int nfsrv3_access __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 597 struct proc *procp, struct mbuf **mrq)); 598int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 599 struct proc *procp, struct mbuf **mrq)); 600int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 601 struct proc *procp, struct mbuf **mrq)); 602int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **, 603 struct ucred *,struct nfssvc_sock *,struct mbuf *, 604 int *,int)); 605int nfsrv_fsinfo __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 606 struct proc *procp, struct mbuf **mrq)); 607int nfsrv_getattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 608 struct proc *procp, struct mbuf **mrq)); 609int nfsrv_link __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 610 struct proc *procp, struct mbuf **mrq)); 611int nfsrv_lookup __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 612 struct proc *procp, struct mbuf **mrq)); 613int nfsrv_mkdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 614 struct proc *procp, struct mbuf **mrq)); 615int nfsrv_mknod __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 616 struct proc *procp, struct mbuf **mrq)); 617int nfsrv_noop __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 618 struct proc *procp, struct mbuf **mrq)); 619int nfsrv_null __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 620 struct proc *procp, struct mbuf **mrq)); 621int nfsrv_pathconf __P((struct nfsrv_descript *nfsd, 622 struct nfssvc_sock *slp, struct proc *procp, 623 struct mbuf **mrq)); 624int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 625 struct proc *procp, struct mbuf **mrq)); 626int nfsrv_readdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 627 struct proc *procp, struct mbuf **mrq)); 628int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd, 629 struct nfssvc_sock *slp, struct proc *procp, 630 struct mbuf **mrq)); 631int nfsrv_readlink __P((struct nfsrv_descript *nfsd, 632 struct nfssvc_sock *slp, struct proc *procp, 633 struct mbuf **mrq)); 634int nfsrv_remove __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 635 struct proc *procp, struct mbuf **mrq)); 636int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 637 struct proc *procp, struct mbuf **mrq)); 638int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 639 struct proc *procp, struct mbuf **mrq)); 640int nfsrv_setattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 641 struct proc *procp, struct mbuf **mrq)); 642int nfsrv_statfs __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 643 struct proc *procp, struct mbuf **mrq)); 644int nfsrv_symlink __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 645 struct proc *procp, struct mbuf **mrq)); 646int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, 647 struct proc *procp, struct mbuf **mrq)); 648void nfsrv_rcv __P((struct socket *so, caddr_t arg, int waitflag)); 649void nfsrv_slpderef __P((struct nfssvc_sock *slp)); 650#endif /* KERNEL */ 651 652#endif
|