/*
- * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2015 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#define NFS_ASYNCTHREADMAXIDLE 60 /* Seconds before idle nfsiods are reaped */
#define NFS_DEFSTATFSRATELIMIT 10 /* Def. max # statfs RPCs per second */
#define NFS_REQUESTDELAY 10 /* ms interval to check request queue */
-#define NFSRV_DEADSOCKDELAY 5 /* Seconds before dead sockets are reaped */
#define NFSRV_MAXWGATHERDELAY 100 /* Max. write gather delay (msec) */
#ifndef NFSRV_WGATHERDELAY
#define NFSRV_WGATHERDELAY 1 /* Default write gather delay (msec) */
#define NFS_MATTR_REALM 24 /* Realm to authenticate with */
#define NFS_MATTR_PRINCIPAL 25 /* GSS principal to authenticate with */
#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 */
/* NFS mount flags */
#define NFS_MFLAG_SOFT 0 /* soft mount (requests fail if unresponsive) */
#define NFS_MFLAG_MNTUDP 16 /* MOUNT protocol should use UDP */
#define NFS_MFLAG_MNTQUICK 17 /* use short timeouts while mounting */
+/* Macros for packing and unpacking packed versions */
+#define PVER2MAJOR(M) ((uint32_t)(((M) >> 16) & 0xffff))
+#define PVER2MINOR(m) ((uint32_t)((m) & 0xffff))
+#define VER2PVER(M, m) ((uint32_t)((M) << 16) | ((m) & 0xffff))
+
/* NFS advisory file locking modes */
#define NFS_LOCK_MODE_ENABLED 0 /* advisory file locking enabled */
#define NFS_LOCK_MODE_DISABLED 1 /* do not support advisory file locking */
*/
#define NFSCLNT_LOCKDANS 0x200
#define NFSCLNT_LOCKDNOTIFY 0x400
-
+#define NFSCLNT_TESTIDMAP 0x001
+
+#include <sys/_types/_guid_t.h> /* for guid_t below */
+#define MAXIDNAMELEN 1024
+struct nfs_testmapid {
+ uint32_t ntm_name2id; /* lookup name 2 id or id 2 name */
+ uint32_t ntm_grpflag; /* Is this a group or user maping */
+ uint32_t ntm_id; /* id to map or return */
+ uint32_t pad;
+ guid_t ntm_guid; /* intermidiate guid used in conversion */
+ char ntm_name[MAXIDNAMELEN]; /* name to map or return */
+};
+
/*
* fs.nfs sysctl(3) identifiers
*/
#define R_XID32(x) ((x) & 0xffffffff)
-#define NFSREQNOLIST ((struct nfsreq *)0xdeadbeef) /* sentinel value for nfsreq lists */
+#define NFSNOLIST ((void *)0x0badcafe) /* sentinel value for nfs lists */
+#define NFSREQNOLIST NFSNOLIST /* sentinel value for nfsreq lists */
/* Flag values for r_flags */
#define R_TIMING 0x00000001 /* timing request (in mntp) */
#define R_ASYNCWAIT 0x00002000 /* async request now being waited on */
#define R_RESENDQ 0x00004000 /* async request currently on resendq */
#define R_SENDING 0x00008000 /* request currently being sent */
+#define R_SOFT 0x00010000 /* request is soft - don't retry or reconnect */
+#define R_IOD 0x00020000 /* request is being managed by an IOD */
#define R_NOINTR 0x20000000 /* request should not be interupted by a signal */
#define R_RECOVER 0x40000000 /* a state recovery RPC - during NFSSTA_RECOVER */
extern int nfs_tprintf_initial_delay, nfs_tprintf_delay;
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;
+extern int nfs_is_mobile, nfs_readlink_nocache, nfs_root_steals_ctx;
extern uint32_t nfs_squishy_flags;
extern uint32_t nfs_debug_ctl;
* nfsrv_sockwork - sockets being worked on which may have more work to do (ns_svcq)
* nfsrv_sockwg - sockets with pending write gather input (ns_wgq)
*/
-extern TAILQ_HEAD(nfsrv_sockhead, nfsrv_sock) nfsrv_socklist, nfsrv_deadsocklist,
- nfsrv_sockwg, nfsrv_sockwait, nfsrv_sockwork;
+extern TAILQ_HEAD(nfsrv_sockhead, nfsrv_sock) nfsrv_socklist, nfsrv_sockwg,
+ nfsrv_sockwait, nfsrv_sockwork;
/* lock groups for nfsrv_sock's */
extern lck_grp_t *nfsrv_slp_rwlock_group;
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_deadsock_timer_call;
+extern thread_call_t nfsrv_idlesock_timer_call;
#if CONFIG_FSE
extern thread_call_t nfsrv_fmod_timer_call;
#endif
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_mount_check_dead_timeout(struct nfsmount *);
+int nfs_mount_gone(struct nfsmount *);
+void nfs_mount_rele(struct nfsmount *);
+void nfs_mount_zombie(struct nfsmount *, int);
+void nfs_mount_make_zombie(struct nfsmount *);
+
void nfs_rpc_record_state_init(struct nfs_rpc_record_state *);
void nfs_rpc_record_state_cleanup(struct nfs_rpc_record_state *);
int nfs_rpc_record_read(socket_t, struct nfs_rpc_record_state *, int, int *, mbuf_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_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);
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 *);
+void nfsrv_idlesock_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 **);
+int nfsrv_check_exports_allow_address(mbuf_t);
#if CONFIG_FSE
void nfsrv_fmod_timer(void *, void *);
#endif
int nfsrv_write(struct nfsrv_descript *, struct nfsrv_sock *, vfs_context_t, mbuf_t *);
void nfs_interval_timer_start(thread_call_t, int);
+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 *);
+void nfs_down(struct nfsmount *, thread_t, int, int, const char *, int);
int nfs_msg(thread_t, const char *, const char *, int);
int nfs_mountroot(void);
#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);
+int nfs_mountopts(struct nfsmount *, char *, int);
__END_DECLS