+/*
+ * NFS file system location structures
+ */
+struct nfs_fs_server {
+ char * ns_name; /* name of server */
+ char ** ns_addresses; /* array of addresses for server */
+ uint32_t ns_addrcount; /* # of addresses */
+};
+struct nfs_fs_path {
+ char ** np_components; /* array of component pointers */
+ uint32_t np_compcount; /* # components in path */
+};
+struct nfs_fs_location {
+ struct nfs_fs_server ** nl_servers; /* array of server pointers */
+ struct nfs_fs_path nl_path; /* file system path */
+ uint32_t nl_servcount; /* # of servers */
+};
+
+struct nfs_location_index {
+ uint8_t nli_flags; /* misc flags */
+ uint8_t nli_loc; /* location index */
+ uint8_t nli_serv; /* server index */
+ uint8_t nli_addr; /* address index */
+};
+#define NLI_VALID 0x01 /* index is valid */
+
+struct nfs_fs_locations {
+ struct nfs_fs_path nl_root; /* current server's root file system path */
+ uint32_t nl_numlocs; /* # of locations */
+ struct nfs_location_index nl_current; /* index of current location/server/address */
+ struct nfs_fs_location **nl_locations; /* array of fs locations */
+};
+
+/*
+ * RPC record marker parsing state
+ */
+struct nfs_rpc_record_state {
+ mbuf_t nrrs_m; /* mbufs for current record */
+ mbuf_t nrrs_mlast;
+ uint16_t nrrs_lastfrag; /* last fragment of record */
+ uint16_t nrrs_markerleft; /* marker bytes remaining */
+ uint32_t nrrs_fragleft; /* fragment bytes remaining */
+ uint32_t nrrs_reclen; /* length of RPC record */
+};
+
+/*
+ * NFS socket structures
+ */
+struct nfs_socket {
+ lck_mtx_t nso_lock; /* nfs socket lock */
+ TAILQ_ENTRY(nfs_socket) nso_link; /* list of sockets */
+ struct sockaddr * nso_saddr; /* socket address */
+ struct sockaddr * nso_saddr2; /* additional socket address */
+ void * nso_wake; /* address to wake up */
+ time_t nso_timestamp;
+ time_t nso_reqtimestamp; /* last request sent */
+ socket_t nso_so; /* socket */
+ uint8_t nso_sotype; /* Type of socket */
+ uint16_t nso_flags; /* NSO_* flags */
+ struct nfs_location_index nso_location; /* location index */
+ uint32_t nso_protocol; /* RPC protocol */
+ uint32_t nso_version; /* RPC protocol version */
+ uint32_t nso_pingxid; /* RPC XID of NULL ping request */
+ int nso_error; /* saved error/status */
+ struct nfs_rpc_record_state nso_rrs; /* RPC record parsing state (TCP) */
+};
+TAILQ_HEAD(nfssocketlist, nfs_socket);
+/* nso_flags */
+#define NSO_UPCALL 0x0001 /* socket upcall in progress */
+#define NSO_DEAD 0x0002 /* socket is dead */
+#define NSO_CONNECTING 0x0004 /* socket is being connected */
+#define NSO_CONNECTED 0x0008 /* socket connection complete */
+#define NSO_PINGING 0x0010 /* socket is being tested */
+#define NSO_VERIFIED 0x0020 /* socket appears functional */
+#define NSO_DISCONNECTING 0x0040 /* socket is being disconnected */
+
+/* NFS connect socket search state */
+struct nfs_socket_search {
+ struct nfs_location_index nss_startloc; /* starting location index */
+ struct nfs_location_index nss_nextloc; /* next location index */
+ struct nfssocketlist nss_socklist; /* list of active sockets */
+ time_t nss_timestamp; /* search start time */
+ time_t nss_last; /* timestamp of last socket */
+ struct nfs_socket * nss_sock; /* found socket */
+ uint8_t nss_sotype; /* TCP/UDP */
+ uint8_t nss_sockcnt; /* # of active sockets */
+ in_port_t nss_port; /* port # to connect to */
+ uint32_t nss_protocol; /* RPC protocol */
+ uint32_t nss_version; /* RPC protocol version */
+ uint32_t nss_flags; /* (see below) */
+ int nss_addrcnt; /* Number addresses to try or left */
+ int nss_timeo; /* how long we are willing to wait */
+ int nss_error; /* best error we've gotten so far */
+};
+/* nss_flags */
+#define NSS_VERBOSE 0x00000001 /* OK to log info about socket search */
+#define NSS_WARNED 0x00000002 /* logged warning about socket search taking a while */
+