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