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