]> git.saurik.com Git - apple/xnu.git/blob - bsd/nfs/nfs.h
867f81b62e793e36e40e6038507c4d4bd385e6e9
[apple/xnu.git] / bsd / nfs / nfs.h
1 /*
2 * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
31 /*
32 * Copyright (c) 1989, 1993, 1995
33 * The Regents of the University of California. All rights reserved.
34 *
35 * This code is derived from software contributed to Berkeley by
36 * Rick Macklem at The University of Guelph.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 *
66 * @(#)nfs.h 8.4 (Berkeley) 5/1/95
67 * FreeBSD-Id: nfs.h,v 1.32 1997/10/12 20:25:38 phk Exp $
68 */
69
70 #ifndef _NFS_NFS_H_
71 #define _NFS_NFS_H_
72
73 #include <sys/appleapiopts.h>
74 #include <sys/cdefs.h>
75
76 #ifdef __APPLE_API_PRIVATE
77 /*
78 * Tunable constants for nfs
79 */
80
81 #define NFS_MAXIOVEC 34
82 #define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */
83 #define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */
84 #define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
85 #define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
86 #define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
87 #define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops*/
88 #define NFS_MAXREXMIT 100 /* Stop counting after this many */
89 #define NFS_MAXWINDOW 1024 /* Max number of outstanding requests */
90 #define NFS_RETRANS 10 /* Num of retrans for soft mounts */
91 #define NFS_TRYLATERDEL 15 /* Initial try later delay (sec) */
92 #define NFS_MAXGRPS 16 /* Max. size of groups list */
93 #ifndef NFS_MINATTRTIMO
94 #define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */
95 #endif
96 #ifndef NFS_MAXATTRTIMO
97 #define NFS_MAXATTRTIMO 60
98 #endif
99 #ifndef NFS_MINDIRATTRTIMO
100 #define NFS_MINDIRATTRTIMO 5 /* directory attribute cache timeout in sec */
101 #endif
102 #ifndef NFS_MAXDIRATTRTIMO
103 #define NFS_MAXDIRATTRTIMO 60
104 #endif
105 #define NFS_WSIZE 16384 /* Def. write data size <= 16K */
106 #define NFS_RSIZE 16384 /* Def. read data size <= 16K */
107 #define NFS_DGRAM_WSIZE 8192 /* UDP Def. write data size <= 8K */
108 #define NFS_DGRAM_RSIZE 8192 /* UDP Def. read data size <= 8K */
109 #define NFS_READDIRSIZE 8192 /* Def. readdir size */
110 #define NFS_DEFRAHEAD 4 /* Def. read ahead # blocks */
111 #define NFS_MAXRAHEAD 16 /* Max. read ahead # blocks */
112 #define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */
113 #define NFS_MAXASYNCDAEMON 32 /* Max. number async_daemons runnable */
114 #define NFS_MAXGATHERDELAY 100 /* Max. write gather delay (msec) */
115 #ifndef NFS_GATHERDELAY
116 #define NFS_GATHERDELAY 10 /* Default write gather delay (msec) */
117 #endif
118 #define NFS_DIRBLKSIZ 4096 /* Must be a multiple of DIRBLKSIZ */
119 #if defined(KERNEL) && !defined(DIRBLKSIZ)
120 #define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */
121 /* can't be larger than NFS_FABLKSIZE */
122 #endif
123
124 /*
125 * Oddballs
126 */
127 #define NMOD(a) ((a) % nfs_asyncdaemons)
128 #define NFS_CMPFH(n, f, s) \
129 ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
130 #define NFS_ISV3(v) (VFSTONFS(vnode_mount(v))->nm_flag & NFSMNT_NFSV3)
131 #define NFS_SRVMAXDATA(n) \
132 (((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \
133 NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
134
135 /*
136 * XXX
137 * The NB_INVAFTERWRITE flag should be set to whatever is required by the
138 * buffer cache code to say "Invalidate the block after it is written back".
139 */
140 #ifdef __FreeBSD__
141 #define NB_INVAFTERWRITE NB_NOCACHE
142 #else
143 #define NB_INVAFTERWRITE NB_INVAL
144 #endif
145
146 /*
147 * The IO_METASYNC flag should be implemented for local file systems.
148 * (Until then, it is nothin at all.)
149 */
150 #ifndef IO_METASYNC
151 #define IO_METASYNC 0
152 #endif
153
154 /*
155 * Expected allocation sizes for major data structures. If the actual size
156 * of the structure exceeds these sizes, then malloc() will be allocating
157 * almost twice the memory required. This is used in nfs_init() to warn
158 * the sysadmin that the size of a structure should be reduced.
159 * (These sizes are always a power of 2. If the kernel malloc() changes
160 * to one that does not allocate space in powers of 2 size, then this all
161 * becomes bunk!).
162 * Note that some of these structures come out of there own nfs zones.
163 */
164 #define NFS_NODEALLOC 512
165 #define NFS_MNTALLOC 512
166 #define NFS_SVCALLOC 256
167 #define NFS_UIDALLOC 128
168
169 /*
170 * Arguments to mount NFS
171 */
172 #define NFS_ARGSVERSION 4 /* change when nfs_args changes */
173 struct nfs_args {
174 int version; /* args structure version number */
175 struct sockaddr *addr; /* file server address */
176 int addrlen; /* length of address */
177 int sotype; /* Socket type */
178 int proto; /* and Protocol */
179 u_char *fh; /* File handle to be mounted */
180 int fhsize; /* Size, in bytes, of fh */
181 int flags; /* flags */
182 int wsize; /* write size in bytes */
183 int rsize; /* read size in bytes */
184 int readdirsize; /* readdir size in bytes */
185 int timeo; /* initial timeout in .1 secs */
186 int retrans; /* times to retry send */
187 int maxgrouplist; /* Max. size of group list */
188 int readahead; /* # of blocks to readahead */
189 int leaseterm; /* obsolete: Term (sec) of lease */
190 int deadthresh; /* obsolete: Retrans threshold */
191 char *hostname; /* server's name */
192 /* NFS_ARGSVERSION 3 ends here */
193 int acregmin; /* reg file min attr cache timeout */
194 int acregmax; /* reg file max attr cache timeout */
195 int acdirmin; /* dir min attr cache timeout */
196 int acdirmax; /* dir max attr cache timeout */
197 };
198
199 struct nfs_args3 {
200 int version; /* args structure version number */
201 struct sockaddr *addr; /* file server address */
202 int addrlen; /* length of address */
203 int sotype; /* Socket type */
204 int proto; /* and Protocol */
205 u_char *fh; /* File handle to be mounted */
206 int fhsize; /* Size, in bytes, of fh */
207 int flags; /* flags */
208 int wsize; /* write size in bytes */
209 int rsize; /* read size in bytes */
210 int readdirsize; /* readdir size in bytes */
211 int timeo; /* initial timeout in .1 secs */
212 int retrans; /* times to retry send */
213 int maxgrouplist; /* Max. size of group list */
214 int readahead; /* # of blocks to readahead */
215 int leaseterm; /* obsolete: Term (sec) of lease */
216 int deadthresh; /* obsolete: Retrans threshold */
217 char *hostname; /* server's name */
218 };
219
220 // LP64todo - should this move?
221 #ifdef KERNEL
222 /* LP64 version of nfs_args. all pointers and longs
223 * grow when we're dealing with a 64-bit process.
224 * WARNING - keep in sync with nfs_args
225 */
226 #if __DARWIN_ALIGN_NATURAL
227 #pragma options align=natural
228 #endif
229
230 struct user_nfs_args {
231 int version; /* args structure version number */
232 user_addr_t addr; /* file server address */
233 int addrlen; /* length of address */
234 int sotype; /* Socket type */
235 int proto; /* and Protocol */
236 user_addr_t fh; /* File handle to be mounted */
237 int fhsize; /* Size, in bytes, of fh */
238 int flags; /* flags */
239 int wsize; /* write size in bytes */
240 int rsize; /* read size in bytes */
241 int readdirsize; /* readdir size in bytes */
242 int timeo; /* initial timeout in .1 secs */
243 int retrans; /* times to retry send */
244 int maxgrouplist; /* Max. size of group list */
245 int readahead; /* # of blocks to readahead */
246 int leaseterm; /* obsolete: Term (sec) of lease */
247 int deadthresh; /* obsolete: Retrans threshold */
248 user_addr_t hostname; /* server's name */
249 /* NFS_ARGSVERSION 3 ends here */
250 int acregmin; /* reg file min attr cache timeout */
251 int acregmax; /* reg file max attr cache timeout */
252 int acdirmin; /* dir min attr cache timeout */
253 int acdirmax; /* dir max attr cache timeout */
254 };
255 struct user_nfs_args3 {
256 int version; /* args structure version number */
257 user_addr_t addr; /* file server address */
258 int addrlen; /* length of address */
259 int sotype; /* Socket type */
260 int proto; /* and Protocol */
261 user_addr_t fh; /* File handle to be mounted */
262 int fhsize; /* Size, in bytes, of fh */
263 int flags; /* flags */
264 int wsize; /* write size in bytes */
265 int rsize; /* read size in bytes */
266 int readdirsize; /* readdir size in bytes */
267 int timeo; /* initial timeout in .1 secs */
268 int retrans; /* times to retry send */
269 int maxgrouplist; /* Max. size of group list */
270 int readahead; /* # of blocks to readahead */
271 int leaseterm; /* obsolete: Term (sec) of lease */
272 int deadthresh; /* obsolete: Retrans threshold */
273 user_addr_t hostname; /* server's name */
274 };
275
276 #if __DARWIN_ALIGN_NATURAL
277 #pragma options align=reset
278 #endif
279
280 #endif // KERNEL
281
282 /*
283 * NFS mount option flags
284 */
285 #define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
286 #define NFSMNT_WSIZE 0x00000002 /* set write size */
287 #define NFSMNT_RSIZE 0x00000004 /* set read size */
288 #define NFSMNT_TIMEO 0x00000008 /* set initial timeout */
289 #define NFSMNT_RETRANS 0x00000010 /* set number of request retries */
290 #define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */
291 #define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
292 #define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
293 #define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */
294 #define NFSMNT_KERB 0x00000400 /* Use Kerberos authentication */
295 #define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */
296 #define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
297 #define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
298 #define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
299 #define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
300 #define NFSMNT_NOLOCKS 0x00040000 /* don't support file locking */
301 #define NFSMNT_ACREGMIN 0x00100000 /* reg min attr cache timeout */
302 #define NFSMNT_ACREGMAX 0x00200000 /* reg max attr cache timeout */
303 #define NFSMNT_ACDIRMIN 0x00400000 /* dir min attr cache timeout */
304 #define NFSMNT_ACDIRMAX 0x00800000 /* dir max attr cache timeout */
305
306 /*
307 * NFS mount state flags (nm_state)
308 */
309 #define NFSSTA_LOCKTIMEO 0x00002000 /* experienced a lock req timeout */
310 #define NFSSTA_MOUNTED 0x00004000 /* completely mounted */
311 #define NFSSTA_LOCKSWORK 0x00008000 /* lock ops have worked. */
312 #define NFSSTA_TIMEO 0x00010000 /* experienced a timeout. */
313 #define NFSSTA_FORCE 0x00020000 /* doing a forced unmount. */
314 #define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */
315 #define NFSSTA_GOTPATHCONF 0x00080000 /* Got the V3 pathconf info */
316 #define NFSSTA_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */
317 #define NFSSTA_MNTD 0x00200000 /* Mnt server for mnt point */
318 #define NFSSTA_SNDLOCK 0x01000000 /* Send socket lock */
319 #define NFSSTA_WANTSND 0x02000000 /* Want above */
320 #define NFSSTA_RCVLOCK 0x04000000 /* Rcv socket lock */
321 #define NFSSTA_WANTRCV 0x08000000 /* Want above */
322 #define NFSSTA_WAITAUTH 0x10000000 /* Wait for authentication */
323 #define NFSSTA_HASAUTH 0x20000000 /* Has authenticator */
324 #define NFSSTA_WANTAUTH 0x40000000 /* Wants an authenticator */
325 #define NFSSTA_AUTHERR 0x80000000 /* Authentication error */
326
327 /*
328 * NFS mount pathconf info flags (nm_fsinfo.pcflags)
329 */
330 #define NFSPCINFO_NOTRUNC 0x01
331 #define NFSPCINFO_CHOWN_RESTRICTED 0x02
332 #define NFSPCINFO_CASE_INSENSITIVE 0x04
333 #define NFSPCINFO_CASE_PRESERVING 0x08
334
335 /*
336 * Structures for the nfssvc(2) syscall. Not that anyone but nfsd and mount_nfs
337 * should ever try and use it.
338 */
339 struct nfsd_args {
340 int sock; /* Socket to serve */
341 caddr_t name; /* Client addr for connection based sockets */
342 int namelen; /* Length of name */
343 };
344
345 // LP64todo - should this move?
346 #ifdef KERNEL
347 /* LP64 version of nfsd_args. all pointers and longs
348 * grow when we're dealing with a 64-bit process.
349 * WARNING - keep in sync with nfsd_args
350 */
351 #if __DARWIN_ALIGN_NATURAL
352 #pragma options align=natural
353 #endif
354
355 struct user_nfsd_args {
356 int sock; /* Socket to serve */
357 user_addr_t name; /* Client addr for connection based sockets */
358 int namelen; /* Length of name */
359 };
360
361 #if __DARWIN_ALIGN_NATURAL
362 #pragma options align=reset
363 #endif
364
365 #endif // KERNEL
366
367 struct nfsd_srvargs {
368 struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */
369 uid_t nsd_uid; /* Effective uid mapped to cred */
370 u_long nsd_haddr; /* Ip address of client */
371 struct ucred nsd_cr; /* Cred. uid maps to */
372 int nsd_authlen; /* Length of auth string (ret) */
373 u_char *nsd_authstr; /* Auth string (ret) */
374 int nsd_verflen; /* and the verfier */
375 u_char *nsd_verfstr;
376 struct timeval nsd_timestamp; /* timestamp from verifier */
377 u_long nsd_ttl; /* credential ttl (sec) */
378 NFSKERBKEY_T nsd_key; /* Session key */
379 };
380
381 struct nfsd_cargs {
382 char *ncd_dirp; /* Mount dir path */
383 uid_t ncd_authuid; /* Effective uid */
384 int ncd_authtype; /* Type of authenticator */
385 int ncd_authlen; /* Length of authenticator string */
386 u_char *ncd_authstr; /* Authenticator string */
387 int ncd_verflen; /* and the verifier */
388 u_char *ncd_verfstr;
389 NFSKERBKEY_T ncd_key; /* Session key */
390 };
391
392 /*
393 * NFS Server File Handle structures
394 */
395
396 /* NFS export handle identifies which NFS export */
397 #define NFS_FH_VERSION 0x4e580000 /* 'NX00' */
398 struct nfs_exphandle {
399 uint32_t nxh_version; /* data structure version */
400 uint32_t nxh_fsid; /* File System Export ID */
401 uint32_t nxh_expid; /* Export ID */
402 uint16_t nxh_flags; /* export handle flags */
403 uint8_t nxh_reserved; /* future use */
404 uint8_t nxh_fidlen; /* length of File ID */
405 };
406
407 /* nxh_flags */
408 #define NXHF_INVALIDFH 0x0001 /* file handle is invalid */
409
410 #define NFS_MAX_FID_SIZE (NFS_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
411 #define NFSV2_MAX_FID_SIZE (NFSV2_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
412
413 /* NFS server internal view of fhandle_t */
414 struct nfs_filehandle {
415 int nfh_len; /* total length of file handle */
416 struct nfs_exphandle nfh_xh; /* export handle */
417 unsigned char nfh_fid[NFS_MAX_FID_SIZE]; /* File ID */
418 };
419
420 /*
421 * NFS export data structures
422 */
423
424 struct nfs_export_net_args {
425 uint32_t nxna_flags; /* export flags */
426 struct xucred nxna_cred; /* mapped credential for root/all user */
427 struct sockaddr_storage nxna_addr; /* net address to which exported */
428 struct sockaddr_storage nxna_mask; /* mask for net address */
429 };
430
431 struct nfs_export_args {
432 uint32_t nxa_fsid; /* export FS ID */
433 uint32_t nxa_expid; /* export ID */
434 char *nxa_fspath; /* export FS path */
435 char *nxa_exppath; /* export sub-path */
436 uint32_t nxa_flags; /* export arg flags */
437 uint32_t nxa_netcount; /* #entries in ex_nets array */
438 struct nfs_export_net_args *nxa_nets; /* array of net args */
439 };
440
441 #ifdef KERNEL
442 /* LP64 version of export_args */
443
444 #if __DARWIN_ALIGN_NATURAL
445 #pragma options align=natural
446 #endif
447
448 struct user_nfs_export_args {
449 uint32_t nxa_fsid; /* export FS ID */
450 uint32_t nxa_expid; /* export ID */
451 user_addr_t nxa_fspath; /* export FS path */
452 user_addr_t nxa_exppath; /* export sub-path */
453 uint32_t nxa_flags; /* export arg flags */
454 uint32_t nxa_netcount; /* #entries in ex_nets array */
455 user_addr_t nxa_nets; /* array of net args */
456 };
457
458 #if __DARWIN_ALIGN_NATURAL
459 #pragma options align=reset
460 #endif
461
462 #endif /* KERNEL */
463
464 /* nfs export arg flags */
465 #define NXA_DELETE 0x0001 /* delete the specified export(s) */
466 #define NXA_ADD 0x0002 /* add the specified export(s) */
467 #define NXA_REPLACE 0x0003 /* delete and add the specified export(s) */
468 #define NXA_DELETE_ALL 0x0004 /* delete all exports */
469
470 /* export option flags */
471 #define NX_READONLY 0x0001 /* exported read-only */
472 #define NX_DEFAULTEXPORT 0x0002 /* exported to the world */
473 #define NX_MAPROOT 0x0004 /* map root access to anon credential */
474 #define NX_MAPALL 0x0008 /* map all access to anon credential */
475 #define NX_KERB 0x0010 /* exported with Kerberos uid mapping */
476 #define NX_32BITCLIENTS 0x0020 /* restrict directory cookies to 32 bits */
477
478 #ifdef KERNEL
479 struct nfs_exportfs;
480
481 struct nfs_export_options {
482 uint32_t nxo_flags; /* export options */
483 kauth_cred_t nxo_cred; /* mapped credential */
484 };
485
486 /* Network address lookup element and individual export options */
487 struct nfs_netopt {
488 struct radix_node no_rnodes[2]; /* radix tree glue */
489 struct nfs_export_options no_opt; /* export options */
490 };
491
492 /* Network export information */
493 /* one of these for each exported directory */
494 struct nfs_export {
495 LIST_ENTRY(nfs_export) nx_next; /* FS export list */
496 LIST_ENTRY(nfs_export) nx_hash; /* export hash chain */
497 struct nfs_export *nx_parent; /* parent export */
498 uint32_t nx_id; /* export ID */
499 uint32_t nx_flags; /* export flags */
500 struct nfs_exportfs *nx_fs; /* exported file system */
501 char *nx_path; /* exported file system sub-path */
502 struct nfs_filehandle nx_fh; /* export root file handle */
503 struct nfs_export_options nx_defopt; /* default options */
504 uint32_t nx_expcnt; /* # exports in table */
505 struct radix_node_head *nx_rtable[AF_MAX+1]; /* table of exports (netopts) */
506 };
507
508 /* NFS exported file system info */
509 /* one of these for each exported file system */
510 struct nfs_exportfs {
511 LIST_ENTRY(nfs_exportfs) nxfs_next; /* exported file system list */
512 uint32_t nxfs_id; /* exported file system ID */
513 char *nxfs_path; /* exported file system path */
514 LIST_HEAD(,nfs_export) nxfs_exports; /* list of exports for this file system */
515 };
516
517 extern LIST_HEAD(nfsexpfslist, nfs_exportfs) nfs_exports;
518 extern lck_rw_t nfs_export_rwlock; // lock for export data structures
519 #define NFSEXPHASHVAL(FSID, EXPID) \
520 (((FSID) >> 24) ^ ((FSID) >> 16) ^ ((FSID) >> 8) ^ (EXPID))
521 #define NFSEXPHASH(FSID, EXPID) \
522 (&nfsexphashtbl[NFSEXPHASHVAL((FSID),(EXPID)) & nfsexphash])
523 extern LIST_HEAD(nfsexphashhead, nfs_export) *nfsexphashtbl;
524 extern u_long nfsexphash;
525
526 #endif // KERNEL
527
528 /*
529 * XXX to allow amd to include nfs.h without nfsproto.h
530 */
531 #ifdef NFS_NPROCS
532 /*
533 * Stats structure
534 */
535 struct nfsstats {
536 int attrcache_hits;
537 int attrcache_misses;
538 int lookupcache_hits;
539 int lookupcache_misses;
540 int direofcache_hits;
541 int direofcache_misses;
542 int biocache_reads;
543 int read_bios;
544 int read_physios;
545 int biocache_writes;
546 int write_bios;
547 int write_physios;
548 int biocache_readlinks;
549 int readlink_bios;
550 int biocache_readdirs;
551 int readdir_bios;
552 int rpccnt[NFS_NPROCS];
553 int rpcretries;
554 int srvrpccnt[NFS_NPROCS];
555 int srvrpc_errs;
556 int srv_errs;
557 int rpcrequests;
558 int rpctimeouts;
559 int rpcunexpected;
560 int rpcinvalid;
561 int srvcache_inproghits;
562 int srvcache_idemdonehits;
563 int srvcache_nonidemdonehits;
564 int srvcache_misses;
565 int srvvop_writes;
566 int pageins;
567 int pageouts;
568 };
569 #endif
570
571 /*
572 * Flags for nfssvc() system call.
573 */
574 #define NFSSVC_BIOD 0x002
575 #define NFSSVC_NFSD 0x004
576 #define NFSSVC_ADDSOCK 0x008
577 #define NFSSVC_AUTHIN 0x010
578 #define NFSSVC_GOTAUTH 0x040
579 #define NFSSVC_AUTHINFAIL 0x080
580 #define NFSSVC_MNTD 0x100
581 #define NFSSVC_EXPORT 0x200
582
583 /*
584 * Flags for nfsclnt() system call.
585 */
586 #define NFSCLNT_LOCKDANS 0x200
587 #define NFSCLNT_LOCKDFD 0x400
588 #define NFSCLNT_LOCKDWAIT 0x800
589
590 /*
591 * fs.nfs sysctl(3) identifiers
592 */
593 #define NFS_NFSSTATS 1 /* struct: struct nfsstats */
594 #define NFS_NFSPRIVPORT 2 /* int: prohibit nfs to resvports */
595
596 #define FS_NFS_NAMES { \
597 { 0, 0 }, \
598 { "nfsstats", CTLTYPE_STRUCT }, \
599 { "nfsprivport", CTLTYPE_INT }, \
600 }
601
602 #ifndef NFS_MUIDHASHSIZ
603 #define NFS_MUIDHASHSIZ 63 /* Tune the size of nfsmount with this */
604 #endif
605 #ifndef NFS_WDELAYHASHSIZ
606 #define NFS_WDELAYHASHSIZ 16 /* and with this */
607 #endif
608
609 /*
610 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
611 * What should be in this set is open to debate, but I believe that since
612 * I/O system calls on ufs are never interrupted by signals the set should
613 * be minimal. My reasoning is that many current programs that use signals
614 * such as SIGALRM will not expect file I/O system calls to be interrupted
615 * by them and break.
616 */
617 #ifdef KERNEL
618 #include <sys/kernel_types.h>
619
620 #ifdef MALLOC_DECLARE
621 MALLOC_DECLARE(M_NFSREQ);
622 MALLOC_DECLARE(M_NFSMNT);
623 MALLOC_DECLARE(M_NFSDIROFF);
624 MALLOC_DECLARE(M_NFSRVDESC);
625 MALLOC_DECLARE(M_NFSUID);
626 MALLOC_DECLARE(M_NFSD);
627 MALLOC_DECLARE(M_NFSBIGFH);
628 #endif
629
630 struct uio; struct vnode_attr; struct nameidata; /* XXX */
631 struct nfsbuf;
632 struct nfs_vattr;
633 struct nfsnode;
634
635 #define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
636 sigmask(SIGHUP)|sigmask(SIGQUIT))
637
638 __private_extern__ int nfs_mbuf_mlen, nfs_mbuf_mhlen,
639 nfs_mbuf_minclsize, nfs_mbuf_mclbytes;
640
641 /*
642 * Socket errors ignored for connectionless sockets??
643 * For now, ignore them all
644 */
645 #define NFSIGNORE_SOERROR(s, e) \
646 ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
647 (e) != EIO && ((s)) != SOCK_STREAM)
648
649 /*
650 * Nfs outstanding request list element
651 */
652 struct nfsreq {
653 TAILQ_ENTRY(nfsreq) r_chain;
654 mbuf_t r_mreq;
655 mbuf_t r_mrep;
656 mbuf_t r_md;
657 caddr_t r_dpos;
658 struct nfsmount *r_nmp;
659 vnode_t r_vp;
660 u_long r_xid;
661 int r_flags; /* flags on request, see below */
662 int r_retry; /* max retransmission count */
663 int r_rexmit; /* current retrans count */
664 int r_timer; /* tick counter on reply */
665 u_int32_t r_procnum; /* NFS procedure number */
666 int r_rtt; /* RTT for rpc */
667 proc_t r_procp; /* Proc that did I/O system call */
668 long r_lastmsg; /* time of last tprintf */
669 };
670
671 /*
672 * Queue head for nfsreq's
673 */
674 extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
675
676 /* Flag values for r_flags */
677 #define R_TIMING 0x0001 /* timing request (in mntp) */
678 #define R_SENT 0x0002 /* request has been sent */
679 #define R_SOFTTERM 0x0004 /* soft mnt, too many retries */
680 #define R_INTR 0x0008 /* intr mnt, signal pending */
681 #define R_SOCKERR 0x0010 /* Fatal error on socket */
682 #define R_TPRINTFMSG 0x0020 /* Did a tprintf msg. */
683 #define R_MUSTRESEND 0x0040 /* Must resend request */
684 #define R_BUSY 0x0100 /* Locked. */
685 #define R_WAITING 0x0200 /* Someone waiting for lock. */
686 #define R_RESENDERR 0x0400 /* resend failed. */
687
688 /*
689 * A list of nfssvc_sock structures is maintained with all the sockets
690 * that require service by the nfsd.
691 * The nfsuid structs hang off of the nfssvc_sock structs in both lru
692 * and uid hash lists.
693 */
694 #ifndef NFS_UIDHASHSIZ
695 #define NFS_UIDHASHSIZ 13 /* Tune the size of nfssvc_sock with this */
696 #endif
697 #define NUIDHASH(sock, uid) \
698 (&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ])
699 #define NWDELAYHASH(sock, f) \
700 (&(sock)->ns_wdelayhashtbl[(*((u_long *)(f))) % NFS_WDELAYHASHSIZ])
701 #define NMUIDHASH(nmp, uid) \
702 (&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ])
703 #define NFSNOHASH(fhsum) \
704 (&nfsnodehashtbl[(fhsum) & nfsnodehash])
705
706 /*
707 * Network address hash list element
708 */
709 union nethostaddr {
710 u_long had_inetaddr;
711 mbuf_t had_nam;
712 };
713
714 struct nfsuid {
715 TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */
716 LIST_ENTRY(nfsuid) nu_hash; /* Hash list */
717 int nu_flag; /* Flags */
718 union nethostaddr nu_haddr; /* Host addr. for dgram sockets */
719 kauth_cred_t nu_cr; /* Cred uid mapped to */
720 int nu_expire; /* Expiry time (sec) */
721 struct timeval nu_timestamp; /* Kerb. timestamp */
722 u_long nu_nickname; /* Nickname on server */
723 NFSKERBKEY_T nu_key; /* and session key */
724 };
725
726 #define nu_inetaddr nu_haddr.had_inetaddr
727 #define nu_nam nu_haddr.had_nam
728 /* Bits for nu_flag */
729 #define NU_INETADDR 0x1
730 #define NU_NAM 0x2
731 #define NU_NETFAM(u) (((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO)
732
733 #ifdef notyet
734 /* XXX CSM 12/2/97 When/if we merge queue.h */
735 struct nfsrv_rec {
736 STAILQ_ENTRY(nfsrv_rec) nr_link;
737 struct sockaddr *nr_address;
738 mbuf_t nr_packet;
739 };
740 #endif
741
742 struct nfssvc_sock {
743 TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
744 lck_rw_t ns_rwlock; /* lock for most fields */
745 socket_t ns_so;
746 mbuf_t ns_nam;
747 mbuf_t ns_raw;
748 mbuf_t ns_rawend;
749 mbuf_t ns_rec;
750 mbuf_t ns_recend;
751 mbuf_t ns_frag;
752 int ns_flag;
753 int ns_sotype;
754 int ns_cc;
755 int ns_reclen;
756 int ns_numuids;
757 u_long ns_sref;
758 time_t ns_timestamp; /* socket timestamp */
759 lck_mtx_t ns_wgmutex; /* mutex for write gather fields */
760 u_quad_t ns_wgtime; /* next Write deadline (usec) */
761 LIST_HEAD(, nfsrv_descript) ns_tq; /* Write gather lists */
762 LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ];
763 TAILQ_HEAD(, nfsuid) ns_uidlruhead;
764 LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ];
765 };
766
767 /* Bits for "ns_flag" */
768 #define SLP_VALID 0x01 /* nfs sock valid */
769 #define SLP_DOREC 0x02 /* nfs sock has received data to process */
770 #define SLP_NEEDQ 0x04 /* network socket has data to receive */
771 #define SLP_DISCONN 0x08 /* socket needs to be zapped */
772 #define SLP_GETSTREAM 0x10 /* currently in nfsrv_getstream() */
773 #define SLP_LASTFRAG 0x20 /* on last fragment of RPC record */
774 #define SLP_ALLFLAGS 0xff
775
776 extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead, nfssvc_deadsockhead;
777
778 /* locks for nfssvc_sock's */
779 extern lck_grp_attr_t *nfs_slp_group_attr;
780 extern lck_attr_t *nfs_slp_lock_attr;
781 extern lck_grp_t *nfs_slp_rwlock_group;
782 extern lck_grp_t *nfs_slp_mutex_group;
783
784 /*
785 * One of these structures is allocated for each nfsd.
786 */
787 struct nfsd {
788 TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */
789 int nfsd_flag; /* NFSD_ flags */
790 struct nfssvc_sock *nfsd_slp; /* Current socket */
791 int nfsd_authlen; /* Authenticator len */
792 u_char nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */
793 int nfsd_verflen; /* and the Verifier */
794 u_char nfsd_verfstr[RPCVERF_MAXSIZ];
795 proc_t nfsd_procp; /* Proc ptr */
796 struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */
797 };
798
799 /* Bits for "nfsd_flag" */
800 #define NFSD_WAITING 0x01
801 #define NFSD_REQINPROG 0x02
802 #define NFSD_NEEDAUTH 0x04
803 #define NFSD_AUTHFAIL 0x08
804
805 /*
806 * This structure is used by the server for describing each request.
807 * Some fields are used only when write request gathering is performed.
808 */
809 struct nfsrv_descript {
810 u_quad_t nd_time; /* Write deadline (usec) */
811 off_t nd_off; /* Start byte offset */
812 off_t nd_eoff; /* and end byte offset */
813 LIST_ENTRY(nfsrv_descript) nd_hash; /* Hash list */
814 LIST_ENTRY(nfsrv_descript) nd_tq; /* and timer list */
815 LIST_HEAD(,nfsrv_descript) nd_coalesce; /* coalesced writes */
816 mbuf_t nd_mrep; /* Request mbuf list */
817 mbuf_t nd_md; /* Current dissect mbuf */
818 mbuf_t nd_mreq; /* Reply mbuf list */
819 mbuf_t nd_nam; /* and socket addr */
820 mbuf_t nd_nam2; /* return socket addr */
821 caddr_t nd_dpos; /* Current dissect pos */
822 u_int32_t nd_procnum; /* RPC # */
823 int nd_stable; /* storage type */
824 int nd_flag; /* nd_flag */
825 int nd_len; /* Length of this write */
826 int nd_repstat; /* Reply status */
827 u_long nd_retxid; /* Reply xid */
828 struct timeval nd_starttime; /* Time RPC initiated */
829 struct nfs_filehandle nd_fh; /* File handle */
830 kauth_cred_t nd_cr; /* Credentials */
831 };
832
833 /* Bits for "nd_flag" */
834 #define ND_NFSV3 0x08
835 #define ND_KERBNICK 0x20
836 #define ND_KERBFULL 0x40
837 #define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL)
838
839 extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head;
840 extern int nfsd_head_flag;
841 #define NFSD_CHECKSLP 0x01
842
843 /*
844 * These macros compare nfsrv_descript structures.
845 */
846 #define NFSW_CONTIG(o, n) \
847 (((o)->nd_eoff >= (n)->nd_off) && \
848 ((o)->nd_fh.nfh_len == (n)->nd_fh.nfh_len) && \
849 !bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, (o)->nd_fh.nfh_len))
850
851 #define NFSW_SAMECRED(o, n) \
852 (((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \
853 !bcmp((caddr_t)(o)->nd_cr, (caddr_t)(n)->nd_cr, \
854 sizeof (struct ucred)))
855
856 /* mutex for nfs server */
857 extern lck_grp_t * nfsd_lck_grp;
858 extern lck_grp_attr_t * nfsd_lck_grp_attr;
859 extern lck_attr_t * nfsd_lck_attr;
860 extern lck_mtx_t *nfsd_mutex;
861
862 extern int nfs_numnfsd, nfsd_waiting;
863
864 /*
865 * Defines for WebNFS
866 */
867
868 #define WEBNFS_ESC_CHAR '%'
869 #define WEBNFS_SPECCHAR_START 0x80
870
871 #define WEBNFS_NATIVE_CHAR 0x80
872 /*
873 * ..
874 * Possibly more here in the future.
875 */
876
877 /*
878 * Macro for converting escape characters in WebNFS pathnames.
879 * Should really be in libkern.
880 */
881 #define ISHEX(c) \
882 ((((c) >= 'a') && ((c) <= 'f')) || \
883 (((c) >= 'A') && ((c) <= 'F')) || \
884 (((c) >= '0') && ((c) <= '9')))
885 #define HEXTOC(c) \
886 ((c) >= 'a' ? ((c) - ('a' - 10)) : \
887 ((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))
888 #define HEXSTRTOI(p) \
889 ((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))
890
891 __BEGIN_DECLS
892
893 int nfs_init(struct vfsconf *vfsp);
894 void nfs_mbuf_init(void);
895 int nfs_reply(struct nfsreq *);
896 int nfs_getreq(struct nfsrv_descript *,struct nfsd *,int);
897 int nfs_send(socket_t, mbuf_t, mbuf_t, struct nfsreq *);
898 int nfs_rephead(int, struct nfsrv_descript *, struct nfssvc_sock *,
899 int, mbuf_t *, mbuf_t *, caddr_t *);
900 int nfs_sndlock(struct nfsreq *);
901 void nfs_sndunlock(struct nfsreq *);
902 int nfs_vinvalbuf(vnode_t, int, struct ucred *, proc_t, int);
903 int nfs_buf_page_inval(vnode_t vp, off_t offset);
904 int nfs_readrpc(vnode_t, struct uio *, struct ucred *, proc_t);
905 int nfs_writerpc(vnode_t, struct uio *, struct ucred *, proc_t, int *, int *);
906 int nfs_readdirrpc(vnode_t, struct uio *, struct ucred *, proc_t);
907 int nfs_readdirplusrpc(vnode_t, struct uio *, struct ucred *, proc_t);
908 int nfs_asyncio(struct nfsbuf *, struct ucred *);
909 int nfs_doio(struct nfsbuf *, struct ucred *, proc_t);
910 int nfs_readlinkrpc(vnode_t, struct uio *, struct ucred *, proc_t);
911 int nfs_sigintr(struct nfsmount *, struct nfsreq *, proc_t);
912 int nfsm_disct(mbuf_t *, caddr_t *, int, int, caddr_t *);
913 void nfsm_srvfattr(struct nfsrv_descript *, struct vnode_attr *,
914 struct nfs_fattr *);
915 void nfsm_srvwcc(struct nfsrv_descript *, int, struct vnode_attr *, int,
916 struct vnode_attr *, mbuf_t *, char **);
917 void nfsm_srvpostopattr(struct nfsrv_descript *, int, struct vnode_attr *,
918 mbuf_t *, char **);
919 int netaddr_match(int, union nethostaddr *, mbuf_t);
920 int nfs_request(vnode_t, mount_t, mbuf_t, int, proc_t,
921 struct ucred *, mbuf_t *, mbuf_t *,
922 caddr_t *, u_int64_t *);
923 int nfs_parsefattr(mbuf_t *, caddr_t *, int, struct nfs_vattr *);
924 int nfs_loadattrcache(struct nfsnode *, struct nfs_vattr *, u_int64_t *, int);
925 int nfsm_path_mbuftond(mbuf_t *, caddr_t *, int, int, int *, struct nameidata *);
926 int nfs_namei(struct nfsrv_descript *, struct vfs_context *, struct nameidata *,
927 struct nfs_filehandle *, mbuf_t, int, vnode_t *,
928 struct nfs_export **, struct nfs_export_options **);
929 void nfsm_adj(mbuf_t, int, int);
930 int nfsm_mbuftouio(mbuf_t *, struct uio *, int, caddr_t *);
931 void nfsrv_initcache(void);
932 int nfs_getauth(struct nfsmount *, struct nfsreq *, struct ucred *,
933 char **, int *, char *, int *, NFSKERBKEY_T);
934 int nfs_getnickauth(struct nfsmount *, struct ucred *, char **,
935 int *, char *, int);
936 int nfs_savenickauth(struct nfsmount *, struct ucred *, int,
937 NFSKERBKEY_T, mbuf_t *, char **,
938 mbuf_t);
939 int nfs_adv(mbuf_t *, caddr_t *, int, int);
940 void nfs_nhinit(void);
941 void nfs_timer_funnel(void*);
942 void nfs_timer(void*);
943 u_long nfs_hash(u_char *, int);
944 int nfsrv_dorec(struct nfssvc_sock *, struct nfsd *,
945 struct nfsrv_descript **);
946 int nfsrv_getcache(struct nfsrv_descript *, struct nfssvc_sock *,
947 mbuf_t *);
948 void nfsrv_updatecache(struct nfsrv_descript *, int, mbuf_t);
949 void nfsrv_cleancache(void);
950 int nfs_bind_resv_thread_wake(void);
951 int nfs_connect(struct nfsmount *, struct nfsreq *);
952 void nfs_disconnect(struct nfsmount *);
953 int nfs_getattr_no_vnode(mount_t,u_char *,int,struct ucred *,proc_t,struct nfs_vattr *,u_int64_t *);
954 int nfs_getattr(vnode_t vp, struct nfs_vattr *nvap, struct ucred *cred, proc_t p);
955 int nfs_getattrcache(vnode_t, struct nfs_vattr *);
956 int nfs_attrcachetimeout(vnode_t);
957 int nfsm_strtmbuf(mbuf_t *, char **, char *, long);
958 int nfs_bioread(vnode_t, struct uio *, int, struct ucred *, proc_t);
959 int nfsm_uiotombuf(struct uio *, mbuf_t *, int, caddr_t *);
960 void nfsrv_init(int);
961 int nfs_commit(vnode_t vp, u_quad_t offset, u_int32_t count,
962 struct ucred *cred, proc_t procp);
963 int nfs_flushcommits(vnode_t, proc_t, int);
964 int nfs_flush(vnode_t,int,struct ucred *,proc_t,int);
965 void nfs_clearcommit(mount_t);
966 int nfsrv_errmap(struct nfsrv_descript *, int);
967 void nfsrvw_sort(gid_t *, int);
968 void nfsrv_setcred(struct ucred *, struct ucred *);
969 int nfs_buf_write(struct nfsbuf *);
970 void nfsrv_wakenfsd(struct nfssvc_sock *slp);
971 int nfsrv_writegather(struct nfsrv_descript **, struct nfssvc_sock *,
972 proc_t, mbuf_t *);
973 int nfs_fsinfo(struct nfsmount *, vnode_t, struct ucred *, proc_t p);
974 int nfs_pathconfrpc(vnode_t, struct nfsv3_pathconf *, kauth_cred_t, proc_t);
975 void nfs_pathconf_cache(struct nfsmount *, struct nfsv3_pathconf *);
976
977 int nfsrv3_access(struct nfsrv_descript *nfsd,
978 struct nfssvc_sock *slp,
979 proc_t procp, mbuf_t *mrq);
980 int nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
981 proc_t procp, mbuf_t *mrq);
982 int nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
983 proc_t procp, mbuf_t *mrq);
984 int nfsrv_credcheck(struct nfsrv_descript *, struct nfs_export *,
985 struct nfs_export_options *);
986 int nfsrv_export(struct user_nfs_export_args *, struct vfs_context *);
987 int nfsrv_fhmatch(struct nfs_filehandle *fh1, struct nfs_filehandle *fh2);
988 int nfsrv_fhtovp(struct nfs_filehandle *, mbuf_t, int, vnode_t *,
989 struct nfs_export **, struct nfs_export_options **);
990 int nfs_ispublicfh(struct nfs_filehandle *);
991 int nfsrv_fsinfo(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
992 proc_t procp, mbuf_t *mrq);
993 int nfsrv_getattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
994 proc_t procp, mbuf_t *mrq);
995 int nfsrv_link(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
996 proc_t procp, mbuf_t *mrq);
997 int nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
998 proc_t procp, mbuf_t *mrq);
999 int nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1000 proc_t procp, mbuf_t *mrq);
1001 int nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1002 proc_t procp, mbuf_t *mrq);
1003 int nfsrv_noop(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1004 proc_t procp, mbuf_t *mrq);
1005 int nfsrv_null(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1006 proc_t procp, mbuf_t *mrq);
1007 int nfsrv_pathconf(struct nfsrv_descript *nfsd,
1008 struct nfssvc_sock *slp, proc_t procp,
1009 mbuf_t *mrq);
1010 void nfsrv_rcv(socket_t, caddr_t arg, int waitflag);
1011 void nfsrv_rcv_locked(socket_t, struct nfssvc_sock *slp, int waitflag);
1012 int nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1013 proc_t procp, mbuf_t *mrq);
1014 int nfsrv_readdir(struct nfsrv_descript *nfsd,
1015 struct nfssvc_sock *slp,
1016 proc_t procp, mbuf_t *mrq);
1017 int nfsrv_readdirplus(struct nfsrv_descript *nfsd,
1018 struct nfssvc_sock *slp, proc_t procp,
1019 mbuf_t *mrq);
1020 int nfsrv_readlink(struct nfsrv_descript *nfsd,
1021 struct nfssvc_sock *slp, proc_t procp,
1022 mbuf_t *mrq);
1023 int nfsrv_remove(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1024 proc_t procp, mbuf_t *mrq);
1025 int nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1026 proc_t procp, mbuf_t *mrq);
1027 int nfsrv_rmdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1028 proc_t procp, mbuf_t *mrq);
1029 int nfsrv_setattr(struct nfsrv_descript *nfsd,
1030 struct nfssvc_sock *slp,
1031 proc_t procp, mbuf_t *mrq);
1032 void nfsrv_slpderef(struct nfssvc_sock *slp);
1033 void nfsrv_slpfree(struct nfssvc_sock *slp);
1034 int nfsrv_statfs(struct nfsrv_descript *nfsd,
1035 struct nfssvc_sock *slp,
1036 proc_t procp, mbuf_t *mrq);
1037 int nfsrv_symlink(struct nfsrv_descript *nfsd,
1038 struct nfssvc_sock *slp,
1039 proc_t procp, mbuf_t *mrq);
1040 int nfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1041 proc_t procp, mbuf_t *mrq);
1042 int nfsrv_vptofh( struct nfs_export *, int, struct nfs_filehandle *,
1043 vnode_t, struct vfs_context *, struct nfs_filehandle *);
1044
1045 void nfs_up(struct nfsmount *, proc_t, int, const char *);
1046 void nfs_down(struct nfsmount *, proc_t, int, int, const char *);
1047
1048 struct nfs_diskless;
1049 int nfs_boot_init(struct nfs_diskless *nd, proc_t procp);
1050 int nfs_boot_getfh(struct nfs_diskless *nd, proc_t procp, int v3, int sotype);
1051
1052 __END_DECLS
1053
1054 #endif /* KERNEL */
1055 #endif /* __APPLE_API_PRIVATE */
1056
1057 #endif