1 /*	$OpenBSD: nfsmount.h,v 1.12 2003/06/02 23:28:20 millert Exp $	*/
2 /*	$NetBSD: nfsmount.h,v 1.10 1996/02/18 11:54:03 fvdl Exp $	*/
3 
4 /*
5  * Copyright (c) 1989, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * This code is derived from software contributed to Berkeley by
9  * Rick Macklem at The University of Guelph.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *	@(#)nfsmount.h	8.3 (Berkeley) 3/30/95
36  */
37 
38 
39 #ifndef _NFS_NFSMOUNT_H_
40 #define _NFS_NFSMOUNT_H_
41 
42 /*
43  * Mount structure.
44  * One allocated on every NFS mount.
45  * Holds NFS specific information for mount.
46  */
47 struct	nfsmount {
48 	int	nm_flag;		/* Flags for soft/hard... */
49 	struct	mount *nm_mountp;	/* Vfs structure for this filesystem */
50 	int	nm_numgrps;		/* Max. size of groupslist */
51 	u_char	nm_fh[NFSX_V3FHMAX];	/* File handle of root dir */
52 	int	nm_fhsize;		/* Size of root file handle */
53 	struct	socket *nm_so;		/* Rpc socket */
54 	int	nm_sotype;		/* Type of socket */
55 	int	nm_soproto;		/* and protocol */
56 	int	nm_soflags;		/* pr_flags for socket protocol */
57 	struct	mbuf *nm_nam;		/* Addr of server */
58 	int	nm_timeo;		/* Init timer for NFSMNT_DUMBTIMR */
59 	int	nm_retry;		/* Max retries */
60 	int	nm_srtt[4];		/* Timers for rpcs */
61 	int	nm_sdrtt[4];
62 	int	nm_sent;		/* Request send count */
63 	int	nm_cwnd;		/* Request send window */
64 	int	nm_timeouts;		/* Request timeouts */
65 	int	nm_deadthresh;		/* Threshold of timeouts-->dead server*/
66 	int	nm_rsize;		/* Max size of read rpc */
67 	int	nm_wsize;		/* Max size of write rpc */
68 	int	nm_readdirsize;		/* Size of a readdir rpc */
69 	int	nm_readahead;		/* Num. of blocks to readahead */
70 	CIRCLEQ_HEAD(, nfsnode) nm_timerhead; /* Head of lease timer queue */
71 	struct vnode *nm_inprog;	/* Vnode in prog by nqnfs_clientd() */
72 	uid_t	nm_authuid;		/* Uid for authenticator */
73 	int	nm_authtype;		/* Authenticator type */
74 	int	nm_authlen;		/* and length */
75 	char	*nm_authstr;		/* Authenticator string */
76 	char	*nm_verfstr;		/* and the verifier */
77 	int	nm_verflen;
78 	u_char	nm_verf[NFSX_V3WRITEVERF]; /* V3 write verifier */
79 	NFSKERBKEY_T nm_key;		/* and the session key */
80 	int	nm_numuids;		/* Number of nfsuid mappings */
81 	TAILQ_HEAD(, nfsuid) nm_uidlruhead; /* Lists of nfsuid mappings */
82 	LIST_HEAD(, nfsuid) nm_uidhashtbl[NFS_MUIDHASHSIZ];
83 	u_short	nm_acregmin;		/* Attr cache file recently modified */
84 	u_short	nm_acregmax;		/* ac file not recently modified */
85 	u_short	nm_acdirmin;		/* ac for dir recently modified */
86 	u_short	nm_acdirmax;		/* ac for dir not recently modified */
87 };
88 
89 #ifdef _KERNEL
90 /*
91  * Convert mount ptr to nfsmount ptr.
92  */
93 #define VFSTONFS(mp)	((struct nfsmount *)((mp)->mnt_data))
94 #endif /* _KERNEL */
95 
96 /*
97  * Prototypes for NFS mount operations
98  */
99 int	nfs_mount(struct mount *mp, const char *path, void *data,
100 		struct nameidata *ndp, struct proc *p);
101 int	mountnfs(struct nfs_args *argp, struct mount *mp,
102 		struct mbuf *nam, char *pth, char *hst);
103 int	nfs_mountroot(void);
104 void	nfs_decode_args(struct nfsmount *, struct nfs_args *, struct nfs_args *);
105 int	nfs_start(struct mount *mp, int flags, struct proc *p);
106 int	nfs_unmount(struct mount *mp, int mntflags, struct proc *p);
107 int	nfs_root(struct mount *mp, struct vnode **vpp);
108 int	nfs_quotactl(struct mount *mp, int cmds, uid_t uid, caddr_t arg,
109 		struct proc *p);
110 int	nfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p);
111 int	nfs_sync(struct mount *mp, int waitfor, struct ucred *cred,
112 		struct proc *p);
113 int	nfs_vget(struct mount *, ino_t, struct vnode **);
114 int	nfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp);
115 int	nfs_vptofh(struct vnode *vp, struct fid *fhp);
116 int	nfs_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,
117 			struct proc *);
118 void	nfs_init(void);
119 
120 #endif
121