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
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 * @(#)nfsnode.h 8.9 (Berkeley) 5/14/95
65 * FreeBSD-Id: nfsnode.h,v 1.24 1997/10/28 14:06:25 bde Exp $
69 #ifndef _NFS_NFSNODE_H_
70 #define _NFS_NFSNODE_H_
72 #include <sys/appleapiopts.h>
74 #ifdef __APPLE_API_PRIVATE
80 * Silly rename structure that hangs off the nfsnode until the name
81 * can be removed by nfs_vnop_inactive()
83 struct nfs_sillyrename
{
84 kauth_cred_t nsr_cred
;
85 struct nfsnode
*nsr_dnp
;
91 * This structure is used to save the logical directory offset to
92 * NFS cookie mappings.
93 * The mappings are stored in a list headed
94 * by n_cookies, as required.
95 * There is one mapping for each NFS_DIRBLKSIZ bytes of directory information
96 * stored in increasing logical offset byte order.
98 #define NFSNUMCOOKIES 31
101 LIST_ENTRY(nfsdmap
) ndm_list
;
103 nfsuint64 ndm_cookies
[NFSNUMCOOKIES
];
107 * The nfsbuf is the nfs equivalent to a struct buf.
110 LIST_ENTRY(nfsbuf
) nb_hash
; /* hash chain */
111 LIST_ENTRY(nfsbuf
) nb_vnbufs
; /* nfsnode's nfsbuf chain */
112 TAILQ_ENTRY(nfsbuf
) nb_free
; /* free list position if not active. */
113 volatile long nb_flags
; /* NB_* flags. */
114 volatile long nb_lflags
; /* NBL_* flags. */
115 volatile long nb_refs
; /* outstanding references. */
116 long nb_bufsize
; /* buffer size */
117 daddr64_t nb_lblkno
; /* logical block number. */
118 uint64_t nb_verf
; /* V3 write verifier */
119 int nb_commitlevel
; /* lowest write commit level */
120 time_t nb_timestamp
; /* buffer timestamp */
121 int nb_error
; /* errno value. */
122 u_int32_t nb_valid
; /* valid pages in buf */
123 u_int32_t nb_dirty
; /* dirty pages in buf */
124 int nb_validoff
; /* offset in buffer of valid region. */
125 int nb_validend
; /* offset of end of valid region. */
126 int nb_dirtyoff
; /* offset in buffer of dirty region. */
127 int nb_dirtyend
; /* offset of end of dirty region. */
128 int nb_offio
; /* offset in buffer of I/O region. */
129 int nb_endio
; /* offset of end of I/O region. */
130 int nb_rpcs
; /* Count of RPCs remaining for this buffer. */
131 caddr_t nb_data
; /* mapped buffer */
132 nfsnode_t nb_np
; /* nfsnode buffer belongs to */
133 kauth_cred_t nb_rcred
; /* read credentials reference */
134 kauth_cred_t nb_wcred
; /* write credentials reference */
135 void * nb_pagelist
; /* upl */
138 #define NFS_MAXBSIZE (32 * PAGE_SIZE) /* valid/dirty page masks limit buffer size */
140 #define NFS_A_LOT_OF_NEEDCOMMITS 256 /* max# uncommitted buffers for a node */
141 #define NFS_A_LOT_OF_DELAYED_WRITES MAX(nfsbufcnt/8,512) /* max# "delwri" buffers in system */
144 * These flags are kept in b_lflags...
145 * nfs_buf_mutex must be held before examining/updating
147 #define NBL_BUSY 0x00000001 /* I/O in progress. */
148 #define NBL_WANTED 0x00000002 /* Process wants this buffer. */
151 * These flags are kept in nb_flags and they're (purposefully)
152 * very similar to the B_* flags for struct buf.
153 * nfs_buf_mutex is not needed to examine/update these.
155 #define NB_STALEWVERF 0x00000001 /* write verifier changed on us */
156 #define NB_NEEDCOMMIT 0x00000002 /* buffer needs to be committed */
157 #define NB_ASYNC 0x00000004 /* Start I/O, do not wait. */
158 #define NB_CACHE 0x00000020 /* buffer data found in the cache */
159 #define NB_STABLE 0x00000040 /* write FILESYNC not UNSTABLE */
160 #define NB_DELWRI 0x00000080 /* delayed write: dirty range needs to be written */
161 #define NB_DONE 0x00000200 /* I/O completed. */
162 #define NB_EINTR 0x00000400 /* I/O was interrupted */
163 #define NB_ERROR 0x00000800 /* I/O error occurred. */
164 #define NB_INVAL 0x00002000 /* Does not contain valid info. */
165 #define NB_NCRDAHEAD 0x00004000 /* "nocache readahead" data */
166 #define NB_NOCACHE 0x00008000 /* Do not cache block after use. */
167 #define NB_WRITE 0x00000000 /* Write buffer (pseudo flag). */
168 #define NB_READ 0x00100000 /* Read buffer. */
169 #define NB_MULTASYNCRPC 0x00200000 /* multiple async RPCs issued for buffer */
170 #define NB_PAGELIST 0x00400000 /* Buffer describes pagelist I/O. */
171 #define NB_WRITEINPROG 0x01000000 /* Write in progress. */
172 #define NB_META 0x40000000 /* buffer contains meta-data. */
174 /* Flags for operation type in nfs_buf_get() */
175 #define NBLK_READ 0x00000001 /* buffer for read */
176 #define NBLK_WRITE 0x00000002 /* buffer for write */
177 #define NBLK_META 0x00000004 /* buffer for metadata */
178 #define NBLK_OPMASK 0x00000007 /* operation mask */
179 /* modifiers for above flags... */
180 #define NBLK_NOWAIT 0x40000000 /* don't wait on busy buffer */
181 #define NBLK_ONLYVALID 0x80000000 /* only return cached buffer */
183 /* These flags are used for nfsbuf iterating */
184 #define NBI_ITER 0x01 /* iteration in progress */
185 #define NBI_ITERWANT 0x02 /* waiting to iterate */
186 #define NBI_CLEAN 0x04 /* requesting clean buffers */
187 #define NBI_DIRTY 0x08 /* requesting dirty buffers */
188 #define NBI_NOWAIT 0x10 /* don't block on NBI_ITER */
190 /* Flags for nfs_buf_acquire */
191 #define NBAC_NOWAIT 0x01 /* Don't wait if buffer is busy */
192 #define NBAC_REMOVE 0x02 /* Remove from free list once buffer is acquired */
194 /* some convenience macros... */
195 #define NBOFF(BP) ((off_t)(BP)->nb_lblkno * (off_t)(BP)->nb_bufsize)
196 #define NBPGVALID(BP,P) (((BP)->nb_valid >> (P)) & 0x1)
197 #define NBPGDIRTY(BP,P) (((BP)->nb_dirty >> (P)) & 0x1)
198 #define NBPGVALID_SET(BP,P) ((BP)->nb_valid |= (1 << (P)))
199 #define NBPGDIRTY_SET(BP,P) ((BP)->nb_dirty |= (1 << (P)))
201 #define NBUFSTAMPVALID(BP) ((BP)->nb_timestamp != ~0)
202 #define NBUFSTAMPINVALIDATE(BP) ((BP)->nb_timestamp = ~0)
204 #define NFS_BUF_MAP(BP) \
206 if (!(BP)->nb_data && nfs_buf_map(BP)) \
207 panic("nfs_buf_map failed"); \
210 LIST_HEAD(nfsbuflists
, nfsbuf
);
211 TAILQ_HEAD(nfsbuffreehead
, nfsbuf
);
213 #define NFSNOLIST ((struct nfsbuf *)0xdeadbeef)
215 __private_extern__ lck_mtx_t
*nfs_buf_mutex
;
216 __private_extern__
int nfsbufcnt
, nfsbufmin
, nfsbufmax
, nfsbufmetacnt
, nfsbufmetamax
;
217 __private_extern__
int nfsbuffreecnt
, nfsbuffreemetacnt
, nfsbufdelwricnt
, nfsneedbuffer
;
218 __private_extern__
int nfs_nbdwrite
;
219 __private_extern__
struct nfsbuffreehead nfsbuffree
, nfsbufdelwri
;
222 #define NFSBUFCNTCHK() \
224 if ( (nfsbufcnt < 0) || \
225 (nfsbufcnt > nfsbufmax) || \
226 (nfsbufmetacnt < 0) || \
227 (nfsbufmetacnt > nfsbufmetamax) || \
228 (nfsbufmetacnt > nfsbufcnt) || \
229 (nfsbuffreecnt < 0) || \
230 (nfsbuffreecnt > nfsbufmax) || \
231 (nfsbuffreecnt > nfsbufcnt) || \
232 (nfsbuffreemetacnt < 0) || \
233 (nfsbuffreemetacnt > nfsbufmax) || \
234 (nfsbuffreemetacnt > nfsbufcnt) || \
235 (nfsbuffreemetacnt > nfsbufmetamax) || \
236 (nfsbuffreemetacnt > nfsbufmetacnt) || \
237 (nfsbufdelwricnt < 0) || \
238 (nfsbufdelwricnt > nfsbufmax) || \
239 (nfsbufdelwricnt > nfsbufcnt) || \
240 (nfs_nbdwrite < 0) || \
241 (nfs_nbdwrite > nfsbufcnt) || \
243 panic("nfsbuf count error: max %d meta %d cnt %d meta %d free %d meta %d delwr %d bdw %d\n", \
244 nfsbufmax, nfsbufmetamax, nfsbufcnt, nfsbufmetacnt, nfsbuffreecnt, nfsbuffreemetacnt, \
245 nfsbufdelwricnt, nfs_nbdwrite); \
248 #define NFSBUFCNTCHK()
252 * NFS vnode attribute structure
254 #define NFSTIME_ACCESS 0 /* time of last access */
255 #define NFSTIME_MODIFY 1 /* time of last modification */
256 #define NFSTIME_CHANGE 2 /* time file changed */
257 #define NFSTIME_CREATE 3 /* time file created */
258 #define NFSTIME_BACKUP 4 /* time of last backup */
259 #define NFSTIME_COUNT 5
261 #define NFS_COMPARE_MTIME(TVP, NVAP, CMP) \
262 (((TVP)->tv_sec == (NVAP)->nva_timesec[NFSTIME_MODIFY]) ? \
263 ((TVP)->tv_nsec CMP (NVAP)->nva_timensec[NFSTIME_MODIFY]) : \
264 ((TVP)->tv_sec CMP (NVAP)->nva_timesec[NFSTIME_MODIFY]))
265 #define NFS_COPY_TIME(TVP, NVAP, WHICH) \
267 (TVP)->tv_sec = (NVAP)->nva_timesec[NFSTIME_##WHICH]; \
268 (TVP)->tv_nsec = (NVAP)->nva_timensec[NFSTIME_##WHICH]; \
272 enum vtype nva_type
; /* vnode type (for create) */
273 uint32_t nva_mode
; /* files access mode (and type) */
274 uid_t nva_uid
; /* owner user id */
275 gid_t nva_gid
; /* owner group id */
276 nfs_specdata nva_rawdev
; /* device the special file represents */
277 uint32_t nva_flags
; /* file flags */
278 uint32_t nva_maxlink
; /* maximum # of links (v4) */
279 uint64_t nva_nlink
; /* number of references to file */
280 uint64_t nva_fileid
; /* file id */
281 nfs_fsid nva_fsid
; /* file system id */
282 uint64_t nva_size
; /* file size in bytes */
283 uint64_t nva_bytes
; /* bytes of disk space held by file */
284 uint64_t nva_change
; /* change attribute */
285 int64_t nva_timesec
[NFSTIME_COUNT
];
286 int32_t nva_timensec
[NFSTIME_COUNT
];
287 uint32_t nva_bitmap
[NFS_ATTR_BITMAP_LEN
]; /* attributes that are valid */
290 #define NFS_FFLAG_ARCHIVED 0x0001
291 #define NFS_FFLAG_HIDDEN 0x0002
292 #define NFS_FFLAG_NAMED_ATTR 0x0004 /* file has named attributes */
295 * macros for detecting node changes
297 * These macros help us determine if a file has been changed on the server and
298 * thus whether or not we need to invalidate any cached data.
300 * For NFSv2/v3, the modification time is used.
301 * For NFSv4, the change attribute is used.
303 #define NFS_CHANGED(VERS, NP, NVAP) \
304 (((VERS) >= NFS_VER4) ? \
305 ((NP)->n_change != (NVAP)->nva_change) : \
306 NFS_COMPARE_MTIME(&(NP)->n_mtime, (NVAP), !=))
307 #define NFS_CHANGED_NC(VERS, NP, NVAP) \
308 (((VERS) >= NFS_VER4) ? \
309 ((NP)->n_ncchange != (NVAP)->nva_change) : \
310 NFS_COMPARE_MTIME(&(NP)->n_ncmtime, (NVAP), !=))
311 #define NFS_CHANGED_UPDATE(VERS, NP, NVAP) \
313 if ((VERS) >= NFS_VER4) \
314 (NP)->n_change = (NVAP)->nva_change; \
316 NFS_COPY_TIME(&(NP)->n_mtime, (NVAP), MODIFY); \
318 #define NFS_CHANGED_UPDATE_NC(VERS, NP, NVAP) \
320 if ((VERS) >= NFS_VER4) \
321 (NP)->n_ncchange = (NVAP)->nva_change; \
323 NFS_COPY_TIME(&(NP)->n_ncmtime, (NVAP), MODIFY); \
327 * The nfsnode is the NFS equivalent of an inode.
328 * There is a unique nfsnode for each NFS vnode.
329 * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
330 * NB: Hopefully the current order of the fields is such that everything will
331 * be well aligned and, therefore, tightly packed.
334 #define NFS_ACCESS_CACHE_SIZE 3
337 lck_rw_t n_lock
; /* nfs node lock */
338 void *n_lockowner
; /* nfs node lock owner (exclusive) */
339 lck_rw_t n_datalock
; /* nfs node data lock */
340 void *n_datalockowner
;/* nfs node data lock owner (exclusive) */
341 LIST_ENTRY(nfsnode
) n_hash
; /* Hash chain */
342 u_quad_t n_size
; /* Current size of file */
343 u_quad_t n_newsize
; /* new size of file (pending update) */
344 u_int64_t n_xid
; /* last xid to loadattr */
345 struct nfs_vattr n_vattr
; /* Vnode attribute cache */
346 time_t n_attrstamp
; /* Attr. cache timestamp */
347 u_int8_t n_mode
[NFS_ACCESS_CACHE_SIZE
+1]; /* ACCESS mode cache */
348 uid_t n_modeuid
[NFS_ACCESS_CACHE_SIZE
]; /* credentials having mode */
349 time_t n_modestamp
[NFS_ACCESS_CACHE_SIZE
]; /* mode cache timestamp */
352 struct timespec n3_mtime
; /* Prev modify time. */
353 struct timespec n3_ncmtime
; /* namecache modify time. */
356 uint64_t n4_change
; /* prev change attribute */
357 uint64_t n4_ncchange
; /* namecache change attribute */
360 vnode_t n_parent
; /* this node's parent */
361 u_char
*n_fhp
; /* NFS File Handle */
362 vnode_t n_vnode
; /* associated vnode */
363 mount_t n_mount
; /* associated mount (NHINIT) */
364 int n_error
; /* Save write error value */
366 struct timespec nf_atim
; /* Special file times */
367 nfsuint64 nd_cookieverf
; /* Cookie verifier (dir only) */
370 struct timespec nf_mtim
; /* Special file times */
371 daddr64_t nf_lastread
; /* last block# read from (for readahead) */
372 off_t nd_direof
; /* Dir. EOF offset cache */
375 struct nfs_sillyrename
*nf_silly
;/* Ptr to silly rename struct */
376 LIST_HEAD(, nfsdmap
) nd_cook
; /* cookies */
378 u_short n_fhsize
; /* size in bytes, of fh */
379 u_short n_flag
; /* node flags */
380 u_short n_hflag
; /* node hash flags */
381 u_short n_bflag
; /* node buffer flags */
382 u_char n_fh
[NFS_SMALLFH
];/* Small File Handle */
383 struct nfsbuflists n_cleanblkhd
; /* clean blocklist head */
384 struct nfsbuflists n_dirtyblkhd
; /* dirty blocklist head */
385 int n_wrbusy
; /* # threads in write/fsync */
386 int n_needcommitcnt
;/* # bufs that need committing */
387 int n_bufiterflags
; /* buf iterator flags */
390 #define NFS_NODE_LOCK_SHARED 1
391 #define NFS_NODE_LOCK_EXCLUSIVE 2
392 #define NFS_NODE_LOCK_FORCE 3
394 #define nfstimespeccmp(tvp, uvp, cmp) \
395 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
396 ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
397 ((tvp)->tv_sec cmp (uvp)->tv_sec))
399 #define CHECK_NEEDCOMMITCNT(np) \
401 if ((np)->n_needcommitcnt < 0) { \
402 printf("nfs: n_needcommitcnt negative\n"); \
403 (np)->n_needcommitcnt = 0; \
407 #define n_atim n_un1.nf_atim
408 #define n_mtim n_un2.nf_mtim
409 #define n_lastread n_un2.nf_lastread
410 #define n_sillyrename n_un3.nf_silly
411 #define n_cookieverf n_un1.nd_cookieverf
412 #define n_direofoffset n_un2.nd_direof
413 #define n_cookies n_un3.nd_cook
414 #define n_mtime n_un4.v3.n3_mtime
415 #define n_ncmtime n_un4.v3.n3_ncmtime
416 #define n_change n_un4.v4.n4_change
417 #define n_ncchange n_un4.v4.n4_ncchange
422 #define NUPDATESIZE 0x0001 /* size of file needs updating */
423 #define NMODIFIED 0x0004 /* Might have a modified buffer in bio */
424 #define NWRITEERR 0x0008 /* Flag write errors so close will know */
425 #define NNEEDINVALIDATE 0x0010 /* need to call vinvalbuf() */
426 #define NACC 0x0100 /* Special file accessed */
427 #define NUPD 0x0200 /* Special file updated */
428 #define NCHG 0x0400 /* Special file times changed */
429 #define NNEGNCENTRIES 0x0800 /* directory has negative name cache entries */
433 * Note: protected by nfs_node_hash_mutex
435 #define NHHASHED 0x0001 /* node is in hash table */
436 #define NHINIT 0x0002 /* node is being initialized */
437 #define NHLOCKED 0x0004 /* node is locked (initting or deleting) */
438 #define NHLOCKWANT 0x0008 /* someone wants to lock */
442 * Note: protected by nfs_buf_mutex
444 #define NBFLUSHINPROG 0x0001 /* Avoid multiple calls to nfs_flush() */
445 #define NBFLUSHWANT 0x0002 /* waiting for nfs_flush() to complete */
446 #define NBINVALINPROG 0x0004 /* Avoid multiple calls to nfs_vinvalbuf() */
447 #define NBINVALWANT 0x0008 /* waiting for nfs_vinvalbuf() to complete */
449 /* attr/mode timestamp macros */
450 #define NATTRVALID(np) ((np)->n_attrstamp != ~0)
451 #define NATTRINVALIDATE(np) ((np)->n_attrstamp = ~0)
452 #define NMODEVALID(np, slot) (((slot) >= 0) && ((slot) < 3) && ((np)->n_modestamp[(slot)] != ~0))
453 #define NMODEINVALIDATE(np) \
455 (np)->n_modestamp[0] = ~0; \
456 (np)->n_modestamp[1] = ~0; \
457 (np)->n_modestamp[2] = ~0; \
458 (np)->n_mode[3] = 0; \
462 * NFS-specific flags for nfs_vinvalbuf/nfs_flush
464 #define V_IGNORE_WRITEERR 0x8000
467 * Flags for nfs_nget()
469 #define NG_MARKROOT 0x0001 /* mark vnode as root of FS */
470 #define NG_MAKEENTRY 0x0002 /* add name cache entry for vnode */
473 * Convert between nfsnode pointers and vnode pointers
475 #define VTONFS(vp) ((nfsnode_t)vnode_fsnode(vp))
476 #define NFSTOV(np) ((np)->n_vnode)
478 /* nfsnode hash table mutex */
479 __private_extern__ lck_mtx_t
*nfs_node_hash_mutex
;
485 TAILQ_ENTRY(nfsiod
) niod_link
; /* List of nfsiods */
486 struct nfsmount
* niod_nmp
; /* mount point for this nfsiod */
488 TAILQ_HEAD(nfsiodlist
, nfsiod
);
489 TAILQ_HEAD(nfsiodmountlist
, nfsmount
);
490 __private_extern__
struct nfsiodlist nfsiodfree
, nfsiodwork
;
491 __private_extern__
struct nfsiodmountlist nfsiodmounts
;
492 __private_extern__ lck_mtx_t
*nfsiod_mutex
;
496 typedef int vnop_t(void *);
497 extern vnop_t
**fifo_nfsv2nodeop_p
;
498 extern vnop_t
**nfsv2_vnodeop_p
;
499 extern vnop_t
**spec_nfsv2nodeop_p
;
500 extern vnop_t
**fifo_nfsv4nodeop_p
;
501 extern vnop_t
**nfsv4_vnodeop_p
;
502 extern vnop_t
**spec_nfsv4nodeop_p
;
505 * Prototypes for NFS vnode operations
507 int nfs_vnop_write(struct vnop_write_args
*);
508 #define nfs_vnop_revoke nop_revoke
509 int nfs_vnop_inactive(struct vnop_inactive_args
*);
510 int nfs_vnop_reclaim(struct vnop_reclaim_args
*);
512 int nfs_lock(nfsnode_t
, int);
513 void nfs_unlock(nfsnode_t
);
514 int nfs_lock2(nfsnode_t
, nfsnode_t
, int);
515 void nfs_unlock2(nfsnode_t
, nfsnode_t
);
516 int nfs_lock4(nfsnode_t
, nfsnode_t
, nfsnode_t
, nfsnode_t
, int);
517 void nfs_unlock4(nfsnode_t
, nfsnode_t
, nfsnode_t
, nfsnode_t
);
518 void nfs_data_lock(nfsnode_t
, int);
519 void nfs_data_lock2(nfsnode_t
, int, int);
520 void nfs_data_unlock(nfsnode_t
);
521 void nfs_data_unlock2(nfsnode_t
, int);
522 void nfs_data_update_size(nfsnode_t
, int);
525 int nfs_removeit(struct nfs_sillyrename
*);
526 int nfs_nget(mount_t
,nfsnode_t
,struct componentname
*,u_char
*,int,struct nfs_vattr
*,u_int64_t
*,int,nfsnode_t
*);
527 nfsuint64
*nfs_getcookie(nfsnode_t
, off_t
, int);
528 void nfs_invaldir(nfsnode_t
);
530 /* nfsbuf functions */
531 void nfs_nbinit(void);
532 void nfs_buf_timer(void *, void *);
533 void nfs_buf_remfree(struct nfsbuf
*);
534 boolean_t
nfs_buf_is_incore(nfsnode_t
, daddr64_t
);
535 struct nfsbuf
* nfs_buf_incore(nfsnode_t
, daddr64_t
);
536 int nfs_buf_get(nfsnode_t
, daddr64_t
, int, thread_t
, int, struct nfsbuf
**);
537 int nfs_buf_upl_setup(struct nfsbuf
*bp
);
538 void nfs_buf_upl_check(struct nfsbuf
*bp
);
539 void nfs_buf_normalize_valid_range(nfsnode_t
, struct nfsbuf
*);
540 int nfs_buf_map(struct nfsbuf
*);
541 void nfs_buf_release(struct nfsbuf
*, int);
542 int nfs_buf_iowait(struct nfsbuf
*);
543 void nfs_buf_iodone(struct nfsbuf
*);
544 void nfs_buf_write_delayed(struct nfsbuf
*);
545 void nfs_buf_check_write_verifier(nfsnode_t
, struct nfsbuf
*);
546 void nfs_buf_freeup(int);
547 void nfs_buf_refget(struct nfsbuf
*bp
);
548 void nfs_buf_refrele(struct nfsbuf
*bp
);
549 void nfs_buf_drop(struct nfsbuf
*);
550 errno_t
nfs_buf_acquire(struct nfsbuf
*, int, int, int);
551 int nfs_buf_iterprepare(nfsnode_t
, struct nfsbuflists
*, int);
552 void nfs_buf_itercomplete(nfsnode_t
, struct nfsbuflists
*, int);
554 int nfs_bioread(nfsnode_t
, struct uio
*, int, int *, vfs_context_t
);
555 int nfs_buf_readdir(struct nfsbuf
*, vfs_context_t
);
556 int nfs_buf_read(struct nfsbuf
*);
557 void nfs_buf_read_finish(struct nfsbuf
*);
558 int nfs_buf_read_rpc(struct nfsbuf
*, thread_t
, kauth_cred_t
);
559 void nfs_buf_read_rpc_finish(struct nfsreq
*);
560 int nfs_buf_write(struct nfsbuf
*);
561 void nfs_buf_write_finish(struct nfsbuf
*, thread_t
, kauth_cred_t
);
562 int nfs_buf_write_rpc(struct nfsbuf
*, int, thread_t
, kauth_cred_t
);
563 void nfs_buf_write_rpc_finish(struct nfsreq
*);
564 int nfs_buf_write_dirty_pages(struct nfsbuf
*, thread_t
, kauth_cred_t
);
566 int nfs_flushcommits(nfsnode_t
, int);
567 int nfs_flush(nfsnode_t
, int, thread_t
, int);
569 int nfsiod_start(void);
570 void nfs_asyncio_finish(struct nfsreq
*);
571 void nfs_asyncio_resend(struct nfsreq
*);
575 #endif /* __APPLE_API_PRIVATE */
576 #endif /* _NFS_NFSNODE_H_ */