xref: /freebsd/sys/fs/nfs/nfs_var.h (revision f01edb6f5d55fe093f8ab9c5da2b1707af698a56)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
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  * $FreeBSD$
35  */
36 
37 /*
38  * XXX needs <nfs/rpcv2.h> and <nfs/nfs.h> because of typedefs
39  */
40 
41 struct uio;
42 struct ucred;
43 struct nfscred;
44 NFSPROC_T;
45 struct buf;
46 struct sockaddr_in;
47 struct nfs_dlmount;
48 struct file;
49 struct nfsmount;
50 struct socket;
51 struct nfsreq;
52 struct nfssockreq;
53 struct vattr;
54 struct nameidata;
55 struct nfsnode;
56 struct nfsfh;
57 struct sillyrename;
58 struct componentname;
59 struct nfsd_srvargs;
60 struct nfsrv_descript;
61 struct nfs_fattr;
62 union nethostaddr;
63 struct nfsstate;
64 struct nfslock;
65 struct nfsclient;
66 struct nfslayout;
67 struct nfsdsession;
68 struct nfslockconflict;
69 struct nfsd_idargs;
70 struct nfsd_clid;
71 struct nfsusrgrp;
72 struct nfsclowner;
73 struct nfsclopen;
74 struct nfsclopenhead;
75 struct nfsclclient;
76 struct nfsclsession;
77 struct nfscllockowner;
78 struct nfscllock;
79 struct nfscldeleg;
80 struct nfscllayout;
81 struct nfscldevinfo;
82 struct nfsv4lock;
83 struct nfsvattr;
84 struct nfs_vattr;
85 struct NFSSVCARGS;
86 struct nfsdevice;
87 struct pnfsdsfile;
88 struct pnfsdsattr;
89 #ifdef __FreeBSD__
90 NFS_ACCESS_ARGS;
91 NFS_OPEN_ARGS;
92 NFS_GETATTR_ARGS;
93 NFS_LOOKUP_ARGS;
94 NFS_READDIR_ARGS;
95 #endif
96 
97 /* nfs_nfsdstate.c */
98 int nfsrv_setclient(struct nfsrv_descript *, struct nfsclient **,
99     nfsquad_t *, nfsquad_t *, NFSPROC_T *);
100 int nfsrv_getclient(nfsquad_t, int, struct nfsclient **, struct nfsdsession *,
101     nfsquad_t, uint32_t, struct nfsrv_descript *, NFSPROC_T *);
102 int nfsrv_destroyclient(nfsquad_t, NFSPROC_T *);
103 int nfsrv_destroysession(struct nfsrv_descript *, uint8_t *);
104 int nfsrv_bindconnsess(struct nfsrv_descript *, uint8_t *, int *);
105 int nfsrv_freestateid(struct nfsrv_descript *, nfsv4stateid_t *, NFSPROC_T *);
106 int nfsrv_teststateid(struct nfsrv_descript *, nfsv4stateid_t *, NFSPROC_T *);
107 int nfsrv_adminrevoke(struct nfsd_clid *, NFSPROC_T *);
108 void nfsrv_dumpclients(struct nfsd_dumpclients *, int);
109 void nfsrv_dumplocks(vnode_t, struct nfsd_dumplocks *, int, NFSPROC_T *);
110 int nfsrv_lockctrl(vnode_t, struct nfsstate **,
111     struct nfslock **, struct nfslockconflict *, nfsquad_t, nfsv4stateid_t *,
112     struct nfsexstuff *, struct nfsrv_descript *, NFSPROC_T *);
113 int nfsrv_openctrl(struct nfsrv_descript *, vnode_t,
114     struct nfsstate **, nfsquad_t, nfsv4stateid_t *, nfsv4stateid_t *,
115     u_int32_t *, struct nfsexstuff *, NFSPROC_T *, u_quad_t);
116 int nfsrv_opencheck(nfsquad_t, nfsv4stateid_t *, struct nfsstate *,
117     vnode_t, struct nfsrv_descript *, NFSPROC_T *, int);
118 int nfsrv_openupdate(vnode_t, struct nfsstate *, nfsquad_t,
119     nfsv4stateid_t *, struct nfsrv_descript *, NFSPROC_T *, int *);
120 int nfsrv_delegupdate(struct nfsrv_descript *, nfsquad_t, nfsv4stateid_t *,
121     vnode_t, int, struct ucred *, NFSPROC_T *, int *);
122 int nfsrv_releaselckown(struct nfsstate *, nfsquad_t, NFSPROC_T *);
123 void nfsrv_zapclient(struct nfsclient *, NFSPROC_T *);
124 int nfssvc_idname(struct nfsd_idargs *);
125 void nfsrv_servertimer(void);
126 int nfsrv_getclientipaddr(struct nfsrv_descript *, struct nfsclient *);
127 void nfsrv_setupstable(NFSPROC_T *);
128 void nfsrv_updatestable(NFSPROC_T *);
129 void nfsrv_writestable(u_char *, int, int, NFSPROC_T *);
130 void nfsrv_throwawayopens(NFSPROC_T *);
131 int nfsrv_checkremove(vnode_t, int, NFSPROC_T *);
132 void nfsd_recalldelegation(vnode_t, NFSPROC_T *);
133 void nfsd_disabledelegation(vnode_t, NFSPROC_T *);
134 int nfsrv_checksetattr(vnode_t, struct nfsrv_descript *,
135     nfsv4stateid_t *, struct nfsvattr *, nfsattrbit_t *, struct nfsexstuff *,
136     NFSPROC_T *);
137 int nfsrv_checkgetattr(struct nfsrv_descript *, vnode_t,
138     struct nfsvattr *, nfsattrbit_t *, NFSPROC_T *);
139 int nfsrv_nfsuserdport(struct nfsuserd_args *, NFSPROC_T *);
140 void nfsrv_nfsuserddelport(void);
141 void nfsrv_throwawayallstate(NFSPROC_T *);
142 int nfsrv_checksequence(struct nfsrv_descript *, uint32_t, uint32_t *,
143     uint32_t *, int, uint32_t *, NFSPROC_T *);
144 int nfsrv_checkreclaimcomplete(struct nfsrv_descript *, int);
145 void nfsrv_cache_session(uint8_t *, uint32_t, int, struct mbuf **);
146 void nfsrv_freeallbackchannel_xprts(void);
147 int nfsrv_layoutcommit(struct nfsrv_descript *, vnode_t, int, int, uint64_t,
148     uint64_t, uint64_t, int, struct timespec *, int, nfsv4stateid_t *,
149     int, char *, int *, uint64_t *, struct ucred *, NFSPROC_T *);
150 int nfsrv_layoutget(struct nfsrv_descript *, vnode_t, struct nfsexstuff *,
151     int, int *, uint64_t *, uint64_t *, uint64_t, nfsv4stateid_t *, int, int *,
152     int *, char *, struct ucred *, NFSPROC_T *);
153 void nfsrv_flexmirrordel(char *, NFSPROC_T *);
154 void nfsrv_recalloldlayout(NFSPROC_T *);
155 int nfsrv_layoutreturn(struct nfsrv_descript *, vnode_t, int, int, uint64_t,
156     uint64_t, int, int, nfsv4stateid_t *, int, uint32_t *, int *,
157     struct ucred *, NFSPROC_T *);
158 int nfsrv_getdevinfo(char *, int, uint32_t *, uint32_t *, int *, char **);
159 void nfsrv_freeonedevid(struct nfsdevice *);
160 void nfsrv_freealllayoutsanddevids(void);
161 void nfsrv_freefilelayouts(fhandle_t *);
162 int nfsrv_deldsserver(int, char *, NFSPROC_T *);
163 struct nfsdevice *nfsrv_deldsnmp(int, struct nfsmount *, NFSPROC_T *);
164 int nfsrv_createdevids(struct nfsd_nfsd_args *, NFSPROC_T *);
165 int nfsrv_checkdsattr(vnode_t, NFSPROC_T *);
166 int nfsrv_copymr(vnode_t, vnode_t, vnode_t, struct nfsdevice *,
167     struct pnfsdsfile *, struct pnfsdsfile *, int, struct ucred *, NFSPROC_T *);
168 int nfsrv_mdscopymr(char *, char *, char *, char *, int *, char *, NFSPROC_T *,
169     struct vnode **, struct vnode **, struct pnfsdsfile **, struct nfsdevice **,
170     struct nfsdevice **);
171 
172 /* nfs_nfsdserv.c */
173 int nfsrvd_access(struct nfsrv_descript *, int,
174     vnode_t, struct nfsexstuff *);
175 int nfsrvd_getattr(struct nfsrv_descript *, int,
176     vnode_t, struct nfsexstuff *);
177 int nfsrvd_setattr(struct nfsrv_descript *, int,
178     vnode_t, struct nfsexstuff *);
179 int nfsrvd_lookup(struct nfsrv_descript *, int,
180     vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *);
181 int nfsrvd_readlink(struct nfsrv_descript *, int,
182     vnode_t, struct nfsexstuff *);
183 int nfsrvd_read(struct nfsrv_descript *, int,
184     vnode_t, struct nfsexstuff *);
185 int nfsrvd_write(struct nfsrv_descript *, int,
186     vnode_t, struct nfsexstuff *);
187 int nfsrvd_create(struct nfsrv_descript *, int,
188     vnode_t, struct nfsexstuff *);
189 int nfsrvd_mknod(struct nfsrv_descript *, int,
190     vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *);
191 int nfsrvd_remove(struct nfsrv_descript *, int,
192     vnode_t, struct nfsexstuff *);
193 int nfsrvd_rename(struct nfsrv_descript *, int,
194     vnode_t, vnode_t, struct nfsexstuff *, struct nfsexstuff *);
195 int nfsrvd_link(struct nfsrv_descript *, int,
196     vnode_t, vnode_t, struct nfsexstuff *, struct nfsexstuff *);
197 int nfsrvd_symlink(struct nfsrv_descript *, int,
198     vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *);
199 int nfsrvd_mkdir(struct nfsrv_descript *, int,
200     vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *);
201 int nfsrvd_readdir(struct nfsrv_descript *, int,
202     vnode_t, struct nfsexstuff *);
203 int nfsrvd_readdirplus(struct nfsrv_descript *, int,
204     vnode_t, struct nfsexstuff *);
205 int nfsrvd_commit(struct nfsrv_descript *, int,
206     vnode_t, struct nfsexstuff *);
207 int nfsrvd_statfs(struct nfsrv_descript *, int,
208     vnode_t, struct nfsexstuff *);
209 int nfsrvd_fsinfo(struct nfsrv_descript *, int,
210     vnode_t, struct nfsexstuff *);
211 int nfsrvd_close(struct nfsrv_descript *, int,
212     vnode_t, struct nfsexstuff *);
213 int nfsrvd_delegpurge(struct nfsrv_descript *, int,
214     vnode_t, struct nfsexstuff *);
215 int nfsrvd_delegreturn(struct nfsrv_descript *, int,
216     vnode_t, struct nfsexstuff *);
217 int nfsrvd_getfh(struct nfsrv_descript *, int,
218     vnode_t, struct nfsexstuff *);
219 int nfsrvd_lock(struct nfsrv_descript *, int,
220     vnode_t, struct nfsexstuff *);
221 int nfsrvd_lockt(struct nfsrv_descript *, int,
222     vnode_t, struct nfsexstuff *);
223 int nfsrvd_locku(struct nfsrv_descript *, int,
224     vnode_t, struct nfsexstuff *);
225 int nfsrvd_openconfirm(struct nfsrv_descript *, int,
226     vnode_t, struct nfsexstuff *);
227 int nfsrvd_opendowngrade(struct nfsrv_descript *, int,
228     vnode_t, struct nfsexstuff *);
229 int nfsrvd_renew(struct nfsrv_descript *, int,
230     vnode_t, struct nfsexstuff *);
231 int nfsrvd_secinfo(struct nfsrv_descript *, int,
232     vnode_t, struct nfsexstuff *);
233 int nfsrvd_setclientid(struct nfsrv_descript *, int,
234     vnode_t, struct nfsexstuff *);
235 int nfsrvd_setclientidcfrm(struct nfsrv_descript *, int,
236     vnode_t, struct nfsexstuff *);
237 int nfsrvd_verify(struct nfsrv_descript *, int,
238     vnode_t, struct nfsexstuff *);
239 int nfsrvd_open(struct nfsrv_descript *, int,
240     vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *);
241 int nfsrvd_openattr(struct nfsrv_descript *, int,
242     vnode_t, vnode_t *, fhandle_t *, struct nfsexstuff *);
243 int nfsrvd_releaselckown(struct nfsrv_descript *, int,
244     vnode_t, struct nfsexstuff *);
245 int nfsrvd_pathconf(struct nfsrv_descript *, int,
246     vnode_t, struct nfsexstuff *);
247 int nfsrvd_exchangeid(struct nfsrv_descript *, int,
248     vnode_t, struct nfsexstuff *);
249 int nfsrvd_createsession(struct nfsrv_descript *, int,
250     vnode_t, struct nfsexstuff *);
251 int nfsrvd_sequence(struct nfsrv_descript *, int,
252     vnode_t, struct nfsexstuff *);
253 int nfsrvd_reclaimcomplete(struct nfsrv_descript *, int,
254     vnode_t, struct nfsexstuff *);
255 int nfsrvd_destroyclientid(struct nfsrv_descript *, int,
256     vnode_t, struct nfsexstuff *);
257 int nfsrvd_bindconnsess(struct nfsrv_descript *, int,
258     vnode_t, struct nfsexstuff *);
259 int nfsrvd_destroysession(struct nfsrv_descript *, int,
260     vnode_t, struct nfsexstuff *);
261 int nfsrvd_freestateid(struct nfsrv_descript *, int,
262     vnode_t, struct nfsexstuff *);
263 int nfsrvd_layoutget(struct nfsrv_descript *, int,
264     vnode_t, struct nfsexstuff *);
265 int nfsrvd_getdevinfo(struct nfsrv_descript *, int,
266     vnode_t, struct nfsexstuff *);
267 int nfsrvd_layoutcommit(struct nfsrv_descript *, int,
268     vnode_t, struct nfsexstuff *);
269 int nfsrvd_layoutreturn(struct nfsrv_descript *, int,
270     vnode_t, struct nfsexstuff *);
271 int nfsrvd_teststateid(struct nfsrv_descript *, int,
272     vnode_t, struct nfsexstuff *);
273 int nfsrvd_notsupp(struct nfsrv_descript *, int,
274     vnode_t, struct nfsexstuff *);
275 
276 /* nfs_nfsdsocket.c */
277 void nfsrvd_rephead(struct nfsrv_descript *);
278 void nfsrvd_dorpc(struct nfsrv_descript *, int, u_char *, int, u_int32_t);
279 
280 /* nfs_nfsdcache.c */
281 void nfsrvd_initcache(void);
282 int nfsrvd_getcache(struct nfsrv_descript *);
283 struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *);
284 void nfsrvd_sentcache(struct nfsrvcache *, int, uint32_t);
285 void nfsrvd_cleancache(void);
286 void nfsrvd_refcache(struct nfsrvcache *);
287 void nfsrvd_derefcache(struct nfsrvcache *);
288 void nfsrvd_delcache(struct nfsrvcache *);
289 void nfsrc_trimcache(uint64_t, uint32_t, int);
290 
291 /* nfs_commonsubs.c */
292 void nfscl_reqstart(struct nfsrv_descript *, int, struct nfsmount *,
293     u_int8_t *, int, u_int32_t **, struct nfsclsession *, int, int);
294 void nfsm_stateidtom(struct nfsrv_descript *, nfsv4stateid_t *, int);
295 void nfscl_fillsattr(struct nfsrv_descript *, struct vattr *,
296       vnode_t, int, u_int32_t);
297 void newnfs_init(void);
298 int nfsaddr_match(int, union nethostaddr *, NFSSOCKADDR_T);
299 int nfsaddr2_match(NFSSOCKADDR_T, NFSSOCKADDR_T);
300 int nfsm_strtom(struct nfsrv_descript *, const char *, int);
301 int nfsm_mbufuio(struct nfsrv_descript *, struct uio *, int);
302 int nfsm_fhtom(struct nfsrv_descript *, u_int8_t *, int, int);
303 int nfsm_advance(struct nfsrv_descript *, int, int);
304 void *nfsm_dissct(struct nfsrv_descript *, int, int);
305 void newnfs_trimleading(struct nfsrv_descript *);
306 void newnfs_trimtrailing(struct nfsrv_descript *, mbuf_t,
307     caddr_t);
308 void newnfs_copycred(struct nfscred *, struct ucred *);
309 void newnfs_copyincred(struct ucred *, struct nfscred *);
310 int nfsrv_dissectacl(struct nfsrv_descript *, NFSACL_T *, int *,
311     int *, NFSPROC_T *);
312 int nfsrv_getattrbits(struct nfsrv_descript *, nfsattrbit_t *, int *,
313     int *);
314 int nfsv4_loadattr(struct nfsrv_descript *, vnode_t,
315     struct nfsvattr *, struct nfsfh **, fhandle_t *, int,
316     struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *,
317     struct nfsfsinfo *, NFSACL_T *,
318     int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *);
319 int nfsv4_lock(struct nfsv4lock *, int, int *, void *, struct mount *);
320 void nfsv4_unlock(struct nfsv4lock *, int);
321 void nfsv4_relref(struct nfsv4lock *);
322 void nfsv4_getref(struct nfsv4lock *, int *, void *, struct mount *);
323 int nfsv4_getref_nonblock(struct nfsv4lock *);
324 int nfsv4_testlock(struct nfsv4lock *);
325 int nfsrv_mtostr(struct nfsrv_descript *, char *, int);
326 void nfsrv_cleanusergroup(void);
327 int nfsrv_checkutf8(u_int8_t *, int);
328 int newnfs_sndlock(int *);
329 void newnfs_sndunlock(int *);
330 int nfsv4_getipaddr(struct nfsrv_descript *, struct sockaddr_in *,
331     struct sockaddr_in6 *, sa_family_t *, int *);
332 int nfsv4_seqsession(uint32_t, uint32_t, uint32_t, struct nfsslot *,
333     struct mbuf **, uint16_t);
334 void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **);
335 void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *,
336     struct nfsclsession *, int);
337 int nfsv4_sequencelookup(struct nfsmount *, struct nfsclsession *, int *,
338     int *, uint32_t *, uint8_t *);
339 void nfsv4_freeslot(struct nfsclsession *, int);
340 struct ucred *nfsrv_getgrpscred(struct ucred *);
341 struct nfsdevice *nfsv4_findmirror(struct nfsmount *);
342 
343 /* nfs_clcomsubs.c */
344 void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int);
345 struct mbuf *nfsm_uiombuflist(struct uio *, int, struct mbuf **, char **);
346 nfsuint64 *nfscl_getcookie(struct nfsnode *, off_t off, int);
347 u_int8_t *nfscl_getmyip(struct nfsmount *, struct in6_addr *, int *);
348 int nfsm_getfh(struct nfsrv_descript *, struct nfsfh **);
349 int nfscl_mtofh(struct nfsrv_descript *, struct nfsfh **,
350         struct nfsvattr *, int *);
351 int nfscl_postop_attr(struct nfsrv_descript *, struct nfsvattr *, int *,
352     void *);
353 int nfscl_wcc_data(struct nfsrv_descript *, vnode_t,
354     struct nfsvattr *, int *, int *, void *);
355 int nfsm_loadattr(struct nfsrv_descript *, struct nfsvattr *);
356 int nfscl_request(struct nfsrv_descript *, vnode_t,
357          NFSPROC_T *, struct ucred *, void *);
358 
359 /* nfs_nfsdsubs.c */
360 void nfsd_fhtovp(struct nfsrv_descript *, struct nfsrvfh *, int,
361     vnode_t *, struct nfsexstuff *, mount_t *, int);
362 int nfsd_excred(struct nfsrv_descript *, struct nfsexstuff *, struct ucred *);
363 int nfsrv_mtofh(struct nfsrv_descript *, struct nfsrvfh *);
364 int nfsrv_putattrbit(struct nfsrv_descript *, nfsattrbit_t *);
365 void nfsrv_wcc(struct nfsrv_descript *, int, struct nfsvattr *, int,
366     struct nfsvattr *);
367 int nfsv4_fillattr(struct nfsrv_descript *, struct mount *, vnode_t, NFSACL_T *,
368     struct vattr *, fhandle_t *, int, nfsattrbit_t *,
369     struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t, struct statfs *);
370 void nfsrv_fillattr(struct nfsrv_descript *, struct nfsvattr *);
371 void nfsrv_adj(mbuf_t, int, int);
372 void nfsrv_postopattr(struct nfsrv_descript *, int, struct nfsvattr *);
373 int nfsd_errmap(struct nfsrv_descript *);
374 void nfsv4_uidtostr(uid_t, u_char **, int *);
375 int nfsv4_strtouid(struct nfsrv_descript *, u_char *, int, uid_t *);
376 void nfsv4_gidtostr(gid_t, u_char **, int *);
377 int nfsv4_strtogid(struct nfsrv_descript *, u_char *, int, gid_t *);
378 int nfsrv_checkuidgid(struct nfsrv_descript *, struct nfsvattr *);
379 void nfsrv_fixattr(struct nfsrv_descript *, vnode_t,
380     struct nfsvattr *, NFSACL_T *, NFSPROC_T *, nfsattrbit_t *,
381     struct nfsexstuff *);
382 int nfsrv_errmoved(int);
383 int nfsrv_putreferralattr(struct nfsrv_descript *, nfsattrbit_t *,
384     struct nfsreferral *, int, int *);
385 int nfsrv_parsename(struct nfsrv_descript *, char *, u_long *,
386     NFSPATHLEN_T *);
387 void nfsd_init(void);
388 int nfsd_checkrootexp(struct nfsrv_descript *);
389 void nfsd_getminorvers(struct nfsrv_descript *, u_char *, u_char **, int *,
390     u_int32_t *);
391 
392 /* nfs_clvfsops.c */
393 void nfscl_retopts(struct nfsmount *, char *, size_t);
394 
395 /* nfs_commonport.c */
396 int nfsrv_lookupfilename(struct nameidata *, char *, NFSPROC_T *);
397 void nfsrv_object_create(vnode_t, NFSPROC_T *);
398 int nfsrv_mallocmget_limit(void);
399 int nfsvno_v4rootexport(struct nfsrv_descript *);
400 void newnfs_portinit(void);
401 struct ucred *newnfs_getcred(void);
402 void newnfs_setroot(struct ucred *);
403 int nfs_catnap(int, int, const char *);
404 struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);
405 int nfsvno_pathconf(vnode_t, int, long *, struct ucred *, NFSPROC_T *);
406 int nfsrv_atroot(vnode_t, uint64_t *);
407 void newnfs_timer(void *);
408 int nfs_supportsnfsv4acls(vnode_t);
409 
410 /* nfs_commonacl.c */
411 int nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *,
412     int *, int *, NFSPROC_T *);
413 int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, enum vtype,
414     NFSPROC_T *);
415 int nfsrv_compareacl(NFSACL_T *, NFSACL_T *);
416 
417 /* nfs_clrpcops.c */
418 int nfsrpc_null(vnode_t, struct ucred *, NFSPROC_T *);
419 int nfsrpc_access(vnode_t, int, struct ucred *, NFSPROC_T *,
420     struct nfsvattr *, int *);
421 int nfsrpc_accessrpc(vnode_t, u_int32_t, struct ucred *,
422     NFSPROC_T *, struct nfsvattr *, int *, u_int32_t *, void *);
423 int nfsrpc_open(vnode_t, int, struct ucred *, NFSPROC_T *);
424 int nfsrpc_openrpc(struct nfsmount *, vnode_t, u_int8_t *, int, u_int8_t *, int,
425     u_int32_t, struct nfsclopen *, u_int8_t *, int, struct nfscldeleg **, int,
426     u_int32_t, struct ucred *, NFSPROC_T *, int, int);
427 int nfsrpc_opendowngrade(vnode_t, u_int32_t, struct nfsclopen *,
428     struct ucred *, NFSPROC_T *);
429 int nfsrpc_close(vnode_t, int, NFSPROC_T *);
430 int nfsrpc_closerpc(struct nfsrv_descript *, struct nfsmount *,
431     struct nfsclopen *, struct ucred *, NFSPROC_T *, int);
432 int nfsrpc_openconfirm(vnode_t, u_int8_t *, int, struct nfsclopen *,
433     struct ucred *, NFSPROC_T *);
434 int nfsrpc_setclient(struct nfsmount *, struct nfsclclient *, int,
435     struct ucred *, NFSPROC_T *);
436 int nfsrpc_getattr(vnode_t, struct ucred *, NFSPROC_T *,
437     struct nfsvattr *, void *);
438 int nfsrpc_getattrnovp(struct nfsmount *, u_int8_t *, int, int,
439     struct ucred *, NFSPROC_T *, struct nfsvattr *, u_int64_t *, uint32_t *);
440 int nfsrpc_setattr(vnode_t, struct vattr *, NFSACL_T *, struct ucred *,
441     NFSPROC_T *, struct nfsvattr *, int *, void *);
442 int nfsrpc_lookup(vnode_t, char *, int, struct ucred *, NFSPROC_T *,
443     struct nfsvattr *, struct nfsvattr *, struct nfsfh **, int *, int *,
444     void *);
445 int nfsrpc_readlink(vnode_t, struct uio *, struct ucred *,
446     NFSPROC_T *, struct nfsvattr *, int *, void *);
447 int nfsrpc_read(vnode_t, struct uio *, struct ucred *, NFSPROC_T *,
448     struct nfsvattr *, int *, void *);
449 int nfsrpc_write(vnode_t, struct uio *, int *, int *,
450     struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *, int);
451 int nfsrpc_mknod(vnode_t, char *, int, struct vattr *, u_int32_t,
452     enum vtype, struct ucred *, NFSPROC_T *, struct nfsvattr *,
453     struct nfsvattr *, struct nfsfh **, int *, int *, void *);
454 int nfsrpc_create(vnode_t, char *, int, struct vattr *, nfsquad_t,
455     int, struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
456     struct nfsfh **, int *, int *, void *);
457 int nfsrpc_remove(vnode_t, char *, int, vnode_t, struct ucred *, NFSPROC_T *,
458     struct nfsvattr *, int *, void *);
459 int nfsrpc_rename(vnode_t, vnode_t, char *, int, vnode_t, vnode_t, char *, int,
460     struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
461     int *, int *, void *, void *);
462 int nfsrpc_link(vnode_t, vnode_t, char *, int,
463     struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
464     int *, int *, void *);
465 int nfsrpc_symlink(vnode_t, char *, int, const char *, struct vattr *,
466     struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
467     struct nfsfh **, int *, int *, void *);
468 int nfsrpc_mkdir(vnode_t, char *, int, struct vattr *,
469     struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,
470     struct nfsfh **, int *, int *, void *);
471 int nfsrpc_rmdir(vnode_t, char *, int, struct ucred *, NFSPROC_T *,
472     struct nfsvattr *, int *, void *);
473 int nfsrpc_readdir(vnode_t, struct uio *, nfsuint64 *, struct ucred *,
474     NFSPROC_T *, struct nfsvattr *, int *, int *, void *);
475 int nfsrpc_readdirplus(vnode_t, struct uio *, nfsuint64 *,
476     struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, int *, void *);
477 int nfsrpc_commit(vnode_t, u_quad_t, int, struct ucred *,
478     NFSPROC_T *, struct nfsvattr *, int *, void *);
479 int nfsrpc_advlock(vnode_t, off_t, int, struct flock *, int,
480     struct ucred *, NFSPROC_T *, void *, int);
481 int nfsrpc_lockt(struct nfsrv_descript *, vnode_t,
482     struct nfsclclient *, u_int64_t, u_int64_t, struct flock *,
483     struct ucred *, NFSPROC_T *, void *, int);
484 int nfsrpc_lock(struct nfsrv_descript *, struct nfsmount *, vnode_t,
485     u_int8_t *, int, struct nfscllockowner *, int, int, u_int64_t,
486     u_int64_t, short, struct ucred *, NFSPROC_T *, int);
487 int nfsrpc_statfs(vnode_t, struct nfsstatfs *, struct nfsfsinfo *,
488     struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *);
489 int nfsrpc_fsinfo(vnode_t, struct nfsfsinfo *, struct ucred *,
490     NFSPROC_T *, struct nfsvattr *, int *, void *);
491 int nfsrpc_pathconf(vnode_t, struct nfsv3_pathconf *,
492     struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *);
493 int nfsrpc_renew(struct nfsclclient *, struct nfsclds *, struct ucred *,
494     NFSPROC_T *);
495 int nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *, uint8_t *,
496     int, struct ucred *, NFSPROC_T *);
497 int nfsrpc_getdirpath(struct nfsmount *, u_char *, struct ucred *,
498     NFSPROC_T *);
499 int nfsrpc_delegreturn(struct nfscldeleg *, struct ucred *,
500     struct nfsmount *, NFSPROC_T *, int);
501 int nfsrpc_getacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *);
502 int nfsrpc_setacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *);
503 int nfsrpc_exchangeid(struct nfsmount *, struct nfsclclient *,
504     struct nfssockreq *, uint32_t, struct nfsclds **, struct ucred *,
505     NFSPROC_T *);
506 int nfsrpc_createsession(struct nfsmount *, struct nfsclsession *,
507     struct nfssockreq *, uint32_t, int, struct ucred *, NFSPROC_T *);
508 int nfsrpc_destroysession(struct nfsmount *, struct nfsclclient *,
509     struct ucred *, NFSPROC_T *);
510 int nfsrpc_destroyclient(struct nfsmount *, struct nfsclclient *,
511     struct ucred *, NFSPROC_T *);
512 int nfsrpc_getdeviceinfo(struct nfsmount *, uint8_t *, int, uint32_t *,
513     struct nfscldevinfo **, struct ucred *, NFSPROC_T *);
514 int nfsrpc_layoutcommit(struct nfsmount *, uint8_t *, int, int,
515     uint64_t, uint64_t, uint64_t, nfsv4stateid_t *, int, struct ucred *,
516     NFSPROC_T *, void *);
517 int nfsrpc_layoutreturn(struct nfsmount *, uint8_t *, int, int, int, uint32_t,
518     int, uint64_t, uint64_t, nfsv4stateid_t *, struct ucred *, NFSPROC_T *,
519     uint32_t, uint32_t, char *);
520 int nfsrpc_reclaimcomplete(struct nfsmount *, struct ucred *, NFSPROC_T *);
521 int nfscl_doiods(vnode_t, struct uio *, int *, int *, uint32_t, int,
522     struct ucred *, NFSPROC_T *);
523 int nfscl_findlayoutforio(struct nfscllayout *, uint64_t, uint32_t,
524     struct nfsclflayout **);
525 void nfscl_freenfsclds(struct nfsclds *);
526 
527 /* nfs_clstate.c */
528 int nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int,
529     struct ucred *, NFSPROC_T *, struct nfsclowner **, struct nfsclopen **,
530     int *, int *, int);
531 int nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *,
532     NFSPROC_T *, nfsv4stateid_t *, void **);
533 void nfscl_ownerrelease(struct nfsmount *, struct nfsclowner *, int, int, int);
534 void nfscl_openrelease(struct nfsmount *, struct nfsclopen *, int, int);
535 int nfscl_getcl(struct mount *, struct ucred *, NFSPROC_T *, int,
536     struct nfsclclient **);
537 struct nfsclclient *nfscl_findcl(struct nfsmount *);
538 void nfscl_clientrelease(struct nfsclclient *);
539 void nfscl_freelock(struct nfscllock *, int);
540 void nfscl_freelockowner(struct nfscllockowner *, int);
541 int nfscl_getbytelock(vnode_t, u_int64_t, u_int64_t, short,
542     struct ucred *, NFSPROC_T *, struct nfsclclient *, int, void *, int,
543     u_int8_t *, u_int8_t *, struct nfscllockowner **, int *, int *);
544 int nfscl_relbytelock(vnode_t, u_int64_t, u_int64_t,
545     struct ucred *, NFSPROC_T *, int, struct nfsclclient *,
546     void *, int, struct nfscllockowner **, int *);
547 int nfscl_checkwritelocked(vnode_t, struct flock *,
548     struct ucred *, NFSPROC_T *, void *, int);
549 void nfscl_lockrelease(struct nfscllockowner *, int, int);
550 void nfscl_fillclid(u_int64_t, char *, u_int8_t *, u_int16_t);
551 void nfscl_filllockowner(void *, u_int8_t *, int);
552 void nfscl_freeopen(struct nfsclopen *, int);
553 void nfscl_umount(struct nfsmount *, NFSPROC_T *);
554 void nfscl_renewthread(struct nfsclclient *, NFSPROC_T *);
555 void nfscl_initiate_recovery(struct nfsclclient *);
556 int nfscl_hasexpired(struct nfsclclient *, u_int32_t, NFSPROC_T *);
557 void nfscl_dumpstate(struct nfsmount *, int, int, int, int);
558 void nfscl_dupopen(vnode_t, int);
559 int nfscl_getclose(vnode_t, struct nfsclclient **);
560 int nfscl_doclose(vnode_t, struct nfsclclient **, NFSPROC_T *);
561 void nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, NFSPROC_T *);
562 int nfscl_deleg(mount_t, struct nfsclclient *, u_int8_t *, int,
563     struct ucred *, NFSPROC_T *, struct nfscldeleg **);
564 void nfscl_lockinit(struct nfsv4lock *);
565 void nfscl_lockexcl(struct nfsv4lock *, void *);
566 void nfscl_lockunlock(struct nfsv4lock *);
567 void nfscl_lockderef(struct nfsv4lock *);
568 void nfscl_docb(struct nfsrv_descript *, NFSPROC_T *);
569 void nfscl_releasealllocks(struct nfsclclient *, vnode_t, NFSPROC_T *, void *,
570     int);
571 int nfscl_lockt(vnode_t, struct nfsclclient *, u_int64_t,
572     u_int64_t, struct flock *, NFSPROC_T *, void *, int);
573 int nfscl_mustflush(vnode_t);
574 int nfscl_nodeleg(vnode_t, int);
575 int nfscl_removedeleg(vnode_t, NFSPROC_T *, nfsv4stateid_t *);
576 int nfscl_getref(struct nfsmount *);
577 void nfscl_relref(struct nfsmount *);
578 int nfscl_renamedeleg(vnode_t, nfsv4stateid_t *, int *, vnode_t,
579     nfsv4stateid_t *, int *, NFSPROC_T *);
580 void nfscl_reclaimnode(vnode_t);
581 void nfscl_newnode(vnode_t);
582 void nfscl_delegmodtime(vnode_t);
583 void nfscl_deleggetmodtime(vnode_t, struct timespec *);
584 int nfscl_tryclose(struct nfsclopen *, struct ucred *,
585     struct nfsmount *, NFSPROC_T *);
586 void nfscl_cleanup(NFSPROC_T *);
587 int nfscl_layout(struct nfsmount *, vnode_t, u_int8_t *, int, nfsv4stateid_t *,
588     int, int, struct nfsclflayouthead *, struct nfscllayout **, struct ucred *,
589     NFSPROC_T *);
590 struct nfscllayout *nfscl_getlayout(struct nfsclclient *, uint8_t *, int,
591     uint64_t, struct nfsclflayout **, int *);
592 void nfscl_dserr(uint32_t, uint32_t, struct nfscldevinfo *,
593     struct nfscllayout *, struct nfsclds *);
594 void nfscl_cancelreqs(struct nfsclds *);
595 void nfscl_rellayout(struct nfscllayout *, int);
596 struct nfscldevinfo *nfscl_getdevinfo(struct nfsclclient *, uint8_t *,
597     struct nfscldevinfo *);
598 void nfscl_reldevinfo(struct nfscldevinfo *);
599 int nfscl_adddevinfo(struct nfsmount *, struct nfscldevinfo *, int,
600     struct nfsclflayout *);
601 void nfscl_freelayout(struct nfscllayout *);
602 void nfscl_freeflayout(struct nfsclflayout *);
603 void nfscl_freedevinfo(struct nfscldevinfo *);
604 int nfscl_layoutcommit(vnode_t, NFSPROC_T *);
605 
606 /* nfs_clport.c */
607 int nfscl_nget(mount_t, vnode_t, struct nfsfh *,
608     struct componentname *, NFSPROC_T *, struct nfsnode **, void *, int);
609 NFSPROC_T *nfscl_getparent(NFSPROC_T *);
610 void nfscl_start_renewthread(struct nfsclclient *);
611 void nfscl_loadsbinfo(struct nfsmount *, struct nfsstatfs *, void *);
612 void nfscl_loadfsinfo (struct nfsmount *, struct nfsfsinfo *);
613 void nfscl_delegreturn(struct nfscldeleg *, int, struct nfsmount *,
614     struct ucred *, NFSPROC_T *);
615 void nfsrvd_cbinit(int);
616 int nfscl_checksattr(struct vattr *, struct nfsvattr *);
617 int nfscl_ngetreopen(mount_t, u_int8_t *, int, NFSPROC_T *,
618     struct nfsnode **);
619 int nfscl_procdoesntexist(u_int8_t *);
620 int nfscl_maperr(NFSPROC_T *, int, uid_t, gid_t);
621 
622 /* nfs_clsubs.c */
623 void nfscl_init(void);
624 
625 /* nfs_clbio.c */
626 int ncl_flush(vnode_t, int, NFSPROC_T *, int, int);
627 
628 /* nfs_clnode.c */
629 void ncl_invalcaches(vnode_t);
630 
631 /* nfs_nfsdport.c */
632 int nfsvno_getattr(vnode_t, struct nfsvattr *, struct nfsrv_descript *,
633     NFSPROC_T *, int, nfsattrbit_t *);
634 int nfsvno_setattr(vnode_t, struct nfsvattr *, struct ucred *,
635     NFSPROC_T *, struct nfsexstuff *);
636 int nfsvno_getfh(vnode_t, fhandle_t *, NFSPROC_T *);
637 int nfsvno_accchk(vnode_t, accmode_t, struct ucred *,
638     struct nfsexstuff *, NFSPROC_T *, int, int, u_int32_t *);
639 int nfsvno_namei(struct nfsrv_descript *, struct nameidata *,
640     vnode_t, int, struct nfsexstuff *, NFSPROC_T *, vnode_t *);
641 void nfsvno_setpathbuf(struct nameidata *, char **, u_long **);
642 void nfsvno_relpathbuf(struct nameidata *);
643 int nfsvno_readlink(vnode_t, struct ucred *, NFSPROC_T *, mbuf_t *,
644     mbuf_t *, int *);
645 int nfsvno_read(vnode_t, off_t, int, struct ucred *, NFSPROC_T *,
646     mbuf_t *, mbuf_t *);
647 int nfsvno_write(vnode_t, off_t, int, int, int *, mbuf_t,
648     char *, struct ucred *, NFSPROC_T *);
649 int nfsvno_createsub(struct nfsrv_descript *, struct nameidata *,
650     vnode_t *, struct nfsvattr *, int *, int32_t *, NFSDEV_T,
651     struct nfsexstuff *);
652 int nfsvno_mknod(struct nameidata *, struct nfsvattr *, struct ucred *,
653     NFSPROC_T *);
654 int nfsvno_mkdir(struct nameidata *,
655     struct nfsvattr *, uid_t, struct ucred *, NFSPROC_T *,
656     struct nfsexstuff *);
657 int nfsvno_symlink(struct nameidata *, struct nfsvattr *, char *, int, int,
658     uid_t, struct ucred *, NFSPROC_T *, struct nfsexstuff *);
659 int nfsvno_getsymlink(struct nfsrv_descript *, struct nfsvattr *,
660     NFSPROC_T *, char **, int *);
661 int nfsvno_removesub(struct nameidata *, int, struct ucred *, NFSPROC_T *,
662     struct nfsexstuff *);
663 int nfsvno_rmdirsub(struct nameidata *, int, struct ucred *, NFSPROC_T *,
664     struct nfsexstuff *);
665 int nfsvno_rename(struct nameidata *, struct nameidata *, u_int32_t,
666     u_int32_t, struct ucred *, NFSPROC_T *);
667 int nfsvno_link(struct nameidata *, vnode_t, struct ucred *,
668     NFSPROC_T *, struct nfsexstuff *);
669 int nfsvno_fsync(vnode_t, u_int64_t, int, struct ucred *, NFSPROC_T *);
670 int nfsvno_statfs(vnode_t, struct statfs *);
671 void nfsvno_getfs(struct nfsfsinfo *, int);
672 void nfsvno_open(struct nfsrv_descript *, struct nameidata *, nfsquad_t,
673     nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, int32_t *,
674     int, NFSACL_T *, nfsattrbit_t *, struct ucred *,
675     struct nfsexstuff *, vnode_t *);
676 int nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct nfsrv_descript *,
677     NFSPROC_T *);
678 int nfsvno_fillattr(struct nfsrv_descript *, struct mount *, vnode_t,
679     struct nfsvattr *, fhandle_t *, int, nfsattrbit_t *,
680     struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t);
681 int nfsrv_sattr(struct nfsrv_descript *, vnode_t, struct nfsvattr *, nfsattrbit_t *,
682     NFSACL_T *, NFSPROC_T *);
683 int nfsv4_sattr(struct nfsrv_descript *, vnode_t, struct nfsvattr *, nfsattrbit_t *,
684     NFSACL_T *, NFSPROC_T *);
685 int nfsvno_checkexp(mount_t, NFSSOCKADDR_T, struct nfsexstuff *,
686     struct ucred **);
687 int nfsvno_fhtovp(mount_t, fhandle_t *, NFSSOCKADDR_T, int,
688     vnode_t *, struct nfsexstuff *, struct ucred **);
689 vnode_t nfsvno_getvp(fhandle_t *);
690 int nfsvno_advlock(vnode_t, int, u_int64_t, u_int64_t, NFSPROC_T *);
691 int nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *);
692 int nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *);
693 uint32_t nfsrv_hashfh(fhandle_t *);
694 uint32_t nfsrv_hashsessionid(uint8_t *);
695 void nfsrv_backupstable(void);
696 int nfsrv_dsgetdevandfh(struct vnode *, NFSPROC_T *, int *, fhandle_t *,
697     char *);
698 int nfsrv_dsgetsockmnt(struct vnode *, int, char *, int *, int *,
699     NFSPROC_T *, struct vnode **, fhandle_t *, char *, char *,
700     struct vnode **, struct nfsmount **, struct nfsmount *, int *, int *);
701 int nfsrv_dscreate(struct vnode *, struct vattr *, struct vattr *,
702     fhandle_t *, struct pnfsdsfile *, struct pnfsdsattr *, char *,
703     struct ucred *, NFSPROC_T *, struct vnode **);
704 int nfsrv_updatemdsattr(struct vnode *, struct nfsvattr *, NFSPROC_T *);
705 void nfsrv_killrpcs(struct nfsmount *);
706 int nfsrv_setacl(struct vnode *, NFSACL_T *, struct ucred *, NFSPROC_T *);
707 
708 /* nfs_commonkrpc.c */
709 int newnfs_nmcancelreqs(struct nfsmount *);
710 void newnfs_set_sigmask(struct thread *, sigset_t *);
711 void newnfs_restore_sigmask(struct thread *, sigset_t *);
712 int newnfs_msleep(struct thread *, void *, struct mtx *, int, char *, int);
713 int newnfs_request(struct nfsrv_descript *, struct nfsmount *,
714     struct nfsclient *, struct nfssockreq *, vnode_t, NFSPROC_T *,
715     struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *,
716     struct nfsclsession *);
717 int newnfs_connect(struct nfsmount *, struct nfssockreq *,
718     struct ucred *, NFSPROC_T *, int);
719 void newnfs_disconnect(struct nfssockreq *);
720 int newnfs_sigintr(struct nfsmount *, NFSPROC_T *);
721 
722 /* nfs_nfsdkrpc.c */
723 int nfsrvd_addsock(struct file *);
724 int nfsrvd_nfsd(NFSPROC_T *, struct nfsd_nfsd_args *);
725 void nfsrvd_init(int);
726 
727 /* nfs_clkrpc.c */
728 int nfscbd_addsock(struct file *);
729 int nfscbd_nfsd(NFSPROC_T *, struct nfsd_nfscbd_args *);
730 
731