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