xref: /netbsd-src/sys/nfs/nfs_var.h (revision 2a399c6883d870daece976daec6ffa7bb7f934ce)
1 /*	$NetBSD: nfs_var.h,v 1.11 1997/10/19 01:46:36 fvdl 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 struct nfsdircache;
63 
64 /* nfs_bio.c */
65 int nfs_bioread __P((struct vnode *, struct uio *, int, struct ucred *, int));
66 struct buf *nfs_getcacheblk __P((struct vnode *, daddr_t, int, struct proc *));
67 int nfs_vinvalbuf __P((struct vnode *, int, struct ucred *, struct proc *,
68 		       int));
69 int nfs_asyncio __P((struct buf *, struct ucred *));
70 int nfs_doio __P((struct buf *, struct ucred *, struct proc *));
71 
72 /* nfs_boot.c */
73 /* see nfsdiskless.h */
74 
75 /* nfs_node.c */
76 void nfs_nhinit __P((void));
77 u_long nfs_hash __P((nfsfh_t *, int));
78 int nfs_nget __P((struct mount *, nfsfh_t *, int, struct nfsnode **));
79 
80 /* nfs_vnops.c */
81 int nfs_null __P((struct vnode *, struct ucred *, struct proc *));
82 int nfs_setattrrpc __P((struct vnode *, struct vattr *, struct ucred *,
83 			struct proc *));
84 int nfs_readlinkrpc __P((struct vnode *, struct uio *, struct ucred *));
85 int nfs_readrpc __P((struct vnode *, struct uio *, struct ucred *));
86 int nfs_writerpc __P((struct vnode *, struct uio *, struct ucred *, int *,
87 		      int *));
88 int nfs_mknodrpc __P((struct vnode *, struct vnode **, struct componentname *,
89 		      struct vattr *));
90 int nfs_removeit __P((struct sillyrename *));
91 int nfs_removerpc __P((struct vnode *, const char *, int, struct ucred *,
92 		       struct proc *));
93 int nfs_renameit __P((struct vnode *, struct componentname *,
94 		      struct sillyrename *));
95 int nfs_renamerpc __P((struct vnode *, const char *, int, struct vnode *,
96 		       const char *, int, struct ucred *, struct proc *));
97 int nfs_readdirrpc __P((struct vnode *, struct uio *, struct ucred *));
98 int nfs_readdirplusrpc __P((struct vnode *, struct uio *, struct ucred *));
99 int nfs_sillyrename __P((struct vnode *, struct vnode *,
100 			 struct componentname *));
101 int nfs_lookitup __P((struct vnode *, const char *, int, struct ucred *,
102 		      struct proc *, struct nfsnode **));
103 int nfs_commit __P((struct vnode *, u_quad_t, int, struct ucred *,
104 		    struct proc *));
105 int nfs_flush __P((struct vnode *, struct ucred *, int, struct proc *, int));
106 int nfs_writebp __P((struct buf *, int));
107 
108 /* nfs_nqlease.c */
109 void nqnfs_lease_updatetime __P((int));
110 void nqnfs_clientlease __P((struct nfsmount *, struct nfsnode *, int, int,
111 			    time_t, u_quad_t));
112 void nqsrv_locklease __P((struct nqlease *));
113 void nqsrv_unlocklease __P((struct nqlease *));
114 int nqsrv_getlease __P((struct vnode *, u_int32_t *, int, struct nfssvc_sock *,
115 			struct proc *, struct mbuf *, int *, u_quad_t *,
116 			struct ucred *));
117 int nqnfs_vop_lease_check __P((void *));
118 void nqsrv_addhost __P((struct nqhost *, struct nfssvc_sock *, struct mbuf *));
119 void nqsrv_instimeq __P((struct nqlease *, u_int32_t));
120 int nqsrv_cmpnam __P((struct nfssvc_sock *, struct mbuf *, struct nqhost *));
121 void nqsrv_send_eviction __P((struct vnode *, struct nqlease *,
122 			      struct nfssvc_sock *, struct mbuf *,
123 			      struct ucred *));
124 void nqsrv_waitfor_expiry __P((struct nqlease *));
125 void nqnfs_serverd __P((void));
126 int nqnfsrv_getlease __P((struct nfsrv_descript *, struct nfssvc_sock *,
127 			  struct proc *, struct mbuf **));
128 int nqnfsrv_vacated __P((struct nfsrv_descript *, struct nfssvc_sock *,
129 			 struct proc *, struct mbuf **));
130 int nqnfs_getlease __P((struct vnode *, int, struct ucred *, struct proc *));
131 int nqnfs_vacated __P((struct vnode *, struct ucred *));
132 int nqnfs_callback __P((struct nfsmount *, struct mbuf *, struct mbuf *,
133 			caddr_t));
134 
135 /* nfs_serv.c */
136 int nfsrv3_access __P((struct nfsrv_descript *, struct nfssvc_sock *,
137 		       struct proc *, struct mbuf **));
138 int nfsrv_getattr __P((struct nfsrv_descript *, struct nfssvc_sock *,
139 		       struct proc *, struct mbuf **));
140 int nfsrv_setattr __P((struct nfsrv_descript *, struct nfssvc_sock *,
141 		       struct proc *, struct mbuf **));
142 int nfsrv_lookup __P((struct nfsrv_descript *, struct nfssvc_sock *,
143 		      struct proc *, struct mbuf **));
144 int nfsrv_readlink __P((struct nfsrv_descript *, struct nfssvc_sock *,
145 			struct proc *, struct mbuf **));
146 int nfsrv_read __P((struct nfsrv_descript *, struct nfssvc_sock *,
147 		    struct proc *, struct mbuf **));
148 int nfsrv_write __P((struct nfsrv_descript *, struct nfssvc_sock *,
149 		     struct proc *, struct mbuf **));
150 int nfsrv_writegather __P((struct nfsrv_descript **, struct nfssvc_sock *,
151 			   struct proc *, struct mbuf **));
152 void nfsrvw_coalesce __P((struct nfsrv_descript *, struct nfsrv_descript *));
153 int nfsrv_create __P((struct nfsrv_descript *, struct nfssvc_sock *,
154 		      struct proc *, struct mbuf **));
155 int nfsrv_mknod __P((struct nfsrv_descript *, struct nfssvc_sock *,
156 		     struct proc *, struct mbuf **));
157 int nfsrv_remove __P((struct nfsrv_descript *, struct nfssvc_sock *,
158 		      struct proc *, struct mbuf **));
159 int nfsrv_rename __P((struct nfsrv_descript *, struct nfssvc_sock *,
160 		      struct proc *, struct mbuf **));
161 int nfsrv_link __P((struct nfsrv_descript *, struct nfssvc_sock *,
162 		    struct proc *, struct mbuf **));
163 int nfsrv_symlink __P((struct nfsrv_descript *, struct nfssvc_sock *,
164 		       struct proc *, struct mbuf **));
165 int nfsrv_mkdir __P((struct nfsrv_descript *, struct nfssvc_sock *,
166 		     struct proc *, struct mbuf **));
167 int nfsrv_rmdir __P((struct nfsrv_descript *, struct nfssvc_sock *,
168 		     struct proc *, struct mbuf **));
169 int nfsrv_readdir __P((struct nfsrv_descript *, struct nfssvc_sock *,
170 		       struct proc *, struct mbuf **));
171 int nfsrv_readdirplus __P((struct nfsrv_descript *, struct nfssvc_sock *,
172 			   struct proc *, struct mbuf **));
173 int nfsrv_commit __P((struct nfsrv_descript *, struct nfssvc_sock *,
174 		      struct proc *, struct mbuf **));
175 int nfsrv_statfs __P((struct nfsrv_descript *, struct nfssvc_sock *,
176 		      struct proc *, struct mbuf **));
177 int nfsrv_fsinfo __P((struct nfsrv_descript *, struct nfssvc_sock *,
178 		      struct proc *, struct mbuf **));
179 int nfsrv_pathconf __P((struct nfsrv_descript *, struct nfssvc_sock *,
180 		        struct proc *, struct mbuf **));
181 int nfsrv_null __P((struct nfsrv_descript *, struct nfssvc_sock *,
182 		    struct proc *, struct mbuf **));
183 int nfsrv_noop __P((struct nfsrv_descript *, struct nfssvc_sock *,
184 		    struct proc *, struct mbuf **));
185 int nfsrv_access __P((struct vnode *, int, struct ucred *, int, struct proc *,
186 		      int));
187 
188 /* nfs_socket.c */
189 int nfs_connect __P((struct nfsmount *, struct nfsreq *));
190 int nfs_reconnect __P((struct nfsreq *));
191 void nfs_disconnect __P((struct nfsmount *));
192 int nfs_send __P((struct socket *, struct mbuf *, struct mbuf *,
193 		  struct nfsreq *));
194 int nfs_receive __P((struct nfsreq *, struct mbuf **, struct mbuf **));
195 int nfs_reply __P((struct nfsreq *));
196 int nfs_request __P((struct vnode *, struct mbuf *, int, struct proc *,
197 		     struct ucred *, struct mbuf **, struct mbuf **,
198 		     caddr_t *));
199 int nfs_rephead __P((int, struct nfsrv_descript *, struct nfssvc_sock *,
200 		     int, int, u_quad_t *, struct mbuf **, struct mbuf **,			     caddr_t *));
201 void nfs_timer __P((void *));
202 int nfs_sigintr __P((struct nfsmount *, struct nfsreq *, struct proc *));
203 int nfs_sndlock __P((int *, struct nfsreq *));
204 void nfs_sndunlock __P((int *));
205 int nfs_rcvlock __P((struct nfsreq *));
206 void nfs_rcvunlock __P((int *));
207 void nfs_realign __P((struct mbuf *, int));
208 int nfs_getreq __P((struct nfsrv_descript *, struct nfsd *, int));
209 int nfs_msg __P((struct proc *, char *, char *));
210 void nfsrv_rcv __P((struct socket *, caddr_t, int));
211 int nfsrv_getstream __P((struct nfssvc_sock *, int));
212 int nfsrv_dorec __P((struct nfssvc_sock *, struct nfsd *,
213 		     struct nfsrv_descript **));
214 void nfsrv_wakenfsd __P((struct nfssvc_sock *));
215 
216 /* nfs_srvcache.c */
217 void nfsrv_initcache __P((void ));
218 int nfsrv_getcache __P((struct nfsrv_descript *, struct nfssvc_sock *,
219 			struct mbuf **));
220 void nfsrv_updatecache __P((struct nfsrv_descript *, int, struct mbuf *));
221 void nfsrv_cleancache __P((void));
222 
223 /* nfs_subs.c */
224 struct mbuf *nfsm_reqh __P((struct vnode *, u_long, int, caddr_t *));
225 struct mbuf *nfsm_rpchead __P((struct ucred *, int, int, int, int, char *, int,
226 			       char *, struct mbuf *, int, struct mbuf **,
227 			       u_int32_t *));
228 int nfsm_mbuftouio __P((struct mbuf **, struct uio *, int, caddr_t *));
229 int nfsm_uiotombuf __P((struct uio *, struct mbuf **, int, caddr_t *));
230 int nfsm_disct __P((struct mbuf **, caddr_t *, int, int, caddr_t *));
231 int nfs_adv __P((struct mbuf **, caddr_t *, int, int));
232 int nfsm_strtmbuf __P((struct mbuf **, char **, const char *, long));
233 u_long nfs_dirhash __P((off_t));
234 void nfs_initdircache __P((struct vnode *));
235 struct nfsdircache *nfs_searchdircache __P((struct vnode *, off_t, int, int *));
236 struct nfsdircache *nfs_enterdircache __P((struct vnode *, off_t, off_t,						   daddr_t, int));
237 void nfs_invaldircache __P((struct vnode *, int));
238 void nfs_init __P((void));
239 int nfsm_loadattrcache __P((struct vnode **, struct mbuf **, caddr_t *,
240 			   struct vattr *));
241 int nfs_loadattrcache __P((struct vnode **, struct nfs_fattr *,
242 			   struct vattr *));
243 int nfs_getattrcache __P((struct vnode *, struct vattr *));
244 int nfs_namei __P((struct nameidata *, fhandle_t *, int, struct nfssvc_sock *,
245 		   struct mbuf *, struct mbuf **, caddr_t *, struct vnode **,
246 		   struct proc *, int, int));
247 void nfsm_adj __P((struct mbuf *, int, int));
248 void nfsm_srvwcc __P((struct nfsrv_descript *, int, struct vattr *, int,
249 		      struct vattr *, struct mbuf **, char **));
250 void nfsm_srvpostopattr __P((struct nfsrv_descript *, int, struct vattr *,
251 			     struct mbuf **, char **));
252 void nfsm_srvfattr __P((struct nfsrv_descript *, struct vattr *,
253 			struct nfs_fattr *));
254 int nfsrv_fhtovp __P((fhandle_t *, int, struct vnode **, struct ucred *,
255 		      struct nfssvc_sock *, struct mbuf *, int *, int, int));
256 int nfsrv_setpublicfs __P((struct mount *, struct netexport *,
257 			   struct export_args *));
258 int nfs_ispublicfh __P((fhandle_t *));
259 int netaddr_match __P((int, union nethostaddr *, struct mbuf *));
260 void nfs_clearcommit __P((struct mount *));
261 int nfsrv_errmap __P((struct nfsrv_descript *, int));
262 void nfsrvw_sort __P((gid_t *, int));
263 void nfsrv_setcred __P((struct ucred *, struct ucred *));
264 void nfs_cookieheuristic __P((struct vnode *, int *, struct proc *,
265 			      struct ucred *));
266 
267 /* nfs_syscalls.c */
268 int sys_getfh __P((struct proc *, void *, register_t *));
269 int sys_nfssvc __P((struct proc *, void *, register_t *));
270 int nfssvc_addsock __P((struct file *, struct mbuf *));
271 int nfssvc_nfsd __P((struct nfsd_srvargs *, caddr_t, struct proc *));
272 void nfsrv_zapsock __P((struct nfssvc_sock *));
273 void nfsrv_slpderef __P((struct nfssvc_sock *));
274 void nfsrv_init __P((int));
275 int nfssvc_iod __P((struct proc *));
276 int nfs_getauth __P((struct nfsmount *, struct nfsreq *, struct ucred *,
277 		     char **, int *, char *, int *, NFSKERBKEY_T));
278 int nfs_getnickauth __P((struct nfsmount *, struct ucred *, char **, int *,
279 			 char *, int));
280 int nfs_savenickauth __P((struct nfsmount *, struct ucred *, int, NFSKERBKEY_T,
281 			  struct mbuf **, char **, struct mbuf *));
282