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