2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
30 * Copyright (c) 1989, 1993, 1995
31 * The Regents of the University of California. All rights reserved.
33 * This code is derived from software contributed to Berkeley by
34 * Rick Macklem at The University of Guelph.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
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.
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
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 $
71 #include <sys/appleapiopts.h>
72 #include <sys/cdefs.h>
74 #ifdef __APPLE_API_PRIVATE
76 * Tunable constants for nfs
79 #define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */
80 #define NFS_HZ (hz / nfs_ticks) /* Ticks/sec */
81 __private_extern__
int nfs_ticks
;
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_RETRANS 10 /* Num of retrans for soft mounts */
88 #define NFS_TRYLATERDEL 4 /* Initial try later delay (sec) */
89 #define NFS_MAXGRPS 16 /* Max. size of groups list */
90 #define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */
91 #define NFS_MAXATTRTIMO 60
92 #define NFS_MINDIRATTRTIMO 5 /* directory attribute cache timeout in sec */
93 #define NFS_MAXDIRATTRTIMO 60
94 #define NFS_IOSIZE (1024 * 1024) /* suggested I/O size */
95 #define NFS_RWSIZE 32768 /* Def. read/write data size <= 32K */
96 #define NFS_WSIZE NFS_RWSIZE /* Def. write data size <= 32K */
97 #define NFS_RSIZE NFS_RWSIZE /* Def. read data size <= 32K */
98 #define NFS_DGRAM_WSIZE 8192 /* UDP Def. write data size <= 8K */
99 #define NFS_DGRAM_RSIZE 8192 /* UDP Def. read data size <= 8K */
100 #define NFS_READDIRSIZE 8192 /* Def. readdir size */
101 #define NFS_DEFRAHEAD 16 /* Def. read ahead # blocks */
102 #define NFS_MAXRAHEAD 128 /* Max. read ahead # blocks */
103 #define NFS_DEFMAXASYNCWRITES 128 /* Def. max # concurrent async write RPCs */
104 #define NFS_DEFASYNCTHREAD 16 /* Def. # nfsiod threads */
105 #define NFS_MAXASYNCTHREAD 64 /* max # nfsiod threads */
106 #define NFS_ASYNCTHREADMAXIDLE 60 /* Seconds before idle nfsiods are reaped */
107 #define NFS_DEFSTATFSRATELIMIT 10 /* Def. max # statfs RPCs per second */
108 #define NFS_REQUESTDELAY 10 /* ms interval to check request queue */
109 #define NFSRV_DEADSOCKDELAY 5 /* Seconds before dead sockets are reaped */
110 #define NFSRV_MAXWGATHERDELAY 100 /* Max. write gather delay (msec) */
111 #ifndef NFSRV_WGATHERDELAY
112 #define NFSRV_WGATHERDELAY 1 /* Default write gather delay (msec) */
114 #define NFS_DIRBLKSIZ 4096 /* Must be a multiple of DIRBLKSIZ */
115 #if defined(KERNEL) && !defined(DIRBLKSIZ)
116 #define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */
117 /* can't be larger than NFS_FABLKSIZE */
120 /* default values for unresponsive mount timeouts */
121 #define NFS_TPRINTF_INITIAL_DELAY 12
122 #define NFS_TPRINTF_DELAY 30
127 #define NFS_CMPFH(n, f, s) \
128 ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))
129 #define NFS_SRVMAXDATA(n) \
130 (((n)->nd_vers == NFS_VER3) ? (((n)->nd_nam2) ? \
131 NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)
134 * The IO_METASYNC flag should be implemented for local file systems.
135 * (Until then, it is nothin at all.)
138 #define IO_METASYNC 0
142 * Expected allocation sizes for major data structures. If the actual size
143 * of the structure exceeds these sizes, then malloc() will be allocating
144 * almost twice the memory required. This is used in nfs_init() to warn
145 * the sysadmin that the size of a structure should be reduced.
146 * (These sizes are always a power of 2. If the kernel malloc() changes
147 * to one that does not allocate space in powers of 2 size, then this all
149 * Note that some of these structures come out of there own nfs zones.
151 #define NFS_NODEALLOC 512
152 #define NFS_MNTALLOC 512
153 #define NFS_SVCALLOC 256
156 * Arguments to mount NFS
158 #define NFS_ARGSVERSION 5 /* change when nfs_args changes */
160 int version
; /* args structure version number */
161 struct sockaddr
*addr
; /* file server address */
162 int addrlen
; /* length of address */
163 int sotype
; /* Socket type */
164 int proto
; /* and Protocol */
165 u_char
*fh
; /* File handle to be mounted */
166 int fhsize
; /* Size, in bytes, of fh */
167 int flags
; /* flags */
168 int wsize
; /* write size in bytes */
169 int rsize
; /* read size in bytes */
170 int readdirsize
; /* readdir size in bytes */
171 int timeo
; /* initial timeout in .1 secs */
172 int retrans
; /* times to retry send */
173 int maxgrouplist
; /* Max. size of group list */
174 int readahead
; /* # of blocks to readahead */
175 int leaseterm
; /* obsolete: Term (sec) of lease */
176 int deadthresh
; /* obsolete: Retrans threshold */
177 char *hostname
; /* server's name */
178 /* NFS_ARGSVERSION 3 ends here */
179 int acregmin
; /* reg file min attr cache timeout */
180 int acregmax
; /* reg file max attr cache timeout */
181 int acdirmin
; /* dir min attr cache timeout */
182 int acdirmax
; /* dir max attr cache timeout */
183 /* NFS_ARGSVERSION 4 ends here */
184 uint32_t auth
; /* security mechanism flavor */
187 int version
; /* args structure version number */
188 struct sockaddr
*addr
; /* file server address */
189 int addrlen
; /* length of address */
190 int sotype
; /* Socket type */
191 int proto
; /* and Protocol */
192 u_char
*fh
; /* File handle to be mounted */
193 int fhsize
; /* Size, in bytes, of fh */
194 int flags
; /* flags */
195 int wsize
; /* write size in bytes */
196 int rsize
; /* read size in bytes */
197 int readdirsize
; /* readdir size in bytes */
198 int timeo
; /* initial timeout in .1 secs */
199 int retrans
; /* times to retry send */
200 int maxgrouplist
; /* Max. size of group list */
201 int readahead
; /* # of blocks to readahead */
202 int leaseterm
; /* obsolete: Term (sec) of lease */
203 int deadthresh
; /* obsolete: Retrans threshold */
204 char *hostname
; /* server's name */
205 /* NFS_ARGSVERSION 3 ends here */
206 int acregmin
; /* reg file min attr cache timeout */
207 int acregmax
; /* reg file max attr cache timeout */
208 int acdirmin
; /* dir min attr cache timeout */
209 int acdirmax
; /* dir max attr cache timeout */
213 int version
; /* args structure version number */
214 struct sockaddr
*addr
; /* file server address */
215 int addrlen
; /* length of address */
216 int sotype
; /* Socket type */
217 int proto
; /* and Protocol */
218 u_char
*fh
; /* File handle to be mounted */
219 int fhsize
; /* Size, in bytes, of fh */
220 int flags
; /* flags */
221 int wsize
; /* write size in bytes */
222 int rsize
; /* read size in bytes */
223 int readdirsize
; /* readdir size in bytes */
224 int timeo
; /* initial timeout in .1 secs */
225 int retrans
; /* times to retry send */
226 int maxgrouplist
; /* Max. size of group list */
227 int readahead
; /* # of blocks to readahead */
228 int leaseterm
; /* obsolete: Term (sec) of lease */
229 int deadthresh
; /* obsolete: Retrans threshold */
230 char *hostname
; /* server's name */
234 /* LP64 version of nfs_args. all pointers and longs
235 * grow when we're dealing with a 64-bit process.
236 * WARNING - keep in sync with nfs_args
238 struct user_nfs_args
{
239 int version
; /* args structure version number */
240 user_addr_t addr
__attribute((aligned(8))); /* file server address */
241 int addrlen
; /* length of address */
242 int sotype
; /* Socket type */
243 int proto
; /* and Protocol */
244 user_addr_t fh
__attribute((aligned(8))); /* File handle to be mounted */
245 int fhsize
; /* Size, in bytes, of fh */
246 int flags
; /* flags */
247 int wsize
; /* write size in bytes */
248 int rsize
; /* read size in bytes */
249 int readdirsize
; /* readdir size in bytes */
250 int timeo
; /* initial timeout in .1 secs */
251 int retrans
; /* times to retry send */
252 int maxgrouplist
; /* Max. size of group list */
253 int readahead
; /* # of blocks to readahead */
254 int leaseterm
; /* obsolete: Term (sec) of lease */
255 int deadthresh
; /* obsolete: Retrans threshold */
256 user_addr_t hostname
__attribute((aligned(8))); /* server's name */
257 /* NFS_ARGSVERSION 3 ends here */
258 int acregmin
; /* reg file min attr cache timeout */
259 int acregmax
; /* reg file max attr cache timeout */
260 int acdirmin
; /* dir min attr cache timeout */
261 int acdirmax
; /* dir max attr cache timeout */
262 /* NFS_ARGSVERSION 4 ends here */
263 uint32_t auth
; /* security mechanism flavor */
265 struct user_nfs_args4
{
266 int version
; /* args structure version number */
267 user_addr_t addr
__attribute((aligned(8))); /* file server address */
268 int addrlen
; /* length of address */
269 int sotype
; /* Socket type */
270 int proto
; /* and Protocol */
271 user_addr_t fh
__attribute((aligned(8))); /* File handle to be mounted */
272 int fhsize
; /* Size, in bytes, of fh */
273 int flags
; /* flags */
274 int wsize
; /* write size in bytes */
275 int rsize
; /* read size in bytes */
276 int readdirsize
; /* readdir size in bytes */
277 int timeo
; /* initial timeout in .1 secs */
278 int retrans
; /* times to retry send */
279 int maxgrouplist
; /* Max. size of group list */
280 int readahead
; /* # of blocks to readahead */
281 int leaseterm
; /* obsolete: Term (sec) of lease */
282 int deadthresh
; /* obsolete: Retrans threshold */
283 user_addr_t hostname
__attribute((aligned(8))); /* server's name */
284 /* NFS_ARGSVERSION 3 ends here */
285 int acregmin
; /* reg file min attr cache timeout */
286 int acregmax
; /* reg file max attr cache timeout */
287 int acdirmin
; /* dir min attr cache timeout */
288 int acdirmax
; /* dir max attr cache timeout */
290 struct user_nfs_args3
{
291 int version
; /* args structure version number */
292 user_addr_t addr
__attribute((aligned(8))); /* file server address */
293 int addrlen
; /* length of address */
294 int sotype
; /* Socket type */
295 int proto
; /* and Protocol */
296 user_addr_t fh
__attribute((aligned(8))); /* File handle to be mounted */
297 int fhsize
; /* Size, in bytes, of fh */
298 int flags
; /* flags */
299 int wsize
; /* write size in bytes */
300 int rsize
; /* read size in bytes */
301 int readdirsize
; /* readdir size in bytes */
302 int timeo
; /* initial timeout in .1 secs */
303 int retrans
; /* times to retry send */
304 int maxgrouplist
; /* Max. size of group list */
305 int readahead
; /* # of blocks to readahead */
306 int leaseterm
; /* obsolete: Term (sec) of lease */
307 int deadthresh
; /* obsolete: Retrans threshold */
308 user_addr_t hostname
__attribute((aligned(8))); /* server's name */
314 * NFS mount option flags
316 #define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
317 #define NFSMNT_WSIZE 0x00000002 /* set write size */
318 #define NFSMNT_RSIZE 0x00000004 /* set read size */
319 #define NFSMNT_TIMEO 0x00000008 /* set initial timeout */
320 #define NFSMNT_RETRANS 0x00000010 /* set number of request retries */
321 #define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */
322 #define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */
323 #define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */
324 #define NFSMNT_NONEGNAMECACHE 0x00000100 /* Don't do negative name caching */
325 #define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */
326 #define NFSMNT_NFSV4 0x00000400 /* Use NFS Version 4 protocol */
327 #define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */
328 // #define NFSMNT_UNUSED 0x00001000 /* unused */
329 #define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
330 // #define NFSMNT_UNUSED 0x00004000 /* unused */
331 #define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
332 #define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
333 #define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
334 #define NFSMNT_NOLOCKS 0x00040000 /* don't support file locking */
335 #define NFSMNT_LOCALLOCKS 0x00080000 /* do file locking locally on client */
336 #define NFSMNT_ACREGMIN 0x00100000 /* reg min attr cache timeout */
337 #define NFSMNT_ACREGMAX 0x00200000 /* reg max attr cache timeout */
338 #define NFSMNT_ACDIRMIN 0x00400000 /* dir min attr cache timeout */
339 #define NFSMNT_ACDIRMAX 0x00800000 /* dir max attr cache timeout */
340 #define NFSMNT_SECFLAVOR 0x01000000 /* Use security flavor */
341 #define NFSMNT_SECGIVEN 0x02000000 /* A sec= mount option was given */
344 * Structures for the nfssvc(2) syscall. Not that anyone but nfsd
345 * should ever try and use it.
348 int sock
; /* Socket to serve */
349 caddr_t name
; /* Client addr for connection based sockets */
350 int namelen
; /* Length of name */
354 /* LP64 version of nfsd_args. all pointers and longs
355 * grow when we're dealing with a 64-bit process.
356 * WARNING - keep in sync with nfsd_args
358 struct user_nfsd_args
{
359 int sock
; /* Socket to serve */
360 user_addr_t name
__attribute((aligned(8))); /* Client addr for connection based sockets */
361 int namelen
; /* Length of name */
367 * NFS Server File Handle structures
370 /* NFS export handle identifies which NFS export */
371 #define NFS_FH_VERSION 0x4e580000 /* 'NX00' */
372 struct nfs_exphandle
{
373 uint32_t nxh_version
; /* data structure version */
374 uint32_t nxh_fsid
; /* File System Export ID */
375 uint32_t nxh_expid
; /* Export ID */
376 uint16_t nxh_flags
; /* export handle flags */
377 uint8_t nxh_reserved
; /* future use */
378 uint8_t nxh_fidlen
; /* length of File ID */
382 #define NXHF_INVALIDFH 0x0001 /* file handle is invalid */
384 #define NFS_MAX_FID_SIZE (NFS_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
385 #define NFSV4_MAX_FID_SIZE (NFSV4_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
386 #define NFSV3_MAX_FID_SIZE (NFSV3_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
387 #define NFSV2_MAX_FID_SIZE (NFSV2_MAX_FH_SIZE - sizeof(struct nfs_exphandle))
389 /* NFS server internal view of fhandle_t */
390 /* The first sizeof(fhandle_t) bytes must match what goes into fhandle_t. */
391 /* (fhp is used to allow use of an external buffer) */
392 struct nfs_filehandle
{
393 uint32_t nfh_len
; /* total length of file handle */
394 struct nfs_exphandle nfh_xh
; /* export handle */
395 unsigned char nfh_fid
[NFS_MAX_FID_SIZE
]; /* File ID */
396 unsigned char *nfh_fhp
; /* pointer to file handle */
400 * NFS export data structures
403 /* Structure to hold an array of security flavors */
404 #define NX_MAX_SEC_FLAVORS 5
407 uint32_t flavors
[NX_MAX_SEC_FLAVORS
];
410 struct nfs_export_net_args
{
411 uint32_t nxna_flags
; /* export flags */
412 struct xucred nxna_cred
; /* mapped credential for root/all user */
413 struct sockaddr_storage nxna_addr
; /* net address to which exported */
414 struct sockaddr_storage nxna_mask
; /* mask for net address */
415 struct nfs_sec nxna_sec
; /* security mechanism flavors */
418 struct nfs_export_args
{
419 uint32_t nxa_fsid
; /* export FS ID */
420 uint32_t nxa_expid
; /* export ID */
421 char *nxa_fspath
; /* export FS path */
422 char *nxa_exppath
; /* export sub-path */
423 uint32_t nxa_flags
; /* export arg flags */
424 uint32_t nxa_netcount
; /* #entries in ex_nets array */
425 struct nfs_export_net_args
*nxa_nets
; /* array of net args */
429 /* LP64 version of export_args */
431 struct user_nfs_export_args
{
432 uint32_t nxa_fsid
; /* export FS ID */
433 uint32_t nxa_expid
; /* export ID */
434 user_addr_t nxa_fspath
; /* export FS path */
435 user_addr_t nxa_exppath
; /* export sub-path */
436 uint32_t nxa_flags
; /* export arg flags */
437 uint32_t nxa_netcount
; /* #entries in ex_nets array */
438 user_addr_t nxa_nets
; /* array of net args */
443 /* nfs export arg flags */
444 #define NXA_DELETE 0x0001 /* delete the specified export(s) */
445 #define NXA_ADD 0x0002 /* add the specified export(s) */
446 #define NXA_REPLACE 0x0003 /* delete and add the specified export(s) */
447 #define NXA_DELETE_ALL 0x0004 /* delete all exports */
448 #define NXA_OFFLINE 0x0008 /* export is offline */
450 /* export option flags */
451 #define NX_READONLY 0x0001 /* exported read-only */
452 #define NX_DEFAULTEXPORT 0x0002 /* exported to the world */
453 #define NX_MAPROOT 0x0004 /* map root access to anon credential */
454 #define NX_MAPALL 0x0008 /* map all access to anon credential */
455 #define NX_32BITCLIENTS 0x0020 /* restrict directory cookies to 32 bits */
456 #define NX_OFFLINE 0x0040 /* export is offline */
459 * fs.nfs sysctl(3) export stats record structures
461 #define NFS_EXPORT_STAT_REC_VERSION 1 /* export stat record version */
462 #define NFS_USER_STAT_REC_VERSION 1 /* active user list record version */
464 /* descriptor describing following records */
465 struct nfs_export_stat_desc
467 uint32_t rec_vers
; /* version of export stat records */
468 uint32_t rec_count
; /* total record count */
469 }__attribute__((__packed__
));
471 /* export stat record containing path and stat counters */
472 struct nfs_export_stat_rec
{
473 char path
[RPCMNT_PATHLEN
+ 1];
474 uint64_t ops
; /* Count of NFS Requests received for this export */
475 uint64_t bytes_read
; /* Count of bytes read from this export */
476 uint64_t bytes_written
; /* Count of bytes written to this export */
477 }__attribute__((__packed__
));
479 /* Active user list stat buffer descriptor */
480 struct nfs_user_stat_desc
482 uint32_t rec_vers
; /* version of active user stat records */
483 uint32_t rec_count
; /* total record count */
484 }__attribute__((__packed__
));
486 /* Active user list user stat record format */
487 struct nfs_user_stat_user_rec
{
490 struct sockaddr_storage sock
;
493 uint64_t bytes_written
;
496 }__attribute__((__packed__
));
498 /* Active user list path record format */
499 struct nfs_user_stat_path_rec
{
501 char path
[RPCMNT_PATHLEN
+ 1];
502 }__attribute__((__packed__
));
504 /* Defines for rec_type field of
505 * nfs_user_stat_rec & nfs_user_stat_rec
508 #define NFS_USER_STAT_USER_REC 0
509 #define NFS_USER_STAT_PATH_REC 1
515 struct nfs_export_options
{
516 uint32_t nxo_flags
; /* export options */
517 kauth_cred_t nxo_cred
; /* mapped credential */
518 struct nfs_sec nxo_sec
; /* security mechanism flavors */
521 /* Network address lookup element and individual export options */
523 struct radix_node no_rnodes
[2]; /* radix tree glue */
524 struct nfs_export_options no_opt
; /* export options */
527 /* statistic counters for each exported directory
529 * Since 64-bit atomic operations are not available on 32-bit platforms,
530 * 64-bit counters are implemented using 32-bit integers and 32-bit
533 typedef struct nfsstatcount64
{
538 struct nfs_export_stat_counters
{
539 struct nfsstatcount64 ops
; /* Count of NFS Requests received for this export */
540 struct nfsstatcount64 bytes_read
; /* Count of bytes read from this export */
541 struct nfsstatcount64 bytes_written
; /* Count of bytes written to his export */
542 }__attribute__((__packed__
));
544 /* Macro for updating nfs export stat counters */
545 #define NFSStatAdd64(PTR, VAL) \
547 uint32_t NFSSA_OldValue = \
548 OSAddAtomic((VAL), (SInt32*)&(PTR)->lo); \
549 if ((NFSSA_OldValue + (VAL)) < NFSSA_OldValue) \
550 OSAddAtomic(1, (SInt32*)&(PTR)->hi); \
553 /* Some defines for dealing with active user list stats */
554 #define NFSRV_USER_STAT_DEF_MAX_NODES 1024 /* default active user list size limit */
555 #define NFSRV_USER_STAT_DEF_IDLE_SEC 7200 /* default idle seconds (node no longer considered active) */
557 /* active user list globals */
558 __private_extern__
uint32_t nfsrv_user_stat_enabled
; /* enable/disable active user list */
559 __private_extern__
uint32_t nfsrv_user_stat_node_count
; /* current count of user stat nodes */
560 __private_extern__
uint32_t nfsrv_user_stat_max_idle_sec
; /* idle seconds (node no longer considered active) */
561 __private_extern__
uint32_t nfsrv_user_stat_max_nodes
; /* active user list size limit */
562 __private_extern__ lck_grp_t
*nfsrv_active_user_mutex_group
;
564 /* An active user node represented in the kernel */
565 struct nfs_user_stat_node
{
566 TAILQ_ENTRY(nfs_user_stat_node
) lru_link
;
567 LIST_ENTRY(nfs_user_stat_node
) hash_link
;
569 struct sockaddr_storage sock
;
572 uint64_t bytes_written
;
577 /* Hash table for active user nodes */
578 #define NFS_USER_STAT_HASH_SIZE 16 /* MUST be a power of 2 */
579 #define NFS_USER_STAT_HASH(userhashtbl, uid) \
580 &((userhashtbl)[(uid) & (NFS_USER_STAT_HASH_SIZE - 1)])
582 TAILQ_HEAD(nfs_user_stat_lru_head
, nfs_user_stat_node
);
583 LIST_HEAD(nfs_user_stat_hashtbl_head
, nfs_user_stat_node
);
585 /* Active user list data structure */
586 /* One per exported directory */
587 struct nfs_active_user_list
{
588 struct nfs_user_stat_lru_head user_lru
;
589 struct nfs_user_stat_hashtbl_head user_hashtbl
[NFS_USER_STAT_HASH_SIZE
];
591 lck_mtx_t user_mutex
;
595 /* Network export information */
596 /* one of these for each exported directory */
598 LIST_ENTRY(nfs_export
) nx_next
; /* FS export list */
599 LIST_ENTRY(nfs_export
) nx_hash
; /* export hash chain */
600 struct nfs_export
*nx_parent
; /* parent export */
601 uint32_t nx_id
; /* export ID */
602 uint32_t nx_flags
; /* export flags */
603 struct nfs_exportfs
*nx_fs
; /* exported file system */
604 char *nx_path
; /* exported file system sub-path */
605 struct nfs_filehandle nx_fh
; /* export root file handle */
606 struct nfs_export_options nx_defopt
; /* default options */
607 uint32_t nx_expcnt
; /* # exports in table */
608 struct radix_node_head
*nx_rtable
[AF_MAX
+1]; /* table of exports (netopts) */
609 struct nfs_export_stat_counters nx_stats
; /* statistic counters for this exported directory */
610 struct nfs_active_user_list nx_user_list
; /* Active User List for this exported directory */
611 struct timeval nx_exptime
; /* time of export for write verifier */
614 /* NFS exported file system info */
615 /* one of these for each exported file system */
616 struct nfs_exportfs
{
617 LIST_ENTRY(nfs_exportfs
) nxfs_next
; /* exported file system list */
618 uint32_t nxfs_id
; /* exported file system ID */
619 char *nxfs_path
; /* exported file system path */
620 LIST_HEAD(,nfs_export
) nxfs_exports
; /* list of exports for this file system */
623 __private_extern__
LIST_HEAD(nfsrv_expfs_list
, nfs_exportfs
) nfsrv_exports
;
624 __private_extern__ lck_rw_t nfsrv_export_rwlock
; // lock for export data structures
625 #define NFSRVEXPHASHVAL(FSID, EXPID) \
626 (((FSID) >> 24) ^ ((FSID) >> 16) ^ ((FSID) >> 8) ^ (EXPID))
627 #define NFSRVEXPHASH(FSID, EXPID) \
628 (&nfsrv_export_hashtbl[NFSRVEXPHASHVAL((FSID),(EXPID)) & nfsrv_export_hash])
629 __private_extern__
LIST_HEAD(nfsrv_export_hashhead
, nfs_export
) *nfsrv_export_hashtbl
;
630 __private_extern__ u_long nfsrv_export_hash
;
633 * NFS server file mod fsevents
636 LIST_ENTRY(nfsrv_fmod
) fm_link
;
638 struct vfs_context fm_context
;
639 uint64_t fm_deadline
;
642 #define NFSRVFMODHASHSZ 128
643 #define NFSRVFMODHASH(vp) (((u_long) vp) & nfsrv_fmod_hash)
644 __private_extern__
LIST_HEAD(nfsrv_fmod_hashhead
, nfsrv_fmod
) *nfsrv_fmod_hashtbl
;
645 __private_extern__ u_long nfsrv_fmod_hash
;
646 __private_extern__ lck_mtx_t
*nfsrv_fmod_mutex
;
647 __private_extern__
int nfsrv_fmod_pending
, nfsrv_fsevents_enabled
;
648 __private_extern__
int nfsrv_async
, nfsrv_reqcache_size
, nfsrv_sock_max_rec_queue_length
;
650 __private_extern__
struct nfsstats nfsstats
;
655 * XXX to allow amd to include nfs.h without nfsproto.h
663 int attrcache_misses
;
664 int lookupcache_hits
;
665 int lookupcache_misses
;
666 int direofcache_hits
;
667 int direofcache_misses
;
674 int biocache_readlinks
;
676 int biocache_readdirs
;
678 int rpccnt
[NFS_NPROCS
];
680 int srvrpccnt
[NFS_NPROCS
];
687 int srvcache_inproghits
;
688 int srvcache_idemdonehits
;
689 int srvcache_nonidemdonehits
;
698 * Flags for nfssvc() system call.
700 #define NFSSVC_NFSD 0x004
701 #define NFSSVC_ADDSOCK 0x008
702 #define NFSSVC_EXPORT 0x200
705 * Flags for nfsclnt() system call.
707 #define NFSCLNT_LOCKDANS 0x200
710 * fs.nfs sysctl(3) identifiers
712 #define NFS_NFSSTATS 1 /* struct: struct nfsstats */
713 #define NFS_EXPORTSTATS 3 /* gets exported directory stats */
714 #define NFS_USERSTATS 4 /* gets exported directory active user stats */
715 #define NFS_USERCOUNT 5 /* gets current count of active nfs users */
717 #ifndef NFS_WDELAYHASHSIZ
718 #define NFS_WDELAYHASHSIZ 16 /* and with this */
722 #include <sys/kernel_types.h>
723 #include <kern/thread_call.h>
724 #include <sys/kdebug.h>
726 #define NFS_KERNEL_DEBUG KERNEL_DEBUG
728 /* kernel debug trace macros */
729 #define FSDBG(A, B, C, D, E) \
730 NFS_KERNEL_DEBUG((FSDBG_CODE(DBG_FSRW, (A))) | DBG_FUNC_NONE, \
731 (int)(B), (int)(C), (int)(D), (int)(E), 0)
732 #define FSDBG_TOP(A, B, C, D, E) \
733 NFS_KERNEL_DEBUG((FSDBG_CODE(DBG_FSRW, (A))) | DBG_FUNC_START, \
734 (int)(B), (int)(C), (int)(D), (int)(E), 0)
735 #define FSDBG_BOT(A, B, C, D, E) \
736 NFS_KERNEL_DEBUG((FSDBG_CODE(DBG_FSRW, (A))) | DBG_FUNC_END, \
737 (int)(B), (int)(C), (int)(D), (int)(E), 0)
739 #ifdef MALLOC_DECLARE
740 MALLOC_DECLARE(M_NFSREQ
);
741 MALLOC_DECLARE(M_NFSMNT
);
742 MALLOC_DECLARE(M_NFSDIROFF
);
743 MALLOC_DECLARE(M_NFSRVDESC
);
744 MALLOC_DECLARE(M_NFSD
);
745 MALLOC_DECLARE(M_NFSBIGFH
);
748 struct uio
; struct vnode_attr
; struct nameidata
; struct dqblk
; /* XXX */
753 typedef struct nfsnode
* nfsnode_t
;
757 * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
758 * What should be in this set is open to debate, but I believe that since
759 * I/O system calls on ufs are never interrupted by signals the set should
760 * be minimal. My reasoning is that many current programs that use signals
761 * such as SIGALRM will not expect file I/O system calls to be interrupted
764 #define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
765 sigmask(SIGHUP)|sigmask(SIGQUIT))
767 __private_extern__
size_t nfs_mbuf_mhlen
, nfs_mbuf_minclsize
;
770 * NFS mbuf chain structure used for managing the building/dissection of RPCs
773 mbuf_t nmc_mhead
; /* mbuf chain head */
774 mbuf_t nmc_mcur
; /* current mbuf */
775 caddr_t nmc_ptr
; /* pointer into current mbuf */
776 uint32_t nmc_left
; /* bytes remaining in current mbuf */
777 uint32_t nmc_flags
; /* flags for this nfsm_chain */
779 #define NFSM_CHAIN_FLAG_ADD_CLUSTERS 0x1 /* always add mbuf clusters */
782 * Each retransmission of an RPCSEC_GSS request
783 * has an additional sequence number.
786 SLIST_ENTRY(gss_seq
) gss_seqnext
;
791 * async NFS request callback info
793 struct nfsreq_cbinfo
{
794 void (*rcb_func
)(struct nfsreq
*); /* async request callback function */
795 struct nfsbuf
*rcb_bp
; /* buffer I/O RPC is for */
796 uint32_t rcb_args
[2]; /* additional callback args */
800 * NFS outstanding request list element
803 lck_mtx_t r_mtx
; /* NFS request mutex */
804 TAILQ_ENTRY(nfsreq
) r_chain
; /* request queue chain */
805 TAILQ_ENTRY(nfsreq
) r_achain
; /* mount's async I/O request queue chain */
806 TAILQ_ENTRY(nfsreq
) r_rchain
; /* mount's async I/O resend queue chain */
807 TAILQ_ENTRY(nfsreq
) r_cchain
; /* mount's cwnd queue chain */
808 mbuf_t r_mrest
; /* request body mbufs */
809 mbuf_t r_mhead
; /* request header mbufs */
810 struct nfsm_chain r_nmrep
; /* reply mbufs */
811 nfsnode_t r_np
; /* NFS node */
812 struct nfsmount
*r_nmp
; /* NFS mount point */
813 uint64_t r_xid
; /* RPC transaction ID */
814 uint32_t r_procnum
; /* NFS procedure number */
815 u_long r_mreqlen
; /* request length */
816 int r_flags
; /* flags on request, see below */
817 int r_lflags
; /* flags protected by list mutex, see below */
818 int r_refs
; /* # outstanding references */
819 uint8_t r_delay
; /* delay to use for jukebox error */
820 uint8_t r_retry
; /* max retransmission count */
821 uint8_t r_rexmit
; /* current retrans count */
822 int r_rtt
; /* RTT for rpc */
823 thread_t r_thread
; /* thread that did I/O system call */
824 kauth_cred_t r_cred
; /* credential used for request */
825 long r_start
; /* request start time */
826 long r_lastmsg
; /* time of last tprintf */
827 long r_resendtime
; /* time of next jukebox error resend */
828 struct nfs_gss_clnt_ctx
*r_gss_ctx
; /* RPCSEC_GSS context */
829 SLIST_HEAD(, gss_seq
) r_gss_seqlist
; /* RPCSEC_GSS sequence numbers */
830 uint32_t r_gss_argoff
; /* RPCSEC_GSS offset to args */
831 uint32_t r_gss_arglen
; /* RPCSEC_GSS arg length */
832 int r_error
; /* request error */
833 struct nfsreq_cbinfo r_callback
; /* callback info */
837 * Queue head for nfsreq's
839 TAILQ_HEAD(nfs_reqqhead
, nfsreq
);
840 __private_extern__
struct nfs_reqqhead nfs_reqq
;
841 __private_extern__ lck_grp_t
*nfs_request_grp
;
843 #define R_XID32(x) ((x) & 0xffffffff)
845 #define NFSREQNOLIST ((struct nfsreq *)0xdeadbeef) /* sentinel value for nfsreq lists */
847 /* Flag values for r_flags */
848 #define R_TIMING 0x0001 /* timing request (in mntp) */
849 #define R_CWND 0x0002 /* request accounted for in congestion window */
850 #define R_SOFTTERM 0x0004 /* request terminated (e.g. soft mnt) */
851 #define R_RESTART 0x0008 /* RPC should be restarted. */
852 #define R_INITTED 0x0010 /* request has been initialized */
853 #define R_TPRINTFMSG 0x0020 /* Did a tprintf msg. */
854 #define R_MUSTRESEND 0x0040 /* Must resend request */
855 #define R_ALLOCATED 0x0080 /* request was allocated */
856 #define R_SENT 0x0100 /* request has been sent */
857 #define R_WAITSENT 0x0200 /* someone is waiting for request to be sent */
858 #define R_RESENDERR 0x0400 /* resend failed */
859 #define R_JBTPRINTFMSG 0x0800 /* Did a tprintf msg for jukebox error */
860 #define R_ASYNC 0x1000 /* async request */
861 #define R_ASYNCWAIT 0x2000 /* async request now being waited on */
862 #define R_RESENDQ 0x4000 /* async request currently on resendq */
864 #define R_SETUP 0x8000 /* a setup RPC - during (re)connection */
865 #define R_OPTMASK 0x8000 /* mask of all RPC option flags */
867 /* Flag values for r_lflags */
868 #define RL_BUSY 0x0001 /* Locked. */
869 #define RL_WAITING 0x0002 /* Someone waiting for lock. */
870 #define RL_QUEUED 0x0004 /* request is on the queue */
872 __private_extern__ u_long nfs_xid
, nfs_xidwrap
;
873 __private_extern__
int nfs_iosize
, nfs_access_cache_timeout
, nfs_allow_async
, nfs_statfs_rate_limit
;
874 __private_extern__
int nfs_lockd_mounts
, nfs_lockd_request_sent
;
875 __private_extern__
int nfs_tprintf_initial_delay
, nfs_tprintf_delay
;
876 __private_extern__
int nfsiod_thread_count
, nfsiod_thread_max
, nfs_max_async_writes
;
878 #define NFSIOD_MAX (MIN(nfsiod_thread_max, NFS_MAXASYNCTHREAD))
880 struct nfs_dulookup
{
881 int du_flags
; /* state of ._ lookup */
882 #define NFS_DULOOKUP_DOIT 0x1
883 #define NFS_DULOOKUP_INPROG 0x2
884 struct componentname du_cn
; /* ._ name being looked up */
885 struct nfsreq du_req
; /* NFS request for lookup */
886 char du_smallname
[48]; /* buffer for small names */
890 * Network address hash list element
898 * One nfsrv_sock structure is maintained for each socket the
899 * server is servicing requests on.
902 TAILQ_ENTRY(nfsrv_sock
) ns_chain
; /* List of all nfsrv_sock's */
903 TAILQ_ENTRY(nfsrv_sock
) ns_svcq
; /* List of sockets needing servicing */
904 TAILQ_ENTRY(nfsrv_sock
) ns_wgq
; /* List of sockets with a pending write gather */
905 lck_rw_t ns_rwlock
; /* lock for most fields */
919 time_t ns_timestamp
; /* socket timestamp */
920 lck_mtx_t ns_wgmutex
; /* mutex for write gather fields */
921 u_quad_t ns_wgtime
; /* next Write deadline (usec) */
922 LIST_HEAD(, nfsrv_descript
) ns_tq
; /* Write gather lists */
923 LIST_HEAD(nfsrv_wg_delayhash
, nfsrv_descript
) ns_wdelayhashtbl
[NFS_WDELAYHASHSIZ
];
926 /* Bits for "ns_flag" */
927 #define SLP_VALID 0x0001 /* nfs sock valid */
928 #define SLP_DOREC 0x0002 /* nfs sock has received data to process */
929 #define SLP_NEEDQ 0x0004 /* network socket has data to receive */
930 #define SLP_DISCONN 0x0008 /* socket needs to be zapped */
931 #define SLP_GETSTREAM 0x0010 /* currently in nfsrv_getstream() */
932 #define SLP_LASTFRAG 0x0020 /* on last fragment of RPC record */
933 #define SLP_DOWRITES 0x0040 /* nfs sock has gathered writes to service */
934 #define SLP_WORKTODO 0x004e /* mask of all "work to do" flags */
935 #define SLP_ALLFLAGS 0x007f
936 #define SLP_WAITQ 0x4000 /* nfs sock is on the wait queue */
937 #define SLP_WORKQ 0x8000 /* nfs sock is on the work queue */
938 #define SLP_QUEUED 0xc000 /* nfs sock is on a queue */
940 #define SLPNOLIST ((struct nfsrv_sock *)0xdeadbeef) /* sentinel value for sockets not in the nfsrv_sockwg list */
942 __private_extern__
struct nfsrv_sock
*nfsrv_udpsock
;
945 * global NFS server socket lists:
947 * nfsrv_socklist - list of all sockets (ns_chain)
948 * nfsrv_sockwait - sockets w/new data waiting to be worked on (ns_svcq)
949 * nfsrv_sockwork - sockets being worked on which may have more work to do (ns_svcq)
950 * nfsrv_sockwg - sockets with pending write gather input (ns_wgq)
952 __private_extern__
TAILQ_HEAD(nfsrv_sockhead
, nfsrv_sock
) nfsrv_socklist
, nfsrv_deadsocklist
,
953 nfsrv_sockwg
, nfsrv_sockwait
, nfsrv_sockwork
;
955 /* lock groups for nfsrv_sock's */
956 __private_extern__ lck_grp_t
*nfsrv_slp_rwlock_group
;
957 __private_extern__ lck_grp_t
*nfsrv_slp_mutex_group
;
960 * One of these structures is allocated for each nfsd.
963 TAILQ_ENTRY(nfsd
) nfsd_chain
; /* List of all nfsd's */
964 TAILQ_ENTRY(nfsd
) nfsd_queue
; /* List of waiting nfsd's */
965 int nfsd_flag
; /* NFSD_ flags */
966 struct nfsrv_sock
*nfsd_slp
; /* Current socket */
967 struct nfsrv_descript
*nfsd_nd
; /* Associated nfsrv_descript */
970 /* Bits for "nfsd_flag" */
971 #define NFSD_WAITING 0x01
972 #define NFSD_REQINPROG 0x02
975 * This structure is used by the server for describing each request.
976 * Some fields are used only when write request gathering is performed.
978 struct nfsrv_descript
{
979 u_quad_t nd_time
; /* Write deadline (usec) */
980 off_t nd_off
; /* Start byte offset */
981 off_t nd_eoff
; /* and end byte offset */
982 LIST_ENTRY(nfsrv_descript
) nd_hash
; /* Hash list */
983 LIST_ENTRY(nfsrv_descript
) nd_tq
; /* and timer list */
984 LIST_HEAD(,nfsrv_descript
) nd_coalesce
; /* coalesced writes */
985 struct nfsm_chain nd_nmreq
; /* Request mbuf chain */
986 mbuf_t nd_mrep
; /* Reply mbuf list (WG) */
987 mbuf_t nd_nam
; /* and socket addr */
988 mbuf_t nd_nam2
; /* return socket addr */
989 u_int32_t nd_procnum
; /* RPC # */
990 int nd_stable
; /* storage type */
991 int nd_vers
; /* NFS version */
992 int nd_len
; /* Length of this write */
993 int nd_repstat
; /* Reply status */
994 u_long nd_retxid
; /* Reply xid */
995 struct timeval nd_starttime
; /* Time RPC initiated */
996 struct nfs_filehandle nd_fh
; /* File handle */
997 uint32_t nd_sec
; /* Security flavor */
998 struct nfs_gss_svc_ctx
*nd_gss_context
;/* RPCSEC_GSS context */
999 uint32_t nd_gss_seqnum
; /* RPCSEC_GSS seq num */
1000 mbuf_t nd_gss_mb
; /* RPCSEC_GSS results mbuf */
1001 kauth_cred_t nd_cr
; /* Credentials */
1004 __private_extern__
TAILQ_HEAD(nfsd_head
, nfsd
) nfsd_head
, nfsd_queue
;
1006 /* mutex for nfs server */
1007 __private_extern__ lck_mtx_t
*nfsd_mutex
;
1008 __private_extern__
int nfsd_thread_count
, nfsd_thread_max
;
1010 /* request list mutex */
1011 __private_extern__ lck_mtx_t
*nfs_request_mutex
;
1012 __private_extern__
int nfs_request_timer_on
;
1014 /* nfs timer call structures */
1015 __private_extern__ thread_call_t nfs_request_timer_call
;
1016 __private_extern__ thread_call_t nfs_buf_timer_call
;
1017 __private_extern__ thread_call_t nfsrv_deadsock_timer_call
;
1018 __private_extern__ thread_call_t nfsrv_fmod_timer_call
;
1022 nfstype
vtonfs_type(enum vtype
, int);
1023 enum vtype
nfstov_type(nfstype
, int);
1024 int vtonfsv2_mode(enum vtype
, mode_t
);
1026 void nfs_mbuf_init(void);
1028 void nfs_nhinit(void);
1029 void nfs_nhinit_finish(void);
1030 u_long
nfs_hash(u_char
*, int);
1032 int nfs4_setclientid(struct nfsmount
*);
1033 void nfs4_renew_timer(void *, void *);
1034 int nfs_connect(struct nfsmount
*);
1035 void nfs_disconnect(struct nfsmount
*);
1036 void nfs_mount_sock_thread_wake(struct nfsmount
*);
1038 int nfs_getattr(nfsnode_t
, struct nfs_vattr
*, vfs_context_t
, int);
1039 int nfs_getattrcache(nfsnode_t
, struct nfs_vattr
*, int);
1040 int nfs_loadattrcache(nfsnode_t
, struct nfs_vattr
*, u_int64_t
*, int);
1041 int nfs_attrcachetimeout(nfsnode_t
);
1043 int nfs_buf_page_inval(vnode_t vp
, off_t offset
);
1044 int nfs_vinvalbuf(vnode_t
, int, vfs_context_t
, int);
1045 int nfs_vinvalbuf2(vnode_t
, int, thread_t
, kauth_cred_t
, int);
1047 int nfs_request_create(nfsnode_t
, mount_t
, struct nfsm_chain
*, int, thread_t
, kauth_cred_t
, struct nfsreq
**);
1048 void nfs_request_destroy(struct nfsreq
*);
1049 void nfs_request_ref(struct nfsreq
*, int);
1050 void nfs_request_rele(struct nfsreq
*);
1051 int nfs_request_add_header(struct nfsreq
*);
1052 int nfs_request_send(struct nfsreq
*, int);
1053 void nfs_request_wait(struct nfsreq
*);
1054 int nfs_request_finish(struct nfsreq
*, struct nfsm_chain
*, int *);
1055 int nfs_request(nfsnode_t
, mount_t
, struct nfsm_chain
*, int, vfs_context_t
, struct nfsm_chain
*, u_int64_t
*, int *);
1056 int nfs_request2(nfsnode_t
, mount_t
, struct nfsm_chain
*, int, thread_t
, kauth_cred_t
, int, struct nfsm_chain
*, u_int64_t
*, int *);
1057 int nfs_request_async(nfsnode_t
, mount_t
, struct nfsm_chain
*, int, thread_t
, kauth_cred_t
, struct nfsreq_cbinfo
*cb
, struct nfsreq
**);
1058 int nfs_request_async_finish(struct nfsreq
*, struct nfsm_chain
*, u_int64_t
*, int *);
1059 void nfs_request_async_cancel(struct nfsreq
*);
1060 void nfs_request_timer(void *, void *);
1061 int nfs_sigintr(struct nfsmount
*, struct nfsreq
*, thread_t
, int);
1062 int nfs_noremotehang(thread_t
);
1064 int nfs_send(struct nfsreq
*, int);
1065 int nfs_sndlock(struct nfsreq
*);
1066 void nfs_sndunlock(struct nfsreq
*);
1068 int nfs_lookitup(nfsnode_t
, char *, int, vfs_context_t
, nfsnode_t
*);
1069 void nfs_dulookup_init(struct nfs_dulookup
*, nfsnode_t
, const char *, int);
1070 void nfs_dulookup_start(struct nfs_dulookup
*, nfsnode_t
, vfs_context_t
);
1071 void nfs_dulookup_finish(struct nfs_dulookup
*, nfsnode_t
, vfs_context_t
);
1073 int nfs_parsefattr(struct nfsm_chain
*, int, struct nfs_vattr
*);
1074 int nfs4_parsefattr(struct nfsm_chain
*, struct nfs_fsattr
*, struct nfs_vattr
*, fhandle_t
*, struct dqblk
*);
1075 void nfs_vattr_set_supported(uint32_t *, struct vnode_attr
*);
1076 void nfs3_pathconf_cache(struct nfsmount
*, struct nfs_fsattr
*);
1077 int nfs_node_mode_slot(nfsnode_t
, uid_t
, int);
1079 int nfs_vnop_access(struct vnop_access_args
*);
1081 int nfs3_vnop_open(struct vnop_open_args
*);
1082 int nfs3_vnop_close(struct vnop_close_args
*);
1084 int nfs4_vnop_create(struct vnop_create_args
*);
1085 int nfs4_vnop_mknod(struct vnop_mknod_args
*);
1086 int nfs4_vnop_open(struct vnop_open_args
*);
1087 int nfs4_vnop_close(struct vnop_close_args
*);
1088 int nfs4_vnop_getattr(struct vnop_getattr_args
*);
1089 int nfs4_vnop_link(struct vnop_link_args
*);
1090 int nfs4_vnop_mkdir(struct vnop_mkdir_args
*);
1091 int nfs4_vnop_rmdir(struct vnop_rmdir_args
*);
1092 int nfs4_vnop_symlink(struct vnop_symlink_args
*);
1093 int nfs4_vnop_advlock(struct vnop_advlock_args
*ap
);
1095 int nfs_read_rpc(nfsnode_t
, struct uio
*, vfs_context_t
);
1096 int nfs_write_rpc(nfsnode_t
, struct uio
*, vfs_context_t
, int *, uint64_t *);
1097 int nfs_write_rpc2(nfsnode_t
, struct uio
*, thread_t
, kauth_cred_t
, int *, uint64_t *);
1099 int nfs3_access_rpc(nfsnode_t
, u_long
*, vfs_context_t
);
1100 int nfs4_access_rpc(nfsnode_t
, u_long
*, vfs_context_t
);
1101 int nfs3_getattr_rpc(nfsnode_t
, mount_t
, u_char
*, size_t, vfs_context_t
, struct nfs_vattr
*, u_int64_t
*);
1102 int nfs4_getattr_rpc(nfsnode_t
, mount_t
, u_char
*, size_t, vfs_context_t
, struct nfs_vattr
*, u_int64_t
*);
1103 int nfs3_setattr_rpc(nfsnode_t
, struct vnode_attr
*, vfs_context_t
, int);
1104 int nfs4_setattr_rpc(nfsnode_t
, struct vnode_attr
*, vfs_context_t
, int);
1105 int nfs3_read_rpc_async(nfsnode_t
, off_t
, size_t, thread_t
, kauth_cred_t
, struct nfsreq_cbinfo
*, struct nfsreq
**);
1106 int nfs4_read_rpc_async(nfsnode_t
, off_t
, size_t, thread_t
, kauth_cred_t
, struct nfsreq_cbinfo
*, struct nfsreq
**);
1107 int nfs3_read_rpc_async_finish(nfsnode_t
, struct nfsreq
*, struct uio
*, size_t *, int *);
1108 int nfs4_read_rpc_async_finish(nfsnode_t
, struct nfsreq
*, struct uio
*, size_t *, int *);
1109 int nfs3_write_rpc_async(nfsnode_t
, struct uio
*, size_t, thread_t
, kauth_cred_t
, int, struct nfsreq_cbinfo
*, struct nfsreq
**);
1110 int nfs4_write_rpc_async(nfsnode_t
, struct uio
*, size_t, thread_t
, kauth_cred_t
, int, struct nfsreq_cbinfo
*, struct nfsreq
**);
1111 int nfs3_write_rpc_async_finish(nfsnode_t
, struct nfsreq
*, int *, size_t *, uint64_t *);
1112 int nfs4_write_rpc_async_finish(nfsnode_t
, struct nfsreq
*, int *, size_t *, uint64_t *);
1113 int nfs3_readdir_rpc(nfsnode_t
, struct uio
*, vfs_context_t
);
1114 int nfs3_readdirplus_rpc(nfsnode_t
, struct uio
*, vfs_context_t
);
1115 int nfs4_readdir_rpc(nfsnode_t
, struct uio
*, vfs_context_t
);
1116 int nfs3_readlink_rpc(nfsnode_t
, char *, uint32_t *, vfs_context_t
);
1117 int nfs4_readlink_rpc(nfsnode_t
, char *, uint32_t *, vfs_context_t
);
1118 int nfs3_commit_rpc(nfsnode_t
, u_int64_t
, u_int64_t
, kauth_cred_t
);
1119 int nfs4_commit_rpc(nfsnode_t
, u_int64_t
, u_int64_t
, kauth_cred_t
);
1120 int nfs3_lookup_rpc_async(nfsnode_t
, char *, int, vfs_context_t
, struct nfsreq
**);
1121 int nfs4_lookup_rpc_async(nfsnode_t
, char *, int, vfs_context_t
, struct nfsreq
**);
1122 int nfs3_lookup_rpc_async_finish(nfsnode_t
, vfs_context_t
, struct nfsreq
*, u_int64_t
*, fhandle_t
*, struct nfs_vattr
*);
1123 int nfs4_lookup_rpc_async_finish(nfsnode_t
, vfs_context_t
, struct nfsreq
*, u_int64_t
*, fhandle_t
*, struct nfs_vattr
*);
1124 int nfs3_remove_rpc(nfsnode_t
, char *, int, thread_t
, kauth_cred_t
);
1125 int nfs4_remove_rpc(nfsnode_t
, char *, int, thread_t
, kauth_cred_t
);
1126 int nfs3_rename_rpc(nfsnode_t
, char *, int, nfsnode_t
, char *, int, vfs_context_t
);
1127 int nfs4_rename_rpc(nfsnode_t
, char *, int, nfsnode_t
, char *, int, vfs_context_t
);
1128 int nfs3_pathconf_rpc(nfsnode_t
, struct nfs_fsattr
*, vfs_context_t
);
1129 int nfs4_pathconf_rpc(nfsnode_t
, struct nfs_fsattr
*, vfs_context_t
);
1131 void nfsrv_active_user_list_reclaim(void);
1132 void nfsrv_cleancache(void);
1133 void nfsrv_cleanup(void);
1134 int nfsrv_credcheck(struct nfsrv_descript
*, vfs_context_t
, struct nfs_export
*,
1135 struct nfs_export_options
*);
1136 void nfsrv_deadsock_timer(void *, void *);
1137 int nfsrv_dorec(struct nfsrv_sock
*, struct nfsd
*, struct nfsrv_descript
**);
1138 int nfsrv_errmap(struct nfsrv_descript
*, int);
1139 int nfsrv_export(struct user_nfs_export_args
*, vfs_context_t
);
1140 int nfsrv_fhmatch(struct nfs_filehandle
*, struct nfs_filehandle
*);
1141 int nfsrv_fhtovp(struct nfs_filehandle
*, struct nfsrv_descript
*, vnode_t
*,
1142 struct nfs_export
**, struct nfs_export_options
**);
1143 void nfsrv_fmod_timer(void *, void *);
1144 int nfsrv_getcache(struct nfsrv_descript
*, struct nfsrv_sock
*, mbuf_t
*);
1145 void nfsrv_group_sort(gid_t
*, int);
1146 void nfsrv_init(void);
1147 void nfsrv_initcache(void);
1148 int nfsrv_is_initialized(void);
1149 int nfsrv_namei(struct nfsrv_descript
*, vfs_context_t
, struct nameidata
*,
1150 struct nfs_filehandle
*, vnode_t
*,
1151 struct nfs_export
**, struct nfs_export_options
**);
1152 void nfsrv_rcv(socket_t
, caddr_t
, int);
1153 void nfsrv_rcv_locked(socket_t
, struct nfsrv_sock
*, int);
1154 int nfsrv_rephead(struct nfsrv_descript
*, struct nfsrv_sock
*, struct nfsm_chain
*, size_t);
1155 int nfsrv_send(struct nfsrv_sock
*, mbuf_t
, mbuf_t
);
1156 void nfsrv_updatecache(struct nfsrv_descript
*, int, mbuf_t
);
1157 void nfsrv_update_user_stat(struct nfs_export
*, struct nfsrv_descript
*, uid_t
, u_int
, u_int
, u_int
);
1158 int nfsrv_vptofh(struct nfs_export
*, int, struct nfs_filehandle
*,
1159 vnode_t
, vfs_context_t
, struct nfs_filehandle
*);
1160 void nfsrv_wakenfsd(struct nfsrv_sock
*);
1161 void nfsrv_wg_timer(void *, void *);
1162 int nfsrv_writegather(struct nfsrv_descript
**, struct nfsrv_sock
*,
1163 vfs_context_t
, mbuf_t
*);
1165 int nfsrv_access(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1166 int nfsrv_commit(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1167 int nfsrv_create(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1168 int nfsrv_fsinfo(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1169 int nfsrv_getattr(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1170 int nfsrv_link(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1171 int nfsrv_lookup(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1172 int nfsrv_mkdir(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1173 int nfsrv_mknod(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1174 int nfsrv_noop(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1175 int nfsrv_null(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1176 int nfsrv_pathconf(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1177 int nfsrv_read(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1178 int nfsrv_readdir(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1179 int nfsrv_readdirplus(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1180 int nfsrv_readlink(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1181 int nfsrv_remove(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1182 int nfsrv_rename(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1183 int nfsrv_rmdir(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1184 int nfsrv_setattr(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1185 int nfsrv_statfs(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1186 int nfsrv_symlink(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1187 int nfsrv_write(struct nfsrv_descript
*, struct nfsrv_sock
*, vfs_context_t
, mbuf_t
*);
1189 void nfs_interval_timer_start(thread_call_t
, int);
1190 void nfs_up(struct nfsmount
*, thread_t
, int, const char *);
1191 void nfs_down(struct nfsmount
*, thread_t
, int, int, const char *);
1193 int nfs_mountroot(void);
1194 struct nfs_diskless
;
1195 int nfs_boot_init(struct nfs_diskless
*);
1196 int nfs_boot_getfh(struct nfs_diskless
*, int, int);
1201 #endif /* __APPLE_API_PRIVATE */