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