xref: /freebsd/sys/nfsclient/nfsmount.h (revision 29363fb446372cb3f10bc98664e9767c53fbb457)
1c398230bSWarner Losh /*-
2*51369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*51369649SPedro F. Giffuni  *
4df8bae1dSRodney W. Grimes  * Copyright (c) 1989, 1993
5df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
6df8bae1dSRodney W. Grimes  *
7df8bae1dSRodney W. Grimes  * This code is derived from software contributed to Berkeley by
8df8bae1dSRodney W. Grimes  * Rick Macklem at The University of Guelph.
9df8bae1dSRodney W. Grimes  *
10df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
11df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
12df8bae1dSRodney W. Grimes  * are met:
13df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
14df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
15df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
16df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
17df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
18fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
19df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
20df8bae1dSRodney W. Grimes  *    without specific prior written permission.
21df8bae1dSRodney W. Grimes  *
22df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
33df8bae1dSRodney W. Grimes  */
34df8bae1dSRodney W. Grimes 
35eb25edbdSPeter Wemm #ifndef _NFSCLIENT_NFSMOUNT_H_
36eb25edbdSPeter Wemm #define _NFSCLIENT_NFSMOUNT_H_
3733420ec6SPaul Richards 
38ca27c028SRick Macklem #include <sys/socket.h>
39ca27c028SRick Macklem 
40ca27c028SRick Macklem #include <nfs/nfs_mountcommon.h>
41ca27c028SRick Macklem 
42a9148abdSDoug Rabson #include <rpc/types.h>
43a9148abdSDoug Rabson #include <rpc/auth.h>
44a9148abdSDoug Rabson #include <rpc/clnt.h>
45a9148abdSDoug Rabson #include <rpc/rpcsec_gss.h>
46a9148abdSDoug Rabson 
47df8bae1dSRodney W. Grimes /*
48df8bae1dSRodney W. Grimes  * Mount structure.
49df8bae1dSRodney W. Grimes  * One allocated on every NFS mount.
50df8bae1dSRodney W. Grimes  * Holds NFS specific information for mount.
51df8bae1dSRodney W. Grimes  */
52df8bae1dSRodney W. Grimes struct	nfsmount {
53ca27c028SRick Macklem 	struct	nfsmount_common nm_com;	/* Common fields for nlm */
54df8bae1dSRodney W. Grimes 	int	nm_numgrps;		/* Max. size of groupslist */
551bf87204SAlfred Perlstein 	u_char	nm_fh[NFSX_V4FH];	/* File handle of root dir */
56a62dc406SDoug Rabson 	int	nm_fhsize;		/* Size of root file handle */
57df8bae1dSRodney W. Grimes 	int	nm_sotype;		/* Type of socket */
58df8bae1dSRodney W. Grimes 	int	nm_soproto;		/* and protocol */
59df8bae1dSRodney W. Grimes 	int	nm_soflags;		/* pr_flags for socket protocol */
6057bf258eSGarrett Wollman 	struct	sockaddr *nm_nam;	/* Addr of server */
61df8bae1dSRodney W. Grimes 	int	nm_deadthresh;		/* Threshold of timeouts-->dead server*/
62df8bae1dSRodney W. Grimes 	int	nm_rsize;		/* Max size of read rpc */
63df8bae1dSRodney W. Grimes 	int	nm_wsize;		/* Max size of write rpc */
64a62dc406SDoug Rabson 	int	nm_readdirsize;		/* Size of a readdir rpc */
65df8bae1dSRodney W. Grimes 	int	nm_readahead;		/* Num. of blocks to readahead */
66cc3149b1SBrian Feldman 	int	nm_wcommitsize;		/* Max size of commit for write */
67fe6c0d45SPeter Wemm 	int	nm_acdirmin;		/* Directory attr cache min lifetime */
68fe6c0d45SPeter Wemm 	int	nm_acdirmax;		/* Directory attr cache max lifetime */
69fe6c0d45SPeter Wemm 	int	nm_acregmin;		/* Reg file attr cache min lifetime */
70fe6c0d45SPeter Wemm 	int	nm_acregmax;		/* Reg file attr cache max lifetime */
71a62dc406SDoug Rabson 	u_char	nm_verf[NFSX_V3WRITEVERF]; /* V3 write verifier */
72e3975643SJake Burkholder 	TAILQ_HEAD(, buf) nm_bufq;	/* async io buffer queue */
73f438ae02SDoug Rabson 	short	nm_bufqlen;		/* number of buffers in queue */
74f438ae02SDoug Rabson 	short	nm_bufqwant;		/* process wants to add to the queue */
75f438ae02SDoug Rabson 	int	nm_bufqiods;		/* number of iods processing queue */
767c1c33a7SPeter Wemm 	u_int64_t nm_maxfilesize;	/* maximum file size */
7790abe7f2SAlfred Perlstein 	struct nfs_rpcops *nm_rpcops;
78c713aaaeSAlfred Perlstein 	int	nm_tprintf_initial_delay;	/* initial delay */
79c713aaaeSAlfred Perlstein 	int	nm_tprintf_delay;		/* interval for messages */
80a9148abdSDoug Rabson 	int	nm_secflavor;		 /* auth flavor to use for rpc */
81a9148abdSDoug Rabson 	struct __rpc_client *nm_client;
82a9148abdSDoug Rabson 	struct rpc_timers nm_timers[NFS_MAX_TIMER]; /* RTT Timers for rpcs */
83a9148abdSDoug Rabson 	char	nm_principal[MNAMELEN];	/* GSS-API principal of server */
84a9148abdSDoug Rabson 	gss_OID	nm_mech_oid;		/* OID of selected GSS-API mechanism */
850b17c7beSJohn Baldwin 	int	nm_nametimeo;		/* timeout for +ve entries (sec) */
86f957b30dSRick Macklem 	int	nm_negnametimeo;	/* timeout for -ve entries (sec) */
871bf87204SAlfred Perlstein 
881bf87204SAlfred Perlstein 	/* NFSv4 */
891bf87204SAlfred Perlstein 	uint64_t nm_clientid;
901bf87204SAlfred Perlstein 	fsid_t	nm_fsid;
911bf87204SAlfred Perlstein 	u_int	nm_lease_time;
921bf87204SAlfred Perlstein 	time_t	nm_last_renewal;
93df8bae1dSRodney W. Grimes };
94df8bae1dSRodney W. Grimes 
95ca27c028SRick Macklem #define	nm_mtx		nm_com.nmcom_mtx
96ca27c028SRick Macklem #define	nm_flag		nm_com.nmcom_flag
97ca27c028SRick Macklem #define	nm_state	nm_com.nmcom_state
98ca27c028SRick Macklem #define	nm_mountp	nm_com.nmcom_mountp
99ca27c028SRick Macklem #define	nm_timeo	nm_com.nmcom_timeo
100ca27c028SRick Macklem #define	nm_retry	nm_com.nmcom_retry
101ca27c028SRick Macklem #define	nm_hostname	nm_com.nmcom_hostname
102ca27c028SRick Macklem #define	nm_getinfo	nm_com.nmcom_getinfo
10390305aa3SRick Macklem #define	nm_vinvalbuf	nm_com.nmcom_vinvalbuf
104ca27c028SRick Macklem 
105c4473420SPeter Wemm #if defined(_KERNEL)
106df8bae1dSRodney W. Grimes /*
107df8bae1dSRodney W. Grimes  * Convert mount ptr to nfsmount ptr.
108df8bae1dSRodney W. Grimes  */
109df8bae1dSRodney W. Grimes #define VFSTONFS(mp)	((struct nfsmount *)((mp)->mnt_data))
110f438ae02SDoug Rabson 
111c713aaaeSAlfred Perlstein #ifndef NFS_TPRINTF_INITIAL_DELAY
112c713aaaeSAlfred Perlstein #define NFS_TPRINTF_INITIAL_DELAY       12
113c713aaaeSAlfred Perlstein #endif
114c713aaaeSAlfred Perlstein 
115c713aaaeSAlfred Perlstein #ifndef NFS_TPRINTF_DELAY
116c713aaaeSAlfred Perlstein #define NFS_TPRINTF_DELAY               30
117c713aaaeSAlfred Perlstein #endif
118c713aaaeSAlfred Perlstein 
1190b17c7beSJohn Baldwin #ifndef NFS_DEFAULT_NAMETIMEO
1200b17c7beSJohn Baldwin #define NFS_DEFAULT_NAMETIMEO		60
1210b17c7beSJohn Baldwin #endif
1220b17c7beSJohn Baldwin 
123f957b30dSRick Macklem #ifndef NFS_DEFAULT_NEGNAMETIMEO
124f957b30dSRick Macklem #define NFS_DEFAULT_NEGNAMETIMEO	60
125f957b30dSRick Macklem #endif
126f957b30dSRick Macklem 
127c4473420SPeter Wemm #endif
128df8bae1dSRodney W. Grimes 
12933420ec6SPaul Richards #endif
130