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