1 /* $OpenBSD: nfsmount.h,v 1.14 2007/06/13 18:05:27 thib 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 uid_t nm_authuid; /* Uid for authenticator */
71 int nm_authtype; /* Authenticator type */
72 int nm_authlen; /* and length */
73 char *nm_authstr; /* Authenticator string */
74 char *nm_verfstr; /* and the verifier */
75 int nm_verflen;
76 u_char nm_verf[NFSX_V3WRITEVERF]; /* V3 write verifier */
77 NFSKERBKEY_T nm_key; /* and the session key */
78 int nm_numuids; /* Number of nfsuid mappings */
79 TAILQ_HEAD(, nfsuid) nm_uidlruhead; /* Lists of nfsuid mappings */
80 LIST_HEAD(, nfsuid) nm_uidhashtbl[NFS_MUIDHASHSIZ];
81 u_short nm_acregmin; /* Attr cache file recently modified */
82 u_short nm_acregmax; /* ac file not recently modified */
83 u_short nm_acdirmin; /* ac for dir recently modified */
84 u_short nm_acdirmax; /* ac for dir not recently modified */
85 };
86
87 #ifdef _KERNEL
88 /*
89 * Convert mount ptr to nfsmount ptr.
90 */
91 #define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data))
92 #endif /* _KERNEL */
93
94 /*
95 * Prototypes for NFS mount operations
96 */
97 int nfs_mount(struct mount *mp, const char *path, void *data,
98 struct nameidata *ndp, struct proc *p);
99 int mountnfs(struct nfs_args *argp, struct mount *mp,
100 struct mbuf *nam, char *pth, char *hst);
101 int nfs_mountroot(void);
102 void nfs_decode_args(struct nfsmount *, struct nfs_args *, struct nfs_args *);
103 int nfs_start(struct mount *mp, int flags, struct proc *p);
104 int nfs_unmount(struct mount *mp, int mntflags, struct proc *p);
105 int nfs_root(struct mount *mp, struct vnode **vpp);
106 int nfs_quotactl(struct mount *mp, int cmds, uid_t uid, caddr_t arg,
107 struct proc *p);
108 int nfs_statfs(struct mount *mp, struct statfs *sbp, struct proc *p);
109 int nfs_sync(struct mount *mp, int waitfor, struct ucred *cred,
110 struct proc *p);
111 int nfs_vget(struct mount *, ino_t, struct vnode **);
112 int nfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp);
113 int nfs_vptofh(struct vnode *vp, struct fid *fhp);
114 int nfs_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,
115 struct proc *);
116 void nfs_init(void);
117
118 #endif