|
|
1.1 root 1: /*
2: * Copyright (c) 1989 The Regents of the University of California.
3: * 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 is only permitted until one year after the first shipment
9: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
10: * binary forms are permitted provided that: (1) source distributions retain
11: * this entire copyright notice and comment, and (2) distributions including
12: * binaries display the following acknowledgement: This product includes
13: * software developed by the University of California, Berkeley and its
14: * contributors'' in the documentation or other materials provided with the
15: * distribution and in all advertising materials mentioning features or use
16: * of this software. Neither the name of the University nor the names of
17: * its contributors may be used to endorse or promote products derived from
18: * this software without specific prior written permission.
19: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
20: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22: *
23: * @(#)nfs.h 7.9 (Berkeley) 6/28/90
24: */
25:
26: /*
27: * Tunable constants for nfs
28: */
29:
30: #define NFS_MAXIOVEC 34
31: #define NFS_HZ 10 /* Ticks per second for NFS timeouts */
32: #define NFS_TIMEO (1*NFS_HZ) /* Default timeout = 1 second */
33: #define NFS_MINTIMEO (NFS_HZ) /* Min timeout to use */
34: #define NFS_MAXTIMEO (60*NFS_HZ) /* Max timeout to backoff to */
35: #define NFS_MINIDEMTIMEO (2*NFS_HZ) /* Min timeout for non-idempotent ops*/
36: #define NFS_RELIABLETIMEO (5*NFS_HZ) /* Min timeout on reliable sockets */
37: #define NFS_MAXREXMIT 100 /* Stop counting after this many */
38: #define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */
39: #define NFS_RETRANS 10 /* Num of retrans for soft mounts */
40: #define NFS_FISHY 8 /* Host not responding at this count */
41: #define NFS_ATTRTIMEO 5 /* Attribute cache timeout in sec */
42: #define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
43: #define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
44: #define NFS_MAXREADDIR NFS_MAXDATA /* Max. size of directory read */
45: #define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */
46: #define NMOD(a) ((a) % nfs_asyncdaemons)
47:
48: /*
49: * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
50: * What should be in this set is open to debate, but I believe that since
51: * I/O system calls on ufs are never interrupted by signals the set should
52: * be minimal. My reasoning is that many current programs that use signals
53: * such as SIGALRM will not expect file I/O system calls to be interrupted
54: * by them and break.
55: */
56: #define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
57: sigmask(SIGHUP)|sigmask(SIGQUIT))
58:
59: /*
60: * Socket errors ignored for connectionless sockets??
61: * For now, ignore them all
62: */
63: #define NFSIGNORE_SOERROR(s, e) \
64: ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
65: ((s) & PR_CONNREQUIRED) == 0)
66:
67: /*
68: * Nfs outstanding request list element
69: */
70: struct nfsreq {
71: struct nfsreq *r_next;
72: struct nfsreq *r_prev;
73: struct mbuf *r_mreq;
74: struct mbuf *r_mrep;
75: struct nfsmount *r_nmp;
76: struct vnode *r_vp;
77: u_long r_xid;
78: short r_flags; /* flags on request, see below */
79: short r_retry; /* max retransmission count */
80: short r_rexmit; /* current retrans count */
81: short r_timer; /* tick counter on reply */
82: short r_timerinit; /* reinit tick counter on reply */
83: struct proc *r_procp; /* Proc that did I/O system call */
84: };
85:
86: /* Flag values for r_flags */
87: #define R_TIMING 0x01 /* timing request (in mntp) */
88: #define R_SENT 0x02 /* request has been sent */
89: #define R_SOFTTERM 0x04 /* soft mnt, too many retries */
90: #define R_INTR 0x08 /* intr mnt, signal pending */
91: #define R_SOCKERR 0x10 /* Fatal error on socket */
92: #define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */
93: #define R_MUSTRESEND 0x40 /* Must resend request */
94:
95: #ifdef KERNEL
96: /*
97: * Silly rename structure that hangs off the nfsnode until the name
98: * can be removed by nfs_inactive()
99: */
100: struct sillyrename {
101: int s_flag;
102: nfsv2fh_t s_fh;
103: struct nameidata s_namei;
104: };
105:
106: /* And its flag values */
107: #define REMOVE 0
108: #define RMDIR 1
109: #endif /* KERNEL */
110:
111: /*
112: * Stats structure
113: */
114: struct nfsstats {
115: int attrcache_hits;
116: int attrcache_misses;
117: int lookupcache_hits;
118: int lookupcache_misses;
119: int direofcache_hits;
120: int direofcache_misses;
121: int biocache_reads;
122: int read_bios;
123: int read_physios;
124: int biocache_writes;
125: int write_bios;
126: int write_physios;
127: int biocache_readlinks;
128: int readlink_bios;
129: int biocache_readdirs;
130: int readdir_bios;
131: int rpccnt[NFS_NPROCS];
132: int rpcretries;
133: int srvrpccnt[NFS_NPROCS];
134: int srvrpc_errs;
135: int srv_errs;
136: int rpcrequests;
137: int rpctimeouts;
138: int rpcunexpected;
139: int rpcinvalid;
140: int srvcache_inproghits;
141: int srvcache_idemdonehits;
142: int srvcache_nonidemdonehits;
143: int srvcache_misses;
144: };
145:
146: #ifdef KERNEL
147: struct nfsstats nfsstats;
148: #endif /* KERNEL */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.