nfsargs.h (6361) | nfsargs.h (9336) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 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 34 * SUCH DAMAGE. 35 * 36 * @(#)nfs.h 8.1 (Berkeley) 6/10/93 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 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 34 * SUCH DAMAGE. 35 * 36 * @(#)nfs.h 8.1 (Berkeley) 6/10/93 |
37 * $Id: nfs.h,v 1.8 1994/11/02 00:11:00 wollman Exp $ | 37 * $Id: nfs.h,v 1.9 1995/02/14 06:22:18 phk Exp $ |
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 | 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_HZ 25 /* Ticks per second for NFS timeouts */ 49#define NFS_TIMEO (1*NFS_HZ) /* Default timeout = 1 second */ 50#define NFS_MINTIMEO (1*NFS_HZ) /* Min timeout to use */ 51#define NFS_MAXTIMEO (60*NFS_HZ) /* Max timeout to backoff to */ 52#define NFS_MINIDEMTIMEO (5*NFS_HZ) /* Min timeout for non-idempotent ops*/ | 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*/ |
53#define NFS_MAXREXMIT 100 /* Stop counting after this many */ 54#define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */ 55#define NFS_RETRANS 10 /* Num of retrans for soft mounts */ 56#define NFS_MAXGRPS 16 /* Max. size of groups list */ 57#ifndef NFS_MINATTRTIMO 58#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */ 59#endif 60#ifndef NFS_MAXATTRTIMO 61#define NFS_MAXATTRTIMO 60 62#endif 63#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */ 64#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */ | 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 */ |
|
65#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */ 66#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */ | 67#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */ 68#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */ |
67#define NFS_MAXREADDIR NFS_MAXDATA /* Max. size of directory read */ | |
68#define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */ | 69#define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */ |
69#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */ 70#define NFS_DIRBLKSIZ 1024 /* Size of an NFS directory block */ | 70#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */ 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 77/* 78 * Oddballs 79 */ |
71#define NMOD(a) ((a) % nfs_asyncdaemons) | 80#define NMOD(a) ((a) % nfs_asyncdaemons) |
81#define NFS_CMPFH(n, f, s) \ 82 ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s))) 83#define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3) 84#define NFS_SRVMAXDATA(n) \ 85 (((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \ 86 NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA) |
|
72 73/* | 87 88/* |
89 * XXX 90 * sys/buf.h should be editted to change B_APPENDWRITE --> B_NEEDCOMMIT, but 91 * until then... 92 * Same goes for sys/malloc.h, which needs M_NFSDIROFF, 93 * M_NFSRVDESC and M_NFSBIGFH added. 94 * The VA_EXCLUSIVE flag should be added for va_vaflags and set for an 95 * exclusive create. 96 * The B_INVAFTERWRITE flag should be set to whatever is required by the 97 * buffer cache code to say "Invalidate the block after it is written back". 98 */ 99#ifndef B_NEEDCOMMIT 100#define B_NEEDCOMMIT B_APPENDWRITE 101#endif 102#ifndef M_NFSRVDESC 103#define M_NFSRVDESC M_TEMP 104#endif 105#ifndef M_NFSDIROFF 106#define M_NFSDIROFF M_TEMP 107#endif 108#ifndef M_NFSBIGFH 109#define M_NFSBIGFH M_TEMP 110#endif 111#ifndef VA_EXCLUSIVE 112#define VA_EXCLUSIVE 0 113#endif 114#ifdef __FreeBSD__ 115#define B_INVAFTERWRITE B_NOCACHE 116#else 117#define B_INVAFTERWRITE B_INVAL 118#endif 119 120/* 121 * These ifdefs try to handle the differences between the various 4.4BSD-Lite 122 * based vfs interfaces. 123 * btw: NetBSD-current does have a VOP_LEASDE(), but I don't know how to 124 * differentiate between NetBSD-1.0 and NetBSD-current, so.. 125 * I also don't know about BSDi's 2.0 release. 126 */ 127#if !defined(HAS_VOPLEASE) && !defined(__FreeBSD__) && !defined(__NetBSD__) 128#define HAS_VOPLEASE 1 129#endif 130#if !defined(HAS_VOPREVOKE) && !defined(__FreeBSD__) && !defined(__NetBSD__) 131#define HAS_VOPREVOKE 1 132#endif 133 134/* 135 * The IO_METASYNC flag should be implemented for local file systems. 136 * (Until then, it is nothin at all.) 137 */ 138#ifndef IO_METASYNC 139#define IO_METASYNC 0 140#endif 141 142/* |
|
74 * Set the attribute timeout based on how recently the file has been modified. 75 */ 76#define NFS_ATTRTIMEO(np) \ 77 ((((np)->n_flag & NMODIFIED) || \ 78 (time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \ 79 ((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \ 80 (time.tv_sec - (np)->n_mtime) / 10)) 81 82/* | 143 * Set the attribute timeout based on how recently the file has been modified. 144 */ 145#define NFS_ATTRTIMEO(np) \ 146 ((((np)->n_flag & NMODIFIED) || \ 147 (time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \ 148 ((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \ 149 (time.tv_sec - (np)->n_mtime) / 10)) 150 151/* |
152 * Expected allocation sizes for major data structures. If the actual size 153 * of the structure exceeds these sizes, then malloc() will be allocating 154 * almost twice the memory required. This is used in nfs_init() to warn 155 * the sysadmin that the size of a structure should be reduced. 156 * (These sizes are always a power of 2. If the kernel malloc() changes 157 * to one that does not allocate space in powers of 2 size, then this all 158 * becomes bunk!) 159 */ 160#define NFS_NODEALLOC 256 161#define NFS_MNTALLOC 512 162#define NFS_SVCALLOC 256 163#define NFS_UIDALLOC 128 164 165/* |
|
83 * Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs 84 * should ever try and use it. 85 */ 86struct nfsd_args { 87 int sock; /* Socket to serve */ 88 caddr_t name; /* Client address for connection based sockets */ 89 int namelen; /* Length of name */ 90}; 91 92struct nfsd_srvargs { 93 struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */ 94 uid_t nsd_uid; /* Effective uid mapped to cred */ 95 u_long nsd_haddr; /* Ip address of client */ 96 struct ucred nsd_cr; /* Cred. uid maps to */ 97 int nsd_authlen; /* Length of auth string (ret) */ | 166 * Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs 167 * should ever try and use it. 168 */ 169struct nfsd_args { 170 int sock; /* Socket to serve */ 171 caddr_t name; /* Client address for connection based sockets */ 172 int namelen; /* Length of name */ 173}; 174 175struct nfsd_srvargs { 176 struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */ 177 uid_t nsd_uid; /* Effective uid mapped to cred */ 178 u_long nsd_haddr; /* Ip address of client */ 179 struct ucred nsd_cr; /* Cred. uid maps to */ 180 int nsd_authlen; /* Length of auth string (ret) */ |
98 char *nsd_authstr; /* Auth string (ret) */ | 181 u_char *nsd_authstr; /* Auth string (ret) */ 182 int nsd_verflen; /* and the verfier */ 183 u_char *nsd_verfstr; 184 struct timeval nsd_timestamp; /* timestamp from verifier */ 185 u_long nsd_ttl; /* credential ttl (sec) */ 186 NFSKERBKEY_T nsd_key; /* Session key */ |
99}; 100 101struct nfsd_cargs { 102 char *ncd_dirp; /* Mount dir path */ 103 uid_t ncd_authuid; /* Effective uid */ 104 int ncd_authtype; /* Type of authenticator */ 105 int ncd_authlen; /* Length of authenticator string */ | 187}; 188 189struct nfsd_cargs { 190 char *ncd_dirp; /* Mount dir path */ 191 uid_t ncd_authuid; /* Effective uid */ 192 int ncd_authtype; /* Type of authenticator */ 193 int ncd_authlen; /* Length of authenticator string */ |
106 char *ncd_authstr; /* Authenticator string */ | 194 u_char *ncd_authstr; /* Authenticator string */ 195 int ncd_verflen; /* and the verifier */ 196 u_char *ncd_verfstr; 197 NFSKERBKEY_T ncd_key; /* Session key */ |
107}; 108 109/* 110 * Stats structure 111 */ 112struct nfsstats { 113 int attrcache_hits; 114 int attrcache_misses; --- 22 unchanged lines hidden (view full) --- 137 int rpcinvalid; 138 int srvcache_inproghits; 139 int srvcache_idemdonehits; 140 int srvcache_nonidemdonehits; 141 int srvcache_misses; 142 int srvnqnfs_leases; 143 int srvnqnfs_maxleases; 144 int srvnqnfs_getleases; | 198}; 199 200/* 201 * Stats structure 202 */ 203struct nfsstats { 204 int attrcache_hits; 205 int attrcache_misses; --- 22 unchanged lines hidden (view full) --- 228 int rpcinvalid; 229 int srvcache_inproghits; 230 int srvcache_idemdonehits; 231 int srvcache_nonidemdonehits; 232 int srvcache_misses; 233 int srvnqnfs_leases; 234 int srvnqnfs_maxleases; 235 int srvnqnfs_getleases; |
236 int srvvop_writes; |
|
145}; 146 147/* 148 * Flags for nfssvc() system call. 149 */ 150#define NFSSVC_BIOD 0x002 151#define NFSSVC_NFSD 0x004 152#define NFSSVC_ADDSOCK 0x008 --- 15 unchanged lines hidden (view full) --- 168/* 169 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts. 170 * What should be in this set is open to debate, but I believe that since 171 * I/O system calls on ufs are never interrupted by signals the set should 172 * be minimal. My reasoning is that many current programs that use signals 173 * such as SIGALRM will not expect file I/O system calls to be interrupted 174 * by them and break. 175 */ | 237}; 238 239/* 240 * Flags for nfssvc() system call. 241 */ 242#define NFSSVC_BIOD 0x002 243#define NFSSVC_NFSD 0x004 244#define NFSSVC_ADDSOCK 0x008 --- 15 unchanged lines hidden (view full) --- 260/* 261 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts. 262 * What should be in this set is open to debate, but I believe that since 263 * I/O system calls on ufs are never interrupted by signals the set should 264 * be minimal. My reasoning is that many current programs that use signals 265 * such as SIGALRM will not expect file I/O system calls to be interrupted 266 * by them and break. 267 */ |
176#ifdef KERNEL | 268#if defined(KERNEL) || defined(_KERNEL) |
177 178struct uio; struct buf; struct vattr; struct nameidata; /* XXX */ 179 180#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \ 181 sigmask(SIGHUP)|sigmask(SIGQUIT)) 182 183/* 184 * Socket errors ignored for connectionless sockets?? --- 34 unchanged lines hidden (view full) --- 219#define R_SENT 0x02 /* request has been sent */ 220#define R_SOFTTERM 0x04 /* soft mnt, too many retries */ 221#define R_INTR 0x08 /* intr mnt, signal pending */ 222#define R_SOCKERR 0x10 /* Fatal error on socket */ 223#define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */ 224#define R_MUSTRESEND 0x40 /* Must resend request */ 225#define R_GETONEREP 0x80 /* Probe for one reply only */ 226 | 269 270struct uio; struct buf; struct vattr; struct nameidata; /* XXX */ 271 272#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \ 273 sigmask(SIGHUP)|sigmask(SIGQUIT)) 274 275/* 276 * Socket errors ignored for connectionless sockets?? --- 34 unchanged lines hidden (view full) --- 311#define R_SENT 0x02 /* request has been sent */ 312#define R_SOFTTERM 0x04 /* soft mnt, too many retries */ 313#define R_INTR 0x08 /* intr mnt, signal pending */ 314#define R_SOCKERR 0x10 /* Fatal error on socket */ 315#define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */ 316#define R_MUSTRESEND 0x40 /* Must resend request */ 317#define R_GETONEREP 0x80 /* Probe for one reply only */ 318 |
227extern struct nfsstats nfsstats; 228 | |
229/* 230 * A list of nfssvc_sock structures is maintained with all the sockets 231 * that require service by the nfsd. 232 * The nfsuid structs hang off of the nfssvc_sock structs in both lru 233 * and uid hash lists. 234 */ | 319/* 320 * A list of nfssvc_sock structures is maintained with all the sockets 321 * that require service by the nfsd. 322 * The nfsuid structs hang off of the nfssvc_sock structs in both lru 323 * and uid hash lists. 324 */ |
235#define NUIDHASHSIZ 32 | 325#ifndef NFS_UIDHASHSIZ 326#define NFS_UIDHASHSIZ 29 /* Tune the size of nfssvc_sock with this */ 327#endif |
236#define NUIDHASH(sock, uid) \ | 328#define NUIDHASH(sock, uid) \ |
237 (&(sock)->ns_uidhashtbl[(uid) & (sock)->ns_uidhash]) | 329 (&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ]) 330#ifndef NFS_WDELAYHASHSIZ 331#define NFS_WDELAYHASHSIZ 16 /* and with this */ 332#endif 333#define NWDELAYHASH(sock, f) \ 334 (&(sock)->ns_wdelayhashtbl[(*((u_long *)(f))) % NFS_WDELAYHASHSIZ]) 335#ifndef NFS_MUIDHASHSIZ 336#define NFS_MUIDHASHSIZ 67 /* Tune the size of nfsmount with this */ 337#endif 338#define NMUIDHASH(nmp, uid) \ 339 (&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ]) 340#define NFSNOHASH(fhsum) \ 341 (&nfsnodehashtbl[(fhsum) & nfsnodehash]) |
238 239/* 240 * Network address hash list element 241 */ 242union nethostaddr { 243 u_long had_inetaddr; 244 struct mbuf *had_nam; 245}; 246 247struct nfsuid { 248 TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */ 249 LIST_ENTRY(nfsuid) nu_hash; /* Hash list */ 250 int nu_flag; /* Flags */ | 342 343/* 344 * Network address hash list element 345 */ 346union nethostaddr { 347 u_long had_inetaddr; 348 struct mbuf *had_nam; 349}; 350 351struct nfsuid { 352 TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */ 353 LIST_ENTRY(nfsuid) nu_hash; /* Hash list */ 354 int nu_flag; /* Flags */ |
251 uid_t nu_uid; /* Uid mapped by this entry */ | |
252 union nethostaddr nu_haddr; /* Host addr. for dgram sockets */ 253 struct ucred nu_cr; /* Cred uid mapped to */ | 355 union nethostaddr nu_haddr; /* Host addr. for dgram sockets */ 356 struct ucred nu_cr; /* Cred uid mapped to */ |
357 int nu_expire; /* Expiry time (sec) */ 358 struct timeval nu_timestamp; /* Kerb. timestamp */ 359 u_long nu_nickname; /* Nickname on server */ 360 NFSKERBKEY_T nu_key; /* and session key */ |
|
254}; 255 256#define nu_inetaddr nu_haddr.had_inetaddr 257#define nu_nam nu_haddr.had_nam 258/* Bits for nu_flag */ 259#define NU_INETADDR 0x1 | 361}; 362 363#define nu_inetaddr nu_haddr.had_inetaddr 364#define nu_nam nu_haddr.had_nam 365/* Bits for nu_flag */ 366#define NU_INETADDR 0x1 |
367#define NU_NAM 0x2 368#define NU_NETFAM(u) (((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO) |
|
260 261struct nfssvc_sock { 262 TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */ 263 TAILQ_HEAD(, nfsuid) ns_uidlruhead; | 369 370struct nfssvc_sock { 371 TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */ 372 TAILQ_HEAD(, nfsuid) ns_uidlruhead; |
264 LIST_HEAD(, nfsuid) *ns_uidhashtbl; 265 u_long ns_uidhash; 266 267 int ns_flag; 268 u_long ns_sref; | |
269 struct file *ns_fp; 270 struct socket *ns_so; | 373 struct file *ns_fp; 374 struct socket *ns_so; |
271 int ns_solock; | |
272 struct mbuf *ns_nam; | 375 struct mbuf *ns_nam; |
273 int ns_cc; | |
274 struct mbuf *ns_raw; 275 struct mbuf *ns_rawend; | 376 struct mbuf *ns_raw; 377 struct mbuf *ns_rawend; |
276 int ns_reclen; | |
277 struct mbuf *ns_rec; 278 struct mbuf *ns_recend; | 378 struct mbuf *ns_rec; 379 struct mbuf *ns_recend; |
380 struct mbuf *ns_frag; 381 int ns_flag; 382 int ns_solock; 383 int ns_cc; 384 int ns_reclen; |
|
279 int ns_numuids; | 385 int ns_numuids; |
386 u_long ns_sref; 387 LIST_HEAD(, nfsrv_descript) ns_tq; /* Write gather lists */ 388 LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ]; 389 LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ]; |
|
280}; 281 282/* Bits for "ns_flag" */ 283#define SLP_VALID 0x01 284#define SLP_DOREC 0x02 285#define SLP_NEEDQ 0x04 286#define SLP_DISCONN 0x08 287#define SLP_GETSTREAM 0x10 | 390}; 391 392/* Bits for "ns_flag" */ 393#define SLP_VALID 0x01 394#define SLP_DOREC 0x02 395#define SLP_NEEDQ 0x04 396#define SLP_DISCONN 0x08 397#define SLP_GETSTREAM 0x10 |
398#define SLP_LASTFRAG 0x20 |
|
288#define SLP_ALLFLAGS 0xff 289 290TAILQ_HEAD(, nfssvc_sock) nfssvc_sockhead; 291int nfssvc_sockhead_flag; 292#define SLP_INIT 0x01 293#define SLP_WANTINIT 0x02 294 295/* 296 * One of these structures is allocated for each nfsd. 297 */ 298struct nfsd { | 399#define SLP_ALLFLAGS 0xff 400 401TAILQ_HEAD(, nfssvc_sock) nfssvc_sockhead; 402int nfssvc_sockhead_flag; 403#define SLP_INIT 0x01 404#define SLP_WANTINIT 0x02 405 406/* 407 * One of these structures is allocated for each nfsd. 408 */ 409struct nfsd { |
299 TAILQ_ENTRY(nfsd) nd_chain; /* List of all nfsd's */ 300 int nd_flag; /* NFSD_ flags */ 301 struct nfssvc_sock *nd_slp; /* Current socket */ 302 struct mbuf *nd_nam; /* Client addr for datagram req. */ 303 struct mbuf *nd_mrep; /* Req. mbuf list */ 304 struct mbuf *nd_md; 305 caddr_t nd_dpos; /* Position in list */ 306 int nd_procnum; /* RPC procedure number */ 307 u_long nd_retxid; /* RPC xid */ 308 int nd_repstat; /* Reply status value */ 309 struct ucred nd_cr; /* Credentials for req. */ 310 int nd_nqlflag; /* Leasing flag */ 311 u_long nd_duration; /* Lease duration */ 312 int nd_authlen; /* Authenticator len */ 313 u_char nd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */ 314 struct proc *nd_procp; /* Proc ptr */ | 410 TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */ 411 int nfsd_flag; /* NFSD_ flags */ 412 struct nfssvc_sock *nfsd_slp; /* Current socket */ 413 int nfsd_authlen; /* Authenticator len */ 414 u_char nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */ 415 int nfsd_verflen; /* and the Verifier */ 416 u_char nfsd_verfstr[RPCVERF_MAXSIZ]; 417 struct proc *nfsd_procp; /* Proc ptr */ 418 struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */ |
315}; 316 | 419}; 420 |
317/* Bits for "nd_flag" */ | 421/* Bits for "nfsd_flag" */ |
318#define NFSD_WAITING 0x01 319#define NFSD_REQINPROG 0x02 320#define NFSD_NEEDAUTH 0x04 321#define NFSD_AUTHFAIL 0x08 322 | 422#define NFSD_WAITING 0x01 423#define NFSD_REQINPROG 0x02 424#define NFSD_NEEDAUTH 0x04 425#define NFSD_AUTHFAIL 0x08 426 |
427/* 428 * This structure is used by the server for describing each request. 429 * Some fields are used only when write request gathering is performed. 430 */ 431struct nfsrv_descript { 432 u_quad_t nd_time; /* Write deadline (usec) */ 433 off_t nd_off; /* Start byte offset */ 434 off_t nd_eoff; /* and end byte offset */ 435 LIST_ENTRY(nfsrv_descript) nd_hash; /* Hash list */ 436 LIST_ENTRY(nfsrv_descript) nd_tq; /* and timer list */ 437 LIST_HEAD(,nfsrv_descript) nd_coalesce; /* coalesced writes */ 438 struct mbuf *nd_mrep; /* Request mbuf list */ 439 struct mbuf *nd_md; /* Current dissect mbuf */ 440 struct mbuf *nd_mreq; /* Reply mbuf list */ 441 struct mbuf *nd_nam; /* and socket addr */ 442 struct mbuf *nd_nam2; /* return socket addr */ 443 caddr_t nd_dpos; /* Current dissect pos */ 444 int nd_procnum; /* RPC # */ 445 int nd_stable; /* storage type */ 446 int nd_flag; /* nd_flag */ 447 int nd_len; /* Length of this write */ 448 int nd_repstat; /* Reply status */ 449 u_long nd_retxid; /* Reply xid */ 450 u_long nd_duration; /* Lease duration */ 451 struct timeval nd_starttime; /* Time RPC initiated */ 452 fhandle_t nd_fh; /* File handle */ 453 struct ucred nd_cr; /* Credentials */ 454}; 455 456/* Bits for "nd_flag" */ 457#define ND_READ LEASE_READ 458#define ND_WRITE LEASE_WRITE 459#define ND_CHECK 0x04 460#define ND_LEASE (ND_READ | ND_WRITE | ND_CHECK) 461#define ND_NFSV3 0x08 462#define ND_NQNFS 0x10 463#define ND_KERBNICK 0x20 464#define ND_KERBFULL 0x40 465#define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL) 466 |
|
323TAILQ_HEAD(, nfsd) nfsd_head; 324int nfsd_head_flag; 325#define NFSD_CHECKSLP 0x01 326 | 467TAILQ_HEAD(, nfsd) nfsd_head; 468int nfsd_head_flag; 469#define NFSD_CHECKSLP 0x01 470 |
471/* 472 * These macros compare nfsrv_descript structures. 473 */ 474#define NFSW_CONTIG(o, n) \ 475 ((o)->nd_eoff >= (n)->nd_off && \ 476 !bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, NFSX_V3FH)) 477 478#define NFSW_SAMECRED(o, n) \ 479 (((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \ 480 !bcmp((caddr_t)&(o)->nd_cr, (caddr_t)&(n)->nd_cr, \ 481 sizeof (struct ucred))) 482 |
|
327int nfs_reply __P((struct nfsreq *)); | 483int nfs_reply __P((struct nfsreq *)); |
328int nfs_getreq __P((struct nfsd *,int)); | 484int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int)); |
329int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *)); | 485int nfs_send __P((struct socket *,struct mbuf *,struct mbuf *,struct nfsreq *)); |
330int nfs_rephead __P((int,struct nfsd *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *)); | 486int nfs_rephead __P((int,struct nfsrv_descript *,struct nfssvc_sock *,int,int,u_quad_t *,struct mbuf **,struct mbuf **,caddr_t *)); |
331int nfs_sndlock __P((int *,struct nfsreq *)); 332int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); 333int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int)); 334int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *)); | 487int nfs_sndlock __P((int *,struct nfsreq *)); 488int nfs_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); 489int nfs_vinvalbuf __P((struct vnode *,int,struct ucred *,struct proc *,int)); 490int nfs_readrpc __P((struct vnode *,struct uio *,struct ucred *)); |
335int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int)); | 491int nfs_writerpc __P((struct vnode *,struct uio *,struct ucred *,int *,int *)); |
336int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *)); | 492int nfs_readdirrpc __P((register struct vnode *,struct uio *,struct ucred *)); |
493int nfs_setattrrpc __P((struct vnode *,struct vattr *,struct ucred *,struct proc *)); |
|
337int nfs_asyncio __P((struct buf *,struct ucred *)); 338int nfs_doio __P((struct buf *,struct ucred *,struct proc *)); 339int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *)); 340int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *)); | 494int nfs_asyncio __P((struct buf *,struct ucred *)); 495int nfs_doio __P((struct buf *,struct ucred *,struct proc *)); 496int nfs_readlinkrpc __P((struct vnode *,struct uio *,struct ucred *)); 497int nfs_sigintr __P((struct nfsmount *,struct nfsreq *r,struct proc *)); |
341int nfs_readdirlookrpc __P((struct vnode *,register struct uio *,struct ucred *)); | 498int nfs_readdirplusrpc __P((struct vnode *,register struct uio *,struct ucred *)); |
342int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); | 499int nfsm_disct __P((struct mbuf **,caddr_t *,int,int,caddr_t *)); |
343int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,struct ucred *,struct nfssvc_sock *,struct mbuf *,int *)); | 500void nfsm_srvfattr __P((struct nfsrv_descript *,struct vattr *,struct nfs_fattr *)); 501void nfsm_srvwcc __P((struct nfsrv_descript *,int,struct vattr *,int,struct vattr *,struct mbuf **,char **)); 502void nfsm_srvpostopattr __P((struct nfsrv_descript *,int,struct vattr *,struct mbuf **,char **)); 503int nfsrv_fhtovp __P((fhandle_t *,int,struct vnode **,struct ucred *,struct nfssvc_sock *,struct mbuf *,int *,int)); |
344int nfsrv_access __P((struct vnode *,int,struct ucred *,int,struct proc *)); 345int netaddr_match __P((int,union nethostaddr *,struct mbuf *)); 346int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *)); 347int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *)); | 504int nfsrv_access __P((struct vnode *,int,struct ucred *,int,struct proc *)); 505int netaddr_match __P((int,union nethostaddr *,struct mbuf *)); 506int nfs_request __P((struct vnode *,struct mbuf *,int,struct proc *,struct ucred *,struct mbuf **,struct mbuf **,caddr_t *)); 507int nfs_loadattrcache __P((struct vnode **,struct mbuf **,caddr_t *,struct vattr *)); |
348int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct proc *)); | 508int nfs_namei __P((struct nameidata *,fhandle_t *,int,struct nfssvc_sock *,struct mbuf *,struct mbuf **,caddr_t *,struct vnode **,struct proc *,int)); |
349void nfsm_adj __P((struct mbuf *,int,int)); 350int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *)); 351void nfsrv_initcache __P((void)); 352int nfs_rcvlock __P((struct nfsreq *)); | 509void nfsm_adj __P((struct mbuf *,int,int)); 510int nfsm_mbuftouio __P((struct mbuf **,struct uio *,int,caddr_t *)); 511void nfsrv_initcache __P((void)); 512int nfs_rcvlock __P((struct nfsreq *)); |
353int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,int *,char **,int *)); | 513int nfs_getauth __P((struct nfsmount *,struct nfsreq *,struct ucred *,char **,int *,char *,int *,NFSKERBKEY_T)); 514int nfs_getnickauth __P((struct nfsmount *,struct ucred *,char **,int *,char *,int)); 515int nfs_savenickauth __P((struct nfsmount *,struct ucred *,int,NFSKERBKEY_T,struct mbuf **,char **,struct mbuf *)); |
354int nfs_msg __P((struct proc *,char *,char *)); 355int nfs_adv __P((struct mbuf **,caddr_t *,int,int)); 356int nfsrv_getstream __P((struct nfssvc_sock *,int)); 357void nfs_nhinit __P((void)); 358void nfs_timer __P((void*)); | 516int nfs_msg __P((struct proc *,char *,char *)); 517int nfs_adv __P((struct mbuf **,caddr_t *,int,int)); 518int nfsrv_getstream __P((struct nfssvc_sock *,int)); 519void nfs_nhinit __P((void)); 520void nfs_timer __P((void*)); |
359struct nfsnodehashhead * nfs_hash __P((nfsv2fh_t *)); | 521u_long nfs_hash __P((nfsfh_t *,int)); |
360int nfssvc_iod __P((struct proc *)); 361int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *)); 362int nfssvc_addsock __P((struct file *,struct mbuf *)); | 522int nfssvc_iod __P((struct proc *)); 523int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *)); 524int nfssvc_addsock __P((struct file *,struct mbuf *)); |
363int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *)); 364int nfsrv_getcache __P((struct mbuf *,struct nfsd *,struct mbuf **)); 365void nfsrv_updatecache __P((struct mbuf *,struct nfsd *,int,struct mbuf *)); | 525int nfsrv_dorec __P((struct nfssvc_sock *,struct nfsd *,struct nfsrv_descript **)); 526int nfsrv_getcache __P((struct nfsrv_descript *,struct nfssvc_sock *,struct mbuf **)); 527void nfsrv_updatecache __P((struct nfsrv_descript *,int,struct mbuf *)); |
366int mountnfs __P((struct nfs_args *,struct mount *,struct mbuf *,char *,char *,struct vnode **)); 367int nfs_connect __P((struct nfsmount *,struct nfsreq *)); 368int nfs_getattrcache __P((struct vnode *,struct vattr *)); 369int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long)); 370int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *)); 371int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *)); 372void nfsrv_init __P((int)); | 528int mountnfs __P((struct nfs_args *,struct mount *,struct mbuf *,char *,char *,struct vnode **)); 529int nfs_connect __P((struct nfsmount *,struct nfsreq *)); 530int nfs_getattrcache __P((struct vnode *,struct vattr *)); 531int nfsm_strtmbuf __P((struct mbuf **,char **,char *,long)); 532int nfs_bioread __P((struct vnode *,struct uio *,int,struct ucred *)); 533int nfsm_uiotombuf __P((struct uio *,struct mbuf **,int,caddr_t *)); 534void nfsrv_init __P((int)); |
535void nfs_clearcommit __P((struct mount *)); 536int nfsrv_errmap __P((struct nfsrv_descript *, int)); 537void nfsrvw_coalesce __P((struct nfsrv_descript *,struct nfsrv_descript *)); 538void nfsrvw_sort __P((gid_t [],int)); 539void nfsrv_setcred __P((struct ucred *,struct ucred *)); 540int nfs_flush __P((struct vnode *,struct ucred *,int,struct proc *,int)); 541int nfs_writebp __P((struct buf *,int)); |
|
373int nfsrv_vput __P(( struct vnode * )); 374int nfsrv_vrele __P(( struct vnode * )); 375int nfsrv_vmio __P(( struct vnode * )); | 542int nfsrv_vput __P(( struct vnode * )); 543int nfsrv_vrele __P(( struct vnode * )); 544int nfsrv_vmio __P(( struct vnode * )); |
545int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *, 546 struct proc *, struct mbuf **)); 547int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *, 548 struct proc *p)); |
|
376 377#endif /* KERNEL */ 378 379#endif | 549 550#endif /* KERNEL */ 551 552#endif |