]> git.saurik.com Git - apple/xnu.git/blob - bsd/nfs/nfs.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / bsd / nfs / nfs.h
1 /*
2 * Copyright (c) 2000-2005 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_IOSIZE (256 * 1024) /* suggested I/O size */
106 #define NFS_WSIZE 16384 /* Def. write data size <= 16K */
107 #define NFS_RSIZE 16384 /* Def. read data size <= 16K */
108 #define NFS_DGRAM_WSIZE 8192 /* UDP Def. write data size <= 8K */
109 #define NFS_DGRAM_RSIZE 8192 /* UDP Def. read data size <= 8K */
110 #define NFS_READDIRSIZE 8192 /* Def. readdir size */
111 #define NFS_DEFRAHEAD 4 /* Def. read ahead # blocks */
112 #define NFS_MAXRAHEAD 16 /* Max. read ahead # blocks */
113 #define NFS_MAXUIDHASH 64 /* Max. # of hashed uid entries/mp */
114 #define NFS_MAXASYNCDAEMON 32 /* Max. number async_daemons runnable */
115 #define NFS_MAXGATHERDELAY 100 /* Max. write gather delay (msec) */
116 #ifndef NFS_GATHERDELAY
117 #define NFS_GATHERDELAY 10 /* Default write gather delay (msec) */
118 #endif
119 #define NFS_DIRBLKSIZ 4096 /* Must be a multiple of DIRBLKSIZ */
120 #if defined(KERNEL) && !defined(DIRBLKSIZ)
121 #define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */
122 /* can't be larger than NFS_FABLKSIZE */
123 #endif
124
125 /*
126 * Oddballs
127 */
128 #define NMOD(a) ((a) % nfs_asyncdaemons)
129 #define NFS_CMPFH(n, f, s) \
130 ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
131 #define NFS_ISV3(v) (VFSTONFS(vnode_mount(v))->nm_flag & NFSMNT_NFSV3)
132 #define NFS_SRVMAXDATA(n) \
133 (((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \
134 NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
135
136 /*
137 * XXX
138 * The NB_INVAFTERWRITE flag should be set to whatever is required by the
139 * buffer cache code to say "Invalidate the block after it is written back".
140 */
141 #ifdef __FreeBSD__
142 #define NB_INVAFTERWRITE NB_NOCACHE
143 #else
144 #define NB_INVAFTERWRITE NB_INVAL
145 #endif
146
147 /*
148 * The IO_METASYNC flag should be implemented for local file systems.
149 * (Until then, it is nothin at all.)
150 */
151 #ifndef IO_METASYNC
152 #define IO_METASYNC 0
153 #endif
154
155 /*
156 * Expected allocation sizes for major data structures. If the actual size
157 * of the structure exceeds these sizes, then malloc() will be allocating
158 * almost twice the memory required. This is used in nfs_init() to warn
159 * the sysadmin that the size of a structure should be reduced.
160 * (These sizes are always a power of 2. If the kernel malloc() changes
161 * to one that does not allocate space in powers of 2 size, then this all
162 * becomes bunk!).
163 * Note that some of these structures come out of there own nfs zones.
164 */
165 #define NFS_NODEALLOC 512
166 #define NFS_MNTALLOC 512
167 #define NFS_SVCALLOC 256
168 #define NFS_UIDALLOC 128
169
170 /*
171 * Arguments to mount NFS
172 */
173 #define NFS_ARGSVERSION 4 /* change when nfs_args changes */
174 struct nfs_args {
175 int version; /* args structure version number */
176 struct sockaddr *addr; /* file server address */
177 int addrlen; /* length of address */
178 int sotype; /* Socket type */
179 int proto; /* and Protocol */
180 u_char *fh; /* File handle to be mounted */
181 int fhsize; /* Size, in bytes, of fh */
182 int flags; /* flags */
183 int wsize; /* write size in bytes */
184 int rsize; /* read size in bytes */
185 int readdirsize; /* readdir size in bytes */
186 int timeo; /* initial timeout in .1 secs */
187 int retrans; /* times to retry send */
188 int maxgrouplist; /* Max. size of group list */
189 int readahead; /* # of blocks to readahead */
190 int leaseterm; /* obsolete: Term (sec) of lease */
191 int deadthresh; /* obsolete: Retrans threshold */
192 char *hostname; /* server's name */
193 /* NFS_ARGSVERSION 3 ends here */
194 int acregmin; /* reg file min attr cache timeout */
195 int acregmax; /* reg file max attr cache timeout */
196 int acdirmin; /* dir min attr cache timeout */
197 int acdirmax; /* dir max attr cache timeout */
198 };
199
200 struct nfs_args3 {
201 int version; /* args structure version number */
202 struct sockaddr *addr; /* file server address */
203 int addrlen; /* length of address */
204 int sotype; /* Socket type */
205 int proto; /* and Protocol */
206 u_char *fh; /* File handle to be mounted */
207 int fhsize; /* Size, in bytes, of fh */
208 int flags; /* flags */
209 int wsize; /* write size in bytes */
210 int rsize; /* read size in bytes */
211 int readdirsize; /* readdir size in bytes */
212 int timeo; /* initial timeout in .1 secs */
213 int retrans; /* times to retry send */
214 int maxgrouplist; /* Max. size of group list */
215 int readahead; /* # of blocks to readahead */
216 int leaseterm; /* obsolete: Term (sec) of lease */
217 int deadthresh; /* obsolete: Retrans threshold */
218 char *hostname; /* server's name */
219 };
220
221 // LP64todo - should this move?
222 #ifdef KERNEL
223 /* LP64 version of nfs_args. all pointers and longs
224 * grow when we're dealing with a 64-bit process.
225 * WARNING - keep in sync with nfs_args
226 */
227 struct user_nfs_args {
228 int version; /* args structure version number */
229 user_addr_t addr __attribute((aligned(8))); /* file server address */
230 int addrlen; /* length of address */
231 int sotype; /* Socket type */
232 int proto; /* and Protocol */
233 user_addr_t fh __attribute((aligned(8))); /* File handle to be mounted */
234 int fhsize; /* Size, in bytes, of fh */
235 int flags; /* flags */
236 int wsize; /* write size in bytes */
237 int rsize; /* read size in bytes */
238 int readdirsize; /* readdir size in bytes */
239 int timeo; /* initial timeout in .1 secs */
240 int retrans; /* times to retry send */
241 int maxgrouplist; /* Max. size of group list */
242 int readahead; /* # of blocks to readahead */
243 int leaseterm; /* obsolete: Term (sec) of lease */
244 int deadthresh; /* obsolete: Retrans threshold */
245 user_addr_t hostname __attribute((aligned(8))); /* server's name */
246 /* NFS_ARGSVERSION 3 ends here */
247 int acregmin; /* reg file min attr cache timeout */
248 int acregmax; /* reg file max attr cache timeout */
249 int acdirmin; /* dir min attr cache timeout */
250 int acdirmax; /* dir max attr cache timeout */
251 };
252 struct user_nfs_args3 {
253 int version; /* args structure version number */
254 user_addr_t addr __attribute((aligned(8))); /* file server address */
255 int addrlen; /* length of address */
256 int sotype; /* Socket type */
257 int proto; /* and Protocol */
258 user_addr_t fh __attribute((aligned(8))); /* File handle to be mounted */
259 int fhsize; /* Size, in bytes, of fh */
260 int flags; /* flags */
261 int wsize; /* write size in bytes */
262 int rsize; /* read size in bytes */
263 int readdirsize; /* readdir size in bytes */
264 int timeo; /* initial timeout in .1 secs */
265 int retrans; /* times to retry send */
266 int maxgrouplist; /* Max. size of group list */
267 int readahead; /* # of blocks to readahead */
268 int leaseterm; /* obsolete: Term (sec) of lease */
269 int deadthresh; /* obsolete: Retrans threshold */
270 user_addr_t hostname __attribute((aligned(8))); /* server's name */
271 };
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 struct user_nfsd_args {
345 int sock; /* Socket to serve */
346 user_addr_t name __attribute((aligned(8))); /* Client addr for connection based sockets */
347 int namelen; /* Length of name */
348 };
349
350 #endif // KERNEL
351
352 struct nfsd_srvargs {
353 struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */
354 uid_t nsd_uid; /* Effective uid mapped to cred */
355 u_long nsd_haddr; /* Ip address of client */
356 struct ucred nsd_cr; /* Cred. uid maps to */
357 int nsd_authlen; /* Length of auth string (ret) */
358 u_char *nsd_authstr; /* Auth string (ret) */
359 int nsd_verflen; /* and the verfier */
360 u_char *nsd_verfstr;
361 struct timeval nsd_timestamp; /* timestamp from verifier */
362 u_long nsd_ttl; /* credential ttl (sec) */
363 NFSKERBKEY_T nsd_key; /* Session key */
364 };
365
366 struct nfsd_cargs {
367 char *ncd_dirp; /* Mount dir path */
368 uid_t ncd_authuid; /* Effective uid */
369 int ncd_authtype; /* Type of authenticator */
370 int ncd_authlen; /* Length of authenticator string */
371 u_char *ncd_authstr; /* Authenticator string */
372 int ncd_verflen; /* and the verifier */
373 u_char *ncd_verfstr;
374 NFSKERBKEY_T ncd_key; /* Session key */
375 };
376
377 /*
378 * NFS Server File Handle structures
379 */
380
381 /* NFS export handle identifies which NFS export */
382 #define NFS_FH_VERSION 0x4e580000 /* 'NX00' */
383 struct nfs_exphandle {
384 uint32_t nxh_version; /* data structure version */
385 uint32_t nxh_fsid; /* File System Export ID */
386 uint32_t nxh_expid; /* Export ID */
387 uint16_t nxh_flags; /* export handle flags */
388 uint8_t nxh_reserved; /* future use */
389 uint8_t nxh_fidlen; /* length of File ID */
390 };
391
392 /* nxh_flags */
393 #define NXHF_INVALIDFH 0x0001 /* file handle is invalid */
394
395 #define NFS_MAX_FID_SIZE (NFS_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
396 #define NFSV2_MAX_FID_SIZE (NFSV2_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
397
398 /* NFS server internal view of fhandle_t */
399 struct nfs_filehandle {
400 int nfh_len; /* total length of file handle */
401 struct nfs_exphandle nfh_xh; /* export handle */
402 unsigned char nfh_fid[NFS_MAX_FID_SIZE]; /* File ID */
403 };
404
405 /*
406 * NFS export data structures
407 */
408
409 struct nfs_export_net_args {
410 uint32_t nxna_flags; /* export flags */
411 struct xucred nxna_cred; /* mapped credential for root/all user */
412 struct sockaddr_storage nxna_addr; /* net address to which exported */
413 struct sockaddr_storage nxna_mask; /* mask for net address */
414 };
415
416 struct nfs_export_args {
417 uint32_t nxa_fsid; /* export FS ID */
418 uint32_t nxa_expid; /* export ID */
419 char *nxa_fspath; /* export FS path */
420 char *nxa_exppath; /* export sub-path */
421 uint32_t nxa_flags; /* export arg flags */
422 uint32_t nxa_netcount; /* #entries in ex_nets array */
423 struct nfs_export_net_args *nxa_nets; /* array of net args */
424 };
425
426 #ifdef KERNEL
427 /* LP64 version of export_args */
428
429 struct user_nfs_export_args {
430 uint32_t nxa_fsid; /* export FS ID */
431 uint32_t nxa_expid; /* export ID */
432 user_addr_t nxa_fspath; /* export FS path */
433 user_addr_t nxa_exppath; /* export sub-path */
434 uint32_t nxa_flags; /* export arg flags */
435 uint32_t nxa_netcount; /* #entries in ex_nets array */
436 user_addr_t nxa_nets; /* array of net args */
437 };
438
439 #endif /* KERNEL */
440
441 /* nfs export arg flags */
442 #define NXA_DELETE 0x0001 /* delete the specified export(s) */
443 #define NXA_ADD 0x0002 /* add the specified export(s) */
444 #define NXA_REPLACE 0x0003 /* delete and add the specified export(s) */
445 #define NXA_DELETE_ALL 0x0004 /* delete all exports */
446
447 /* export option flags */
448 #define NX_READONLY 0x0001 /* exported read-only */
449 #define NX_DEFAULTEXPORT 0x0002 /* exported to the world */
450 #define NX_MAPROOT 0x0004 /* map root access to anon credential */
451 #define NX_MAPALL 0x0008 /* map all access to anon credential */
452 #define NX_KERB 0x0010 /* exported with Kerberos uid mapping */
453 #define NX_32BITCLIENTS 0x0020 /* restrict directory cookies to 32 bits */
454
455 #ifdef KERNEL
456 struct nfs_exportfs;
457
458 struct nfs_export_options {
459 uint32_t nxo_flags; /* export options */
460 kauth_cred_t nxo_cred; /* mapped credential */
461 };
462
463 /* Network address lookup element and individual export options */
464 struct nfs_netopt {
465 struct radix_node no_rnodes[2]; /* radix tree glue */
466 struct nfs_export_options no_opt; /* export options */
467 };
468
469 /* Network export information */
470 /* one of these for each exported directory */
471 struct nfs_export {
472 LIST_ENTRY(nfs_export) nx_next; /* FS export list */
473 LIST_ENTRY(nfs_export) nx_hash; /* export hash chain */
474 struct nfs_export *nx_parent; /* parent export */
475 uint32_t nx_id; /* export ID */
476 uint32_t nx_flags; /* export flags */
477 struct nfs_exportfs *nx_fs; /* exported file system */
478 char *nx_path; /* exported file system sub-path */
479 struct nfs_filehandle nx_fh; /* export root file handle */
480 struct nfs_export_options nx_defopt; /* default options */
481 uint32_t nx_expcnt; /* # exports in table */
482 struct radix_node_head *nx_rtable[AF_MAX+1]; /* table of exports (netopts) */
483 };
484
485 /* NFS exported file system info */
486 /* one of these for each exported file system */
487 struct nfs_exportfs {
488 LIST_ENTRY(nfs_exportfs) nxfs_next; /* exported file system list */
489 uint32_t nxfs_id; /* exported file system ID */
490 char *nxfs_path; /* exported file system path */
491 LIST_HEAD(,nfs_export) nxfs_exports; /* list of exports for this file system */
492 };
493
494 extern LIST_HEAD(nfsexpfslist, nfs_exportfs) nfs_exports;
495 extern lck_rw_t nfs_export_rwlock; // lock for export data structures
496 #define NFSEXPHASHVAL(FSID, EXPID) \
497 (((FSID) >> 24) ^ ((FSID) >> 16) ^ ((FSID) >> 8) ^ (EXPID))
498 #define NFSEXPHASH(FSID, EXPID) \
499 (&nfsexphashtbl[NFSEXPHASHVAL((FSID),(EXPID)) & nfsexphash])
500 extern LIST_HEAD(nfsexphashhead, nfs_export) *nfsexphashtbl;
501 extern u_long nfsexphash;
502
503 #endif // KERNEL
504
505 /*
506 * XXX to allow amd to include nfs.h without nfsproto.h
507 */
508 #ifdef NFS_NPROCS
509 /*
510 * Stats structure
511 */
512 struct nfsstats {
513 int attrcache_hits;
514 int attrcache_misses;
515 int lookupcache_hits;
516 int lookupcache_misses;
517 int direofcache_hits;
518 int direofcache_misses;
519 int biocache_reads;
520 int read_bios;
521 int read_physios;
522 int biocache_writes;
523 int write_bios;
524 int write_physios;
525 int biocache_readlinks;
526 int readlink_bios;
527 int biocache_readdirs;
528 int readdir_bios;
529 int rpccnt[NFS_NPROCS];
530 int rpcretries;
531 int srvrpccnt[NFS_NPROCS];
532 int srvrpc_errs;
533 int srv_errs;
534 int rpcrequests;
535 int rpctimeouts;
536 int rpcunexpected;
537 int rpcinvalid;
538 int srvcache_inproghits;
539 int srvcache_idemdonehits;
540 int srvcache_nonidemdonehits;
541 int srvcache_misses;
542 int srvvop_writes;
543 int pageins;
544 int pageouts;
545 };
546 #endif
547
548 /*
549 * Flags for nfssvc() system call.
550 */
551 #define NFSSVC_BIOD 0x002
552 #define NFSSVC_NFSD 0x004
553 #define NFSSVC_ADDSOCK 0x008
554 #define NFSSVC_AUTHIN 0x010
555 #define NFSSVC_GOTAUTH 0x040
556 #define NFSSVC_AUTHINFAIL 0x080
557 #define NFSSVC_MNTD 0x100
558 #define NFSSVC_EXPORT 0x200
559
560 /*
561 * Flags for nfsclnt() system call.
562 */
563 #define NFSCLNT_LOCKDANS 0x200
564 #define NFSCLNT_LOCKDFD 0x400
565 #define NFSCLNT_LOCKDWAIT 0x800
566
567 /*
568 * fs.nfs sysctl(3) identifiers
569 */
570 #define NFS_NFSSTATS 1 /* struct: struct nfsstats */
571 #define NFS_NFSPRIVPORT 2 /* int: prohibit nfs to resvports */
572
573 #define FS_NFS_NAMES { \
574 { 0, 0 }, \
575 { "nfsstats", CTLTYPE_STRUCT }, \
576 { "nfsprivport", CTLTYPE_INT }, \
577 }
578
579 #ifndef NFS_MUIDHASHSIZ
580 #define NFS_MUIDHASHSIZ 63 /* Tune the size of nfsmount with this */
581 #endif
582 #ifndef NFS_WDELAYHASHSIZ
583 #define NFS_WDELAYHASHSIZ 16 /* and with this */
584 #endif
585
586 /*
587 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
588 * What should be in this set is open to debate, but I believe that since
589 * I/O system calls on ufs are never interrupted by signals the set should
590 * be minimal. My reasoning is that many current programs that use signals
591 * such as SIGALRM will not expect file I/O system calls to be interrupted
592 * by them and break.
593 */
594 #ifdef KERNEL
595 #include <sys/kernel_types.h>
596
597 #ifdef MALLOC_DECLARE
598 MALLOC_DECLARE(M_NFSREQ);
599 MALLOC_DECLARE(M_NFSMNT);
600 MALLOC_DECLARE(M_NFSDIROFF);
601 MALLOC_DECLARE(M_NFSRVDESC);
602 MALLOC_DECLARE(M_NFSUID);
603 MALLOC_DECLARE(M_NFSD);
604 MALLOC_DECLARE(M_NFSBIGFH);
605 #endif
606
607 struct uio; struct vnode_attr; struct nameidata; /* XXX */
608 struct nfsbuf;
609 struct nfs_vattr;
610 struct nfsnode;
611
612 #define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
613 sigmask(SIGHUP)|sigmask(SIGQUIT))
614
615 __private_extern__ int nfs_mbuf_mlen, nfs_mbuf_mhlen,
616 nfs_mbuf_minclsize, nfs_mbuf_mclbytes;
617
618 /*
619 * Socket errors ignored for connectionless sockets??
620 * For now, ignore them all
621 */
622 #define NFSIGNORE_SOERROR(s, e) \
623 ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \
624 (e) != EIO && ((s)) != SOCK_STREAM)
625
626 /*
627 * Nfs outstanding request list element
628 */
629 struct nfsreq {
630 TAILQ_ENTRY(nfsreq) r_chain;
631 mbuf_t r_mreq;
632 mbuf_t r_mrep;
633 mbuf_t r_md;
634 caddr_t r_dpos;
635 struct nfsmount *r_nmp;
636 vnode_t r_vp;
637 u_long r_xid;
638 int r_flags; /* flags on request, see below */
639 int r_retry; /* max retransmission count */
640 int r_rexmit; /* current retrans count */
641 int r_timer; /* tick counter on reply */
642 u_int32_t r_procnum; /* NFS procedure number */
643 int r_rtt; /* RTT for rpc */
644 proc_t r_procp; /* Proc that did I/O system call */
645 long r_lastmsg; /* time of last tprintf */
646 };
647
648 /*
649 * Queue head for nfsreq's
650 */
651 extern TAILQ_HEAD(nfs_reqq, nfsreq) nfs_reqq;
652
653 /* Flag values for r_flags */
654 #define R_TIMING 0x0001 /* timing request (in mntp) */
655 #define R_SENT 0x0002 /* request has been sent */
656 #define R_SOFTTERM 0x0004 /* soft mnt, too many retries */
657 #define R_INTR 0x0008 /* intr mnt, signal pending */
658 #define R_SOCKERR 0x0010 /* Fatal error on socket */
659 #define R_TPRINTFMSG 0x0020 /* Did a tprintf msg. */
660 #define R_MUSTRESEND 0x0040 /* Must resend request */
661 #define R_BUSY 0x0100 /* Locked. */
662 #define R_WAITING 0x0200 /* Someone waiting for lock. */
663 #define R_RESENDERR 0x0400 /* resend failed. */
664
665 /*
666 * A list of nfssvc_sock structures is maintained with all the sockets
667 * that require service by the nfsd.
668 * The nfsuid structs hang off of the nfssvc_sock structs in both lru
669 * and uid hash lists.
670 */
671 #ifndef NFS_UIDHASHSIZ
672 #define NFS_UIDHASHSIZ 13 /* Tune the size of nfssvc_sock with this */
673 #endif
674 #define NUIDHASH(sock, uid) \
675 (&(sock)->ns_uidhashtbl[(uid) % NFS_UIDHASHSIZ])
676 #define NWDELAYHASH(sock, f) \
677 (&(sock)->ns_wdelayhashtbl[(*((u_long *)(f))) % NFS_WDELAYHASHSIZ])
678 #define NMUIDHASH(nmp, uid) \
679 (&(nmp)->nm_uidhashtbl[(uid) % NFS_MUIDHASHSIZ])
680 #define NFSNOHASH(fhsum) \
681 (&nfsnodehashtbl[(fhsum) & nfsnodehash])
682
683 /*
684 * Network address hash list element
685 */
686 union nethostaddr {
687 u_long had_inetaddr;
688 mbuf_t had_nam;
689 };
690
691 struct nfsuid {
692 TAILQ_ENTRY(nfsuid) nu_lru; /* LRU chain */
693 LIST_ENTRY(nfsuid) nu_hash; /* Hash list */
694 int nu_flag; /* Flags */
695 union nethostaddr nu_haddr; /* Host addr. for dgram sockets */
696 kauth_cred_t nu_cr; /* Cred uid mapped to */
697 int nu_expire; /* Expiry time (sec) */
698 struct timeval nu_timestamp; /* Kerb. timestamp */
699 u_long nu_nickname; /* Nickname on server */
700 NFSKERBKEY_T nu_key; /* and session key */
701 };
702
703 #define nu_inetaddr nu_haddr.had_inetaddr
704 #define nu_nam nu_haddr.had_nam
705 /* Bits for nu_flag */
706 #define NU_INETADDR 0x1
707 #define NU_NAM 0x2
708 #define NU_NETFAM(u) (((u)->nu_flag & NU_INETADDR) ? AF_INET : AF_ISO)
709
710 #ifdef notyet
711 /* XXX CSM 12/2/97 When/if we merge queue.h */
712 struct nfsrv_rec {
713 STAILQ_ENTRY(nfsrv_rec) nr_link;
714 struct sockaddr *nr_address;
715 mbuf_t nr_packet;
716 };
717 #endif
718
719 struct nfssvc_sock {
720 TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */
721 lck_rw_t ns_rwlock; /* lock for most fields */
722 socket_t ns_so;
723 mbuf_t ns_nam;
724 mbuf_t ns_raw;
725 mbuf_t ns_rawend;
726 mbuf_t ns_rec;
727 mbuf_t ns_recend;
728 mbuf_t ns_frag;
729 int ns_flag;
730 int ns_sotype;
731 int ns_cc;
732 int ns_reclen;
733 int ns_numuids;
734 u_long ns_sref;
735 time_t ns_timestamp; /* socket timestamp */
736 lck_mtx_t ns_wgmutex; /* mutex for write gather fields */
737 u_quad_t ns_wgtime; /* next Write deadline (usec) */
738 LIST_HEAD(, nfsrv_descript) ns_tq; /* Write gather lists */
739 LIST_HEAD(nfsrvw_delayhash, nfsrv_descript) ns_wdelayhashtbl[NFS_WDELAYHASHSIZ];
740 TAILQ_HEAD(, nfsuid) ns_uidlruhead;
741 LIST_HEAD(, nfsuid) ns_uidhashtbl[NFS_UIDHASHSIZ];
742 };
743
744 /* Bits for "ns_flag" */
745 #define SLP_VALID 0x01 /* nfs sock valid */
746 #define SLP_DOREC 0x02 /* nfs sock has received data to process */
747 #define SLP_NEEDQ 0x04 /* network socket has data to receive */
748 #define SLP_DISCONN 0x08 /* socket needs to be zapped */
749 #define SLP_GETSTREAM 0x10 /* currently in nfsrv_getstream() */
750 #define SLP_LASTFRAG 0x20 /* on last fragment of RPC record */
751 #define SLP_ALLFLAGS 0xff
752
753 extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead, nfssvc_deadsockhead;
754
755 /* locks for nfssvc_sock's */
756 extern lck_grp_attr_t *nfs_slp_group_attr;
757 extern lck_attr_t *nfs_slp_lock_attr;
758 extern lck_grp_t *nfs_slp_rwlock_group;
759 extern lck_grp_t *nfs_slp_mutex_group;
760
761 /*
762 * One of these structures is allocated for each nfsd.
763 */
764 struct nfsd {
765 TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */
766 int nfsd_flag; /* NFSD_ flags */
767 struct nfssvc_sock *nfsd_slp; /* Current socket */
768 int nfsd_authlen; /* Authenticator len */
769 u_char nfsd_authstr[RPCAUTH_MAXSIZ]; /* Authenticator data */
770 int nfsd_verflen; /* and the Verifier */
771 u_char nfsd_verfstr[RPCVERF_MAXSIZ];
772 proc_t nfsd_procp; /* Proc ptr */
773 struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */
774 };
775
776 /* Bits for "nfsd_flag" */
777 #define NFSD_WAITING 0x01
778 #define NFSD_REQINPROG 0x02
779 #define NFSD_NEEDAUTH 0x04
780 #define NFSD_AUTHFAIL 0x08
781
782 /*
783 * This structure is used by the server for describing each request.
784 * Some fields are used only when write request gathering is performed.
785 */
786 struct nfsrv_descript {
787 u_quad_t nd_time; /* Write deadline (usec) */
788 off_t nd_off; /* Start byte offset */
789 off_t nd_eoff; /* and end byte offset */
790 LIST_ENTRY(nfsrv_descript) nd_hash; /* Hash list */
791 LIST_ENTRY(nfsrv_descript) nd_tq; /* and timer list */
792 LIST_HEAD(,nfsrv_descript) nd_coalesce; /* coalesced writes */
793 mbuf_t nd_mrep; /* Request mbuf list */
794 mbuf_t nd_md; /* Current dissect mbuf */
795 mbuf_t nd_mreq; /* Reply mbuf list */
796 mbuf_t nd_nam; /* and socket addr */
797 mbuf_t nd_nam2; /* return socket addr */
798 caddr_t nd_dpos; /* Current dissect pos */
799 u_int32_t nd_procnum; /* RPC # */
800 int nd_stable; /* storage type */
801 int nd_flag; /* nd_flag */
802 int nd_len; /* Length of this write */
803 int nd_repstat; /* Reply status */
804 u_long nd_retxid; /* Reply xid */
805 struct timeval nd_starttime; /* Time RPC initiated */
806 struct nfs_filehandle nd_fh; /* File handle */
807 kauth_cred_t nd_cr; /* Credentials */
808 };
809
810 /* Bits for "nd_flag" */
811 #define ND_NFSV3 0x08
812 #define ND_KERBNICK 0x20
813 #define ND_KERBFULL 0x40
814 #define ND_KERBAUTH (ND_KERBNICK | ND_KERBFULL)
815
816 extern TAILQ_HEAD(nfsd_head, nfsd) nfsd_head;
817 extern int nfsd_head_flag;
818 #define NFSD_CHECKSLP 0x01
819
820 /*
821 * These macros compare nfsrv_descript structures.
822 */
823 #define NFSW_CONTIG(o, n) \
824 (((o)->nd_eoff >= (n)->nd_off) && \
825 ((o)->nd_fh.nfh_len == (n)->nd_fh.nfh_len) && \
826 !bcmp((caddr_t)&(o)->nd_fh, (caddr_t)&(n)->nd_fh, (o)->nd_fh.nfh_len))
827
828 #define NFSW_SAMECRED(o, n) \
829 (((o)->nd_flag & ND_KERBAUTH) == ((n)->nd_flag & ND_KERBAUTH) && \
830 !bcmp((caddr_t)(o)->nd_cr, (caddr_t)(n)->nd_cr, \
831 sizeof (struct ucred)))
832
833 /* mutex for nfs server */
834 extern lck_grp_t * nfsd_lck_grp;
835 extern lck_grp_attr_t * nfsd_lck_grp_attr;
836 extern lck_attr_t * nfsd_lck_attr;
837 extern lck_mtx_t *nfsd_mutex;
838
839 extern int nfs_numnfsd, nfsd_waiting;
840
841 /*
842 * Defines for WebNFS
843 */
844
845 #define WEBNFS_ESC_CHAR '%'
846 #define WEBNFS_SPECCHAR_START 0x80
847
848 #define WEBNFS_NATIVE_CHAR 0x80
849 /*
850 * ..
851 * Possibly more here in the future.
852 */
853
854 /*
855 * Macro for converting escape characters in WebNFS pathnames.
856 * Should really be in libkern.
857 */
858 #define ISHEX(c) \
859 ((((c) >= 'a') && ((c) <= 'f')) || \
860 (((c) >= 'A') && ((c) <= 'F')) || \
861 (((c) >= '0') && ((c) <= '9')))
862 #define HEXTOC(c) \
863 ((c) >= 'a' ? ((c) - ('a' - 10)) : \
864 ((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))
865 #define HEXSTRTOI(p) \
866 ((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))
867
868 __BEGIN_DECLS
869
870 int nfs_init(struct vfsconf *vfsp);
871 void nfs_mbuf_init(void);
872 int nfs_reply(struct nfsreq *);
873 int nfs_getreq(struct nfsrv_descript *,struct nfsd *,int);
874 int nfs_send(socket_t, mbuf_t, mbuf_t, struct nfsreq *);
875 int nfs_rephead(int, struct nfsrv_descript *, struct nfssvc_sock *,
876 int, mbuf_t *, mbuf_t *, caddr_t *);
877 int nfs_sndlock(struct nfsreq *);
878 void nfs_sndunlock(struct nfsreq *);
879 int nfs_vinvalbuf(vnode_t, int, struct ucred *, proc_t, int);
880 int nfs_buf_page_inval(vnode_t vp, off_t offset);
881 int nfs_readrpc(vnode_t, struct uio *, struct ucred *, proc_t);
882 int nfs_writerpc(vnode_t, struct uio *, struct ucred *, proc_t, int *, int *);
883 int nfs_readdirrpc(vnode_t, struct uio *, struct ucred *, proc_t);
884 int nfs_readdirplusrpc(vnode_t, struct uio *, struct ucred *, proc_t);
885 int nfs_asyncio(struct nfsbuf *, struct ucred *);
886 int nfs_doio(struct nfsbuf *, struct ucred *, proc_t);
887 int nfs_readlinkrpc(vnode_t, struct uio *, struct ucred *, proc_t);
888 int nfs_sigintr(struct nfsmount *, struct nfsreq *, proc_t);
889 int nfsm_disct(mbuf_t *, caddr_t *, int, int, caddr_t *);
890 void nfsm_srvfattr(struct nfsrv_descript *, struct vnode_attr *,
891 struct nfs_fattr *);
892 void nfsm_srvwcc(struct nfsrv_descript *, int, struct vnode_attr *, int,
893 struct vnode_attr *, mbuf_t *, char **);
894 void nfsm_srvpostopattr(struct nfsrv_descript *, int, struct vnode_attr *,
895 mbuf_t *, char **);
896 int netaddr_match(int, union nethostaddr *, mbuf_t);
897 int nfs_request(vnode_t, mount_t, mbuf_t, int, proc_t,
898 struct ucred *, mbuf_t *, mbuf_t *,
899 caddr_t *, u_int64_t *);
900 int nfs_parsefattr(mbuf_t *, caddr_t *, int, struct nfs_vattr *);
901 int nfs_loadattrcache(struct nfsnode *, struct nfs_vattr *, u_int64_t *, int);
902 int nfsm_path_mbuftond(mbuf_t *, caddr_t *, int, int, int *, struct nameidata *);
903 int nfs_namei(struct nfsrv_descript *, struct vfs_context *, struct nameidata *,
904 struct nfs_filehandle *, mbuf_t, int, vnode_t *,
905 struct nfs_export **, struct nfs_export_options **);
906 void nfsm_adj(mbuf_t, int, int);
907 int nfsm_mbuftouio(mbuf_t *, struct uio *, int, caddr_t *);
908 void nfsrv_initcache(void);
909 int nfs_getauth(struct nfsmount *, struct nfsreq *, struct ucred *,
910 char **, int *, char *, int *, NFSKERBKEY_T);
911 int nfs_getnickauth(struct nfsmount *, struct ucred *, char **,
912 int *, char *, int);
913 int nfs_savenickauth(struct nfsmount *, struct ucred *, int,
914 NFSKERBKEY_T, mbuf_t *, char **,
915 mbuf_t);
916 int nfs_adv(mbuf_t *, caddr_t *, int, int);
917 void nfs_nhinit(void);
918 void nfs_timer_funnel(void*);
919 void nfs_timer(void*);
920 u_long nfs_hash(u_char *, int);
921 int nfsrv_dorec(struct nfssvc_sock *, struct nfsd *,
922 struct nfsrv_descript **);
923 int nfsrv_getcache(struct nfsrv_descript *, struct nfssvc_sock *,
924 mbuf_t *);
925 void nfsrv_updatecache(struct nfsrv_descript *, int, mbuf_t);
926 void nfsrv_cleancache(void);
927 int nfs_bind_resv_thread_wake(void);
928 int nfs_connect(struct nfsmount *, struct nfsreq *);
929 void nfs_disconnect(struct nfsmount *);
930 int nfs_getattr_no_vnode(mount_t,u_char *,int,struct ucred *,proc_t,struct nfs_vattr *,u_int64_t *);
931 int nfs_getattr(vnode_t vp, struct nfs_vattr *nvap, struct ucred *cred, proc_t p);
932 int nfs_getattrcache(vnode_t, struct nfs_vattr *);
933 int nfs_attrcachetimeout(vnode_t);
934 int nfsm_strtmbuf(mbuf_t *, char **, char *, long);
935 int nfs_bioread(vnode_t, struct uio *, int, struct ucred *, proc_t);
936 int nfsm_uiotombuf(struct uio *, mbuf_t *, int, caddr_t *);
937 void nfsrv_init(int);
938 int nfs_commit(vnode_t vp, u_quad_t offset, u_int32_t count,
939 struct ucred *cred, proc_t procp);
940 int nfs_flushcommits(vnode_t, proc_t, int);
941 int nfs_flush(vnode_t,int,struct ucred *,proc_t,int);
942 void nfs_clearcommit(mount_t);
943 int nfsrv_errmap(struct nfsrv_descript *, int);
944 void nfsrvw_sort(gid_t *, int);
945 void nfsrv_setcred(struct ucred *, struct ucred *);
946 int nfs_buf_write(struct nfsbuf *);
947 void nfsrv_wakenfsd(struct nfssvc_sock *slp);
948 int nfsrv_writegather(struct nfsrv_descript **, struct nfssvc_sock *,
949 proc_t, mbuf_t *);
950 int nfs_fsinfo(struct nfsmount *, vnode_t, struct ucred *, proc_t p);
951 int nfs_pathconfrpc(vnode_t, struct nfsv3_pathconf *, kauth_cred_t, proc_t);
952 void nfs_pathconf_cache(struct nfsmount *, struct nfsv3_pathconf *);
953
954 int nfsrv3_access(struct nfsrv_descript *nfsd,
955 struct nfssvc_sock *slp,
956 proc_t procp, mbuf_t *mrq);
957 int nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
958 proc_t procp, mbuf_t *mrq);
959 int nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
960 proc_t procp, mbuf_t *mrq);
961 int nfsrv_credcheck(struct nfsrv_descript *, struct nfs_export *,
962 struct nfs_export_options *);
963 int nfsrv_export(struct user_nfs_export_args *, struct vfs_context *);
964 int nfsrv_fhmatch(struct nfs_filehandle *fh1, struct nfs_filehandle *fh2);
965 int nfsrv_fhtovp(struct nfs_filehandle *, mbuf_t, int, vnode_t *,
966 struct nfs_export **, struct nfs_export_options **);
967 int nfs_ispublicfh(struct nfs_filehandle *);
968 int nfsrv_fsinfo(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
969 proc_t procp, mbuf_t *mrq);
970 int nfsrv_getattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
971 proc_t procp, mbuf_t *mrq);
972 int nfsrv_link(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
973 proc_t procp, mbuf_t *mrq);
974 int nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
975 proc_t procp, mbuf_t *mrq);
976 int nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
977 proc_t procp, mbuf_t *mrq);
978 int nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
979 proc_t procp, mbuf_t *mrq);
980 int nfsrv_noop(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
981 proc_t procp, mbuf_t *mrq);
982 int nfsrv_null(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
983 proc_t procp, mbuf_t *mrq);
984 int nfsrv_pathconf(struct nfsrv_descript *nfsd,
985 struct nfssvc_sock *slp, proc_t procp,
986 mbuf_t *mrq);
987 void nfsrv_rcv(socket_t, caddr_t arg, int waitflag);
988 void nfsrv_rcv_locked(socket_t, struct nfssvc_sock *slp, int waitflag);
989 int nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
990 proc_t procp, mbuf_t *mrq);
991 int nfsrv_readdir(struct nfsrv_descript *nfsd,
992 struct nfssvc_sock *slp,
993 proc_t procp, mbuf_t *mrq);
994 int nfsrv_readdirplus(struct nfsrv_descript *nfsd,
995 struct nfssvc_sock *slp, proc_t procp,
996 mbuf_t *mrq);
997 int nfsrv_readlink(struct nfsrv_descript *nfsd,
998 struct nfssvc_sock *slp, proc_t procp,
999 mbuf_t *mrq);
1000 int nfsrv_remove(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1001 proc_t procp, mbuf_t *mrq);
1002 int nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1003 proc_t procp, mbuf_t *mrq);
1004 int nfsrv_rmdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1005 proc_t procp, mbuf_t *mrq);
1006 int nfsrv_setattr(struct nfsrv_descript *nfsd,
1007 struct nfssvc_sock *slp,
1008 proc_t procp, mbuf_t *mrq);
1009 void nfsrv_slpderef(struct nfssvc_sock *slp);
1010 void nfsrv_slpfree(struct nfssvc_sock *slp);
1011 int nfsrv_statfs(struct nfsrv_descript *nfsd,
1012 struct nfssvc_sock *slp,
1013 proc_t procp, mbuf_t *mrq);
1014 int nfsrv_symlink(struct nfsrv_descript *nfsd,
1015 struct nfssvc_sock *slp,
1016 proc_t procp, mbuf_t *mrq);
1017 int nfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
1018 proc_t procp, mbuf_t *mrq);
1019 int nfsrv_vptofh( struct nfs_export *, int, struct nfs_filehandle *,
1020 vnode_t, struct vfs_context *, struct nfs_filehandle *);
1021
1022 void nfs_up(struct nfsmount *, proc_t, int, const char *);
1023 void nfs_down(struct nfsmount *, proc_t, int, int, const char *);
1024
1025 struct nfs_diskless;
1026 int nfs_boot_init(struct nfs_diskless *nd, proc_t procp);
1027 int nfs_boot_getfh(struct nfs_diskless *nd, proc_t procp, int v3, int sotype);
1028
1029 __END_DECLS
1030
1031 #endif /* KERNEL */
1032 #endif /* __APPLE_API_PRIVATE */
1033
1034 #endif