* Copyright (c) 1989 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Rick Macklem at The University of Guelph.
* %sccs.include.redist.c%
* @(#)nfs.h 7.19 (Berkeley) %G%
* Tunable constants for nfs
#define NFS_HZ 25 /* Ticks per second for NFS timeouts */
#define NFS_TIMEO (1*NFS_HZ) /* Default timeout = 1 second */
#define NFS_MINTIMEO (1*NFS_HZ) /* Min timeout to use */
#define NFS_MAXTIMEO (60*NFS_HZ) /* Max timeout to backoff to */
#define NFS_MINIDEMTIMEO (5*NFS_HZ) /* Min timeout for non-idempotent ops*/
#define NFS_MAXREXMIT 100 /* Stop counting after this many */
#define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */
#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
#define NFS_MAXGRPS 16 /* Max. size of groups list */
#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */
#define NFS_MAXATTRTIMO 60
#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */
#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */
#define NFS_MAXREADDIR NFS_MAXDATA /* Max. size of directory read */
#define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */
#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */
#define NFS_DIRBLKSIZ 1024 /* Size of an NFS directory block */
#define NMOD(a) ((a) % nfs_asyncdaemons)
* Set the attribute timeout based on how recently the file has been modified.
#define NFS_ATTRTIMEO(np) \
((((np)->n_flag & NMODIFIED) || \
(time.tv_sec - (np)->n_mtime) / 10 < NFS_MINATTRTIMO) ? NFS_MINATTRTIMO : \
((time.tv_sec - (np)->n_mtime) / 10 > NFS_MAXATTRTIMO ? NFS_MAXATTRTIMO : \
(time.tv_sec - (np)->n_mtime) / 10))
* Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
* should ever try and use it.
int sock
; /* Socket to serve */
caddr_t name
; /* Client address for connection based sockets */
int namelen
; /* Length of name */
struct nfsd
*nsd_nfsd
; /* Pointer to in kernel nfsd struct */
uid_t nsd_uid
; /* Effective uid mapped to cred */
u_long nsd_haddr
; /* Ip address of client */
struct ucred nsd_cr
; /* Cred. uid maps to */
int nsd_authlen
; /* Length of auth string (ret) */
char *nsd_authstr
; /* Auth string (ret) */
char *ncd_dirp
; /* Mount dir path */
uid_t ncd_authuid
; /* Effective uid */
int ncd_authtype
; /* Type of authenticator */
int ncd_authlen
; /* Length of authenticator string */
char *ncd_authstr
; /* Authenticator string */
int srvrpccnt
[NFS_NPROCS
];
int srvcache_idemdonehits
;
int srvcache_nonidemdonehits
;
* Flags for nfssvc() system call.
#define NFSSVC_BIOD 0x002
#define NFSSVC_NFSD 0x004
#define NFSSVC_ADDSOCK 0x008
#define NFSSVC_AUTHIN 0x010
#define NFSSVC_GOTAUTH 0x040
#define NFSSVC_AUTHINFAIL 0x080
#define NFSSVC_MNTD 0x100
* The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
* What should be in this set is open to debate, but I believe that since
* I/O system calls on ufs are never interrupted by signals the set should
* be minimal. My reasoning is that many current programs that use signals
* such as SIGALRM will not expect file I/O system calls to be interrupted
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
sigmask(SIGHUP)|sigmask(SIGQUIT))
* Socket errors ignored for connectionless sockets??
* For now, ignore them all
#define NFSIGNORE_SOERROR(s, e) \
((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
((s) & PR_CONNREQUIRED) == 0)
* Nfs outstanding request list element
int r_flags
; /* flags on request, see below */
int r_retry
; /* max retransmission count */
int r_rexmit
; /* current retrans count */
int r_timer
; /* tick counter on reply */
int r_procnum
; /* NFS procedure number */
int r_rtt
; /* RTT for rpc */
struct proc
*r_procp
; /* Proc that did I/O system call */
/* Flag values for r_flags */
#define R_TIMING 0x01 /* timing request (in mntp) */
#define R_SENT 0x02 /* request has been sent */
#define R_SOFTTERM 0x04 /* soft mnt, too many retries */
#define R_INTR 0x08 /* intr mnt, signal pending */
#define R_SOCKERR 0x10 /* Fatal error on socket */
#define R_TPRINTFMSG 0x20 /* Did a tprintf msg. */
#define R_MUSTRESEND 0x40 /* Must resend request */
struct nfsstats nfsstats
;
* A list of nfssvc_sock structures is maintained with all the sockets
* that require service by the nfsd.
* The nfsuid structs hang off of the nfssvc_sock structs in both lru
#define NUIDHASH(uid) ((uid) & (NUIDHASHSIZ - 1))
* Network address hash list element
struct nfsuid
*nu_lrunext
; /* MUST be first */
struct nfsuid
*nu_lruprev
;
uid_t nu_uid
; /* Uid mapped by this entry */
union nethostaddr nu_haddr
; /* Host addr. for dgram sockets */
struct ucred nu_cr
; /* Cred uid mapped to */
#define nu_inetaddr nu_haddr.had_inetaddr
#define nu_nam nu_haddr.had_nam
struct nfsuid
*ns_lrunext
; /* MUST be first */
struct nfsuid
*ns_lruprev
;
struct nfssvc_sock
*ns_next
;
struct nfssvc_sock
*ns_prev
;
struct nfsuid
*ns_uidh
[NUIDHASHSIZ
];
#define SLP_GETSTREAM 0x10
#define SLP_WANTINIT 0x40
#define SLP_ALLFLAGS 0xff
* One of these structures is allocated for each nfsd.
struct nfsd
*nd_next
; /* Must be first */
int nd_flag
; /* NFSD_ flags */
struct nfssvc_sock
*nd_slp
; /* Current socket */
struct mbuf
*nd_nam
; /* Client addr for datagram req. */
struct mbuf
*nd_mrep
; /* Req. mbuf list */
caddr_t nd_dpos
; /* Position in list */
int nd_procnum
; /* RPC procedure number */
u_long nd_retxid
; /* RPC xid */
int nd_repstat
; /* Reply status value */
struct ucred nd_cr
; /* Credentials for req. */
int nd_nqlflag
; /* Leasing flag */
int nd_duration
; /* Lease duration */
int nd_authlen
; /* Authenticator len */
u_char nd_authstr
[RPCAUTH_MAXSIZ
]; /* Authenticator data */
struct proc
*nd_procp
; /* Proc ptr */
#define NFSD_WAITING 0x01
#define NFSD_CHECKSLP 0x02
#define NFSD_REQINPROG 0x04
#define NFSD_NEEDAUTH 0x08
#define NFSD_AUTHFAIL 0x10