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