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