nfs_var.h revision 1.3 1 1.3 fvdl /* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */
2 1.1 christos
3 1.1 christos /*
4 1.1 christos * Copyright (c) 1996 Christos Zoulas. All rights reserved.
5 1.1 christos *
6 1.1 christos * Redistribution and use in source and binary forms, with or without
7 1.1 christos * modification, are permitted provided that the following conditions
8 1.1 christos * are met:
9 1.1 christos * 1. Redistributions of source code must retain the above copyright
10 1.1 christos * notice, this list of conditions and the following disclaimer.
11 1.1 christos * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 christos * notice, this list of conditions and the following disclaimer in the
13 1.1 christos * documentation and/or other materials provided with the distribution.
14 1.1 christos * 3. All advertising materials mentioning features or use of this software
15 1.1 christos * must display the following acknowledgement:
16 1.1 christos * This product includes software developed by Christos Zoulas.
17 1.1 christos * 4. The name of the author may not be used to endorse or promote products
18 1.1 christos * derived from this software without specific prior written permission.
19 1.1 christos *
20 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1 christos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1 christos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1 christos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 christos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1 christos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1 christos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 christos */
31 1.1 christos
32 1.3 fvdl /*
33 1.3 fvdl * XXX needs <nfs/rpcv2.h> and <nfs/nfs.h> because of typedefs
34 1.3 fvdl */
35 1.3 fvdl
36 1.1 christos struct vnode;
37 1.1 christos struct uio;
38 1.1 christos struct ucred;
39 1.1 christos struct proc;
40 1.1 christos struct buf;
41 1.1 christos struct nfs_diskless;
42 1.1 christos struct sockaddr_in;
43 1.1 christos struct nfs_dlmount;
44 1.1 christos struct vnode;
45 1.1 christos struct nfsd;
46 1.1 christos struct mbuf;
47 1.1 christos struct file;
48 1.1 christos struct nqlease;
49 1.1 christos struct nqhost;
50 1.1 christos struct nfssvc_sock;
51 1.1 christos struct nfsmount;
52 1.1 christos struct socket;
53 1.1 christos struct nfsreq;
54 1.1 christos struct vattr;
55 1.1 christos struct nameidata;
56 1.1 christos struct nfsnode;
57 1.1 christos struct sillyrename;
58 1.1 christos struct componentname;
59 1.2 christos struct nfsd_srvargs;
60 1.3 fvdl struct nfsrv_descript;
61 1.3 fvdl struct nfs_fattr;
62 1.1 christos
63 1.1 christos /* nfs_bio.c */
64 1.1 christos int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *));
65 1.3 fvdl int nfs_write __P((void *));
66 1.1 christos struct buf *nfs_getcacheblk __P((struct vnode *, daddr_t, int, struct proc *));
67 1.1 christos int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
68 1.1 christos int));
69 1.1 christos int nfs_asyncio __P((struct buf *, struct ucred *));
70 1.1 christos int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
71 1.1 christos
72 1.1 christos /* nfs_boot.c */
73 1.1 christos int nfs_boot_init __P((struct nfs_diskless *, struct proc *));
74 1.1 christos int nfs_boot_init __P((struct nfs_diskless *, struct proc *));
75 1.1 christos
76 1.1 christos /* nfs_node.c */
77 1.1 christos void nfs_nhinit __P((void));
78 1.3 fvdl u_long nfs_hash __P((nfsfh_t *, int));
79 1.3 fvdl int nfs_nget __P((struct mount *, nfsfh_t *, int, struct nfsnode **));
80 1.3 fvdl int nfs_inactive __P((void *));
81 1.3 fvdl int nfs_reclaim __P((void *));
82 1.3 fvdl int nfs_lock __P((void *));
83 1.3 fvdl int nfs_unlock __P((void *));
84 1.3 fvdl int nfs_islocked __P((void *));
85 1.3 fvdl int nfs_abortop __P((void *));
86 1.1 christos
87 1.1 christos /* nfs_vnops.c */
88 1.1 christos int nfs_null __P((struct vnode *, struct ucred *, struct proc *));
89 1.3 fvdl int nfs_access __P((void *));
90 1.3 fvdl int nfs_open __P((void *));
91 1.3 fvdl int nfs_close __P((void *));
92 1.3 fvdl int nfs_getattr __P((void *));
93 1.3 fvdl int nfs_setattr __P((void *));
94 1.3 fvdl int nfs_setattrrpc __P((struct vnode *, struct vattr *, struct ucred *,
95 1.3 fvdl struct proc *));
96 1.3 fvdl int nfs_lookup __P((void *));
97 1.3 fvdl int nfs_read __P((void *));
98 1.3 fvdl int nfs_readlink __P((void *));
99 1.1 christos int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
100 1.1 christos int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
101 1.3 fvdl int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
102 1.3 fvdl int *));
103 1.3 fvdl int nfs_mknodrpc __P((struct vnode *, struct vnode **, struct componentname *,
104 1.3 fvdl struct vattr *));
105 1.3 fvdl int nfs_mknod __P((void *));
106 1.3 fvdl int nfs_create __P((void *));
107 1.3 fvdl int nfs_remove __P((void *));
108 1.1 christos int nfs_removeit __P((struct sillyrename *));
109 1.3 fvdl int nfs_removerpc __P((struct vnode *, char *, int, struct ucred *,
110 1.3 fvdl struct proc *));
111 1.3 fvdl int nfs_rename __P((void *));
112 1.1 christos int nfs_renameit __P((struct vnode *, struct componentname *,
113 1.1 christos struct sillyrename *));
114 1.3 fvdl int nfs_renamerpc __P((struct vnode *, char *, int, struct vnode *, char *, int,
115 1.3 fvdl struct ucred *, struct proc *));
116 1.3 fvdl int nfs_link __P((void *));
117 1.3 fvdl int nfs_symlink __P((void *));
118 1.3 fvdl int nfs_mkdir __P((void *));
119 1.3 fvdl int nfs_rmdir __P((void *));
120 1.3 fvdl int nfs_readdir __P((void *));
121 1.1 christos int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
122 1.3 fvdl int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
123 1.1 christos int nfs_sillyrename __P((struct vnode *, struct vnode *,
124 1.1 christos struct componentname *));
125 1.3 fvdl int nfs_lookitup __P((struct vnode *, char *, int, struct ucred *,
126 1.3 fvdl struct proc *, struct nfsnode **));
127 1.3 fvdl int nfs_commit __P((struct vnode *, u_quad_t, int, struct ucred *,
128 1.3 fvdl struct proc *));
129 1.3 fvdl int nfs_bmap __P((void *));
130 1.3 fvdl int nfs_strategy __P((void *));
131 1.3 fvdl int nfs_mmap __P((void *));
132 1.3 fvdl int nfs_fsync __P((void *));
133 1.3 fvdl int nfs_flush __P((struct vnode *, struct ucred *, int, struct proc *, int));
134 1.3 fvdl int nfs_pathconf __P((void *));
135 1.3 fvdl int nfs_advlock __P((void *));
136 1.3 fvdl int nfs_print __P((void *));
137 1.3 fvdl int nfs_blkatoff __P((void *));
138 1.3 fvdl int nfs_valloc __P((void *));
139 1.3 fvdl int nfs_vfree __P((void *));
140 1.3 fvdl int nfs_truncate __P((void *));
141 1.3 fvdl int nfs_update __P((void *));
142 1.3 fvdl int nfs_bwrite __P((void *));
143 1.3 fvdl int nfs_writebp __P((struct buf *, int));
144 1.3 fvdl int nfsspec_access __P((void *));
145 1.3 fvdl int nfsspec_read __P((void *));
146 1.3 fvdl int nfsspec_write __P((void *));
147 1.3 fvdl int nfsspec_close __P((void *));
148 1.3 fvdl int nfsfifo_read __P((void *));
149 1.3 fvdl int nfsfifo_write __P((void *));
150 1.3 fvdl int nfsfifo_close __P((void *));
151 1.1 christos
152 1.1 christos /* nfs_nqlease.c */
153 1.3 fvdl void nqnfs_lease_updatetime __P((int));
154 1.3 fvdl void nqnfs_clientlease __P((struct nfsmount *, struct nfsnode *, int, int,
155 1.3 fvdl time_t, u_quad_t));
156 1.3 fvdl void nqsrv_locklease __P((struct nqlease *));
157 1.3 fvdl void nqsrv_unlocklease __P((struct nqlease *));
158 1.3 fvdl int nqsrv_getlease __P((struct vnode *, u_int32_t *, int, struct nfssvc_sock *,
159 1.3 fvdl struct proc *, struct mbuf *, int *, u_quad_t *,
160 1.3 fvdl struct ucred *));
161 1.3 fvdl int nqnfs_vop_lease_check __P((void *));
162 1.1 christos void nqsrv_addhost __P((struct nqhost *, struct nfssvc_sock *, struct mbuf *));
163 1.3 fvdl void nqsrv_instimeq __P((struct nqlease *, u_int32_t));
164 1.1 christos int nqsrv_cmpnam __P((struct nfssvc_sock *, struct mbuf *, struct nqhost *));
165 1.1 christos void nqsrv_send_eviction __P((struct vnode *, struct nqlease *,
166 1.1 christos struct nfssvc_sock *, struct mbuf *,
167 1.1 christos struct ucred *));
168 1.1 christos void nqsrv_waitfor_expiry __P((struct nqlease *));
169 1.1 christos void nqnfs_serverd __P((void));
170 1.3 fvdl int nqnfsrv_getlease __P((struct nfsrv_descript *, struct nfssvc_sock *,
171 1.3 fvdl struct proc *, struct mbuf **));
172 1.3 fvdl int nqnfsrv_vacated __P((struct nfsrv_descript *, struct nfssvc_sock *,
173 1.3 fvdl struct proc *, struct mbuf **));
174 1.1 christos int nqnfs_getlease __P((struct vnode *, int, struct ucred *, struct proc *));
175 1.1 christos int nqnfs_vacated __P((struct vnode *, struct ucred *));
176 1.1 christos int nqnfs_callback __P((struct nfsmount *, struct mbuf *, struct mbuf *,
177 1.3 fvdl caddr_t));
178 1.1 christos
179 1.1 christos /* nfs_serv.c */
180 1.3 fvdl int nfsrv3_access __P((struct nfsrv_descript *, struct nfssvc_sock *,
181 1.3 fvdl struct proc *, struct mbuf **));
182 1.3 fvdl int nfsrv_getattr __P((struct nfsrv_descript *, struct nfssvc_sock *,
183 1.3 fvdl struct proc *, struct mbuf **));
184 1.3 fvdl int nfsrv_setattr __P((struct nfsrv_descript *, struct nfssvc_sock *,
185 1.3 fvdl struct proc *, struct mbuf **));
186 1.3 fvdl int nfsrv_lookup __P((struct nfsrv_descript *, struct nfssvc_sock *,
187 1.3 fvdl struct proc *, struct mbuf **));
188 1.3 fvdl int nfsrv_readlink __P((struct nfsrv_descript *, struct nfssvc_sock *,
189 1.3 fvdl struct proc *, struct mbuf **));
190 1.3 fvdl int nfsrv_read __P((struct nfsrv_descript *, struct nfssvc_sock *,
191 1.3 fvdl struct proc *, struct mbuf **));
192 1.3 fvdl int nfsrv_write __P((struct nfsrv_descript *, struct nfssvc_sock *,
193 1.3 fvdl struct proc *, struct mbuf **));
194 1.3 fvdl int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
195 1.3 fvdl struct proc *, struct mbuf **));
196 1.3 fvdl void nfsrvw_coalesce __P((struct nfsrv_descript *, struct nfsrv_descript *));
197 1.3 fvdl int nfsrv_create __P((struct nfsrv_descript *, struct nfssvc_sock *,
198 1.3 fvdl struct proc *, struct mbuf **));
199 1.3 fvdl int nfsrv_mknod __P((struct nfsrv_descript *, struct nfssvc_sock *,
200 1.3 fvdl struct proc *, struct mbuf **));
201 1.3 fvdl int nfsrv_remove __P((struct nfsrv_descript *, struct nfssvc_sock *,
202 1.3 fvdl struct proc *, struct mbuf **));
203 1.3 fvdl int nfsrv_rename __P((struct nfsrv_descript *, struct nfssvc_sock *,
204 1.3 fvdl struct proc *, struct mbuf **));
205 1.3 fvdl int nfsrv_link __P((struct nfsrv_descript *, struct nfssvc_sock *,
206 1.3 fvdl struct proc *, struct mbuf **));
207 1.3 fvdl int nfsrv_symlink __P((struct nfsrv_descript *, struct nfssvc_sock *,
208 1.3 fvdl struct proc *, struct mbuf **));
209 1.3 fvdl int nfsrv_mkdir __P((struct nfsrv_descript *, struct nfssvc_sock *,
210 1.3 fvdl struct proc *, struct mbuf **));
211 1.3 fvdl int nfsrv_rmdir __P((struct nfsrv_descript *, struct nfssvc_sock *,
212 1.3 fvdl struct proc *, struct mbuf **));
213 1.3 fvdl int nfsrv_readdir __P((struct nfsrv_descript *, struct nfssvc_sock *,
214 1.3 fvdl struct proc *, struct mbuf **));
215 1.3 fvdl int nfsrv_readdirplus __P((struct nfsrv_descript *, struct nfssvc_sock *,
216 1.3 fvdl struct proc *, struct mbuf **));
217 1.3 fvdl int nfsrv_commit __P((struct nfsrv_descript *, struct nfssvc_sock *,
218 1.3 fvdl struct proc *, struct mbuf **));
219 1.3 fvdl int nfsrv_statfs __P((struct nfsrv_descript *, struct nfssvc_sock *,
220 1.3 fvdl struct proc *, struct mbuf **));
221 1.3 fvdl int nfsrv_fsinfo __P((struct nfsrv_descript *, struct nfssvc_sock *,
222 1.3 fvdl struct proc *, struct mbuf **));
223 1.3 fvdl int nfsrv_pathconf __P((struct nfsrv_descript *, struct nfssvc_sock *,
224 1.3 fvdl struct proc *, struct mbuf **));
225 1.3 fvdl int nfsrv_null __P((struct nfsrv_descript *, struct nfssvc_sock *,
226 1.3 fvdl struct proc *, struct mbuf **));
227 1.3 fvdl int nfsrv_noop __P((struct nfsrv_descript *, struct nfssvc_sock *,
228 1.3 fvdl struct proc *, struct mbuf **));
229 1.1 christos int nfsrv_access __P((struct vnode *, int, struct ucred *, int, struct proc *));
230 1.1 christos
231 1.1 christos /* nfs_socket.c */
232 1.1 christos int nfs_connect __P((struct nfsmount *, struct nfsreq *));
233 1.1 christos int nfs_reconnect __P((struct nfsreq *));
234 1.1 christos void nfs_disconnect __P((struct nfsmount *));
235 1.1 christos int nfs_send __P((struct socket *, struct mbuf *, struct mbuf *,
236 1.1 christos struct nfsreq *));
237 1.1 christos int nfs_receive __P((struct nfsreq *, struct mbuf **, struct mbuf **));
238 1.1 christos int nfs_reply __P((struct nfsreq *));
239 1.1 christos int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
240 1.1 christos struct ucred *, struct mbuf **, struct mbuf **,
241 1.1 christos caddr_t *));
242 1.3 fvdl int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
243 1.3 fvdl int, int, u_quad_t *, struct mbuf **, struct mbuf **, caddr_t *));
244 1.1 christos void nfs_timer __P((void *));
245 1.1 christos int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
246 1.1 christos int nfs_sndlock __P((int *, struct nfsreq *));
247 1.1 christos void nfs_sndunlock __P((int *));
248 1.1 christos int nfs_rcvlock __P((struct nfsreq *));
249 1.1 christos void nfs_rcvunlock __P((int *));
250 1.1 christos void nfs_realign __P((struct mbuf *, int));
251 1.3 fvdl int nfs_getreq __P((struct nfsrv_descript *, struct nfsd *, int));
252 1.3 fvdl int nfs_msg __P((struct proc *, char *, char *));
253 1.1 christos void nfsrv_rcv __P((struct socket *, caddr_t, int));
254 1.1 christos int nfsrv_getstream __P((struct nfssvc_sock *, int));
255 1.3 fvdl int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
256 1.3 fvdl struct nfsrv_descript **));
257 1.1 christos void nfsrv_wakenfsd __P((struct nfssvc_sock *));
258 1.1 christos
259 1.1 christos /* nfs_srvcache.c */
260 1.3 fvdl void nfsrv_initcache __P((void ));
261 1.3 fvdl int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
262 1.3 fvdl struct mbuf **));
263 1.3 fvdl void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
264 1.1 christos void nfsrv_cleancache __P((void));
265 1.1 christos
266 1.1 christos /* nfs_subs.c */
267 1.1 christos struct mbuf *nfsm_reqh __P((struct vnode *, u_long, int, caddr_t *));
268 1.3 fvdl struct mbuf *nfsm_rpchead __P((struct ucred *, int, int, int, int, char *, int,
269 1.3 fvdl char *, struct mbuf *, int, struct mbuf **,
270 1.1 christos u_int32_t *));
271 1.1 christos int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
272 1.1 christos int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
273 1.1 christos int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
274 1.1 christos int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
275 1.1 christos int nfsm_strtmbuf __P((struct mbuf **, char **, char *, long));
276 1.3 fvdl void nfs_init __P((void));
277 1.1 christos int nfs_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
278 1.1 christos struct vattr *));
279 1.1 christos int nfs_getattrcache __P((struct vnode *, struct vattr *));
280 1.1 christos int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *,
281 1.3 fvdl struct mbuf *, struct mbuf **, caddr_t *, struct vnode **,
282 1.3 fvdl struct proc *, int));
283 1.1 christos void nfsm_adj __P((struct mbuf *, int, int));
284 1.3 fvdl void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
285 1.3 fvdl struct vattr *, struct mbuf **, char **));
286 1.3 fvdl void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
287 1.3 fvdl struct mbuf **, char **));
288 1.3 fvdl void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
289 1.3 fvdl struct nfs_fattr *));
290 1.1 christos int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
291 1.3 fvdl struct nfssvc_sock *, struct mbuf *, int *, int));
292 1.1 christos int netaddr_match __P((int, union nethostaddr *, struct mbuf *));
293 1.3 fvdl nfsuint64 *nfs_getcookie __P((struct nfsnode *, off_t off, int));
294 1.3 fvdl void nfs_invaldir __P((struct vnode *));
295 1.3 fvdl void nfs_clearcommit __P((struct mount *));
296 1.3 fvdl int nfsrv_errmap __P((struct nfsrv_descript *, int));
297 1.3 fvdl void nfsrvw_sort __P((gid_t *, int));
298 1.3 fvdl void nfsrv_setcred __P((struct ucred *, struct ucred *));
299 1.1 christos
300 1.1 christos /* nfs_syscalls.c */
301 1.3 fvdl int sys_getfh __P((struct proc *, void *, register_t *));
302 1.3 fvdl int sys_nfssvc __P((struct proc *, void *, register_t *));
303 1.1 christos int nfssvc_addsock __P((struct file *, struct mbuf *));
304 1.1 christos int nfssvc_nfsd __P((struct nfsd_srvargs *, caddr_t, struct proc *));
305 1.1 christos void nfsrv_zapsock __P((struct nfssvc_sock *));
306 1.1 christos void nfsrv_slpderef __P((struct nfssvc_sock *));
307 1.1 christos void nfsrv_init __P((int));
308 1.1 christos int nfssvc_iod __P((struct proc *));
309 1.1 christos int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
310 1.3 fvdl char **, int *, char *, int *, NFSKERBKEY_T));
311 1.3 fvdl int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **, int *,
312 1.3 fvdl char *, int));
313 1.3 fvdl int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int, NFSKERBKEY_T,
314 1.3 fvdl struct mbuf **, char **, struct mbuf *));
315