#ifndef _NFS_NFS_H_
#define _NFS_NFS_H_
#include <sys/appleapiopts.h>
#ifdef __APPLE_API_PRIVATE
#define NFS_MAXIOVEC 34
#define NFS_TICKINTVL 5
#define NFS_HZ (hz / nfs_ticks)
#define NFS_TIMEO (1 * NFS_HZ)
#define NFS_MINTIMEO (1 * NFS_HZ)
#define NFS_MAXTIMEO (60 * NFS_HZ)
#define NFS_MINIDEMTIMEO (5 * NFS_HZ)
#define NFS_MAXREXMIT 100
#define NFS_MAXWINDOW 1024
#define NFS_RETRANS 10
#define NFS_MAXGRPS 16
#ifndef NFS_MINATTRTIMO
#define NFS_MINATTRTIMO 5
#endif
#ifndef NFS_MAXATTRTIMO
#define NFS_MAXATTRTIMO 60
#endif
#define NFS_WSIZE 8192
#define NFS_RSIZE 8192
#define NFS_READDIRSIZE 8192
#define NFS_DEFRAHEAD 1
#define NFS_MAXRAHEAD 4
#define NFS_MAXUIDHASH 64
#define NFS_MAXASYNCDAEMON 20
#define NFS_MAXGATHERDELAY 100
#ifndef NFS_GATHERDELAY
#define NFS_GATHERDELAY 10
#endif
#define NFS_DIRBLKSIZ 4096
#define NMOD(a) ((a) % nfs_asyncdaemons)
#define NFS_CMPFH(n, f, s) \
((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
#define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)
#define NFS_SRVMAXDATA(n) \
(((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \
NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
#ifdef __FreeBSD__
#define B_INVAFTERWRITE B_NOCACHE
#else
#define B_INVAFTERWRITE B_INVAL
#endif
#ifndef IO_METASYNC
#define IO_METASYNC 0
#endif
#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))
#define NFS_NODEALLOC 512
#define NFS_MNTALLOC 512
#define NFS_SVCALLOC 256
#define NFS_UIDALLOC 128
#define NFS_ARGSVERSION 3
struct nfs_args {
int version;
struct sockaddr *addr;
int addrlen;
int sotype;
int proto;
u_char *fh;
int fhsize;
int flags;
int wsize;
int rsize;
int readdirsize;
int timeo;
int retrans;
int maxgrouplist;
int readahead;
int leaseterm;
int deadthresh;
char *hostname;
};
#define NFSMNT_SOFT 0x00000001
#define NFSMNT_WSIZE 0x00000002
#define NFSMNT_RSIZE 0x00000004
#define NFSMNT_TIMEO 0x00000008
#define NFSMNT_RETRANS 0x00000010
#define NFSMNT_MAXGRPS 0x00000020
#define NFSMNT_INT 0x00000040
#define NFSMNT_NOCONN 0x00000080
#define NFSMNT_NQNFS 0x00000100
#define NFSMNT_NFSV3 0x00000200
#define NFSMNT_KERB 0x00000400
#define NFSMNT_DUMBTIMR 0x00000800
#define NFSMNT_LEASETERM 0x00001000
#define NFSMNT_READAHEAD 0x00002000
#define NFSMNT_DEADTHRESH 0x00004000
#define NFSMNT_RESVPORT 0x00008000
#define NFSMNT_RDIRPLUS 0x00010000
#define NFSMNT_READDIRSIZE 0x00020000
#define NFSMNT_INTERNAL 0xfffc0000
#define NFSMNT_HASWRITEVERF 0x00040000
#define NFSMNT_GOTPATHCONF 0x00080000
#define NFSMNT_GOTFSINFO 0x00100000
#define NFSMNT_MNTD 0x00200000
#define NFSMNT_DISMINPROG 0x00400000
#define NFSMNT_DISMNT 0x00800000
#define NFSMNT_SNDLOCK 0x01000000
#define NFSMNT_WANTSND 0x02000000
#define NFSMNT_RCVLOCK 0x04000000
#define NFSMNT_WANTRCV 0x08000000
#define NFSMNT_WAITAUTH 0x10000000
#define NFSMNT_HASAUTH 0x20000000
#define NFSMNT_WANTAUTH 0x40000000
#define NFSMNT_AUTHERR 0x80000000
struct nfsd_args {
int sock;
caddr_t name;
int namelen;
};
struct nfsd_srvargs {
struct nfsd *nsd_nfsd;
uid_t nsd_uid;
u_long nsd_haddr;
struct ucred nsd_cr;
int nsd_authlen;
u_char *nsd_authstr;
int nsd_verflen;
u_char *nsd_verfstr;
struct timeval nsd_timestamp;
u_long nsd_ttl;
NFSKERBKEY_T nsd_key;
};
struct nfsd_cargs {
char *ncd_dirp;
uid_t ncd_authuid;
int ncd_authtype;
int ncd_authlen;
u_char *ncd_authstr;
int ncd_verflen;
u_char *ncd_verfstr;
NFSKERBKEY_T ncd_key;
};
#ifdef NFS_NPROCS
struct nfsstats {
int attrcache_hits;
int attrcache_misses;
int lookupcache_hits;
int lookupcache_misses;
int direofcache_hits;
int direofcache_misses;
int biocache_reads;
int read_bios;
int read_physios;
int biocache_writes;
int write_bios;
int write_physios;
int biocache_readlinks;
int readlink_bios;
int biocache_readdirs;
int readdir_bios;
int rpccnt[NFS_NPROCS];
int rpcretries;
int srvrpccnt[NFS_NPROCS];
int srvrpc_errs;
int srv_errs;
int rpcrequests;
int rpctimeouts;
int rpcunexpected;
int rpcinvalid;
int srvcache_inproghits;
int srvcache_idemdonehits;
int srvcache_nonidemdonehits;
int srvcache_misses;
int srvnqnfs_leases;
int srvnqnfs_maxleases;
int srvnqnfs_getleases;
int srvvop_writes;
int pageins;
int pageouts;
};
#endif
#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
#define NFS_NFSSTATS 1
#define NFS_NFSPRIVPORT 2
#define FS_NFS_NAMES { \
{ 0, 0 }, \
{ "nfsstats", CTLTYPE_STRUCT }, \
{ "nfsprivport", CTLTYPE_INT }, \
}
#ifndef NFS_MUIDHASHSIZ
#define NFS_MUIDHASHSIZ 63
#endif
#ifndef NFS_WDELAYHASHSIZ
#define NFS_WDELAYHASHSIZ 16
#endif
#ifdef KERNEL
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_NFSREQ);
MALLOC_DECLARE(M_NFSMNT);
MALLOC_DECLARE(M_NFSDIROFF);
MALLOC_DECLARE(M_NFSRVDESC);
MALLOC_DECLARE(M_NFSUID);
MALLOC_DECLARE(M_NQLEASE);
MALLOC_DECLARE(M_NFSD);
MALLOC_DECLARE(M_NFSBIGFH);
#endif
struct uio; struct buf; struct vattr; struct nameidata;
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
sigmask(SIGHUP)|sigmask(SIGQUIT))
#define NFSIGNORE_SOERROR(s, e) \
((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
((s) & PR_CONNREQUIRED) == 0)
struct nfsreq {
TAILQ_ENTRY(nfsreq) r_chain;
struct mbuf *r_mreq;
struct mbuf *r_mrep;
struct mbuf *r_md;
caddr_t r_dpos;
struct nfsmount *r_nmp;
struct vnode *r_vp;
u_long r_xid;
int r_flags;
int r_retry;
int r_rexmit;
int r_timer;
u_int32_t r_procnum;
int r_rtt;
struct proc *r_procp;
};
extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
#define R_TIMING 0x01
#define R_SENT 0x02
#define R_SOFTTERM 0x04
#define R_INTR 0x08
#define R_SOCKERR 0x10
#define R_TPRINTFMSG 0x20
#define R_MUSTRESEND 0x40
#define R_GETONEREP 0x80
#ifndef NFS_UIDHASHSIZ
#define NFS_UIDHASHSIZ 29
#endif
#define NUIDHASH(sock, uid) \
(&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ])
#define NWDELAYHASH(sock, f) \
(&(sock)->ns_wdelayhashtbl[(*((u_long *)(f))) % NFS_WDELAYHASHSIZ])
#define NMUIDHASH(nmp, uid) \
(&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ])
#define NFSNOHASH(fhsum) \
(&nfsnodehashtbl[(fhsum) & nfsnodehash])
union nethostaddr {
u_long had_inetaddr;
struct mbuf *had_nam;
};
struct nfsuid {
TAILQ_ENTRY(nfsuid) nu_lru;
LIST_ENTRY(nfsuid) nu_hash;
int nu_flag;
union nethostaddr nu_haddr;
struct ucred nu_cr;
int nu_expire;
struct timeval nu_timestamp;
u_long nu_nickname;
NFSKERBKEY_T nu_key;
};
#define nu_inetaddr nu_haddr.had_inetaddr
#define nu_nam nu_haddr.had_nam
#define NU_INETADDR 0x1
#define NU_NAM 0x2
#define NU_NETFAM(u) (((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO)
#ifdef notyet
struct nfsrv_rec {
STAILQ_ENTRY(nfsrv_rec) nr_link;
struct sockaddr *nr_address;
struct mbuf *nr_packet;
};
#endif
struct nfssvc_sock {
TAILQ_ENTRY(nfssvc_sock) ns_chain;
TAILQ_HEAD(, nfsuid) ns_uidlruhead;
struct file *ns_fp;
struct socket *ns_so;
struct mbuf *ns_nam;
struct mbuf *ns_raw;
struct mbuf *ns_rawend;
struct mbuf *ns_rec;
struct mbuf *ns_recend;
struct mbuf *ns_frag;
int ns_flag;
int ns_solock;
int ns_cc;
int ns_reclen;
int ns_numuids;
u_long ns_sref;
LIST_HEAD(, nfsrv_descript) ns_tq;
LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ];
LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ];
};
#define SLP_VALID 0x01
#define SLP_DOREC 0x02
#define SLP_NEEDQ 0x04
#define SLP_DISCONN 0x08
#define SLP_GETSTREAM 0x10
#define SLP_LASTFRAG 0x20
#define SLP_ALLFLAGS 0xff
extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead;
extern int nfssvc_sockhead_flag;
#define SLP_INIT 0x01
#define SLP_WANTINIT 0x02
struct nfsd {
TAILQ_ENTRY(nfsd) nfsd_chain;
int nfsd_flag;
struct nfssvc_sock *nfsd_slp;
int nfsd_authlen;
u_char nfsd_authstr[RPCAUTH_MAXSIZ];
int nfsd_verflen;
u_char nfsd_verfstr[RPCVERF_MAXSIZ];
struct proc *nfsd_procp;
struct nfsrv_descript *nfsd_nd;
};
#define NFSD_WAITING 0x01
#define NFSD_REQINPROG 0x02
#define NFSD_NEEDAUTH 0x04
#define NFSD_AUTHFAIL 0x08
struct nfsrv_descript {
u_quad_t nd_time;
off_t nd_off;
off_t nd_eoff;
LIST_ENTRY(nfsrv_descript) nd_hash;
LIST_ENTRY(nfsrv_descript) nd_tq;
LIST_HEAD(,nfsrv_descript) nd_coalesce;
struct mbuf *nd_mrep;
struct mbuf *nd_md;
struct mbuf *nd_mreq;
struct mbuf *nd_nam;
struct mbuf *nd_nam2;
caddr_t nd_dpos;
u_int32_t nd_procnum;
int nd_stable;
int nd_flag;
int nd_len;
int nd_repstat;
u_long nd_retxid;
u_long nd_duration;
struct timeval nd_starttime;
fhandle_t nd_fh;
struct ucred nd_cr;
};
#define ND_READ LEASE_READ
#define ND_WRITE LEASE_WRITE
#define ND_CHECK 0x04
#define ND_LEASE (ND_READ | ND_WRITE | ND_CHECK)
#define ND_NFSV3 0x08
#define ND_NQNFS 0x10
#define ND_KERBNICK 0x20
#define ND_KERBFULL 0x40
#define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL)
extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head;
extern int nfsd_head_flag;
#define NFSD_CHECKSLP 0x01
#define NFSW_CONTIG(o, n) \
((o)->nd_eoff >= (n)->nd_off && \
!bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, NFSX_V3FH))
#define NFSW_SAMECRED(o, n) \
(((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \
!bcmp((caddr_t)&(o)->nd_cr, (caddr_t)&(n)->nd_cr, \
sizeof (struct ucred)))
#define WEBNFS_ESC_CHAR '%'
#define WEBNFS_SPECCHAR_START 0x80
#define WEBNFS_NATIVE_CHAR 0x80
#define HEXTOC(c) \
((c) >= 'a' ? ((c) - ('a' - 10)) : \
((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))
#define HEXSTRTOI(p) \
((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))
#define NFSDIAG 0
#if NFSDIAG
extern int nfs_debug;
#define NFS_DEBUG_ASYNCIO 1
#define NFS_DEBUG_WG 2
#define NFS_DEBUG_RC 4
#define NFS_DEBUG_SILLY 8
#define NFS_DEBUG_DUP 16
#define NFS_DEBUG_ATTR 32
#define NFS_DPF(cat, args) \
do { \
if (nfs_debug & NFS_DEBUG_##cat) kprintf args; \
} while (0)
#else
#define NFS_DPF(cat, args)
#endif
int nfs_init __P((struct vfsconf *vfsp));
int nfs_reply __P((struct nfsreq *));
int nfs_getreq __P((struct nfsrv_descript *,struct nfsd *,int));
int nfs_send __P((struct socket *, struct mbuf *, struct mbuf *,
struct nfsreq *));
int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
int, int, u_quad_t *, struct mbuf **, struct mbuf **,
caddr_t *));
int nfs_sndlock __P((int *, struct nfsreq *));
void nfs_sndunlock __P((int *flagp));
int nfs_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
int));
int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
int *));
int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
int nfs_asyncio __P((struct buf *, struct ucred *));
int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
struct nfs_fattr *));
void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
struct vattr *, struct mbuf **, char **));
void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
struct mbuf **, char **));
int netaddr_match __P((int, union nethostaddr *, struct mbuf *));
int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
struct ucred *, struct mbuf **, struct mbuf **,
caddr_t *, u_int64_t *));
int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
struct vattr *, int, u_int64_t *));
int nfs_namei __P((struct nameidata *, fhandle_t *, int,
struct nfssvc_sock *, struct mbuf *, struct mbuf **,
caddr_t *, struct vnode **, struct proc *, int, int));
void nfsm_adj __P((struct mbuf *, int, int));
int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
void nfsrv_initcache __P((void));
int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
char **, int *, char *, int *, NFSKERBKEY_T));
int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **,
int *, char *, int));
int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int,
NFSKERBKEY_T, struct mbuf **, char **,
struct mbuf *));
int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
void nfs_nhinit __P((void));
void nfs_timer __P((void*));
u_long nfs_hash __P((nfsfh_t *, int));
int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
struct nfsrv_descript **));
int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
struct mbuf **));
void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
void nfsrv_cleancache __P((void));
int nfs_connect __P((struct nfsmount *, struct nfsreq *));
void nfs_disconnect __P((struct nfsmount *));
int nfs_getattrcache __P((struct vnode *, struct vattr *));
int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long));
int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *,
int));
int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
void nfsrv_init __P((int));
void nfs_clearcommit __P((struct mount *));
int nfsrv_errmap __P((struct nfsrv_descript *, int));
void nfsrvw_sort __P((gid_t *, int));
void nfsrv_setcred __P((struct ucred *, struct ucred *));
int nfs_writebp __P((struct buf *, int));
int nfsrv_object_create __P((struct vnode *));
void nfsrv_wakenfsd __P((struct nfssvc_sock *slp));
int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
struct proc *, struct mbuf **));
int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
struct proc *p));
int nfsrv3_access __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_commit __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_create __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
struct nfssvc_sock *, struct mbuf *, int *,
int, int));
int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
struct export_args *));
int nfs_ispublicfh __P((fhandle_t *));
int nfsrv_fsinfo __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_getattr __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_link __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_lookup __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_mkdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_mknod __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_noop __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_null __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_pathconf __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp, struct proc *procp,
struct mbuf **mrq));
int nfsrv_read __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_readdir __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_readdirplus __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp, struct proc *procp,
struct mbuf **mrq));
int nfsrv_readlink __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp, struct proc *procp,
struct mbuf **mrq));
int nfsrv_remove __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_rename __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_rmdir __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_setattr __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_statfs __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_symlink __P((struct nfsrv_descript *nfsd,
struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
int nfsrv_write __P((struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
struct proc *procp, struct mbuf **mrq));
void nfsrv_rcv __P((struct socket *so, caddr_t arg, int waitflag));
void nfsrv_slpderef __P((struct nfssvc_sock *slp));
#undef NFSDIAG
#if NFSDIAG
extern int nfstraceindx;
#define NFSTBUFSIZ 8912
struct nfstracerec { uint i1, i2, i3, i4; };
extern struct nfstracerec nfstracebuf[NFSTBUFSIZ];
extern uint nfstracemask;
#define NFSTRC_GAC_MISS 0x00
#define NFSTRC_GAC_HIT 0x01
#define NFSTRC_GAC_NP 0x02
#define NFSTRC_LAC 0x03
#define NFSTRC_LAC_INIT 0x04
#define NFSTRC_LAC_NP 0x05
#define NFSTRC_GA_INV 0x06
#define NFSTRC_GA_INV1 0x07
#define NFSTRC_VMP_INV 0x08
#define NFSTRC_REQ 0x09
#define NFSTRC_VPR 0xa
#define NFSTRC_VPR_DONE 0xb
#define NFSTRC_DIO 0xc
#define NFSTRC_DIO_DONE 0xd
#define NFSTRC_CWND_INIT 0xe
#define NFSTRC_CWND_REPLY 0xf
#define NFSTRC_CWND_TIMER 0x10
#define NFSTRC_CWND_REQ1 0x11
#define NFSTRC_CWND_REQ2 0x12
#define NFSTRC_CWND_SOFT 0x13
#define NFSTRC_ECONN 0x14
#define NFSTRC_RCVERR 0x15
#define NFSTRC_REQFREE 0x16
#define NFSTRC_NOTMINE 0x17
#define NFSTRC_6 0x18
#define NFSTRC_7 0x19
#define NFSTRC_RCVLCKINTR 0x1a
#define NFSTRC_RCVALREADY 0x1b
#define NFSTRC_RCVLCKW 0x1c
#define NFSTRC_RCVLCK 0x1d
#define NFSTRC_RCVUNLW 0x1e
#define NFSTRC_RCVUNL 0x1f
#define NFSTRC_GA_INV2 0x20
#define NFSTRC_VBAD 0x21
#define NFSTRC_REQERR 0x22
#define NFSTRC_RPCERR 0x23
#define NFSTRC_DISSECTERR 0x24
#define NFSTRC_CONTINUE 0xff
#define NFSTRACEX(a1, a2, a3, a4) \
( \
nfstracebuf[nfstraceindx].i1 = (uint)(a1), \
nfstracebuf[nfstraceindx].i2 = (uint)(a2), \
nfstracebuf[nfstraceindx].i3 = (uint)(a3), \
nfstracebuf[nfstraceindx].i4 = (uint)(a4), \
nfstraceindx = (nfstraceindx + 1) % NFSTBUFSIZ, \
1 \
)
#define NFSTRACE(cnst, fptr) \
( \
(nfstracemask && ((cnst) > 31 || nfstracemask & 1<<(cnst))) ? \
NFSTRACEX((cnst), (fptr), current_thread(), \
clock_get_system_value().tv_nsec) : \
0 \
)
#define NFSTRACE4(cnst, fptr, a2, a3, a4) \
( \
NFSTRACE(cnst,fptr) ? \
NFSTRACEX(NFSTRC_CONTINUE, a2, a3, a4) : \
0 \
)
#else
#define NFSTRACE(cnst, fptr)
#define NFSTRACE4(cnst, fptr, a2, a3, a4)
#endif
#endif
#endif
#endif