1c398230bSWarner Losh /*- 2df8bae1dSRodney W. Grimes * Copyright (c) 1989, 1993 3df8bae1dSRodney W. Grimes * The Regents of the University of California. All rights reserved. 4df8bae1dSRodney W. Grimes * 5df8bae1dSRodney W. Grimes * This code is derived from software contributed to Berkeley by 6df8bae1dSRodney W. Grimes * Rick Macklem at The University of Guelph. 7df8bae1dSRodney W. Grimes * 8df8bae1dSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 9df8bae1dSRodney W. Grimes * modification, are permitted provided that the following conditions 10df8bae1dSRodney W. Grimes * are met: 11df8bae1dSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 12df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer. 13df8bae1dSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 14df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 15df8bae1dSRodney W. Grimes * documentation and/or other materials provided with the distribution. 16df8bae1dSRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 17df8bae1dSRodney W. Grimes * may be used to endorse or promote products derived from this software 18df8bae1dSRodney W. Grimes * without specific prior written permission. 19df8bae1dSRodney W. Grimes * 20df8bae1dSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21df8bae1dSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22df8bae1dSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23df8bae1dSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24df8bae1dSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25df8bae1dSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26df8bae1dSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27df8bae1dSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28df8bae1dSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29df8bae1dSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30df8bae1dSRodney W. Grimes * SUCH DAMAGE. 31df8bae1dSRodney W. Grimes * 32996c772fSJohn Dyson * @(#)nfsmount.h 8.3 (Berkeley) 3/30/95 33c3aac50fSPeter Wemm * $FreeBSD$ 34df8bae1dSRodney W. Grimes */ 35df8bae1dSRodney W. Grimes 36eb25edbdSPeter Wemm #ifndef _NFSCLIENT_NFSMOUNT_H_ 37eb25edbdSPeter Wemm #define _NFSCLIENT_NFSMOUNT_H_ 3833420ec6SPaul Richards 39a9148abdSDoug Rabson #ifndef NFS_LEGACYRPC 40a9148abdSDoug Rabson 41a9148abdSDoug Rabson #undef RPC_SUCCESS 42a9148abdSDoug Rabson #undef RPC_PROGUNAVAIL 43a9148abdSDoug Rabson #undef RPC_PROCUNAVAIL 44a9148abdSDoug Rabson #undef AUTH_OK 45a9148abdSDoug Rabson #undef AUTH_BADCRED 46a9148abdSDoug Rabson #undef AUTH_BADVERF 47a9148abdSDoug Rabson #undef AUTH_TOOWEAK 48a9148abdSDoug Rabson 49a9148abdSDoug Rabson #include <rpc/types.h> 50a9148abdSDoug Rabson #include <rpc/auth.h> 51a9148abdSDoug Rabson #include <rpc/clnt.h> 52a9148abdSDoug Rabson #include <rpc/rpcsec_gss.h> 53a9148abdSDoug Rabson 54a9148abdSDoug Rabson #endif 55a9148abdSDoug Rabson 56a9148abdSDoug Rabson #ifdef NFS_LEGACYRPC 57a9148abdSDoug Rabson 5835ec46b7SPaul Saab struct nfs_tcp_mountstate { 5935ec46b7SPaul Saab int rpcresid; 6035ec46b7SPaul Saab #define NFS_TCP_EXPECT_RPCMARKER 0x0001 /* Expect to see a RPC/TCP marker next */ 6135ec46b7SPaul Saab #define NFS_TCP_FORCE_RECONNECT 0x0002 /* Force a TCP reconnect */ 62faf529dcSMohan Srinivasan #define NFS_TCP_WAIT_WRITE_DRAIN 0x0004 /* Waiting for socket writers to finish */ 6335ec46b7SPaul Saab int flags; 64faf529dcSMohan Srinivasan int sock_send_inprog; 6535ec46b7SPaul Saab }; 6635ec46b7SPaul Saab 67a9148abdSDoug Rabson #endif 68a9148abdSDoug Rabson 69df8bae1dSRodney W. Grimes /* 70df8bae1dSRodney W. Grimes * Mount structure. 71df8bae1dSRodney W. Grimes * One allocated on every NFS mount. 72df8bae1dSRodney W. Grimes * Holds NFS specific information for mount. 73df8bae1dSRodney W. Grimes */ 74df8bae1dSRodney W. Grimes struct nfsmount { 75f1cdf899SMohan Srinivasan struct mtx nm_mtx; 76df8bae1dSRodney W. Grimes int nm_flag; /* Flags for soft/hard... */ 77fe6c0d45SPeter Wemm int nm_state; /* Internal state flags */ 78df8bae1dSRodney W. Grimes struct mount *nm_mountp; /* Vfs structure for this filesystem */ 79df8bae1dSRodney W. Grimes int nm_numgrps; /* Max. size of groupslist */ 801bf87204SAlfred Perlstein u_char nm_fh[NFSX_V4FH]; /* File handle of root dir */ 81a62dc406SDoug Rabson int nm_fhsize; /* Size of root file handle */ 821bf87204SAlfred Perlstein struct rpcclnt nm_rpcclnt; /* rpc state */ 83a9148abdSDoug Rabson #ifdef NFS_LEGACYRPC 84df8bae1dSRodney W. Grimes struct socket *nm_so; /* Rpc socket */ 85a9148abdSDoug Rabson #endif 86df8bae1dSRodney W. Grimes int nm_sotype; /* Type of socket */ 87df8bae1dSRodney W. Grimes int nm_soproto; /* and protocol */ 88df8bae1dSRodney W. Grimes int nm_soflags; /* pr_flags for socket protocol */ 8957bf258eSGarrett Wollman struct sockaddr *nm_nam; /* Addr of server */ 90df8bae1dSRodney W. Grimes int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */ 91df8bae1dSRodney W. Grimes int nm_retry; /* Max retries */ 92a9148abdSDoug Rabson #ifdef NFS_LEGACYRPC 9394163ea2SChuck Lever int nm_srtt[NFS_MAX_TIMER], /* RTT Timers for rpcs */ 9494163ea2SChuck Lever nm_sdrtt[NFS_MAX_TIMER]; 95df8bae1dSRodney W. Grimes int nm_sent; /* Request send count */ 96df8bae1dSRodney W. Grimes int nm_cwnd; /* Request send window */ 97df8bae1dSRodney W. Grimes int nm_timeouts; /* Request timeouts */ 98a9148abdSDoug Rabson #endif 99df8bae1dSRodney W. Grimes int nm_deadthresh; /* Threshold of timeouts-->dead server*/ 100df8bae1dSRodney W. Grimes int nm_rsize; /* Max size of read rpc */ 101df8bae1dSRodney W. Grimes int nm_wsize; /* Max size of write rpc */ 102a62dc406SDoug Rabson int nm_readdirsize; /* Size of a readdir rpc */ 103df8bae1dSRodney W. Grimes int nm_readahead; /* Num. of blocks to readahead */ 104cc3149b1SBrian Feldman int nm_wcommitsize; /* Max size of commit for write */ 105fe6c0d45SPeter Wemm int nm_acdirmin; /* Directory attr cache min lifetime */ 106fe6c0d45SPeter Wemm int nm_acdirmax; /* Directory attr cache max lifetime */ 107fe6c0d45SPeter Wemm int nm_acregmin; /* Reg file attr cache min lifetime */ 108fe6c0d45SPeter Wemm int nm_acregmax; /* Reg file attr cache max lifetime */ 109a62dc406SDoug Rabson u_char nm_verf[NFSX_V3WRITEVERF]; /* V3 write verifier */ 110e3975643SJake Burkholder TAILQ_HEAD(, buf) nm_bufq; /* async io buffer queue */ 111f438ae02SDoug Rabson short nm_bufqlen; /* number of buffers in queue */ 112f438ae02SDoug Rabson short nm_bufqwant; /* process wants to add to the queue */ 113f438ae02SDoug Rabson int nm_bufqiods; /* number of iods processing queue */ 1147c1c33a7SPeter Wemm u_int64_t nm_maxfilesize; /* maximum file size */ 11590abe7f2SAlfred Perlstein struct nfs_rpcops *nm_rpcops; 116c713aaaeSAlfred Perlstein int nm_tprintf_initial_delay; /* initial delay */ 117c713aaaeSAlfred Perlstein int nm_tprintf_delay; /* interval for messages */ 118a9148abdSDoug Rabson #ifdef NFS_LEGACYRPC 11935ec46b7SPaul Saab struct nfs_tcp_mountstate nm_nfstcpstate; 120a9148abdSDoug Rabson #endif 121c675522fSDoug Rabson char nm_hostname[MNAMELEN]; /* server's name */ 122a9148abdSDoug Rabson #ifndef NFS_LEGACYRPC 123a9148abdSDoug Rabson int nm_secflavor; /* auth flavor to use for rpc */ 124a9148abdSDoug Rabson struct __rpc_client *nm_client; 125a9148abdSDoug Rabson struct rpc_timers nm_timers[NFS_MAX_TIMER]; /* RTT Timers for rpcs */ 126a9148abdSDoug Rabson char nm_principal[MNAMELEN]; /* GSS-API principal of server */ 127a9148abdSDoug Rabson gss_OID nm_mech_oid; /* OID of selected GSS-API mechanism */ 128a9148abdSDoug Rabson #endif 1291bf87204SAlfred Perlstein 1301bf87204SAlfred Perlstein /* NFSv4 */ 1311bf87204SAlfred Perlstein uint64_t nm_clientid; 1321bf87204SAlfred Perlstein fsid_t nm_fsid; 1331bf87204SAlfred Perlstein u_int nm_lease_time; 1341bf87204SAlfred Perlstein time_t nm_last_renewal; 135df8bae1dSRodney W. Grimes }; 136df8bae1dSRodney W. Grimes 137c4473420SPeter Wemm #if defined(_KERNEL) 138df8bae1dSRodney W. Grimes /* 139df8bae1dSRodney W. Grimes * Convert mount ptr to nfsmount ptr. 140df8bae1dSRodney W. Grimes */ 141df8bae1dSRodney W. Grimes #define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data)) 142f438ae02SDoug Rabson 143c713aaaeSAlfred Perlstein #ifndef NFS_TPRINTF_INITIAL_DELAY 144c713aaaeSAlfred Perlstein #define NFS_TPRINTF_INITIAL_DELAY 12 145c713aaaeSAlfred Perlstein #endif 146c713aaaeSAlfred Perlstein 147c713aaaeSAlfred Perlstein #ifndef NFS_TPRINTF_DELAY 148c713aaaeSAlfred Perlstein #define NFS_TPRINTF_DELAY 30 149c713aaaeSAlfred Perlstein #endif 150c713aaaeSAlfred Perlstein 151c4473420SPeter Wemm #endif 152df8bae1dSRodney W. Grimes 15333420ec6SPaul Richards #endif 154