nfs.h revision 1.1 1 1.1 mycroft /*
2 1.1 mycroft * Copyright (c) 1989 The Regents of the University of California.
3 1.1 mycroft * All rights reserved.
4 1.1 mycroft *
5 1.1 mycroft * This code is derived from software contributed to Berkeley by
6 1.1 mycroft * Rick Macklem at The University of Guelph.
7 1.1 mycroft *
8 1.1 mycroft * Redistribution and use in source and binary forms, with or without
9 1.1 mycroft * modification, are permitted provided that the following conditions
10 1.1 mycroft * are met:
11 1.1 mycroft * 1. Redistributions of source code must retain the above copyright
12 1.1 mycroft * notice, this list of conditions and the following disclaimer.
13 1.1 mycroft * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 mycroft * notice, this list of conditions and the following disclaimer in the
15 1.1 mycroft * documentation and/or other materials provided with the distribution.
16 1.1 mycroft * 3. All advertising materials mentioning features or use of this software
17 1.1 mycroft * must display the following acknowledgement:
18 1.1 mycroft * This product includes software developed by the University of
19 1.1 mycroft * California, Berkeley and its contributors.
20 1.1 mycroft * 4. Neither the name of the University nor the names of its contributors
21 1.1 mycroft * may be used to endorse or promote products derived from this software
22 1.1 mycroft * without specific prior written permission.
23 1.1 mycroft *
24 1.1 mycroft * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 1.1 mycroft * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 1.1 mycroft * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 1.1 mycroft * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 1.1 mycroft * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 1.1 mycroft * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 1.1 mycroft * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 1.1 mycroft * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 1.1 mycroft * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 1.1 mycroft * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 1.1 mycroft * SUCH DAMAGE.
35 1.1 mycroft *
36 1.1 mycroft * @(#)nfs.h 7.11 (Berkeley) 4/19/91
37 1.1 mycroft */
38 1.1 mycroft
39 1.1 mycroft #ifndef _NFS_NFS_H_
40 1.1 mycroft #define _NFS_NFS_H_
41 1.1 mycroft
42 1.1 mycroft /*
43 1.1 mycroft * Tunable constants for nfs
44 1.1 mycroft */
45 1.1 mycroft
46 1.1 mycroft #define NFS_MAXIOVEC 34
47 1.1 mycroft #define NFS_HZ 10 /* Ticks per second for NFS timeouts */
48 1.1 mycroft #define NFS_TIMEO (1*NFS_HZ) /* Default timeout = 1 second */
49 1.1 mycroft #define NFS_MINTIMEO (NFS_HZ) /* Min timeout to use */
50 1.1 mycroft #define NFS_MAXTIMEO (60*NFS_HZ) /* Max timeout to backoff to */
51 1.1 mycroft #define NFS_MINIDEMTIMEO (2*NFS_HZ) /* Min timeout for non-idempotent ops*/
52 1.1 mycroft #define NFS_RELIABLETIMEO (5*NFS_HZ) /* Min timeout on reliable sockets */
53 1.1 mycroft #define NFS_MAXREXMIT 100 /* Stop counting after this many */
54 1.1 mycroft #define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */
55 1.1 mycroft #define NFS_RETRANS 10 /* Num of retrans for soft mounts */
56 1.1 mycroft #define NFS_FISHY 8 /* Host not responding at this count */
57 1.1 mycroft #define NFS_ATTRTIMEO 5 /* Attribute cache timeout in sec */
58 1.1 mycroft #define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
59 1.1 mycroft #define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
60 1.1 mycroft #define NFS_MAXREADDIR NFS_MAXDATA /* Max. size of directory read */
61 1.1 mycroft #define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */
62 1.1 mycroft #define NFS_DIRBLKSIZ 1024 /* Size of an NFS directory block */
63 1.1 mycroft #define NMOD(a) ((a) % nfs_asyncdaemons)
64 1.1 mycroft
65 1.1 mycroft /*
66 1.1 mycroft * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
67 1.1 mycroft * What should be in this set is open to debate, but I believe that since
68 1.1 mycroft * I/O system calls on ufs are never interrupted by signals the set should
69 1.1 mycroft * be minimal. My reasoning is that many current programs that use signals
70 1.1 mycroft * such as SIGALRM will not expect file I/O system calls to be interrupted
71 1.1 mycroft * by them and break.
72 1.1 mycroft */
73 1.1 mycroft #define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
74 1.1 mycroft sigmask(SIGHUP)|sigmask(SIGQUIT))
75 1.1 mycroft
76 1.1 mycroft /*
77 1.1 mycroft * Socket errors ignored for connectionless sockets??
78 1.1 mycroft * For now, ignore them all
79 1.1 mycroft */
80 1.1 mycroft #define NFSIGNORE_SOERROR(s, e) \
81 1.1 mycroft ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
82 1.1 mycroft ((s) & PR_CONNREQUIRED) == 0)
83 1.1 mycroft
84 1.1 mycroft /*
85 1.1 mycroft * Nfs outstanding request list element
86 1.1 mycroft */
87 1.1 mycroft struct nfsreq {
88 1.1 mycroft struct nfsreq *r_next;
89 1.1 mycroft struct nfsreq *r_prev;
90 1.1 mycroft struct mbuf *r_mreq;
91 1.1 mycroft struct mbuf *r_mrep;
92 1.1 mycroft struct nfsmount *r_nmp;
93 1.1 mycroft struct vnode *r_vp;
94 1.1 mycroft u_long r_xid;
95 1.1 mycroft short r_flags; /* flags on request, see below */
96 1.1 mycroft short r_retry; /* max retransmission count */
97 1.1 mycroft short r_rexmit; /* current retrans count */
98 1.1 mycroft short r_timer; /* tick counter on reply */
99 1.1 mycroft short r_timerinit; /* reinit tick counter on reply */
100 1.1 mycroft struct proc *r_procp; /* Proc that did I/O system call */
101 1.1 mycroft };
102 1.1 mycroft
103 1.1 mycroft /* Flag values for r_flags */
104 1.1 mycroft #define R_TIMING 0x01 /* timing request (in mntp) */
105 1.1 mycroft #define R_SENT 0x02 /* request has been sent */
106 1.1 mycroft #define R_SOFTTERM 0x04 /* soft mnt, too many retries */
107 1.1 mycroft #define R_INTR 0x08 /* intr mnt, signal pending */
108 1.1 mycroft #define R_SOCKERR 0x10 /* Fatal error on socket */
109 1.1 mycroft #define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */
110 1.1 mycroft #define R_MUSTRESEND 0x40 /* Must resend request */
111 1.1 mycroft
112 1.1 mycroft #ifdef KERNEL
113 1.1 mycroft /*
114 1.1 mycroft * Silly rename structure that hangs off the nfsnode until the name
115 1.1 mycroft * can be removed by nfs_inactive()
116 1.1 mycroft */
117 1.1 mycroft struct sillyrename {
118 1.1 mycroft nfsv2fh_t s_fh;
119 1.1 mycroft struct ucred *s_cred;
120 1.1 mycroft struct vnode *s_dvp;
121 1.1 mycroft u_short s_namlen;
122 1.1 mycroft char s_name[20];
123 1.1 mycroft };
124 1.1 mycroft
125 1.1 mycroft /* And its flag values */
126 1.1 mycroft #define REMOVE 0
127 1.1 mycroft #define RMDIR 1
128 1.1 mycroft #endif /* KERNEL */
129 1.1 mycroft
130 1.1 mycroft /*
131 1.1 mycroft * Stats structure
132 1.1 mycroft */
133 1.1 mycroft struct nfsstats {
134 1.1 mycroft int attrcache_hits;
135 1.1 mycroft int attrcache_misses;
136 1.1 mycroft int lookupcache_hits;
137 1.1 mycroft int lookupcache_misses;
138 1.1 mycroft int direofcache_hits;
139 1.1 mycroft int direofcache_misses;
140 1.1 mycroft int biocache_reads;
141 1.1 mycroft int read_bios;
142 1.1 mycroft int read_physios;
143 1.1 mycroft int biocache_writes;
144 1.1 mycroft int write_bios;
145 1.1 mycroft int write_physios;
146 1.1 mycroft int biocache_readlinks;
147 1.1 mycroft int readlink_bios;
148 1.1 mycroft int biocache_readdirs;
149 1.1 mycroft int readdir_bios;
150 1.1 mycroft int rpccnt[NFS_NPROCS];
151 1.1 mycroft int rpcretries;
152 1.1 mycroft int srvrpccnt[NFS_NPROCS];
153 1.1 mycroft int srvrpc_errs;
154 1.1 mycroft int srv_errs;
155 1.1 mycroft int rpcrequests;
156 1.1 mycroft int rpctimeouts;
157 1.1 mycroft int rpcunexpected;
158 1.1 mycroft int rpcinvalid;
159 1.1 mycroft int srvcache_inproghits;
160 1.1 mycroft int srvcache_idemdonehits;
161 1.1 mycroft int srvcache_nonidemdonehits;
162 1.1 mycroft int srvcache_misses;
163 1.1 mycroft };
164 1.1 mycroft
165 1.1 mycroft #ifdef KERNEL
166 1.1 mycroft struct nfsstats nfsstats;
167 1.1 mycroft #endif /* KERNEL */
168 1.1 mycroft
169 1.1 mycroft #endif /* !_NFS_NFS_H_ */
170