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