/*
- * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2018 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#define NFS_MAXATTRTIMO 60
#define NFS_MINDIRATTRTIMO 5 /* directory attribute cache timeout in sec */
#define NFS_MAXDIRATTRTIMO 60
+#define NFS_MAXPORT 0xffff
#define NFS_IOSIZE (1024 * 1024) /* suggested I/O size */
#define NFS_RWSIZE 32768 /* Def. read/write data size <= 32K */
#define NFS_WSIZE NFS_RWSIZE /* Def. write data size <= 32K */
#endif
/* default values for unresponsive mount timeouts */
-#define NFS_TPRINTF_INITIAL_DELAY 12
+#define NFS_TPRINTF_INITIAL_DELAY 5
#define NFS_TPRINTF_DELAY 30
/*
#define NFSRV_NDMAXDATA(n) \
(((n)->nd_vers == NFS_VER3) ? (((n)->nd_nam2) ? \
NFS_MAXDGRAMDATA : NFSRV_MAXDATA) : NFS_V2MAXDATA)
+#define NFS_PORT_INVALID(port) \
+ (((port) > NFS_MAXPORT) || ((port) < 0))
/*
* The IO_METASYNC flag should be implemented for local file systems.
#define NFS_MATTR_SVCPRINCIPAL 26 /* GSS principal to authenticate to, the server principal */
#define NFS_MATTR_NFS_VERSION_RANGE 27 /* Packed version range to try */
#define NFS_MATTR_KERB_ETYPE 28 /* Enctype to use for kerberos mounts */
+#define NFS_MATTR_LOCAL_NFS_PORT 29 /* Unix domain socket for NFS protocol */
+#define NFS_MATTR_LOCAL_MOUNT_PORT 30 /* Unix domain socket for MOUNT protocol */
+#define NFS_MATTR_SET_MOUNT_OWNER 31 /* Set owner of mount point */
/* NFS mount flags */
#define NFS_MFLAG_SOFT 0 /* soft mount (requests fail if unresponsive) */
#define NFS_MFLAG_NOQUOTA 15 /* don't support QUOTA requests */
#define NFS_MFLAG_MNTUDP 16 /* MOUNT protocol should use UDP */
#define NFS_MFLAG_MNTQUICK 17 /* use short timeouts while mounting */
+/* 18 reserved */
+#define NFS_MFLAG_NOOPAQUE_AUTH 19 /* don't make the mount AUTH_OPAQUE. Used by V3 */
/* Macros for packing and unpacking packed versions */
#define PVER2MAJOR(M) ((uint32_t)(((M) >> 16) & 0xffff))
#define NFS_LOCK_MODE_DISABLED 1 /* do not support advisory file locking */
#define NFS_LOCK_MODE_LOCAL 2 /* perform advisory file locking locally */
+#define NFS_STRLEN_INT(str) \
+ (int)strnlen(str, INT_MAX)
+#define NFS_UIO_ADDIOV(a_uio, a_baseaddr, a_length) \
+ assert(a_length <= UINT32_MAX); uio_addiov(a_uio, a_baseaddr, (uint32_t)(a_length));
+#define NFS_BZERO(off, bytes) \
+ do { \
+ uint32_t bytes32 = bytes > UINT32_MAX ? UINT32_MAX : (uint32_t)(bytes); \
+ bzero(off, bytes32); \
+ if (bytes > UINT32_MAX) { \
+ bzero(off + bytes32, (uint32_t)(bytes - UINT32_MAX)); \
+ } \
+ } while(0);
+#define NFS_ZFREE(zone, ptr) \
+ do { \
+ if ((ptr)) { \
+ zfree((zone), (ptr)); \
+ (ptr) = NULL; \
+ } \
+ } while (0); \
/* Supported encryption types for kerberos session keys */
typedef enum nfs_supported_kerberos_etypes {
#else
struct sockaddr *addr; /* file server address */
#endif
- int addrlen; /* length of address */
+ uint8_t addrlen; /* length of address */
int sotype; /* Socket type */
int proto; /* and Protocol */
#ifdef KERNEL
struct user_nfs_args {
int version; /* args structure version number */
user_addr_t addr __attribute((aligned(8))); /* file server address */
- int addrlen; /* length of address */
+ uint8_t addrlen; /* length of address */
int sotype; /* Socket type */
int proto; /* and Protocol */
user_addr_t fh __attribute((aligned(8))); /* File handle to be mounted */
uint32_t nxh_expid; /* Export ID */
uint16_t nxh_flags; /* export handle flags */
uint8_t nxh_reserved; /* future use */
- uint8_t nxh_fidlen; /* length of File ID */
+ uint32_t nxh_fidlen; /* length of File ID */
};
/* nxh_flags */
/* descriptor describing following records */
struct nfs_export_stat_desc {
uint32_t rec_vers; /* version of export stat records */
- uint32_t rec_count; /* total record count */
+ uint64_t rec_count; /* total record count */
}__attribute__((__packed__));
/* export stat record containing path and stat counters */
uint64_t ops;
uint64_t bytes_read;
uint64_t bytes_written;
- uint32_t tm_start;
- uint32_t tm_last;
+ time_t tm_start;
+ time_t tm_last;
}__attribute__((__packed__));
/* Active user list path record format */
uint64_t ops;
uint64_t bytes_read;
uint64_t bytes_written;
- uint32_t tm_start;
- uint32_t tm_last;
+ time_t tm_start;
+ time_t tm_last;
};
/* Hash table for active user nodes */
/*
* fs.nfs sysctl(3) identifiers
*/
-#define NFS_NFSSTATS 1 /* struct: struct nfsstats */
-#define NFS_EXPORTSTATS 3 /* gets exported directory stats */
-#define NFS_USERSTATS 4 /* gets exported directory active user stats */
-#define NFS_USERCOUNT 5 /* gets current count of active nfs users */
-#define NFS_MOUNTINFO 6 /* gets information about an NFS mount */
+#define NFS_NFSSTATS 1 /* struct: struct nfsstats */
+#define NFS_EXPORTSTATS 3 /* gets exported directory stats */
+#define NFS_USERSTATS 4 /* gets exported directory active user stats */
+#define NFS_USERCOUNT 5 /* gets current count of active nfs users */
+#define NFS_MOUNTINFO 6 /* gets information about an NFS mount */
+#define NFS_NFSZEROSTATS 7 /* zero nfs statistics */
#ifndef NFS_WDELAYHASHSIZ
#define NFS_WDELAYHASHSIZ 16 /* and with this */
(int)(B), (int)(C), (int)(D), (int)(E), 0)
#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_NFSREQ);
MALLOC_DECLARE(M_NFSMNT);
+MALLOC_DECLARE(M_NFSBIO);
MALLOC_DECLARE(M_NFSDIROFF);
MALLOC_DECLARE(M_NFSRVDESC);
MALLOC_DECLARE(M_NFSD);
struct nfs_socket;
struct nfs_socket_search;
struct nfsrv_uc_arg;
+struct direntry;
/*
* The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
mbuf_t nmc_mhead; /* mbuf chain head */
mbuf_t nmc_mcur; /* current mbuf */
caddr_t nmc_ptr; /* pointer into current mbuf */
- uint32_t nmc_left; /* bytes remaining in current mbuf */
+ size_t nmc_left; /* bytes remaining in current mbuf */
uint32_t nmc_flags; /* flags for this nfsm_chain */
};
#define NFSM_CHAIN_FLAG_ADD_CLUSTERS 0x1 /* always add mbuf clusters */
uint32_t gss_seqnum;
};
+/**
+ * nfsreq callback args
+ */
+struct nfsreq_cbargs {
+ off_t offset;
+ size_t length;
+ uint32_t stategenid;
+};
+
/*
* async NFS request callback info
*/
struct nfsreq_cbinfo {
void (*rcb_func)(struct nfsreq *); /* async request callback function */
struct nfsbuf *rcb_bp; /* buffer I/O RPC is for */
- uint32_t rcb_args[3]; /* additional callback args */
+ struct nfsreq_cbargs rcb_args; /* nfsreq callback args */
};
/*
struct nfsmount *r_nmp; /* NFS mount point */
uint64_t r_xid; /* RPC transaction ID */
uint32_t r_procnum; /* NFS procedure number */
- uint32_t r_mreqlen; /* request length */
+ size_t r_mreqlen; /* request length */
int r_flags; /* flags on request, see below */
int r_lflags; /* flags protected by list mutex, see below */
int r_refs; /* # outstanding references */
uint8_t r_delay; /* delay to use for jukebox error */
- uint8_t r_retry; /* max retransmission count */
+ uint32_t r_retry; /* max retransmission count */
uint8_t r_rexmit; /* current retrans count */
int r_rtt; /* RTT for rpc */
thread_t r_thread; /* thread that did I/O system call */
time_t r_resendtime; /* time of next jukebox error resend */
struct nfs_gss_clnt_ctx *r_gss_ctx; /* RPCSEC_GSS context */
SLIST_HEAD(, gss_seq) r_gss_seqlist; /* RPCSEC_GSS sequence numbers */
- uint32_t r_gss_argoff; /* RPCSEC_GSS offset to args */
+ size_t r_gss_argoff; /* RPCSEC_GSS offset to args */
uint32_t r_gss_arglen; /* RPCSEC_GSS arg length */
uint32_t r_auth; /* security flavor request sent with */
uint32_t *r_wrongsec; /* wrongsec: other flavors to try */
#define RL_WAITING 0x0002 /* Someone waiting for lock. */
#define RL_QUEUED 0x0004 /* request is on the queue */
-extern u_int32_t nfs_xid, nfs_xidwrap;
+extern u_int64_t nfs_xid, nfs_xidwrap;
extern int nfs_iosize, nfs_allow_async, nfs_statfs_rate_limit;
extern int nfs_access_cache_timeout, nfs_access_delete, nfs_access_dotzfs, nfs_access_for_getattr;
extern int nfs_lockd_mounts, nfs_lockd_request_sent;
extern int nfsiod_thread_count, nfsiod_thread_max, nfs_max_async_writes;
extern int nfs_idmap_ctrl, nfs_callback_port;
extern int nfs_is_mobile, nfs_readlink_nocache, nfs_root_steals_ctx;
+extern uint32_t nfs_tcp_sockbuf;
extern uint32_t nfs_squishy_flags;
extern uint32_t nfs_debug_ctl;
mbuf_t ns_frag;
int ns_flag;
int ns_sotype;
- int ns_cc;
- int ns_reclen;
+ size_t ns_cc;
+ size_t ns_reclen;
int ns_reccnt;
- u_int32_t ns_sref;
+ int ns_sobufsize;
+ u_int32_t ns_sref;
time_t ns_timestamp; /* socket timestamp */
lck_mtx_t ns_wgmutex; /* mutex for write gather fields */
- u_quad_t ns_wgtime; /* next Write deadline (usec) */
+ time_t ns_wgtime; /* next Write deadline (usec) */
LIST_HEAD(, nfsrv_descript) ns_tq; /* Write gather lists */
LIST_HEAD(nfsrv_wg_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ];
};
* Some fields are used only when write request gathering is performed.
*/
struct nfsrv_descript {
- u_quad_t nd_time; /* Write deadline (usec) */
+ time_t nd_time; /* Write deadline (usec) */
off_t nd_off; /* Start byte offset */
off_t nd_eoff; /* and end byte offset */
LIST_ENTRY(nfsrv_descript) nd_hash; /* Hash list */
int nd_vers; /* NFS version */
int nd_len; /* Length of this write */
int nd_repstat; /* Reply status */
- u_int32_t nd_retxid; /* Reply xid */
+ u_int32_t nd_retxid; /* Reply xid */
struct timeval nd_starttime; /* Time RPC initiated */
struct nfs_filehandle nd_fh; /* File handle */
uint32_t nd_sec; /* Security flavor */
/* mutex for nfs client globals */
extern lck_mtx_t *nfs_global_mutex;
+#if CONFIG_NFS4
/* NFSv4 callback globals */
extern int nfs4_callback_timer_on;
extern in_port_t nfs4_cb_port, nfs4_cb_port6;
+/* nfs 4 default domain for user mapping */
+extern char nfs4_default_domain[MAXPATHLEN];
+/* nfs 4 timer call structure */
+extern thread_call_t nfs4_callback_timer_call;
+#endif
+
/* nfs timer call structures */
extern thread_call_t nfs_request_timer_call;
extern thread_call_t nfs_buf_timer_call;
-extern thread_call_t nfs4_callback_timer_call;
extern thread_call_t nfsrv_idlesock_timer_call;
#if CONFIG_FSE
extern thread_call_t nfsrv_fmod_timer_call;
#endif
-/* nfs 4 default domain for user mapping */
-extern char nfs4_default_domain[MAXPATHLEN];
-
__BEGIN_DECLS
nfstype vtonfs_type(enum vtype, int);
void nfs_nhinit_finish(void);
u_long nfs_hash(u_char *, int);
+#if CONFIG_NFS4
int nfs4_init_clientid(struct nfsmount *);
int nfs4_setclientid(struct nfsmount *);
int nfs4_renew(struct nfsmount *, int);
void nfs4_callback_timer(void *, void *);
int nfs4_secinfo_rpc(struct nfsmount *, struct nfsreq_secinfo_args *, kauth_cred_t, uint32_t *, int *);
int nfs4_get_fs_locations(struct nfsmount *, nfsnode_t, u_char *, int, const char *, vfs_context_t, struct nfs_fs_locations *);
-void nfs_fs_locations_cleanup(struct nfs_fs_locations *);
void nfs4_default_attrs_for_referral_trigger(nfsnode_t, char *, int, struct nfs_vattr *, fhandle_t *);
+#endif
+
+void nfs_fs_locations_cleanup(struct nfs_fs_locations *);
int nfs_sockaddr_cmp(struct sockaddr *, struct sockaddr *);
int nfs_connect(struct nfsmount *, int, int);
int nfs_getattr(nfsnode_t, struct nfs_vattr *, vfs_context_t, int);
int nfs_getattrcache(nfsnode_t, struct nfs_vattr *, int);
int nfs_loadattrcache(nfsnode_t, struct nfs_vattr *, u_int64_t *, int);
-int nfs_attrcachetimeout(nfsnode_t);
+long 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);
void nfs_location_next(struct nfs_fs_locations *, struct nfs_location_index *);
int nfs_location_index_cmp(struct nfs_location_index *, struct nfs_location_index *);
-void nfs_location_mntfromname(struct nfs_fs_locations *, struct nfs_location_index, char *, int, int);
-int nfs_socket_create(struct nfsmount *, struct sockaddr *, int, in_port_t, uint32_t, uint32_t, int, struct nfs_socket **);
+void nfs_location_mntfromname(struct nfs_fs_locations *, struct nfs_location_index, char *, size_t, int);
+int nfs_socket_create(struct nfsmount *, struct sockaddr *, uint8_t, in_port_t, uint32_t, uint32_t, int, struct nfs_socket **);
void nfs_socket_destroy(struct nfs_socket *);
void nfs_socket_options(struct nfsmount *, struct nfs_socket *);
void nfs_connect_upcall(socket_t, void *, int);
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_cache_lookup(nfsnode_t, nfsnode_t *, struct componentname *, vfs_context_t, int, 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);
+#if CONFIG_NFS4
uint32_t nfs4_ace_nfstype_to_vfstype(uint32_t, int *);
uint32_t nfs4_ace_vfstype_to_nfstype(uint32_t, int *);
uint32_t nfs4_ace_nfsflags_to_vfsflags(uint32_t);
int nfs4_id2guid(char *, guid_t *, int);
int nfs4_guid2id(guid_t *, char *, size_t *, int);
-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 *, struct nfs_fs_locations *);
+#endif
+
+int nfs_parsefattr(struct nfsmount *nmp, struct nfsm_chain *, int,
+ struct nfs_vattr *);
void nfs_vattr_set_supported(uint32_t *, struct vnode_attr *);
void nfs_vattr_set_bitmap(struct nfsmount *, uint32_t *, struct vnode_attr *);
void nfs3_pathconf_cache(struct nfsmount *, struct nfs_fsattr *);
+int nfs3_check_lockmode(struct nfsmount *, struct sockaddr *, int, int);
int nfs3_mount_rpc(struct nfsmount *, struct sockaddr *, int, int, char *, vfs_context_t, int, fhandle_t *, struct nfs_sec *);
void nfs3_umount_rpc(struct nfsmount *, vfs_context_t, int);
+void nfs_rdirplus_update_node_attrs(nfsnode_t, struct direntry *, fhandle_t *, struct nfs_vattr *, uint64_t *);
int nfs_node_access_slot(nfsnode_t, uid_t, int);
void nfs_vnode_notify(nfsnode_t, uint32_t);
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, thread_t);
void nfs_open_state_clear_busy(nfsnode_t);
struct nfs_open_owner *nfs_open_owner_find(struct nfsmount *, kauth_cred_t, int);
int nfs_open_file_set_busy(struct nfs_open_file *, thread_t);
void nfs_open_file_clear_busy(struct nfs_open_file *);
void nfs_open_file_add_open(struct nfs_open_file *, uint32_t, uint32_t, int);
-void nfs_open_file_remove_open_find(struct nfs_open_file *, uint32_t, uint32_t, uint32_t *, uint32_t *, int*);
+void nfs_open_file_remove_open_find(struct nfs_open_file *, uint32_t, uint32_t, uint8_t *, uint8_t *, int *);
void nfs_open_file_remove_open(struct nfs_open_file *, uint32_t, uint32_t);
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_open_delegated(nfsnode_t, struct nfs_open_file *, uint32_t, uint32_t, vfs_context_t);
-int nfs_close(nfsnode_t, struct nfs_open_file *, uint32_t, uint32_t, vfs_context_t);
int nfs_check_for_locks(struct nfs_open_owner *, struct nfs_open_file *);
-int 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_confirm_rpc(struct nfsmount *, nfsnode_t, u_char *, int, struct nfs_open_owner *, nfs_stateid *, thread_t, kauth_cred_t, struct nfs_vattr *, uint64_t *);
-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_claim_delegated_open_rpc(struct nfs_open_file *, int, int, int);
-int nfs4_claim_delegated_state_for_open_file(struct nfs_open_file *, int);
-int nfs4_claim_delegated_state_for_node(nfsnode_t, 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);
-void nfs4_delegation_return_enqueue(nfsnode_t);
-int nfs4_delegation_return(nfsnode_t, int, thread_t, kauth_cred_t);
-int nfs4_delegreturn_rpc(struct nfsmount *, u_char *, int, struct nfs_stateid *, int, thread_t, kauth_cred_t);
+int nfs_close(nfsnode_t, struct nfs_open_file *, uint32_t, uint32_t, vfs_context_t);
+
void nfs_release_open_state_for_node(nfsnode_t, int);
void nfs_revoke_open_state_for_node(nfsnode_t);
struct nfs_lock_owner *nfs_lock_owner_find(nfsnode_t, proc_t, int);
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, int, thread_t, kauth_cred_t);
int nfs_unlock_rpc(nfsnode_t, struct nfs_lock_owner *, int, uint64_t, uint64_t, thread_t, kauth_cred_t, int);
int nfs_advlock_getlock(nfsnode_t, struct nfs_lock_owner *, struct flock *, uint64_t, uint64_t, vfs_context_t);
int nfs_advlock_setlock(nfsnode_t, struct nfs_open_file *, struct nfs_lock_owner *, int, uint64_t, uint64_t, int, short, vfs_context_t);
int nfs_advlock_unlock(nfsnode_t, struct nfs_open_file *, struct nfs_lock_owner *, uint64_t, uint64_t, int, vfs_context_t);
+#if CONFIG_NFS4
+int nfs4_create_rpc(vfs_context_t, nfsnode_t, struct componentname *, struct vnode_attr *, int, char *, nfsnode_t *);
+int nfs4_open(nfsnode_t, struct nfs_open_file *, uint32_t, uint32_t, vfs_context_t);
+int nfs4_open_delegated(nfsnode_t, struct nfs_open_file *, uint32_t, uint32_t, vfs_context_t);
+int 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_confirm_rpc(struct nfsmount *, nfsnode_t, u_char *, int, struct nfs_open_owner *, nfs_stateid *, thread_t, kauth_cred_t, struct nfs_vattr *, uint64_t *);
+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_claim_delegated_open_rpc(struct nfs_open_file *, int, int, int);
+int nfs4_claim_delegated_state_for_open_file(struct nfs_open_file *, int);
+int nfs4_claim_delegated_state_for_node(nfsnode_t, 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);
+void nfs4_delegation_return_enqueue(nfsnode_t);
+int nfs4_delegation_return(nfsnode_t, int, thread_t, kauth_cred_t);
+int nfs4_lock_rpc(nfsnode_t, struct nfs_open_file *, struct nfs_file_lock *, int, int, thread_t, kauth_cred_t);
+int nfs4_delegreturn_rpc(struct nfsmount *, u_char *, int, struct nfs_stateid *, int, thread_t, kauth_cred_t);
+
nfsnode_t nfs4_named_attr_dir_get(nfsnode_t, int, vfs_context_t);
int nfs4_named_attr_get(nfsnode_t, struct componentname *, uint32_t, int, vfs_context_t, nfsnode_t *, struct nfs_open_file **);
int nfs4_named_attr_remove(nfsnode_t, nfsnode_t, const char *, vfs_context_t);
+#endif
int nfs_mount_state_in_use_start(struct nfsmount *, thread_t);
int nfs_mount_state_in_use_end(struct nfsmount *, int);
int nfs_vnop_close(struct vnop_close_args *);
int nfs_vnop_advlock(struct vnop_advlock_args *);
int nfs_vnop_mmap(struct vnop_mmap_args *);
+int nfs_vnop_mmap_check(struct vnop_mmap_check_args *ap);
int nfs_vnop_mnomap(struct vnop_mnomap_args *);
+#if CONFIG_NFS4
int nfs4_vnop_create(struct vnop_create_args *);
int nfs4_vnop_mknod(struct vnop_mknod_args *);
int nfs4_vnop_close(struct vnop_close_args *);
int nfs4_vnop_removenamedstream(struct vnop_removenamedstream_args *);
#endif
+int nfs4_access_rpc(nfsnode_t, u_int32_t *, int, vfs_context_t);
+int nfs4_getattr_rpc(nfsnode_t, mount_t, u_char *, size_t, int, vfs_context_t, struct nfs_vattr *, u_int64_t *);
+int nfs4_setattr_rpc(nfsnode_t, struct vnode_attr *, vfs_context_t);
+int nfs4_read_rpc_async(nfsnode_t, off_t, size_t, thread_t, kauth_cred_t, struct nfsreq_cbinfo *, struct nfsreq **);
+int nfs4_read_rpc_async_finish(nfsnode_t, struct nfsreq *, uio_t, size_t *, int *);
+int nfs4_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_finish(nfsnode_t, struct nfsreq *, int *, size_t *, uint64_t *);
+int nfs4_readdir_rpc(nfsnode_t, struct nfsbuf *, vfs_context_t);
+int nfs4_readlink_rpc(nfsnode_t, char *, size_t *, vfs_context_t);
+int nfs4_commit_rpc(nfsnode_t, uint64_t, uint64_t, kauth_cred_t, uint64_t);
+int nfs4_lookup_rpc_async(nfsnode_t, char *, int, vfs_context_t, struct nfsreq **);
+int nfs4_lookup_rpc_async_finish(nfsnode_t, char *, int, vfs_context_t, struct nfsreq *, u_int64_t *, fhandle_t *, struct nfs_vattr *);
+int nfs4_remove_rpc(nfsnode_t, char *, int, thread_t, kauth_cred_t);
+int nfs4_rename_rpc(nfsnode_t, char *, int, nfsnode_t, char *, int, vfs_context_t);
+int nfs4_pathconf_rpc(nfsnode_t, struct nfs_fsattr *, vfs_context_t);
+int nfs4_setlock_rpc(nfsnode_t, struct nfs_open_file *, struct nfs_file_lock *, int, int, thread_t, kauth_cred_t);
+int nfs4_unlock_rpc(nfsnode_t, struct nfs_lock_owner *, int, uint64_t, uint64_t, int, thread_t, kauth_cred_t);
+int nfs4_getlock_rpc(nfsnode_t, struct nfs_lock_owner *, struct flock *, uint64_t, uint64_t, vfs_context_t);
+#endif
+
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 *, int, vfs_context_t);
-int nfs4_access_rpc(nfsnode_t, u_int32_t *, int, vfs_context_t);
int nfs3_getattr_rpc(nfsnode_t, mount_t, u_char *, size_t, int, vfs_context_t, struct nfs_vattr *, u_int64_t *);
-int nfs4_getattr_rpc(nfsnode_t, mount_t, u_char *, size_t, int, 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_readlink_rpc(nfsnode_t, char *, size_t *, vfs_context_t);
int nfs3_commit_rpc(nfsnode_t, uint64_t, uint64_t, kauth_cred_t, uint64_t);
-int nfs4_commit_rpc(nfsnode_t, uint64_t, uint64_t, kauth_cred_t, uint64_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, char *, int, vfs_context_t, struct nfsreq *, u_int64_t *, fhandle_t *, struct nfs_vattr *);
-int nfs4_lookup_rpc_async_finish(nfsnode_t, char *, int, 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);
int nfs3_setlock_rpc(nfsnode_t, struct nfs_open_file *, struct nfs_file_lock *, int, int, thread_t, kauth_cred_t);
-int nfs4_setlock_rpc(nfsnode_t, struct nfs_open_file *, struct nfs_file_lock *, int, int, thread_t, kauth_cred_t);
int nfs3_unlock_rpc(nfsnode_t, struct nfs_lock_owner *, int, uint64_t, uint64_t, int, thread_t, kauth_cred_t);
-int nfs4_unlock_rpc(nfsnode_t, struct nfs_lock_owner *, int, uint64_t, uint64_t, int, thread_t, kauth_cred_t);
int nfs3_getlock_rpc(nfsnode_t, struct nfs_lock_owner *, struct flock *, uint64_t, uint64_t, vfs_context_t);
-int nfs4_getlock_rpc(nfsnode_t, struct nfs_lock_owner *, struct flock *, uint64_t, uint64_t, vfs_context_t);
void nfsrv_active_user_list_reclaim(void);
void nfsrv_cleancache(void);
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_interval_timer_start(thread_call_t, time_t);
int nfs_use_cache(struct nfsmount *);
void nfs_up(struct nfsmount *, thread_t, int, const char *);
void nfs_down(struct nfsmount *, thread_t, int, int, const char *, int);
/* Debug support */
#define NFS_DEBUG_LEVEL (nfs_debug_ctl & 0xf)
-#define NFS_DEBUG_FACILITY ((nfs_debug_ctl >> 4) & 0xff)
-#define NFS_DEBUG_FLAGS ((nfs_debug_ctl >> 12) & 0xff)
+#define NFS_DEBUG_FACILITY ((nfs_debug_ctl >> 4) & 0xfff)
+#define NFS_DEBUG_FLAGS ((nfs_debug_ctl >> 16) & 0xf)
#define NFS_DEBUG_VALUE ((nfs_debug_ctl >> 20) & 0xfff)
-#define NFS_FAC_SOCK 0x01
-#define NFS_FAC_STATE 0x02
-#define NFS_FAC_NODE 0x04
-#define NFS_FAC_VNOP 0x08
-#define NFS_FAC_BIO 0x10
-#define NFS_FAC_GSS 0x20
-#define NFS_FAC_VFS 0x40
-
-#define NFS_DBG(fac, lev, fmt, ...) \
- if (__builtin_expect(NFS_DEBUG_LEVEL, 0)) nfs_printf(fac, lev, "%s: %d: " fmt, __func__, __LINE__, ## __VA_ARGS__)
-
-void nfs_printf(int, int, const char *, ...) __printflike(3, 4);
+#define NFS_FAC_SOCK 0x001
+#define NFS_FAC_STATE 0x002
+#define NFS_FAC_NODE 0x004
+#define NFS_FAC_VNOP 0x008
+#define NFS_FAC_BIO 0x010
+#define NFS_FAC_GSS 0x020
+#define NFS_FAC_VFS 0x040
+#define NFS_FAC_SRV 0x080
+
+#define NFS_IS_DBG(fac, lev) \
+ (__builtin_expect((NFS_DEBUG_FACILITY & (fac)) && ((lev) <= NFS_DEBUG_LEVEL), 0))
+#define NFS_DBG(fac, lev, fmt, ...) nfs_printf((fac), (lev), "%s: %d: " fmt, __func__, __LINE__, ## __VA_ARGS__)
+
+void nfs_printf(unsigned int, unsigned int, const char *, ...) __printflike(3, 4);
+void nfs_dump_mbuf(const char *, int, const char *, mbuf_t);
int nfs_mountopts(struct nfsmount *, char *, int);
+#if XNU_KERNEL_PRIVATE
+#include <kern/kalloc.h>
+
+ZONE_VIEW_DECLARE(ZV_NFSDIROFF);
+extern zone_t nfs_buf_zone;
+extern zone_t nfsrv_descript_zone;
+extern zone_t nfsnode_zone;
+extern zone_t nfs_fhandle_zone;
+extern zone_t nfs_req_zone;
+extern zone_t nfsrv_descript_zone;
+extern zone_t nfsmnt_zone;
+
+#endif /* XNU_KERNEL_PRIVATE */
__END_DECLS
#endif /* KERNEL */