#ifndef _NFS_NFS_H_
#define _NFS_NFS_H_
#include <sys/appleapiopts.h>
#include <sys/cdefs.h>
#ifdef __APPLE_API_PRIVATE
#define NFS_TICKINTVL 5
#define NFS_HZ (hz / nfs_ticks)
__private_extern__ int 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_RETRANS 10
#define NFS_TRYLATERDEL 4
#define NFS_MAXGRPS 16
#define NFS_MINATTRTIMO 5
#define NFS_MAXATTRTIMO 60
#define NFS_MINDIRATTRTIMO 5
#define NFS_MAXDIRATTRTIMO 60
#define NFS_IOSIZE (1024 * 1024)
#define NFS_RWSIZE 32768
#define NFS_WSIZE NFS_RWSIZE
#define NFS_RSIZE NFS_RWSIZE
#define NFS_DGRAM_WSIZE 8192
#define NFS_DGRAM_RSIZE 8192
#define NFS_READDIRSIZE 32768
#define NFS_DEFRAHEAD 16
#define NFS_MAXRAHEAD 128
#define NFS_DEFMAXASYNCWRITES 128
#define NFS_DEFASYNCTHREAD 16
#define NFS_MAXASYNCTHREAD 64
#define NFS_ASYNCTHREADMAXIDLE 60
#define NFS_DEFSTATFSRATELIMIT 10
#define NFS_REQUESTDELAY 10
#define NFSRV_DEADSOCKDELAY 5
#define NFSRV_MAXWGATHERDELAY 100
#ifndef NFSRV_WGATHERDELAY
#define NFSRV_WGATHERDELAY 1
#endif
#define NFS_DIRBLKSIZ 4096
#if defined(KERNEL) && !defined(DIRBLKSIZ)
#define DIRBLKSIZ 512
#endif
#define NFS_TPRINTF_INITIAL_DELAY 12
#define NFS_TPRINTF_DELAY 30
#define NFS_CMPFH(n, f, s) \
((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
#define NFSRV_NDMAXDATA(n) \
(((n)->nd_vers == NFS_VER3) ? (((n)->nd_nam2) ? \
NFS_MAXDGRAMDATA : NFSRV_MAXDATA) : NFS_V2MAXDATA)
#ifndef IO_METASYNC
#define IO_METASYNC 0
#endif
#define NFS_NODEALLOC 1024
#define NFS_MNTALLOC 1024
#define NFS_SVCALLOC 512
#define NFS_ARGSVERSION 6
struct nfs_args {
int version;
#ifdef KERNEL
user32_addr_t addr;
#else
struct sockaddr *addr;
#endif
int addrlen;
int sotype;
int proto;
#ifdef KERNEL
user32_addr_t fh;
#else
u_char *fh;
#endif
int fhsize;
int flags;
int wsize;
int rsize;
int readdirsize;
int timeo;
int retrans;
int maxgrouplist;
int readahead;
int leaseterm;
int deadthresh;
#ifdef KERNEL
user32_addr_t hostname;
#else
char *hostname;
#endif
int acregmin;
int acregmax;
int acdirmin;
int acdirmax;
uint32_t auth;
uint32_t deadtimeout;
};
struct nfs_args5 {
int version;
#ifdef KERNEL
user32_addr_t addr;
#else
struct sockaddr *addr;
#endif
int addrlen;
int sotype;
int proto;
#ifdef KERNEL
user32_addr_t fh;
#else
u_char *fh;
#endif
int fhsize;
int flags;
int wsize;
int rsize;
int readdirsize;
int timeo;
int retrans;
int maxgrouplist;
int readahead;
int leaseterm;
int deadthresh;
#ifdef KERNEL
user32_addr_t hostname;
#else
char *hostname;
#endif
int acregmin;
int acregmax;
int acdirmin;
int acdirmax;
uint32_t auth;
};
struct nfs_args4 {
int version;
#ifdef KERNEL
user32_addr_t addr;
#else
struct sockaddr *addr;
#endif
int addrlen;
int sotype;
int proto;
#ifdef KERNEL
user32_addr_t fh;
#else
u_char *fh;
#endif
int fhsize;
int flags;
int wsize;
int rsize;
int readdirsize;
int timeo;
int retrans;
int maxgrouplist;
int readahead;
int leaseterm;
int deadthresh;
#ifdef KERNEL
user32_addr_t hostname;
#else
char *hostname;
#endif
int acregmin;
int acregmax;
int acdirmin;
int acdirmax;
};
struct nfs_args3 {
int version;
#ifdef KERNEL
user32_addr_t addr;
#else
struct sockaddr *addr;
#endif
int addrlen;
int sotype;
int proto;
#ifdef KERNEL
user32_addr_t fh;
#else
u_char *fh;
#endif
int fhsize;
int flags;
int wsize;
int rsize;
int readdirsize;
int timeo;
int retrans;
int maxgrouplist;
int readahead;
int leaseterm;
int deadthresh;
#ifdef KERNEL
user32_addr_t hostname;
#else
char *hostname;
#endif
};
#ifdef KERNEL
struct user_nfs_args {
int version;
user_addr_t addr __attribute((aligned(8)));
int addrlen;
int sotype;
int proto;
user_addr_t fh __attribute((aligned(8)));
int fhsize;
int flags;
int wsize;
int rsize;
int readdirsize;
int timeo;
int retrans;
int maxgrouplist;
int readahead;
int leaseterm;
int deadthresh;
user_addr_t hostname __attribute((aligned(8)));
int acregmin;
int acregmax;
int acdirmin;
int acdirmax;
uint32_t auth;
uint32_t deadtimeout;
};
struct user_nfs_args5 {
int version;
user_addr_t addr __attribute((aligned(8)));
int addrlen;
int sotype;
int proto;
user_addr_t fh __attribute((aligned(8)));
int fhsize;
int flags;
int wsize;
int rsize;
int readdirsize;
int timeo;
int retrans;
int maxgrouplist;
int readahead;
int leaseterm;
int deadthresh;
user_addr_t hostname __attribute((aligned(8)));
int acregmin;
int acregmax;
int acdirmin;
int acdirmax;
uint32_t auth;
};
struct user_nfs_args4 {
int version;
user_addr_t addr __attribute((aligned(8)));
int addrlen;
int sotype;
int proto;
user_addr_t fh __attribute((aligned(8)));
int fhsize;
int flags;
int wsize;
int rsize;
int readdirsize;
int timeo;
int retrans;
int maxgrouplist;
int readahead;
int leaseterm;
int deadthresh;
user_addr_t hostname __attribute((aligned(8)));
int acregmin;
int acregmax;
int acdirmin;
int acdirmax;
};
struct user_nfs_args3 {
int version;
user_addr_t addr __attribute((aligned(8)));
int addrlen;
int sotype;
int proto;
user_addr_t fh __attribute((aligned(8)));
int fhsize;
int flags;
int wsize;
int rsize;
int readdirsize;
int timeo;
int retrans;
int maxgrouplist;
int readahead;
int leaseterm;
int deadthresh;
user_addr_t hostname __attribute((aligned(8)));
};
#endif // KERNEL
#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_NONEGNAMECACHE 0x00000100
#define NFSMNT_NFSV3 0x00000200
#define NFSMNT_NFSV4 0x00000400
#define NFSMNT_DUMBTIMR 0x00000800
#define NFSMNT_DEADTIMEOUT 0x00001000
#define NFSMNT_READAHEAD 0x00002000
#define NFSMNT_CALLUMNT 0x00004000
#define NFSMNT_RESVPORT 0x00008000
#define NFSMNT_RDIRPLUS 0x00010000
#define NFSMNT_READDIRSIZE 0x00020000
#define NFSMNT_NOLOCKS 0x00040000
#define NFSMNT_LOCALLOCKS 0x00080000
#define NFSMNT_ACREGMIN 0x00100000
#define NFSMNT_ACREGMAX 0x00200000
#define NFSMNT_ACDIRMIN 0x00400000
#define NFSMNT_ACDIRMAX 0x00800000
#define NFSMNT_SECFLAVOR 0x01000000
#define NFSMNT_SECSYSOK 0x02000000
#define NFSMNT_MUTEJUKEBOX 0x04000000
struct nfsd_args {
int sock;
#ifdef KERNEL
user32_addr_t name;
#else
caddr_t name;
#endif
int namelen;
};
#ifdef KERNEL
struct user_nfsd_args {
int sock;
user_addr_t name __attribute((aligned(8)));
int namelen;
};
#endif // KERNEL
#define NFS_FH_VERSION 0x4e580000
struct nfs_exphandle {
uint32_t nxh_version;
uint32_t nxh_fsid;
uint32_t nxh_expid;
uint16_t nxh_flags;
uint8_t nxh_reserved;
uint8_t nxh_fidlen;
};
#define NXHF_INVALIDFH 0x0001
#define NFS_MAX_FID_SIZE (NFS_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
#define NFSV4_MAX_FID_SIZE (NFSV4_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
#define NFSV3_MAX_FID_SIZE (NFSV3_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
#define NFSV2_MAX_FID_SIZE (NFSV2_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
struct nfs_filehandle {
uint32_t nfh_len;
struct nfs_exphandle nfh_xh;
unsigned char nfh_fid[NFS_MAX_FID_SIZE];
unsigned char *nfh_fhp;
};
#define NX_MAX_SEC_FLAVORS 5
struct nfs_sec {
int count;
uint32_t flavors[NX_MAX_SEC_FLAVORS];
};
struct nfs_export_net_args {
uint32_t nxna_flags;
struct xucred nxna_cred;
struct sockaddr_storage nxna_addr;
struct sockaddr_storage nxna_mask;
struct nfs_sec nxna_sec;
};
struct nfs_export_args {
uint32_t nxa_fsid;
uint32_t nxa_expid;
#ifdef KERNEL
user32_addr_t nxa_fspath;
user32_addr_t nxa_exppath;
#else
char *nxa_fspath;
char *nxa_exppath;
#endif
uint32_t nxa_flags;
uint32_t nxa_netcount;
#ifdef KERNEL
user32_addr_t nxa_nets;
#else
struct nfs_export_net_args *nxa_nets;
#endif
};
#ifdef KERNEL
struct user_nfs_export_args {
uint32_t nxa_fsid;
uint32_t nxa_expid;
user_addr_t nxa_fspath;
user_addr_t nxa_exppath;
uint32_t nxa_flags;
uint32_t nxa_netcount;
user_addr_t nxa_nets;
};
#endif
#define NXA_DELETE 0x0001
#define NXA_ADD 0x0002
#define NXA_REPLACE 0x0003
#define NXA_DELETE_ALL 0x0004
#define NXA_OFFLINE 0x0008
#define NXA_CHECK 0x0010
#define NX_READONLY 0x0001
#define NX_DEFAULTEXPORT 0x0002
#define NX_MAPROOT 0x0004
#define NX_MAPALL 0x0008
#define NX_32BITCLIENTS 0x0020
#define NX_OFFLINE 0x0040
#define NFS_EXPORT_STAT_REC_VERSION 1
#define NFS_USER_STAT_REC_VERSION 1
struct nfs_export_stat_desc
{
uint32_t rec_vers;
uint32_t rec_count;
}__attribute__((__packed__));
struct nfs_export_stat_rec {
char path[RPCMNT_PATHLEN + 1];
uint64_t ops;
uint64_t bytes_read;
uint64_t bytes_written;
}__attribute__((__packed__));
struct nfs_user_stat_desc
{
uint32_t rec_vers;
uint32_t rec_count;
}__attribute__((__packed__));
struct nfs_user_stat_user_rec {
u_char rec_type;
uid_t uid;
struct sockaddr_storage sock;
uint64_t ops;
uint64_t bytes_read;
uint64_t bytes_written;
uint32_t tm_start;
uint32_t tm_last;
}__attribute__((__packed__));
struct nfs_user_stat_path_rec {
u_char rec_type;
char path[RPCMNT_PATHLEN + 1];
}__attribute__((__packed__));
#define NFS_USER_STAT_USER_REC 0
#define NFS_USER_STAT_PATH_REC 1
#ifdef KERNEL
struct nfs_exportfs;
struct nfs_export_options {
uint32_t nxo_flags;
kauth_cred_t nxo_cred;
struct nfs_sec nxo_sec;
};
struct nfs_netopt {
struct radix_node no_rnodes[2];
struct nfs_export_options no_opt;
};
typedef struct nfsstatcount64 {
uint32_t hi;
uint32_t lo;
} nfsstatcount64;
struct nfs_export_stat_counters {
struct nfsstatcount64 ops;
struct nfsstatcount64 bytes_read;
struct nfsstatcount64 bytes_written;
}__attribute__((__packed__));
#define NFSStatAdd64(PTR, VAL) \
do { \
uint32_t NFSSA_OldValue = \
OSAddAtomic((VAL), &(PTR)->lo); \
if ((NFSSA_OldValue + (VAL)) < NFSSA_OldValue) \
OSAddAtomic(1, &(PTR)->hi); \
} while (0)
#define NFSRV_USER_STAT_DEF_MAX_NODES 1024
#define NFSRV_USER_STAT_DEF_IDLE_SEC 7200
__private_extern__ uint32_t nfsrv_user_stat_enabled;
__private_extern__ uint32_t nfsrv_user_stat_node_count;
__private_extern__ uint32_t nfsrv_user_stat_max_idle_sec;
__private_extern__ uint32_t nfsrv_user_stat_max_nodes;
__private_extern__ lck_grp_t *nfsrv_active_user_mutex_group;
struct nfs_user_stat_node {
TAILQ_ENTRY(nfs_user_stat_node) lru_link;
LIST_ENTRY(nfs_user_stat_node) hash_link;
uid_t uid;
struct sockaddr_storage sock;
uint64_t ops;
uint64_t bytes_read;
uint64_t bytes_written;
uint32_t tm_start;
uint32_t tm_last;
};
#define NFS_USER_STAT_HASH_SIZE 16
#define NFS_USER_STAT_HASH(userhashtbl, uid) \
&((userhashtbl)[(uid) & (NFS_USER_STAT_HASH_SIZE - 1)])
TAILQ_HEAD(nfs_user_stat_lru_head, nfs_user_stat_node);
LIST_HEAD(nfs_user_stat_hashtbl_head, nfs_user_stat_node);
struct nfs_active_user_list {
struct nfs_user_stat_lru_head user_lru;
struct nfs_user_stat_hashtbl_head user_hashtbl[NFS_USER_STAT_HASH_SIZE];
uint32_t node_count;
lck_mtx_t user_mutex;
};
struct nfs_export {
LIST_ENTRY(nfs_export) nx_next;
LIST_ENTRY(nfs_export) nx_hash;
struct nfs_export *nx_parent;
uint32_t nx_id;
uint32_t nx_flags;
struct nfs_exportfs *nx_fs;
char *nx_path;
struct nfs_filehandle nx_fh;
struct nfs_export_options nx_defopt;
uint32_t nx_expcnt;
struct radix_node_head *nx_rtable[AF_MAX+1];
struct nfs_export_stat_counters nx_stats;
struct nfs_active_user_list nx_user_list;
struct timeval nx_exptime;
};
struct nfs_exportfs {
LIST_ENTRY(nfs_exportfs) nxfs_next;
uint32_t nxfs_id;
char *nxfs_path;
LIST_HEAD(,nfs_export) nxfs_exports;
};
__private_extern__ LIST_HEAD(nfsrv_expfs_list, nfs_exportfs) nfsrv_exports;
__private_extern__ lck_rw_t nfsrv_export_rwlock; #define NFSRVEXPHASHSZ 64
#define NFSRVEXPHASHVAL(FSID, EXPID) \
(((FSID) >> 24) ^ ((FSID) >> 16) ^ ((FSID) >> 8) ^ (EXPID))
#define NFSRVEXPHASH(FSID, EXPID) \
(&nfsrv_export_hashtbl[NFSRVEXPHASHVAL((FSID),(EXPID)) & nfsrv_export_hash])
__private_extern__ LIST_HEAD(nfsrv_export_hashhead, nfs_export) *nfsrv_export_hashtbl;
__private_extern__ u_long nfsrv_export_hash;
#if CONFIG_FSE
struct nfsrv_fmod {
LIST_ENTRY(nfsrv_fmod) fm_link;
vnode_t fm_vp;
struct vfs_context fm_context;
uint64_t fm_deadline;
};
#define NFSRVFMODHASHSZ 128
#define NFSRVFMODHASH(vp) (((uintptr_t) vp) & nfsrv_fmod_hash)
__private_extern__ LIST_HEAD(nfsrv_fmod_hashhead, nfsrv_fmod) *nfsrv_fmod_hashtbl;
__private_extern__ u_long nfsrv_fmod_hash;
__private_extern__ lck_mtx_t *nfsrv_fmod_mutex;
__private_extern__ int nfsrv_fmod_pending, nfsrv_fsevents_enabled;
#endif
__private_extern__ int nfsrv_async, nfsrv_export_hash_size,
nfsrv_reqcache_size, nfsrv_sock_max_rec_queue_length;
__private_extern__ uint32_t nfsrv_gss_context_ttl;
__private_extern__ struct nfsstats nfsstats;
#endif // KERNEL
#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 srvvop_writes;
int pageins;
int pageouts;
};
#endif
#define NFSSVC_NFSD 0x004
#define NFSSVC_ADDSOCK 0x008
#define NFSSVC_EXPORT 0x200
#define NFSCLNT_LOCKDANS 0x200
#define NFS_NFSSTATS 1
#define NFS_EXPORTSTATS 3
#define NFS_USERSTATS 4
#define NFS_USERCOUNT 5
#ifndef NFS_WDELAYHASHSIZ
#define NFS_WDELAYHASHSIZ 16
#endif
#ifdef KERNEL
#include <sys/kernel_types.h>
#include <kern/thread_call.h>
#include <sys/kdebug.h>
#define NFS_KERNEL_DEBUG KERNEL_DEBUG
#define FSDBG(A, B, C, D, E) \
NFS_KERNEL_DEBUG((FSDBG_CODE(DBG_FSRW, (A))) | DBG_FUNC_NONE, \
(int)(B), (int)(C), (int)(D), (int)(E), 0)
#define FSDBG_TOP(A, B, C, D, E) \
NFS_KERNEL_DEBUG((FSDBG_CODE(DBG_FSRW, (A))) | DBG_FUNC_START, \
(int)(B), (int)(C), (int)(D), (int)(E), 0)
#define FSDBG_BOT(A, B, C, D, E) \
NFS_KERNEL_DEBUG((FSDBG_CODE(DBG_FSRW, (A))) | DBG_FUNC_END, \
(int)(B), (int)(C), (int)(D), (int)(E), 0)
#ifdef MALLOC_DECLARE
MALLOC_DECLARE(M_NFSREQ);
MALLOC_DECLARE(M_NFSMNT);
MALLOC_DECLARE(M_NFSDIROFF);
MALLOC_DECLARE(M_NFSRVDESC);
MALLOC_DECLARE(M_NFSD);
MALLOC_DECLARE(M_NFSBIGFH);
#endif
struct vnode_attr; struct nameidata; struct dqblk; struct sockaddr_in;
struct nfsbuf;
struct nfs_vattr;
struct nfs_fsattr;
struct nfsnode;
typedef struct nfsnode * nfsnode_t;
struct nfs_open_owner;
struct nfs_open_file;
struct nfs_lock_owner;
struct nfs_file_lock;
struct nfsreq;
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
sigmask(SIGHUP)|sigmask(SIGQUIT))
__private_extern__ size_t nfs_mbuf_mhlen, nfs_mbuf_minclsize;
struct nfsm_chain {
mbuf_t nmc_mhead;
mbuf_t nmc_mcur;
caddr_t nmc_ptr;
uint32_t nmc_left;
uint32_t nmc_flags;
};
#define NFSM_CHAIN_FLAG_ADD_CLUSTERS 0x1
struct gss_seq {
SLIST_ENTRY(gss_seq) gss_seqnext;
uint32_t gss_seqnum;
};
struct nfsreq_cbinfo {
void (*rcb_func)(struct nfsreq *);
struct nfsbuf *rcb_bp;
uint32_t rcb_args[3];
};
struct nfsreq {
lck_mtx_t r_mtx;
TAILQ_ENTRY(nfsreq) r_chain;
TAILQ_ENTRY(nfsreq) r_achain;
TAILQ_ENTRY(nfsreq) r_rchain;
TAILQ_ENTRY(nfsreq) r_cchain;
mbuf_t r_mrest;
mbuf_t r_mhead;
struct nfsm_chain r_nmrep;
nfsnode_t r_np;
struct nfsmount *r_nmp;
uint64_t r_xid;
uint32_t r_procnum;
uint32_t r_mreqlen;
int r_flags;
int r_lflags;
int r_refs;
uint8_t r_delay;
uint8_t r_retry;
uint8_t r_rexmit;
int r_rtt;
thread_t r_thread;
kauth_cred_t r_cred;
time_t r_start;
time_t r_lastmsg;
time_t r_resendtime;
struct nfs_gss_clnt_ctx *r_gss_ctx;
SLIST_HEAD(, gss_seq) r_gss_seqlist;
uint32_t r_gss_argoff;
uint32_t r_gss_arglen;
int r_error;
struct nfsreq_cbinfo r_callback;
};
TAILQ_HEAD(nfs_reqqhead, nfsreq);
__private_extern__ struct nfs_reqqhead nfs_reqq;
__private_extern__ lck_grp_t *nfs_request_grp;
#define R_XID32(x) ((x) & 0xffffffff)
#define NFSREQNOLIST ((struct nfsreq *)0xdeadbeef)
#define R_TIMING 0x00000001
#define R_CWND 0x00000002
#define R_SOFTTERM 0x00000004
#define R_RESTART 0x00000008
#define R_INITTED 0x00000010
#define R_TPRINTFMSG 0x00000020
#define R_MUSTRESEND 0x00000040
#define R_ALLOCATED 0x00000080
#define R_SENT 0x00000100
#define R_WAITSENT 0x00000200
#define R_RESENDERR 0x00000400
#define R_JBTPRINTFMSG 0x00000800
#define R_ASYNC 0x00001000
#define R_ASYNCWAIT 0x00002000
#define R_RESENDQ 0x00004000
#define R_SENDING 0x00008000
#define R_RECOVER 0x40000000
#define R_SETUP 0x80000000
#define R_OPTMASK 0xc0000000
#define RL_BUSY 0x0001
#define RL_WAITING 0x0002
#define RL_QUEUED 0x0004
__private_extern__ u_int32_t nfs_xid, nfs_xidwrap;
__private_extern__ int nfs_iosize, nfs_access_cache_timeout, nfs_access_delete, nfs_allow_async, nfs_statfs_rate_limit;
__private_extern__ int nfs_lockd_mounts, nfs_lockd_request_sent, nfs_single_des;
__private_extern__ int nfs_tprintf_initial_delay, nfs_tprintf_delay;
__private_extern__ int nfsiod_thread_count, nfsiod_thread_max, nfs_max_async_writes;
#define NFSIOD_MAX (MIN(nfsiod_thread_max, NFS_MAXASYNCTHREAD))
struct nfs_dulookup {
int du_flags;
#define NFS_DULOOKUP_DOIT 0x1
#define NFS_DULOOKUP_INPROG 0x2
struct componentname du_cn;
struct nfsreq du_req;
char du_smallname[48];
};
union nethostaddr {
u_int32_t had_inetaddr;
mbuf_t had_nam;
};
struct nfsrv_sock {
TAILQ_ENTRY(nfsrv_sock) ns_chain;
TAILQ_ENTRY(nfsrv_sock) ns_svcq;
TAILQ_ENTRY(nfsrv_sock) ns_wgq;
lck_rw_t ns_rwlock;
socket_t ns_so;
mbuf_t ns_nam;
mbuf_t ns_raw;
mbuf_t ns_rawend;
mbuf_t ns_rec;
mbuf_t ns_recend;
mbuf_t ns_frag;
int ns_flag;
int ns_sotype;
int ns_cc;
int ns_reclen;
int ns_reccnt;
u_int32_t ns_sref;
time_t ns_timestamp;
lck_mtx_t ns_wgmutex;
u_quad_t ns_wgtime;
LIST_HEAD(, nfsrv_descript) ns_tq;
LIST_HEAD(nfsrv_wg_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ];
};
#define SLP_VALID 0x0001
#define SLP_DOREC 0x0002
#define SLP_NEEDQ 0x0004
#define SLP_DISCONN 0x0008
#define SLP_GETSTREAM 0x0010
#define SLP_LASTFRAG 0x0020
#define SLP_DOWRITES 0x0040
#define SLP_WORKTODO 0x004e
#define SLP_ALLFLAGS 0x007f
#define SLP_WAITQ 0x4000
#define SLP_WORKQ 0x8000
#define SLP_QUEUED 0xc000
#define SLPNOLIST ((struct nfsrv_sock *)0xdeadbeef)
__private_extern__ struct nfsrv_sock *nfsrv_udpsock;
__private_extern__ TAILQ_HEAD(nfsrv_sockhead, nfsrv_sock) nfsrv_socklist, nfsrv_deadsocklist,
nfsrv_sockwg, nfsrv_sockwait, nfsrv_sockwork;
__private_extern__ lck_grp_t *nfsrv_slp_rwlock_group;
__private_extern__ lck_grp_t *nfsrv_slp_mutex_group;
struct nfsd {
TAILQ_ENTRY(nfsd) nfsd_chain;
TAILQ_ENTRY(nfsd) nfsd_queue;
int nfsd_flag;
struct nfsrv_sock *nfsd_slp;
struct nfsrv_descript *nfsd_nd;
};
#define NFSD_WAITING 0x01
#define NFSD_REQINPROG 0x02
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 nfsm_chain nd_nmreq;
mbuf_t nd_mrep;
mbuf_t nd_nam;
mbuf_t nd_nam2;
u_int32_t nd_procnum;
int nd_stable;
int nd_vers;
int nd_len;
int nd_repstat;
u_int32_t nd_retxid;
struct timeval nd_starttime;
struct nfs_filehandle nd_fh;
uint32_t nd_sec;
struct nfs_gss_svc_ctx *nd_gss_context;
uint32_t nd_gss_seqnum;
mbuf_t nd_gss_mb;
kauth_cred_t nd_cr;
};
__private_extern__ TAILQ_HEAD(nfsd_head, nfsd) nfsd_head, nfsd_queue;
__private_extern__ lck_mtx_t *nfsd_mutex;
__private_extern__ int nfsd_thread_count, nfsd_thread_max;
__private_extern__ lck_mtx_t *nfs_request_mutex;
__private_extern__ int nfs_request_timer_on;
__private_extern__ lck_mtx_t *nfs_global_mutex;
__private_extern__ int nfs4_callback_timer_on;
__private_extern__ in_port_t nfs4_cb_port;
__private_extern__ thread_call_t nfs_request_timer_call;
__private_extern__ thread_call_t nfs_buf_timer_call;
__private_extern__ thread_call_t nfs4_callback_timer_call;
__private_extern__ thread_call_t nfsrv_deadsock_timer_call;
#if CONFIG_FSE
__private_extern__ thread_call_t nfsrv_fmod_timer_call;
#endif
__BEGIN_DECLS
nfstype vtonfs_type(enum vtype, int);
enum vtype nfstov_type(nfstype, int);
int vtonfsv2_mode(enum vtype, mode_t);
void nfs_mbuf_init(void);
void nfs_nhinit(void);
void nfs_nhinit_finish(void);
u_long nfs_hash(u_char *, int);
int nfs4_init_clientid(struct nfsmount *);
int nfs4_setclientid(struct nfsmount *);
int nfs4_renew(struct nfsmount *, int);
void nfs4_renew_timer(void *, void *);
void nfs4_mount_callback_setup(struct nfsmount *);
void nfs4_mount_callback_shutdown(struct nfsmount *);
void nfs4_cb_accept(socket_t, void *, int);
void nfs4_cb_rcv(socket_t, void *, int);
void nfs4_callback_timer(void *, void *);
int nfs_connect(struct nfsmount *, int);
void nfs_disconnect(struct nfsmount *);
void nfs_need_reconnect(struct nfsmount *);
void nfs_mount_sock_thread_wake(struct nfsmount *);
void nfs_mount_check_dead_timeout(struct nfsmount *);
int nfs_getattr(nfsnode_t, struct nfs_vattr *, vfs_context_t, int);
int nfs_getattrcache(nfsnode_t, struct nfs_vattr *);
int nfs_loadattrcache(nfsnode_t, struct nfs_vattr *, u_int64_t *, int);
int nfs_attrcachetimeout(nfsnode_t);
int nfs_buf_page_inval(vnode_t vp, off_t offset);
int nfs_vinvalbuf(vnode_t, int, vfs_context_t, int);
int nfs_vinvalbuf2(vnode_t, int, thread_t, kauth_cred_t, int);
int nfs_vinvalbuf_internal(nfsnode_t, int, thread_t, kauth_cred_t, int, int);
int nfs_request_create(nfsnode_t, mount_t, struct nfsm_chain *, int, thread_t, kauth_cred_t, struct nfsreq **);
void nfs_request_destroy(struct nfsreq *);
void nfs_request_ref(struct nfsreq *, int);
void nfs_request_rele(struct nfsreq *);
int nfs_request_add_header(struct nfsreq *);
int nfs_request_send(struct nfsreq *, int);
void nfs_request_wait(struct nfsreq *);
int nfs_request_finish(struct nfsreq *, struct nfsm_chain *, int *);
int nfs_request(nfsnode_t, mount_t, struct nfsm_chain *, int, vfs_context_t, struct nfsm_chain *, u_int64_t *, int *);
int nfs_request2(nfsnode_t, mount_t, struct nfsm_chain *, int, thread_t, kauth_cred_t, int, struct nfsm_chain *, u_int64_t *, int *);
int nfs_request_gss(mount_t, struct nfsm_chain *, thread_t, kauth_cred_t, int, struct nfs_gss_clnt_ctx *, struct nfsm_chain *, int *);
int nfs_request_async(nfsnode_t, mount_t, struct nfsm_chain *, int, thread_t, kauth_cred_t, struct nfsreq_cbinfo *cb, struct nfsreq **);
int nfs_request_async_finish(struct nfsreq *, struct nfsm_chain *, u_int64_t *, int *);
void nfs_request_async_cancel(struct nfsreq *);
void nfs_request_timer(void *, void *);
int nfs_aux_request(struct nfsmount *, thread_t, struct sockaddr_in *, mbuf_t, uint32_t, int, int, struct nfsm_chain *);
void nfs_get_xid(uint64_t *);
int nfs_sigintr(struct nfsmount *, struct nfsreq *, thread_t, int);
int nfs_noremotehang(thread_t);
int nfs_send(struct nfsreq *, int);
int nfs_sndlock(struct nfsreq *);
void nfs_sndunlock(struct nfsreq *);
int nfs_lookitup(nfsnode_t, char *, int, vfs_context_t, nfsnode_t *);
void nfs_dulookup_init(struct nfs_dulookup *, nfsnode_t, const char *, int, vfs_context_t);
void nfs_dulookup_start(struct nfs_dulookup *, nfsnode_t, vfs_context_t);
void nfs_dulookup_finish(struct nfs_dulookup *, nfsnode_t, vfs_context_t);
int nfs_dir_buf_cache_lookup(nfsnode_t, nfsnode_t *, struct componentname *, vfs_context_t, int);
int nfs_dir_buf_search(struct nfsbuf *, struct componentname *, fhandle_t *, struct nfs_vattr *, uint64_t *, time_t *, daddr64_t *, int);
void nfs_name_cache_purge(nfsnode_t, nfsnode_t, struct componentname *, vfs_context_t);
int nfs_parsefattr(struct nfsm_chain *, int, struct nfs_vattr *);
int nfs4_parsefattr(struct nfsm_chain *, struct nfs_fsattr *, struct nfs_vattr *, fhandle_t *, struct dqblk *);
void nfs_vattr_set_supported(uint32_t *, struct vnode_attr *);
void nfs3_pathconf_cache(struct nfsmount *, struct nfs_fsattr *);
void nfs3_umount_rpc(struct nfsmount *, vfs_context_t, int);
int nfs_node_mode_slot(nfsnode_t, uid_t, int);
void nfs_avoid_needless_id_setting_on_create(nfsnode_t, struct vnode_attr *, vfs_context_t);
int nfs4_create_rpc(vfs_context_t, nfsnode_t, struct componentname *, struct vnode_attr *, int, char *, nfsnode_t *);
int nfs_open_state_set_busy(nfsnode_t, vfs_context_t);
void nfs_open_state_clear_busy(nfsnode_t);
struct nfs_open_owner *nfs_open_owner_find(struct nfsmount *, kauth_cred_t, int);
void nfs_open_owner_destroy(struct nfs_open_owner *);
void nfs_open_owner_ref(struct nfs_open_owner *);
void nfs_open_owner_rele(struct nfs_open_owner *);
int nfs_open_owner_set_busy(struct nfs_open_owner *, thread_t);
void nfs_open_owner_clear_busy(struct nfs_open_owner *);
void nfs_owner_seqid_increment(struct nfs_open_owner *, struct nfs_lock_owner *, int);
int nfs_open_file_find(nfsnode_t, struct nfs_open_owner *, struct nfs_open_file **, uint32_t, uint32_t, int);
void nfs_open_file_destroy(struct nfs_open_file *);
int nfs_open_file_set_busy(struct nfs_open_file *, thread_t);
void nfs_open_file_clear_busy(struct nfs_open_file *);
void nfs_get_stateid(nfsnode_t, thread_t, kauth_cred_t, nfs_stateid *);
int nfs4_open(nfsnode_t, struct nfs_open_file *, uint32_t, uint32_t, vfs_context_t);
int nfs4_close(nfsnode_t, struct nfs_open_file *, uint32_t, uint32_t, vfs_context_t);
int nfs4_check_for_locks(struct nfs_open_owner *, struct nfs_open_file *);
void nfs4_reopen(struct nfs_open_file *, thread_t);
int nfs4_open_rpc(struct nfs_open_file *, vfs_context_t, struct componentname *, struct vnode_attr *, vnode_t, vnode_t *, int, int, int);
int nfs4_open_rpc_internal(struct nfs_open_file *, vfs_context_t, thread_t, kauth_cred_t, struct componentname *, struct vnode_attr *, vnode_t, vnode_t *, int, int, int);
int nfs4_open_reopen_rpc(struct nfs_open_file *, thread_t, kauth_cred_t, struct componentname *, vnode_t, vnode_t *, int, int);
int nfs4_open_reclaim_rpc(struct nfs_open_file *, int, int);
int nfs4_open_downgrade_rpc(nfsnode_t, struct nfs_open_file *, vfs_context_t);
int nfs4_close_rpc(nfsnode_t, struct nfs_open_file *, thread_t, kauth_cred_t, int);
int nfs4_delegreturn_rpc(struct nfsmount *, u_char *, int, struct nfs_stateid *, thread_t, kauth_cred_t);
struct nfs_lock_owner *nfs_lock_owner_find(nfsnode_t, proc_t, int);
void nfs_lock_owner_destroy(struct nfs_lock_owner *);
void nfs_lock_owner_ref(struct nfs_lock_owner *);
void nfs_lock_owner_rele(struct nfs_lock_owner *);
int nfs_lock_owner_set_busy(struct nfs_lock_owner *, thread_t);
void nfs_lock_owner_clear_busy(struct nfs_lock_owner *);
void nfs_lock_owner_insert_held_lock(struct nfs_lock_owner *, struct nfs_file_lock *);
struct nfs_file_lock *nfs_file_lock_alloc(struct nfs_lock_owner *);
void nfs_file_lock_destroy(struct nfs_file_lock *);
int nfs_file_lock_conflict(struct nfs_file_lock *, struct nfs_file_lock *, int *);
int nfs4_lock_rpc(nfsnode_t, struct nfs_open_file *, struct nfs_file_lock *, int, thread_t, kauth_cred_t);
int nfs4_unlock_rpc(nfsnode_t, struct nfs_lock_owner *, int, uint64_t, uint64_t, vfs_context_t);
int nfs4_getlock(nfsnode_t, struct nfs_lock_owner *, struct flock *, uint64_t, uint64_t, vfs_context_t);
int nfs4_setlock(nfsnode_t, struct nfs_open_file *, struct nfs_lock_owner *, int, uint64_t, uint64_t, int, short, vfs_context_t);
int nfs4_unlock(nfsnode_t, struct nfs_open_file *, struct nfs_lock_owner *, uint64_t, uint64_t, int, vfs_context_t);
int nfs_mount_state_in_use_start(struct nfsmount *);
int nfs_mount_state_in_use_end(struct nfsmount *, int);
int nfs_mount_state_error_should_restart(int);
uint nfs_mount_state_max_restarts(struct nfsmount *);
int nfs_mount_state_wait_for_recovery(struct nfsmount *);
void nfs4_recover(struct nfsmount *);
int nfs_vnop_access(struct vnop_access_args *);
int nfs3_vnop_open(struct vnop_open_args *);
int nfs3_vnop_close(struct vnop_close_args *);
int nfs4_vnop_create(struct vnop_create_args *);
int nfs4_vnop_mknod(struct vnop_mknod_args *);
int nfs4_vnop_open(struct vnop_open_args *);
int nfs4_vnop_close(struct vnop_close_args *);
int nfs4_vnop_mmap(struct vnop_mmap_args *);
int nfs4_vnop_mnomap(struct vnop_mnomap_args *);
int nfs4_vnop_getattr(struct vnop_getattr_args *);
int nfs4_vnop_read(struct vnop_read_args *);
int nfs4_vnop_link(struct vnop_link_args *);
int nfs4_vnop_mkdir(struct vnop_mkdir_args *);
int nfs4_vnop_rmdir(struct vnop_rmdir_args *);
int nfs4_vnop_symlink(struct vnop_symlink_args *);
int nfs4_vnop_advlock(struct vnop_advlock_args *ap);
int nfs_read_rpc(nfsnode_t, uio_t, vfs_context_t);
int nfs_write_rpc(nfsnode_t, uio_t, vfs_context_t, int *, uint64_t *);
int nfs_write_rpc2(nfsnode_t, uio_t, thread_t, kauth_cred_t, int *, uint64_t *);
int nfs3_access_rpc(nfsnode_t, u_int32_t *, vfs_context_t);
int nfs4_access_rpc(nfsnode_t, u_int32_t *, vfs_context_t);
int nfs3_getattr_rpc(nfsnode_t, mount_t, u_char *, size_t, vfs_context_t, struct nfs_vattr *, u_int64_t *);
int nfs4_getattr_rpc(nfsnode_t, mount_t, u_char *, size_t, vfs_context_t, struct nfs_vattr *, u_int64_t *);
int nfs3_setattr_rpc(nfsnode_t, struct vnode_attr *, vfs_context_t);
int nfs4_setattr_rpc(nfsnode_t, struct vnode_attr *, vfs_context_t);
int nfs3_read_rpc_async(nfsnode_t, off_t, size_t, thread_t, kauth_cred_t, struct nfsreq_cbinfo *, struct nfsreq **);
int nfs4_read_rpc_async(nfsnode_t, off_t, size_t, thread_t, kauth_cred_t, struct nfsreq_cbinfo *, struct nfsreq **);
int nfs3_read_rpc_async_finish(nfsnode_t, struct nfsreq *, uio_t, size_t *, int *);
int nfs4_read_rpc_async_finish(nfsnode_t, struct nfsreq *, uio_t, size_t *, int *);
int nfs3_write_rpc_async(nfsnode_t, uio_t, size_t, thread_t, kauth_cred_t, int, struct nfsreq_cbinfo *, struct nfsreq **);
int nfs4_write_rpc_async(nfsnode_t, uio_t, size_t, thread_t, kauth_cred_t, int, struct nfsreq_cbinfo *, struct nfsreq **);
int nfs3_write_rpc_async_finish(nfsnode_t, struct nfsreq *, int *, size_t *, uint64_t *);
int nfs4_write_rpc_async_finish(nfsnode_t, struct nfsreq *, int *, size_t *, uint64_t *);
int nfs3_readdir_rpc(nfsnode_t, struct nfsbuf *, vfs_context_t);
int nfs4_readdir_rpc(nfsnode_t, struct nfsbuf *, vfs_context_t);
int nfs3_readlink_rpc(nfsnode_t, char *, uint32_t *, vfs_context_t);
int nfs4_readlink_rpc(nfsnode_t, char *, uint32_t *, vfs_context_t);
int nfs3_commit_rpc(nfsnode_t, u_int64_t, u_int64_t, kauth_cred_t);
int nfs4_commit_rpc(nfsnode_t, u_int64_t, u_int64_t, kauth_cred_t);
int nfs3_lookup_rpc_async(nfsnode_t, char *, int, vfs_context_t, struct nfsreq **);
int nfs4_lookup_rpc_async(nfsnode_t, char *, int, vfs_context_t, struct nfsreq **);
int nfs3_lookup_rpc_async_finish(nfsnode_t, vfs_context_t, struct nfsreq *, u_int64_t *, fhandle_t *, struct nfs_vattr *);
int nfs4_lookup_rpc_async_finish(nfsnode_t, vfs_context_t, struct nfsreq *, u_int64_t *, fhandle_t *, struct nfs_vattr *);
int nfs3_remove_rpc(nfsnode_t, char *, int, thread_t, kauth_cred_t);
int nfs4_remove_rpc(nfsnode_t, char *, int, thread_t, kauth_cred_t);
int nfs3_rename_rpc(nfsnode_t, char *, int, nfsnode_t, char *, int, vfs_context_t);
int nfs4_rename_rpc(nfsnode_t, char *, int, nfsnode_t, char *, int, vfs_context_t);
int nfs3_pathconf_rpc(nfsnode_t, struct nfs_fsattr *, vfs_context_t);
int nfs4_pathconf_rpc(nfsnode_t, struct nfs_fsattr *, vfs_context_t);
void nfsrv_active_user_list_reclaim(void);
void nfsrv_cleancache(void);
void nfsrv_cleanup(void);
int nfsrv_credcheck(struct nfsrv_descript *, vfs_context_t, struct nfs_export *,
struct nfs_export_options *);
void nfsrv_deadsock_timer(void *, void *);
int nfsrv_dorec(struct nfsrv_sock *, struct nfsd *, struct nfsrv_descript **);
int nfsrv_errmap(struct nfsrv_descript *, int);
int nfsrv_export(struct user_nfs_export_args *, vfs_context_t);
int nfsrv_fhmatch(struct nfs_filehandle *, struct nfs_filehandle *);
int nfsrv_fhtovp(struct nfs_filehandle *, struct nfsrv_descript *, vnode_t *,
struct nfs_export **, struct nfs_export_options **);
#if CONFIG_FSE
void nfsrv_fmod_timer(void *, void *);
#endif
int nfsrv_getcache(struct nfsrv_descript *, struct nfsrv_sock *, mbuf_t *);
void nfsrv_group_sort(gid_t *, int);
void nfsrv_init(void);
void nfsrv_initcache(void);
int nfsrv_is_initialized(void);
int nfsrv_namei(struct nfsrv_descript *, vfs_context_t, struct nameidata *,
struct nfs_filehandle *, vnode_t *,
struct nfs_export **, struct nfs_export_options **);
void nfsrv_rcv(socket_t, caddr_t, int);
void nfsrv_rcv_locked(socket_t, struct nfsrv_sock *, int);
int nfsrv_rephead(struct nfsrv_descript *, struct nfsrv_sock *, struct nfsm_chain *, size_t);
int nfsrv_send(struct nfsrv_sock *, mbuf_t, mbuf_t);
void nfsrv_updatecache(struct nfsrv_descript *, int, mbuf_t);
void nfsrv_update_user_stat(struct nfs_export *, struct nfsrv_descript *, uid_t, u_int, u_int, u_int);
int nfsrv_vptofh(struct nfs_export *, int, struct nfs_filehandle *,
vnode_t, vfs_context_t, struct nfs_filehandle *);
void nfsrv_wakenfsd(struct nfsrv_sock *);
void nfsrv_wg_timer(void *, void *);
int nfsrv_writegather(struct nfsrv_descript **, struct nfsrv_sock *,
vfs_context_t, mbuf_t *);
int nfsrv_access(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_commit(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_create(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_fsinfo(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_getattr(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_link(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_lookup(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_mkdir(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_mknod(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_noop(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_null(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_pathconf(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_read(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_readdir(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_readdirplus(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_readlink(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_remove(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_rename(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_rmdir(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_setattr(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_statfs(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_symlink(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
int nfsrv_write(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
void nfs_interval_timer_start(thread_call_t, int);
void nfs_up(struct nfsmount *, thread_t, int, const char *);
void nfs_down(struct nfsmount *, thread_t, int, int, const char *);
int nfs_msg(thread_t, const char *, const char *, int);
int nfs_mountroot(void);
struct nfs_diskless;
int nfs_boot_init(struct nfs_diskless *);
int nfs_boot_getfh(struct nfs_diskless *, int, int);
__END_DECLS
#endif
#endif
#endif