FreeBSD/Linux Kernel Cross Reference
sys/nfs/nfsmount.h
1 /* $NetBSD: nfsmount.h,v 1.33.6.1 2005/09/26 20:31:03 tron Exp $ */
2
3 /*
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Rick Macklem at The University of Guelph.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)nfsmount.h 8.3 (Berkeley) 3/30/95
35 */
36
37
38 #ifndef _NFS_NFSMOUNT_H_
39 #define _NFS_NFSMOUNT_H_
40
41 /*
42 * Arguments to mount NFS
43 */
44 #define NFS_ARGSVERSION 3 /* change when nfs_args changes */
45 struct nfs_args {
46 int version; /* args structure version number */
47 struct sockaddr *addr; /* file server address */
48 int addrlen; /* length of address */
49 int sotype; /* Socket type */
50 int proto; /* and Protocol */
51 u_char *fh; /* File handle to be mounted */
52 int fhsize; /* Size, in bytes, of fh */
53 int flags; /* flags */
54 int wsize; /* write size in bytes */
55 int rsize; /* read size in bytes */
56 int readdirsize; /* readdir size in bytes */
57 int timeo; /* initial timeout in .1 secs */
58 int retrans; /* times to retry send */
59 int maxgrouplist; /* Max. size of group list */
60 int readahead; /* # of blocks to readahead */
61 int leaseterm; /* Term (sec) of lease */
62 int deadthresh; /* Retrans threshold */
63 char *hostname; /* server's name */
64 };
65
66 /*
67 * NFS mount option flags (nm_flag)
68 */
69 #define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
70 #define NFSMNT_WSIZE 0x00000002 /* set write size */
71 #define NFSMNT_RSIZE 0x00000004 /* set read size */
72 #define NFSMNT_TIMEO 0x00000008 /* set initial timeout */
73 #define NFSMNT_RETRANS 0x00000010 /* set number of request retries */
74 #define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */
75 #define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
76 #define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
77 #define NFSMNT_NQNFS 0x00000100 /* Use Nqnfs protocol */
78 #define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */
79 #define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */
80 #define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */
81 #define NFSMNT_LEASETERM 0x00001000 /* set lease term (nqnfs) */
82 #define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
83 #define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */
84 #define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
85 #define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
86 #define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
87 #define NFSMNT_XLATECOOKIE 0x00040000 /* 32<->64 dir cookie xlation */
88 #define NFSMNT_NOAC 0x00080000 /* Turn off attribute cache */
89
90 #define NFSMNT_BITS "\177\2" \
91 "b\00soft\0b\01wsize\0b\02rsize\0b\03timeo\0" \
92 "b\04retrans\0b\05maxgrps\0b\06intr\0b\07noconn\0" \
93 "b\10nqnfs\0b\11nfsv3\0b\12kerb\0b\13dumbtimr\0" \
94 "b\14leaseterm\0b\15readahead\0b\16deadthresh\0b\17resvport\0" \
95 "b\20rdirplus\0b\21readdirsize\0b\22xlatecookie\0b\23noac\0"
96
97 /*
98 * NFS internal flags (nm_iflag) */
99
100 #define NFSMNT_HASWRITEVERF 0x00000001 /* Has write verifier for V3 */
101 #define NFSMNT_GOTPATHCONF 0x00000002 /* Got the V3 pathconf info */
102 #define NFSMNT_GOTFSINFO 0x00000004 /* Got the V3 fsinfo */
103 #define NFSMNT_MNTD 0x00000008 /* Mnt server for mnt point */
104 #define NFSMNT_DISMINPROG 0x00000010 /* Dismount in progress */
105 #define NFSMNT_DISMNT 0x00000020 /* Dismounted */
106 #define NFSMNT_SNDLOCK 0x00000040 /* Send socket lock */
107 #define NFSMNT_WANTSND 0x00000080 /* Want above */
108 #define NFSMNT_RCVLOCK 0x00000100 /* Rcv socket lock */
109 #define NFSMNT_WANTRCV 0x00000200 /* Want above */
110 #define NFSMNT_WAITAUTH 0x00000400 /* Wait for authentication */
111 #define NFSMNT_HASAUTH 0x00000800 /* Has authenticator */
112 #define NFSMNT_WANTAUTH 0x00001000 /* Wants an authenticator */
113 #define NFSMNT_AUTHERR 0x00002000 /* Authentication error */
114 #define NFSMNT_SWAPCOOKIE 0x00004000 /* XDR encode dir cookies */
115 #define NFSMNT_STALEWRITEVERF 0x00008000 /* Write verifier is changing */
116 #define NFSMNT_WCCKLUDGE 0x00010000 /* see nfs_check_wccdata() */
117
118 #ifdef _KERNEL
119 /*
120 * Mount structure.
121 * One allocated on every NFS mount.
122 * Holds NFS specific information for mount.
123 */
124 struct nfsmount {
125 struct simplelock nm_slock; /* Lock for this structure */
126 int nm_flag; /* Flags for soft/hard... */
127 struct mount *nm_mountp; /* Vfs structure for this filesystem */
128 int nm_numgrps; /* Max. size of groupslist */
129 struct vnode *nm_vnode;
130 struct socket *nm_so; /* Rpc socket */
131 int nm_sotype; /* Type of socket */
132 int nm_soproto; /* and protocol */
133 int nm_soflags; /* pr_flags for socket protocol */
134 struct mbuf *nm_nam; /* Addr of server */
135 int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */
136 int nm_retry; /* Max retries */
137 int nm_srtt[4]; /* Timers for rpcs */
138 int nm_sdrtt[4];
139 int nm_sent; /* Request send count */
140 int nm_cwnd; /* Request send window */
141 int nm_timeouts; /* Request timeouts */
142 int nm_deadthresh; /* Threshold of timeouts-->dead server*/
143 int nm_rsize; /* Max size of read rpc */
144 int nm_wsize; /* Max size of write rpc */
145 int nm_readdirsize; /* Size of a readdir rpc */
146 int nm_readahead; /* Num. of blocks to readahead */
147 int nm_leaseterm; /* Term (sec) for NQNFS lease */
148 CIRCLEQ_HEAD(, nfsnode) nm_timerhead; /* Head of lease timer queue */
149 struct vnode *nm_inprog; /* Vnode in prog by nqnfs_clientd() */
150 uid_t nm_authuid; /* Uid for authenticator */
151 int nm_authtype; /* Authenticator type */
152 int nm_authlen; /* and length */
153 char *nm_authstr; /* Authenticator string */
154 char *nm_verfstr; /* and the verifier */
155 int nm_verflen;
156 struct lock nm_writeverflock; /* lock for below */
157 u_char nm_writeverf[NFSX_V3WRITEVERF]; /* V3 write verifier */
158 NFSKERBKEY_T nm_key; /* and the session key */
159 int nm_numuids; /* Number of nfsuid mappings */
160 TAILQ_HEAD(, nfsuid) nm_uidlruhead; /* Lists of nfsuid mappings */
161 LIST_HEAD(, nfsuid) nm_uidhashtbl[NFS_MUIDHASHSIZ];
162 TAILQ_HEAD(, buf) nm_bufq; /* async io buffer queue */
163 short nm_bufqlen; /* number of buffers in queue */
164 short nm_bufqwant; /* process wants to add to the queue */
165 int nm_bufqiods; /* number of iods processing queue */
166 u_int64_t nm_maxfilesize; /* maximum file size */
167 int nm_iflag; /* internal flags */
168 int nm_waiters; /* number of waiting listeners.. */
169 long nm_wcckludgetime; /* see nfs_check_wccdata() */
170 };
171
172 /*
173 * Convert mount ptr to nfsmount ptr.
174 */
175 #define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data))
176
177 /*
178 * Prototypes for NFS mount operations
179 */
180 int nfs_mount __P((struct mount *mp, const char *path, void *data,
181 struct nameidata *ndp, struct proc *p));
182 int mountnfs __P((struct nfs_args *argp, struct mount *mp,
183 struct mbuf *nam, const char *pth, const char *hst,
184 struct vnode **vpp, struct proc *p));
185 int nfs_mountroot __P((void));
186 void nfs_decode_args __P((struct nfsmount *, struct nfs_args *,
187 struct proc *p));
188 int nfs_start __P((struct mount *mp, int flags, struct proc *p));
189 int nfs_unmount __P((struct mount *mp, int mntflags, struct proc *p));
190 int nfs_root __P((struct mount *mp, struct vnode **vpp));
191 int nfs_quotactl __P((struct mount *mp, int cmds, uid_t uid, void *arg,
192 struct proc *p));
193 int nfs_statvfs __P((struct mount *mp, struct statvfs *sbp, struct proc *p));
194 int nfs_sync __P((struct mount *mp, int waitfor, struct ucred *cred,
195 struct proc *p));
196 int nfs_vget __P((struct mount *, ino_t, struct vnode **));
197 int nfs_fhtovp __P((struct mount *mp, struct fid *fhp, struct vnode **vpp));
198 int nfs_checkexp __P((struct mount *mp, struct mbuf *nam, int *exflagsp,
199 struct ucred **credanonp));
200 int nfs_vptofh __P((struct vnode *vp, struct fid *fhp));
201 int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *,
202 struct proc *));
203 void nfs_vfs_init __P((void));
204 void nfs_vfs_reinit __P((void));
205 void nfs_vfs_done __P((void));
206
207 /*
208 * Prototypes for miscellaneous exported NFS functions.
209 */
210 void nfs_init __P((void));
211
212 #endif /* _KERNEL */
213
214 #endif
Cache object: 2b48e6d0227facb7f16145e1d5f492ae
|