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