]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | |
2 | /* | |
5d5c5d0d A |
3 | * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. |
4 | * | |
2d21ac55 | 5 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 6 | * |
2d21ac55 A |
7 | * This file contains Original Code and/or Modifications of Original Code |
8 | * as defined in and that are subject to the Apple Public Source License | |
9 | * Version 2.0 (the 'License'). You may not use this file except in | |
10 | * compliance with the License. The rights granted to you under the License | |
11 | * may not be used to create, or enable the creation or redistribution of, | |
12 | * unlawful or unlicensed copies of an Apple operating system, or to | |
13 | * circumvent, violate, or enable the circumvention or violation of, any | |
14 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 15 | * |
2d21ac55 A |
16 | * Please obtain a copy of the License at |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
18 | * | |
19 | * The Original Code and all software distributed under the License are | |
20 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
21 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
22 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
23 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
24 | * Please see the License for the specific language governing rights and | |
25 | * limitations under the License. | |
8f6c56a5 | 26 | * |
2d21ac55 | 27 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
28 | */ |
29 | /* | |
30 | * Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved | |
31 | * Copyright (c) 1992, 1993, 1994, 1995 | |
32 | * The Regents of the University of California. All rights reserved. | |
33 | * | |
34 | * Redistribution and use in source and binary forms, with or without | |
35 | * modification, are permitted provided that the following conditions | |
36 | * are met: | |
37 | * 1. Redistributions of source code must retain the above copyright | |
38 | * notice, this list of conditions and the following disclaimer. | |
39 | * 2. Redistributions in binary form must reproduce the above copyright | |
40 | * notice, this list of conditions and the following disclaimer in the | |
41 | * documentation and/or other materials provided with the distribution. | |
42 | * 3. All advertising materials mentioning features or use of this software | |
43 | * must display the following acknowledgement: | |
44 | * This product includes software developed by the University of | |
45 | * California, Berkeley and its contributors. | |
46 | * 4. Neither the name of the University nor the names of its contributors | |
47 | * may be used to endorse or promote products derived from this software | |
48 | * without specific prior written permission. | |
49 | * | |
50 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS AND | |
51 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
52 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
53 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
54 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
55 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
56 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
57 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
60 | * SUCH DAMAGE. | |
61 | */ | |
2d21ac55 A |
62 | /* |
63 | * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce | |
64 | * support for mandatory and extensible security protections. This notice | |
65 | * is included in support of clause 2.2 (b) of the Apple Public License, | |
66 | * Version 2.0. | |
67 | */ | |
1c79356b A |
68 | |
69 | /* | |
70 | * Warning: This file is generated automatically. | |
71 | * (Modifications made here may easily be lost!) | |
72 | * | |
73 | * Created by the script: | |
74 | * @(#)vnode_if.sh 8.7 (Berkeley) 5/11/95 | |
75 | */ | |
76 | ||
77 | ||
9bccf70c A |
78 | #ifndef _SYS_VNODE_IF_H_ |
79 | #define _SYS_VNODE_IF_H_ | |
1c79356b | 80 | |
9bccf70c | 81 | #include <sys/appleapiopts.h> |
91447636 A |
82 | #include <sys/cdefs.h> |
83 | #include <sys/kernel_types.h> | |
84 | #include <sys/buf.h> | |
85 | #ifdef BSD_KERNEL_PRIVATE | |
86 | #include <sys/vm.h> | |
87 | #endif | |
88 | #include <mach/memory_object_types.h> | |
89 | ||
90 | ||
91 | #ifdef KERNEL | |
92 | ||
93 | extern struct vnodeop_desc vnop_default_desc; | |
94 | extern struct vnodeop_desc vnop_lookup_desc; | |
95 | extern struct vnodeop_desc vnop_create_desc; | |
96 | extern struct vnodeop_desc vnop_whiteout_desc; | |
97 | extern struct vnodeop_desc vnop_mknod_desc; | |
98 | extern struct vnodeop_desc vnop_open_desc; | |
99 | extern struct vnodeop_desc vnop_close_desc; | |
100 | extern struct vnodeop_desc vnop_access_desc; | |
101 | extern struct vnodeop_desc vnop_getattr_desc; | |
102 | extern struct vnodeop_desc vnop_setattr_desc; | |
91447636 A |
103 | extern struct vnodeop_desc vnop_read_desc; |
104 | extern struct vnodeop_desc vnop_write_desc; | |
105 | extern struct vnodeop_desc vnop_ioctl_desc; | |
106 | extern struct vnodeop_desc vnop_select_desc; | |
107 | extern struct vnodeop_desc vnop_exchange_desc; | |
108 | extern struct vnodeop_desc vnop_revoke_desc; | |
109 | extern struct vnodeop_desc vnop_mmap_desc; | |
110 | extern struct vnodeop_desc vnop_mnomap_desc; | |
111 | extern struct vnodeop_desc vnop_fsync_desc; | |
112 | extern struct vnodeop_desc vnop_remove_desc; | |
113 | extern struct vnodeop_desc vnop_link_desc; | |
114 | extern struct vnodeop_desc vnop_rename_desc; | |
115 | extern struct vnodeop_desc vnop_mkdir_desc; | |
116 | extern struct vnodeop_desc vnop_rmdir_desc; | |
117 | extern struct vnodeop_desc vnop_symlink_desc; | |
118 | extern struct vnodeop_desc vnop_readdir_desc; | |
119 | extern struct vnodeop_desc vnop_readdirattr_desc; | |
120 | extern struct vnodeop_desc vnop_readlink_desc; | |
121 | extern struct vnodeop_desc vnop_inactive_desc; | |
122 | extern struct vnodeop_desc vnop_reclaim_desc; | |
123 | extern struct vnodeop_desc vnop_print_desc; | |
124 | extern struct vnodeop_desc vnop_pathconf_desc; | |
125 | extern struct vnodeop_desc vnop_advlock_desc; | |
126 | extern struct vnodeop_desc vnop_truncate_desc; | |
127 | extern struct vnodeop_desc vnop_allocate_desc; | |
128 | extern struct vnodeop_desc vnop_pagein_desc; | |
129 | extern struct vnodeop_desc vnop_pageout_desc; | |
91447636 A |
130 | extern struct vnodeop_desc vnop_searchfs_desc; |
131 | extern struct vnodeop_desc vnop_copyfile_desc; | |
132 | extern struct vnodeop_desc vnop_blktooff_desc; | |
133 | extern struct vnodeop_desc vnop_offtoblk_desc; | |
134 | extern struct vnodeop_desc vnop_blockmap_desc; | |
135 | extern struct vnodeop_desc vnop_strategy_desc; | |
136 | extern struct vnodeop_desc vnop_bwrite_desc; | |
137 | ||
2d21ac55 A |
138 | #ifdef __APPLE_API_UNSTABLE |
139 | ||
140 | #if NAMEDSTREAMS | |
141 | extern struct vnodeop_desc vnop_getnamedstream_desc; | |
142 | extern struct vnodeop_desc vnop_makenamedstream_desc; | |
143 | extern struct vnodeop_desc vnop_removenamedstream_desc; | |
144 | #endif | |
145 | ||
146 | #endif | |
147 | ||
91447636 | 148 | __BEGIN_DECLS |
b0d623f7 | 149 | |
91447636 | 150 | struct vnop_lookup_args { |
1c79356b | 151 | struct vnodeop_desc *a_desc; |
91447636 A |
152 | vnode_t a_dvp; |
153 | vnode_t *a_vpp; | |
1c79356b | 154 | struct componentname *a_cnp; |
91447636 | 155 | vfs_context_t a_context; |
1c79356b | 156 | }; |
91447636 | 157 | |
b0d623f7 A |
158 | /*! |
159 | @function VNOP_LOOKUP | |
160 | @abstract Call down to a filesystem to look for a directory entry by name. | |
161 | @discussion VNOP_LOOKUP is the key pathway through which VFS asks a filesystem to find a file. The vnode | |
162 | should be returned with an iocount to be dropped by the caller. A VNOP_LOOKUP() calldown can come without | |
163 | a preceding VNOP_OPEN(). | |
164 | @param dvp Directory in which to look up file. | |
165 | @param vpp Destination for found vnode. | |
166 | @param cnp Structure describing filename to find, reason for lookup, and various other data. | |
167 | @param ctx Context against which to authenticate lookup request. | |
168 | @return 0 for success or a filesystem-specific error. | |
91447636 | 169 | */ |
b0d623f7 A |
170 | #ifdef XNU_KERNEL_PRIVATE |
171 | extern errno_t VNOP_LOOKUP(vnode_t, vnode_t *, struct componentname *, vfs_context_t); | |
172 | #endif /* XNU_KERNEL_PRIVATE */ | |
173 | ||
91447636 | 174 | struct vnop_create_args { |
1c79356b | 175 | struct vnodeop_desc *a_desc; |
91447636 A |
176 | vnode_t a_dvp; |
177 | vnode_t *a_vpp; | |
1c79356b | 178 | struct componentname *a_cnp; |
91447636 A |
179 | struct vnode_attr *a_vap; |
180 | vfs_context_t a_context; | |
1c79356b | 181 | }; |
91447636 | 182 | |
b0d623f7 A |
183 | /*! |
184 | @function VNOP_CREATE | |
185 | @abstract Call down to a filesystem to create a regular file (VREG). | |
186 | @discussion If file creation succeeds, "vpp" should be returned with an iocount to be dropped by the caller. | |
187 | A VNOP_CREATE() calldown can come without a preceding VNOP_OPEN(). | |
188 | @param dvp Directory in which to create file. | |
189 | @param vpp Destination for vnode for newly created file. | |
190 | @param cnp Description of filename to create. | |
191 | @param vap File creation properties, as seen in vnode_getattr(). Manipulated with VATTR_ISACTIVE, VATTR_RETURN, | |
192 | VATTR_SET_SUPPORTED, and so forth. | |
193 | @param ctx Context against which to authenticate file creation. | |
194 | @return 0 for success or a filesystem-specific error. | |
91447636 | 195 | */ |
b0d623f7 A |
196 | #ifdef XNU_KERNEL_PRIVATE |
197 | extern errno_t VNOP_CREATE(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, vfs_context_t); | |
198 | #endif /* XNU_KERNEL_PRIVATE */ | |
199 | ||
91447636 | 200 | struct vnop_whiteout_args { |
1c79356b | 201 | struct vnodeop_desc *a_desc; |
91447636 | 202 | vnode_t a_dvp; |
1c79356b A |
203 | struct componentname *a_cnp; |
204 | int a_flags; | |
91447636 | 205 | vfs_context_t a_context; |
1c79356b | 206 | }; |
91447636 | 207 | |
b0d623f7 A |
208 | /*! |
209 | @function VNOP_WHITEOUT | |
210 | @abstract Call down to a filesystem to create a whiteout. | |
211 | @discussion Whiteouts are used to support the union filesystem, whereby one filesystem is mounted "transparently" | |
212 | on top of another. A whiteout in the upper layer of a union mount is a "deletion" of a file in the lower layer; | |
213 | lookups will catch the whiteout and fail, setting ISWHITEOUT in the componentname structure, even if an underlying | |
214 | file of the same name exists. The whiteout vnop is used for creation, deletion, and checking whether a directory | |
215 | supports whiteouts (see flags). | |
216 | also support the LOOKUP flag, which is used to test whether a directory supports whiteouts. | |
217 | @param dvp Directory in which to create. | |
218 | @param cnp Name information for whiteout. | |
219 | @param flags CREATE: create a whiteout. LOOKUP: check whether a directory supports whiteouts, DELETE: remove a whiteout. | |
220 | @param ctx Context against which to authenticate whiteout creation. | |
221 | @return 0 for success or a filesystem-specific error. Returning 0 for LOOKUP indicates that a directory does support whiteouts. | |
91447636 | 222 | */ |
b0d623f7 A |
223 | #ifdef XNU_KERNEL_PRIVATE |
224 | extern errno_t VNOP_WHITEOUT(vnode_t, struct componentname *, int, vfs_context_t); | |
225 | #endif /* XNU_KERNEL_PRIVATE */ | |
226 | ||
91447636 A |
227 | struct vnop_mknod_args { |
228 | struct vnodeop_desc *a_desc; | |
229 | vnode_t a_dvp; | |
230 | vnode_t *a_vpp; | |
231 | struct componentname *a_cnp; | |
232 | struct vnode_attr *a_vap; | |
233 | vfs_context_t a_context; | |
1c79356b | 234 | }; |
91447636 | 235 | |
b0d623f7 A |
236 | /*! |
237 | @function VNOP_MKNOD | |
238 | @abstract Call down to a filesystem to create a special file. | |
239 | @discussion The mknod vnop is used to create character and block device files, named pipe (FIFO) files, and named sockets. | |
240 | The newly created file should be returned with an iocount which will be dropped by the caller. A VNOP_MKNOD() call | |
241 | can come down without a preceding VNOP_OPEN(). | |
242 | @param dvp Directory in which to create the special file. | |
243 | @param vpp Destination for newly created vnode. | |
244 | @param cnp Name information for new file. | |
245 | @param vap Attributes for new file, including type. | |
246 | @param ctx Context against which to authenticate node creation. | |
247 | @return 0 for success or a filesystem-specific error. | |
91447636 | 248 | */ |
b0d623f7 A |
249 | #ifdef XNU_KERNEL_PRIVATE |
250 | extern errno_t VNOP_MKNOD(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, vfs_context_t); | |
251 | #endif /* XNU_KERNEL_PRIVATE */ | |
252 | ||
91447636 | 253 | struct vnop_open_args { |
1c79356b | 254 | struct vnodeop_desc *a_desc; |
91447636 | 255 | vnode_t a_vp; |
1c79356b | 256 | int a_mode; |
91447636 | 257 | vfs_context_t a_context; |
1c79356b | 258 | }; |
91447636 | 259 | |
b0d623f7 A |
260 | /*! |
261 | @function VNOP_OPEN | |
262 | @abstract Call down to a filesystem to open a file. | |
263 | @discussion The open vnop gives a filesystem a chance to initialize a file for | |
264 | operations like reading, writing, and ioctls. VFS promises to send down exactly one VNOP_CLOSE() | |
265 | for each VNOP_OPEN(). | |
266 | @param vp File to open. | |
267 | @param mode FREAD and/or FWRITE. | |
268 | @param ctx Context against which to authenticate open. | |
269 | @return 0 for success or a filesystem-specific error. | |
91447636 | 270 | */ |
b0d623f7 A |
271 | #ifdef XNU_KERNEL_PRIVATE |
272 | extern errno_t VNOP_OPEN(vnode_t, int, vfs_context_t); | |
273 | #endif /* XNU_KERNEL_PRIVATE */ | |
274 | ||
91447636 | 275 | struct vnop_close_args { |
1c79356b | 276 | struct vnodeop_desc *a_desc; |
91447636 | 277 | vnode_t a_vp; |
1c79356b | 278 | int a_fflag; |
91447636 | 279 | vfs_context_t a_context; |
1c79356b | 280 | }; |
91447636 | 281 | |
b0d623f7 A |
282 | /*! |
283 | @function VNOP_CLOSE | |
284 | @abstract Call down to a filesystem to close a file. | |
285 | @discussion The close vnop gives a filesystem a chance to release state set up | |
286 | by a VNOP_OPEN(). VFS promises to send down exactly one VNOP_CLOSE() for each VNOP_OPEN(). | |
287 | @param vp File to close. | |
288 | @param fflag FREAD and/or FWRITE; in the case of a file opened with open(2), fflag corresponds | |
289 | to how the file was opened. | |
290 | @param ctx Context against which to authenticate close. | |
291 | @return 0 for success or a filesystem-specific error. | |
91447636 | 292 | */ |
b0d623f7 A |
293 | #ifdef XNU_KERNEL_PRIVATE |
294 | extern errno_t VNOP_CLOSE(vnode_t, int, vfs_context_t); | |
295 | #endif /* XNU_KERNEL_PRIVATE */ | |
296 | ||
91447636 | 297 | struct vnop_access_args { |
1c79356b | 298 | struct vnodeop_desc *a_desc; |
91447636 A |
299 | vnode_t a_vp; |
300 | int a_action; | |
301 | vfs_context_t a_context; | |
1c79356b | 302 | }; |
91447636 | 303 | |
b0d623f7 A |
304 | /*! |
305 | @function VNOP_ACCESS | |
306 | @abstract Call down to a filesystem to see if a kauth-style operation is permitted. | |
307 | @discussion VNOP_ACCESS is currently only called on filesystems which mark themselves | |
308 | as doing their authentication remotely (vfs_setauthopaque(), vfs_authopaque()). A VNOP_ACCESS() | |
309 | calldown may come without any preceding VNOP_OPEN(). | |
310 | @param vp File to authorize action for. | |
311 | @param action kauth-style action to be checked for permissions, e.g. KAUTH_VNODE_DELETE. | |
312 | @param ctx Context against which to authenticate action. | |
313 | @return 0 for success or a filesystem-specific error. | |
91447636 | 314 | */ |
b0d623f7 A |
315 | #ifdef XNU_KERNEL_PRIVATE |
316 | extern errno_t VNOP_ACCESS(vnode_t, int, vfs_context_t); | |
317 | #endif /* XNU_KERNEL_PRIVATE */ | |
318 | ||
91447636 | 319 | struct vnop_getattr_args { |
1c79356b | 320 | struct vnodeop_desc *a_desc; |
91447636 A |
321 | vnode_t a_vp; |
322 | struct vnode_attr *a_vap; | |
323 | vfs_context_t a_context; | |
1c79356b | 324 | }; |
91447636 | 325 | |
b0d623f7 A |
326 | /*! |
327 | @function VNOP_GETATTR | |
328 | @abstract Call down to a filesystem to get vnode attributes. | |
329 | @discussion Supported attributes ("Yes, I am returning this information") are set with VATTR_SET_SUPPORTED. | |
330 | Which attributes have been requested is checked with VATTR_IS_ACTIVE. Attributes | |
331 | are returned with VATTR_RETURN. It is through VNOP_GETATTR that routines like stat() get their information. | |
332 | A VNOP_GETATTR() calldown may come without any preceding VNOP_OPEN(). | |
333 | @param vp The vnode whose attributes to get. | |
334 | @param vap Container for which attributes are requested, which attributes are supported by the filesystem, and attribute values. | |
335 | @param ctx Context against which to authenticate request for attributes. | |
336 | @return 0 for success or a filesystem-specific error. VNOP_GETATTR() can return success even if not | |
337 | all requested attributes were returned; returning an error-value should indicate that something went wrong, rather than that | |
338 | some attribute is not supported. | |
91447636 | 339 | */ |
b0d623f7 A |
340 | #ifdef XNU_KERNEL_PRIVATE |
341 | extern errno_t VNOP_GETATTR(vnode_t, struct vnode_attr *, vfs_context_t); | |
342 | #endif /* XNU_KERNEL_PRIVATE */ | |
343 | ||
91447636 | 344 | struct vnop_setattr_args { |
1c79356b | 345 | struct vnodeop_desc *a_desc; |
91447636 A |
346 | vnode_t a_vp; |
347 | struct vnode_attr *a_vap; | |
348 | vfs_context_t a_context; | |
1c79356b | 349 | }; |
91447636 | 350 | |
b0d623f7 A |
351 | /*! |
352 | @function VNOP_SETATTR | |
353 | @abstract Call down to a filesystem to set vnode attributes. | |
354 | @discussion Supported attributes ("Yes, I am setting this attribute.") are set with VATTR_SET_SUPPORTED. | |
355 | Requested attributes are checked with VATTR_IS_ACTIVE. Attribute values are accessed directly through | |
356 | structure fields. VNOP_SETATTR() is the core of the KPI function vnode_setattr(), which is used by chmod(), | |
357 | chown(), truncate(), and many others. A VNOP_SETATTR() call may come without any preceding VNOP_OPEN(). | |
358 | @param vp The vnode whose attributes to set. | |
359 | @param vap Container for which attributes are to be set and their desired values, as well as for the filesystem to | |
360 | return information about which attributes were successfully set. | |
361 | @param ctx Context against which to authenticate request for attribute change. | |
362 | @return 0 for success or a filesystem-specific error. VNOP_SETATTR() can return success even if not | |
363 | all requested attributes were set; returning an error-value should indicate that something went wrong, rather than that | |
364 | some attribute is not supported. | |
91447636 | 365 | */ |
b0d623f7 A |
366 | #ifdef XNU_KERNEL_PRIVATE |
367 | extern errno_t VNOP_SETATTR(vnode_t, struct vnode_attr *, vfs_context_t); | |
368 | #endif /* XNU_KERNEL_PRIVATE */ | |
369 | ||
91447636 | 370 | struct vnop_read_args { |
1c79356b | 371 | struct vnodeop_desc *a_desc; |
91447636 | 372 | vnode_t a_vp; |
1c79356b A |
373 | struct uio *a_uio; |
374 | int a_ioflag; | |
91447636 | 375 | vfs_context_t a_context; |
1c79356b | 376 | }; |
91447636 | 377 | |
b0d623f7 A |
378 | /*! |
379 | @function VNOP_READ | |
380 | @abstract Call down to a filesystem to read file data. | |
381 | @discussion VNOP_READ() is where the hard work of of the read() system call happens. The filesystem may use | |
382 | the buffer cache, the cluster layer, or an alternative method to get its data; uio routines will be used to see that data | |
383 | is copied to the correct virtual address in the correct address space and will update its uio argument | |
384 | to indicate how much data has been moved. Filesystems will not receive a read request on a file without having | |
385 | first received a VNOP_OPEN(). | |
386 | @param vp The vnode to read from. | |
387 | @param uio Description of request, including file offset, amount of data requested, destination address for data, | |
388 | and whether that destination is in kernel or user space. | |
389 | @param ctx Context against which to authenticate read request. | |
390 | @return 0 for success or a filesystem-specific error. VNOP_READ() can return success even if less data was | |
391 | read than originally requested; returning an error value should indicate that something actually went wrong. | |
91447636 | 392 | */ |
b0d623f7 A |
393 | extern errno_t VNOP_READ(vnode_t, struct uio *, int, vfs_context_t); |
394 | ||
91447636 | 395 | struct vnop_write_args { |
1c79356b | 396 | struct vnodeop_desc *a_desc; |
91447636 | 397 | vnode_t a_vp; |
1c79356b A |
398 | struct uio *a_uio; |
399 | int a_ioflag; | |
91447636 | 400 | vfs_context_t a_context; |
1c79356b | 401 | }; |
91447636 | 402 | |
b0d623f7 A |
403 | /*! |
404 | @function VNOP_WRITE | |
405 | @abstract Call down to the filesystem to write file data. | |
406 | @discussion VNOP_WRITE() is to write() as VNOP_READ() is to read(). The filesystem may use | |
407 | the buffer cache, the cluster layer, or an alternative method to write its data; uio routines will be used to see that data | |
408 | is copied to the correct virtual address in the correct address space and will update its uio argument | |
409 | to indicate how much data has been moved. Filesystems will not receive a write request on a file without having | |
410 | first received a VNOP_OPEN(). | |
411 | @param vp The vnode to write to. | |
412 | @param uio Description of request, including file offset, amount of data to write, source address for data, | |
413 | and whether that destination is in kernel or user space. | |
414 | @param ctx Context against which to authenticate write request. | |
415 | @return 0 for success or a filesystem-specific error. VNOP_WRITE() can return success even if less data was | |
416 | written than originally requested; returning an error value should indicate that something actually went wrong. | |
91447636 | 417 | */ |
b0d623f7 A |
418 | extern errno_t VNOP_WRITE(vnode_t, struct uio *, int, vfs_context_t); |
419 | ||
91447636 | 420 | struct vnop_ioctl_args { |
1c79356b | 421 | struct vnodeop_desc *a_desc; |
91447636 | 422 | vnode_t a_vp; |
1c79356b A |
423 | u_long a_command; |
424 | caddr_t a_data; | |
425 | int a_fflag; | |
91447636 | 426 | vfs_context_t a_context; |
1c79356b | 427 | }; |
91447636 | 428 | |
b0d623f7 A |
429 | /*! |
430 | @function VNOP_IOCTL | |
431 | @abstract Call down to a filesystem or device driver to execute various control operations on or request data about a file. | |
432 | @discussion Ioctl controls are typically associated with devices, but they can in fact be passed | |
433 | down for any file; they are used to implement any of a wide range of controls and information requests. | |
434 | fcntl() calls VNOP_IOCTL for several commands, and will attempt a VNOP_IOCTL if it is passed an unknown command, | |
435 | though no copyin or copyout of arguments can occur in this case--the "arg" must be an integer value. | |
436 | Filesystems can define their own fcntls using this mechanism. How ioctl commands are structured | |
437 | is slightly complicated; see the manual page for ioctl(2). | |
438 | @param vp The vnode to execute the command on. | |
439 | @param command Identifier for action to take. | |
440 | @param data Pointer to data; this can be an integer constant (of 32 bits only) or an address to be read from or written to, | |
441 | depending on "command." If it is an address, it is valid and resides in the kernel; callers of VNOP_IOCTL() are | |
442 | responsible for copying to and from userland. | |
443 | @param ctx Context against which to authenticate ioctl request. | |
444 | @return 0 for success or a filesystem-specific error. | |
91447636 | 445 | */ |
b0d623f7 A |
446 | extern errno_t VNOP_IOCTL(vnode_t, u_long, caddr_t, int, vfs_context_t); |
447 | ||
91447636 | 448 | struct vnop_select_args { |
1c79356b | 449 | struct vnodeop_desc *a_desc; |
91447636 | 450 | vnode_t a_vp; |
1c79356b A |
451 | int a_which; |
452 | int a_fflags; | |
9bccf70c | 453 | void *a_wql; |
91447636 | 454 | vfs_context_t a_context; |
55e303ae | 455 | }; |
91447636 | 456 | |
b0d623f7 A |
457 | /*! |
458 | @function VNOP_SELECT | |
459 | @abstract Call down to a filesystem or device to check if a file is ready for I/O and request later notification if it is not currently ready. | |
460 | @discussion In general, regular are always "ready for I/O" and their select vnops simply return "1." | |
461 | Devices, though, may or may not be read; they keep track of who is selecting on them and send notifications | |
462 | when they become ready. xnu provides structures and routines for tracking threads waiting for I/O and waking up | |
463 | those threads: see selrecord(), selthreadclear(), seltrue(), selwait(), selwakeup(), and the selinfo structure (sys/select.h). | |
464 | @param vp The vnode to check for I/O readiness. | |
465 | @param which What kind of I/O is desired: FREAD, FWRITE. | |
466 | @param fflags Flags from fileglob as seen in fcntl.h, e.g. O_NONBLOCK, O_APPEND. | |
467 | @param wql Opaque object to pass to selrecord(). | |
468 | @param ctx Context to authenticate for select request. | |
469 | @return Nonzero indicates that a file is ready for I/O. 0 indicates that the file is not ready for I/O; | |
470 | there is no way to return an error. 0 should be returned if the device (or file) is not ready for I/O | |
471 | and the driver (or filesystem) is going to track the request and provide subsequent wakeups. | |
472 | the device (or filesystem) will provide a wakeup. | |
91447636 | 473 | */ |
b0d623f7 A |
474 | #ifdef XNU_KERNEL_PRIVATE |
475 | extern errno_t VNOP_SELECT(vnode_t, int, int, void *, vfs_context_t); | |
476 | #endif /* XNU_KERNEL_PRIVATE */ | |
477 | ||
91447636 | 478 | struct vnop_exchange_args { |
55e303ae | 479 | struct vnodeop_desc *a_desc; |
91447636 A |
480 | vnode_t a_fvp; |
481 | vnode_t a_tvp; | |
482 | int a_options; | |
483 | vfs_context_t a_context; | |
55e303ae | 484 | }; |
91447636 | 485 | |
b0d623f7 A |
486 | /*! |
487 | @function VNOP_EXCHANGE | |
488 | @abstract Call down to a filesystem to atomically exchange the data of two files. | |
489 | @discussion VNOP_EXCHANGE() is currently only called by the exchangedata() system call. It will only | |
490 | be applied to files on the same volume. | |
491 | @param fvp First vnode. | |
492 | @param tvp Second vnode. | |
493 | @param options Unused. | |
494 | @param ctx Context to authenticate for exchangedata request. | |
495 | @return 0 for success, else an error code. | |
91447636 | 496 | */ |
b0d623f7 A |
497 | #ifdef XNU_KERNEL_PRIVATE |
498 | extern errno_t VNOP_EXCHANGE(vnode_t, vnode_t, int, vfs_context_t); | |
499 | #endif /* XNU_KERNEL_PRIVATE */ | |
500 | ||
91447636 | 501 | struct vnop_revoke_args { |
1c79356b | 502 | struct vnodeop_desc *a_desc; |
91447636 | 503 | vnode_t a_vp; |
1c79356b | 504 | int a_flags; |
91447636 | 505 | vfs_context_t a_context; |
1c79356b | 506 | }; |
91447636 | 507 | |
b0d623f7 A |
508 | /*! |
509 | @function VNOP_REVOKE | |
510 | @abstract Call down to a filesystem to invalidate all open file descriptors for a vnode. | |
511 | @discussion This function is typically called as part of a TTY revoke, but can also be | |
512 | used on regular files. Most filesystems simply use nop_revoke(), which calls vn_revoke(), | |
513 | as their revoke vnop implementation. | |
514 | @param vp The vnode to revoke. | |
515 | @param flags Unused. | |
516 | @param ctx Context to authenticate for revoke request. | |
517 | @return 0 for success, else an error code. | |
91447636 | 518 | */ |
b0d623f7 A |
519 | #ifdef XNU_KERNEL_PRIVATE |
520 | extern errno_t VNOP_REVOKE(vnode_t, int, vfs_context_t); | |
521 | #endif /* XNU_KERNEL_PRIVATE */ | |
522 | ||
91447636 | 523 | struct vnop_mmap_args { |
1c79356b | 524 | struct vnodeop_desc *a_desc; |
91447636 | 525 | vnode_t a_vp; |
1c79356b | 526 | int a_fflags; |
91447636 | 527 | vfs_context_t a_context; |
1c79356b | 528 | }; |
91447636 | 529 | |
b0d623f7 A |
530 | /*! |
531 | @function VNOP_MMAP | |
532 | @abstract Notify a filesystem that a file is being mmap-ed. | |
533 | @discussion VNOP_MMAP is an advisory calldown to say that the system is mmap-ing a file. | |
534 | @param vp The vnode being mmapped. | |
535 | @param flags Memory protection: PROT_READ, PROT_WRITE, PROT_EXEC. | |
536 | @param ctx Context to authenticate for mmap request. | |
537 | @return 0 for success; all errors except EPERM are ignored. | |
91447636 | 538 | */ |
b0d623f7 A |
539 | #ifdef XNU_KERNEL_PRIVATE |
540 | extern errno_t VNOP_MMAP(vnode_t, int, vfs_context_t); | |
541 | #endif /* XNU_KERNEL_PRIVATE */ | |
542 | ||
91447636 | 543 | struct vnop_mnomap_args { |
1c79356b | 544 | struct vnodeop_desc *a_desc; |
91447636 A |
545 | vnode_t a_vp; |
546 | vfs_context_t a_context; | |
1c79356b | 547 | }; |
91447636 | 548 | |
b0d623f7 A |
549 | /*! |
550 | @function VNOP_MNOMAP | |
551 | @abstract Inform a filesystem that a file is no longer mapped. | |
552 | @discussion In general, no action is required of a filesystem for VNOP_MNOMAP. | |
553 | @param vp The vnode which is no longer mapped. | |
554 | @param ctx Context to authenticate for mnomap request. | |
555 | @return Return value is ignored. | |
91447636 | 556 | */ |
b0d623f7 A |
557 | #ifdef XNU_KERNEL_PRIVATE |
558 | extern errno_t VNOP_MNOMAP(vnode_t, vfs_context_t); | |
559 | #endif /* XNU_KERNEL_PRIVATE */ | |
560 | ||
91447636 | 561 | struct vnop_fsync_args { |
1c79356b | 562 | struct vnodeop_desc *a_desc; |
91447636 A |
563 | vnode_t a_vp; |
564 | int a_waitfor; | |
565 | vfs_context_t a_context; | |
1c79356b | 566 | }; |
91447636 | 567 | |
b0d623f7 A |
568 | /*! |
569 | @function VNOP_FSYNC | |
570 | @abstract Call down to a filesystem to synchronize a file with on-disk state. | |
571 | @discussion VNOP_FSYNC is called whenever we need to make sure that a file's data has been | |
572 | pushed to backing store, for example when recycling; it is also the heart of the fsync() system call. | |
573 | @param vp The vnode whose data to flush to backing store. | |
574 | @param ctx Context to authenticate for fsync request. | |
575 | @return 0 for success, else an error code. | |
91447636 | 576 | */ |
b0d623f7 A |
577 | extern errno_t VNOP_FSYNC(vnode_t, int, vfs_context_t); |
578 | ||
91447636 | 579 | struct vnop_remove_args { |
1c79356b | 580 | struct vnodeop_desc *a_desc; |
91447636 A |
581 | vnode_t a_dvp; |
582 | vnode_t a_vp; | |
1c79356b | 583 | struct componentname *a_cnp; |
91447636 A |
584 | int a_flags; |
585 | vfs_context_t a_context; | |
1c79356b | 586 | }; |
91447636 | 587 | |
b0d623f7 A |
588 | /*! |
589 | @function VNOP_REMOVE | |
590 | @abstract Call down to a filesystem to delete a file. | |
591 | @discussion VNOP_REMOVE is called to remove a file from a filesystem's namespace, for example by unlink(). | |
592 | It can operate on regular files, named pipes, special files, and in some cases on directories. | |
593 | @param dvp Directory in which to delete a file. | |
594 | @param vp The file to delete. | |
595 | @param cnp Filename information. | |
596 | @param ctx Context to authenticate for fsync request. | |
597 | @return 0 for success, else an error code. | |
91447636 | 598 | */ |
b0d623f7 A |
599 | #ifdef XNU_KERNEL_PRIVATE |
600 | extern errno_t VNOP_REMOVE(vnode_t, vnode_t, struct componentname *, int, vfs_context_t); | |
601 | #endif /* XNU_KERNEL_PRIVATE */ | |
602 | ||
91447636 | 603 | struct vnop_link_args { |
1c79356b | 604 | struct vnodeop_desc *a_desc; |
91447636 A |
605 | vnode_t a_vp; |
606 | vnode_t a_tdvp; | |
1c79356b | 607 | struct componentname *a_cnp; |
91447636 | 608 | vfs_context_t a_context; |
1c79356b | 609 | }; |
91447636 | 610 | |
b0d623f7 A |
611 | /*! |
612 | @function VNOP_LINK | |
613 | @abstract Call down to a filesystem to create a hardlink to a file. | |
614 | @discussion See "man 2 link". | |
615 | @param vp File to link to. | |
616 | @param dvp Directory in which to create the link. | |
617 | @param cnp Filename information for new link. | |
618 | @param ctx Context to authenticate for link request. | |
619 | @return 0 for success, else an error code. | |
91447636 | 620 | */ |
b0d623f7 A |
621 | #ifdef XNU_KERNEL_PRIVATE |
622 | extern errno_t VNOP_LINK(vnode_t, vnode_t, struct componentname *, vfs_context_t); | |
623 | #endif /* XNU_KERNEL_PRIVATE */ | |
624 | ||
91447636 | 625 | struct vnop_rename_args { |
1c79356b | 626 | struct vnodeop_desc *a_desc; |
91447636 A |
627 | vnode_t a_fdvp; |
628 | vnode_t a_fvp; | |
1c79356b | 629 | struct componentname *a_fcnp; |
91447636 A |
630 | vnode_t a_tdvp; |
631 | vnode_t a_tvp; | |
1c79356b | 632 | struct componentname *a_tcnp; |
91447636 | 633 | vfs_context_t a_context; |
1c79356b | 634 | }; |
91447636 | 635 | |
b0d623f7 A |
636 | /*! |
637 | @function VNOP_RENAME | |
638 | @abstract Call down to a filesystem to rename a file. | |
639 | @discussion VNOP_RENAME() will only be called with a source and target on the same volume. | |
640 | @param fdvp Directory in which source file resides. | |
641 | @param fvp File being renamed. | |
642 | @param fcnp Name information for source file. | |
643 | @param tdvp Directory file is being moved to. | |
644 | @param tvp Existing file with same name as target, should one exist. | |
645 | @param tcnp Name information for target path. | |
646 | @param ctx Context to authenticate for rename request. | |
647 | @return 0 for success, else an error code. | |
91447636 | 648 | */ |
b0d623f7 A |
649 | #ifdef XNU_KERNEL_PRIVATE |
650 | extern errno_t VNOP_RENAME(vnode_t, vnode_t, struct componentname *, vnode_t, vnode_t, struct componentname *, vfs_context_t); | |
651 | #endif /* XNU_KERNEL_PRIVATE */ | |
652 | ||
91447636 | 653 | struct vnop_mkdir_args { |
1c79356b | 654 | struct vnodeop_desc *a_desc; |
91447636 A |
655 | vnode_t a_dvp; |
656 | vnode_t *a_vpp; | |
1c79356b | 657 | struct componentname *a_cnp; |
91447636 A |
658 | struct vnode_attr *a_vap; |
659 | vfs_context_t a_context; | |
b0d623f7 | 660 | }; |
91447636 | 661 | |
b0d623f7 A |
662 | /*! |
663 | @function VNOP_MKDIR | |
664 | @abstract Call down to a filesystem to create a directory. | |
665 | @discussion The newly created directory should be returned with an iocount which will be dropped by the caller. | |
666 | @param dvp Directory in which to create new directory. | |
667 | @param vpp Destination for pointer to new directory's vnode. | |
668 | @param cnp Name information for new directory. | |
669 | @param vap Attributes for new directory. | |
670 | @param ctx Context to authenticate for mkdir request. | |
671 | @return 0 for success, else an error code. | |
91447636 | 672 | */ |
b0d623f7 A |
673 | #ifdef XNU_KERNEL_PRIVATE |
674 | extern errno_t VNOP_MKDIR(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, vfs_context_t); | |
675 | #endif /* XNU_KERNEL_PRIVATE */ | |
676 | ||
91447636 | 677 | struct vnop_rmdir_args { |
1c79356b | 678 | struct vnodeop_desc *a_desc; |
91447636 A |
679 | vnode_t a_dvp; |
680 | vnode_t a_vp; | |
1c79356b | 681 | struct componentname *a_cnp; |
91447636 | 682 | vfs_context_t a_context; |
1c79356b | 683 | }; |
91447636 | 684 | |
b0d623f7 A |
685 | /*! |
686 | @function VNOP_RMDIR | |
687 | @abstract Call down to a filesystem to delete a directory. | |
688 | @param dvp Parent of directory to be removed. | |
689 | @param vp Directory to remove. | |
690 | @param cnp Name information for directory to be deleted. | |
691 | @param ctx Context to authenticate for rmdir request. | |
692 | @return 0 for success, else an error code. | |
91447636 | 693 | */ |
b0d623f7 A |
694 | #ifdef XNU_KERNEL_PRIVATE |
695 | extern errno_t VNOP_RMDIR(vnode_t, vnode_t, struct componentname *, vfs_context_t); | |
696 | #endif /* XNU_KERNEL_PRIVATE */ | |
697 | ||
91447636 A |
698 | struct vnop_symlink_args { |
699 | struct vnodeop_desc *a_desc; | |
700 | vnode_t a_dvp; | |
701 | vnode_t *a_vpp; | |
702 | struct componentname *a_cnp; | |
703 | struct vnode_attr *a_vap; | |
704 | char *a_target; | |
705 | vfs_context_t a_context; | |
1c79356b | 706 | }; |
b0d623f7 A |
707 | |
708 | /*! | |
709 | @function VNOP_SYMLINK | |
710 | @abstract Call down to a filesystem to create a symbolic link. | |
711 | @param If VNOP_SYMLINK() is successful, the new file should be returned with an iocount which will | |
712 | be dropped by the caller. VFS does not ensure that the target path will have a length shorter | |
713 | than the max symlink length for the filesystem. | |
714 | @param dvp Parent directory for new symlink file. | |
715 | @param vpp | |
716 | @param cnp Name information for new symlink. | |
717 | @param vap Attributes for symlink. | |
718 | @param target Path for symlink to store; for "ln -s /var/vardir linktovardir", "target" would be "/var/vardir" | |
719 | @param ctx Context to authenticate for symlink request. | |
720 | @return 0 for success, else an error code. | |
721 | */ | |
722 | #ifdef XNU_KERNEL_PRIVATE | |
91447636 | 723 | extern errno_t VNOP_SYMLINK(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, char *, vfs_context_t); |
b0d623f7 | 724 | #endif /* XNU_KERNEL_PRIVATE */ |
91447636 A |
725 | |
726 | ||
727 | /* | |
91447636 A |
728 | * |
729 | * When VNOP_READDIR is called from the NFS Server, the nfs_data | |
730 | * argument is non-NULL. | |
731 | * | |
732 | * The value of nfs_eofflag should be set to TRUE if the end of | |
733 | * the directory was reached while reading. | |
734 | * | |
735 | * The directory seek offset (cookies) are returned to the NFS client and | |
736 | * may be used later to restart a directory read part way through | |
737 | * the directory. There is one cookie returned for each directory | |
738 | * entry returned and its size is determince from nfs_sizeofcookie. | |
739 | * The value of the cookie should be the logical offset within the | |
740 | * directory where the on-disc version of the appropriate directory | |
741 | * entry starts. Memory for the cookies is allocated from M_TEMP | |
742 | * and it is freed by the caller of VNOP_READDIR. | |
743 | * | |
744 | */ | |
745 | ||
746 | struct vnop_readdir_args { | |
1c79356b | 747 | struct vnodeop_desc *a_desc; |
91447636 | 748 | vnode_t a_vp; |
1c79356b | 749 | struct uio *a_uio; |
91447636 | 750 | int a_flags; |
1c79356b | 751 | int *a_eofflag; |
91447636 A |
752 | int *a_numdirent; |
753 | vfs_context_t a_context; | |
1c79356b | 754 | }; |
91447636 | 755 | |
b0d623f7 A |
756 | /*! |
757 | @function VNOP_READDIR | |
758 | @abstract Call down to a filesystem to enumerate directory entries. | |
759 | @discussion VNOP_READDIR() packs a buffer with "struct dirent" directory entry representations as described | |
760 | by the "getdirentries" manual page. | |
761 | @param vp Directory to enumerate. | |
762 | @param uio Destination information for resulting direntries. | |
763 | @param flags VNODE_READDIR_EXTENDED, VNODE_READDIR_REQSEEKOFF, VNODE_READDIR_SEEKOFF32: Apple-internal flags. | |
764 | @param eofflag Should be set to 1 if the end of the directory has been reached. | |
765 | @param numdirent Should be set to number of entries written into buffer. | |
766 | @param ctx Context to authenticate for readdir request. | |
767 | @return 0 for success, else an error code. | |
91447636 | 768 | */ |
b0d623f7 A |
769 | #ifdef XNU_KERNEL_PRIVATE |
770 | extern errno_t VNOP_READDIR(vnode_t, struct uio *, int, int *, int *, vfs_context_t); | |
771 | #endif /* XNU_KERNEL_PRIVATE */ | |
772 | ||
91447636 | 773 | struct vnop_readdirattr_args { |
1c79356b | 774 | struct vnodeop_desc *a_desc; |
91447636 | 775 | vnode_t a_vp; |
1c79356b A |
776 | struct attrlist *a_alist; |
777 | struct uio *a_uio; | |
b0d623f7 A |
778 | uint32_t a_maxcount; |
779 | uint32_t a_options; | |
780 | uint32_t *a_newstate; | |
1c79356b | 781 | int *a_eofflag; |
b0d623f7 | 782 | uint32_t *a_actualcount; |
91447636 | 783 | vfs_context_t a_context; |
1c79356b | 784 | }; |
91447636 | 785 | |
b0d623f7 A |
786 | /*! |
787 | @function VNOP_READDIRATTR | |
788 | @abstract Call down to get file attributes for many files in a directory at once. | |
789 | @discussion VNOP_READDIRATTR() packs a buffer with file attributes, as if the results of many "getattrlist" calls. | |
790 | @param vp Directory in which to enumerate entries' attributes. | |
791 | @param alist Which attributes are wanted for each directory entry. | |
792 | @param uio Destination information for resulting attributes. | |
793 | @param maxcount Maximum count of files to get attributes for. | |
794 | @param options FSOPT_NOFOLLOW: do not follow symbolic links. FSOPT_NOINMEMUPDATE: do not use data which have been | |
795 | updated since an inode was loaded into memory. | |
796 | @param newstate The "newstate" should be set to a value which changes if the contents of a directory change | |
797 | through an addition or deletion but stays the same otherwise. | |
798 | @param eofflag Should be set to 1 if the end of the directory has been reached. | |
799 | @param actualcount Should be set to number of files whose attributes were written into buffer. | |
800 | @param ctx Context to authenticate for readdirattr request. | |
801 | @return 0 for success, else an error code. | |
91447636 | 802 | */ |
b0d623f7 A |
803 | #ifdef XNU_KERNEL_PRIVATE |
804 | extern errno_t VNOP_READDIRATTR(vnode_t, struct attrlist *, struct uio *, uint32_t, uint32_t, uint32_t *, int *, uint32_t *, vfs_context_t); | |
805 | #endif /* XNU_KERNEL_PRIVATE */ | |
806 | ||
91447636 | 807 | struct vnop_readlink_args { |
1c79356b | 808 | struct vnodeop_desc *a_desc; |
91447636 | 809 | vnode_t a_vp; |
1c79356b | 810 | struct uio *a_uio; |
91447636 | 811 | vfs_context_t a_context; |
1c79356b | 812 | }; |
91447636 | 813 | |
b0d623f7 A |
814 | /*! |
815 | @function VNOP_READLINK | |
816 | @abstract Call down to a filesystem to get the pathname represented by a symbolic link. | |
817 | @discussion VNOP_READLINK() gets the path stored in a symbolic link; it is called by namei() and the readlink() system call. | |
818 | @param vp Symbolic link to read from. | |
819 | @param uio Destination information for link path. | |
820 | @param ctx Context to authenticate for readlink request. | |
821 | @return 0 for success, else an error code. | |
91447636 | 822 | */ |
b0d623f7 A |
823 | #ifdef XNU_KERNEL_PRIVATE |
824 | extern errno_t VNOP_READLINK(vnode_t, struct uio *, vfs_context_t); | |
825 | #endif /* XNU_KERNEL_PRIVATE */ | |
826 | ||
91447636 | 827 | struct vnop_inactive_args { |
1c79356b | 828 | struct vnodeop_desc *a_desc; |
91447636 A |
829 | vnode_t a_vp; |
830 | vfs_context_t a_context; | |
1c79356b | 831 | }; |
91447636 | 832 | |
b0d623f7 A |
833 | /*! |
834 | @function VNOP_INACTIVE | |
835 | @abstract Notify a filesystem that the last usecount (persistent reference) on a vnode has been dropped. | |
836 | @discussion VNOP_INACTVE() gives a filesystem a chance to aggressively release resources assocated with a vnode, perhaps | |
837 | even to call vnode_recycle(), but no action is prescribed; it is acceptable for VNOP_INACTIVE to be a no-op and | |
838 | to defer all reclamation until VNOP_RECLAIM(). | |
839 | VNOP_INACTVE() will not be called on a vnode if no persistent reference is ever taken; an | |
840 | important example is a stat(), which takes an iocount, reads its data, and drops that iocount. | |
841 | @param vp The vnode which is now inactive. | |
842 | @param ctx Context to authenticate for inactive message. | |
843 | @return 0 for success, else an error code, but return value is currently ignored. | |
91447636 | 844 | */ |
b0d623f7 A |
845 | #ifdef XNU_KERNEL_PRIVATE |
846 | extern errno_t VNOP_INACTIVE(vnode_t, vfs_context_t); | |
847 | #endif /* XNU_KERNEL_PRIVATE */ | |
848 | ||
91447636 | 849 | struct vnop_reclaim_args { |
1c79356b | 850 | struct vnodeop_desc *a_desc; |
91447636 A |
851 | vnode_t a_vp; |
852 | vfs_context_t a_context; | |
1c79356b | 853 | }; |
91447636 | 854 | |
b0d623f7 A |
855 | /*! |
856 | @function VNOP_RECLAIM | |
857 | @abstract Release filesystem-internal resources for a vnode. | |
858 | @discussion VNOP_RECLAIM() is called as part of the process of recycling a vnode. During | |
859 | a reclaim routine, a filesystem should remove a vnode from its hash and deallocate any resources | |
860 | allocated to that vnode. VFS guarantees that when VNOP_RECLAIM() is called, there are no more | |
861 | iocount references on a vnode (though there may still be usecount references--these are invalidated | |
862 | by the reclaim) and that no more will be granted. This means in practice that there will be no | |
863 | filesystem calls on the vnode being reclaimed until the reclaim has finished and the vnode has | |
864 | been reused. | |
865 | @param vp The vnode to reclaim. | |
866 | @param ctx Context to authenticate for reclaim. | |
867 | @return 0 for success, or an error code. A nonzero return value results in a panic. | |
91447636 | 868 | */ |
b0d623f7 A |
869 | #ifdef XNU_KERNEL_PRIVATE |
870 | extern errno_t VNOP_RECLAIM(vnode_t, vfs_context_t); | |
871 | #endif /* XNU_KERNEL_PRIVATE */ | |
872 | ||
91447636 | 873 | struct vnop_pathconf_args { |
1c79356b | 874 | struct vnodeop_desc *a_desc; |
91447636 | 875 | vnode_t a_vp; |
1c79356b | 876 | int a_name; |
b0d623f7 | 877 | int32_t *a_retval; |
91447636 | 878 | vfs_context_t a_context; |
1c79356b | 879 | }; |
91447636 | 880 | |
b0d623f7 A |
881 | /*! |
882 | @function VNOP_PATHCONF | |
883 | @abstract Query a filesystem for path properties. | |
884 | @param vp The vnode whose filesystem to query. | |
885 | @param name Which property to request: see unistd.h. For example: _PC_CASE_SENSITIVE (is | |
886 | a filesystem case-sensitive?). Only one property can be requested at a time. | |
887 | @param retval Destination for value of property. | |
888 | @param ctx Context to authenticate for pathconf request. | |
889 | @return 0 for success, or an error code. | |
91447636 | 890 | */ |
b0d623f7 A |
891 | #ifdef XNU_KERNEL_PRIVATE |
892 | extern errno_t VNOP_PATHCONF(vnode_t, int, int32_t *, vfs_context_t); | |
893 | #endif /* XNU_KERNEL_PRIVATE */ | |
894 | ||
91447636 | 895 | struct vnop_advlock_args { |
1c79356b | 896 | struct vnodeop_desc *a_desc; |
91447636 | 897 | vnode_t a_vp; |
1c79356b A |
898 | caddr_t a_id; |
899 | int a_op; | |
900 | struct flock *a_fl; | |
901 | int a_flags; | |
91447636 | 902 | vfs_context_t a_context; |
1c79356b | 903 | }; |
91447636 | 904 | |
b0d623f7 A |
905 | /*! |
906 | @function VNOP_ADVLOCK | |
907 | @abstract Aquire or release and advisory lock on a vnode. | |
908 | @discussion Advisory locking is somewhat complicated. VNOP_ADVLOCK is overloaded for | |
909 | both flock() and POSIX advisory locking usage, though not all filesystems support both (or any). VFS | |
910 | provides an advisory locking mechanism for filesystems which can take advantage of it; vfs_setlocklocal() | |
911 | marks a filesystem as using VFS advisory locking support. | |
912 | @param vp The vnode to lock or unlock. | |
913 | @param id Identifier for lock holder: ignored by most filesystems. | |
914 | @param op Which locking operation: F_SETLK: set locking information about a region. | |
915 | F_GETLK: get locking information about the specified region. F_UNLCK: Unlock a region. | |
916 | @param fl Description of file region to lock. l_whence is as with "lseek." | |
917 | Includes a type: F_RDLCK (shared lock), F_UNLCK (unlock) , and F_WRLCK (exclusive lock). | |
918 | @param flags F_FLOCK: use flock() semantics. F_POSIX: use POSIX semantics. F_WAIT: sleep if necessary. | |
919 | F_PROV: Non-coelesced provisional lock (unused in xnu). | |
920 | @param ctx Context to authenticate for advisory locking request. | |
921 | @return 0 for success, or an error code. | |
91447636 | 922 | */ |
b0d623f7 A |
923 | #ifdef XNU_KERNEL_PRIVATE |
924 | extern errno_t VNOP_ADVLOCK(vnode_t, caddr_t, int, struct flock *, int, vfs_context_t); | |
925 | #endif /* XNU_KERNEL_PRIVATE */ | |
926 | ||
91447636 | 927 | struct vnop_allocate_args { |
1c79356b | 928 | struct vnodeop_desc *a_desc; |
91447636 | 929 | vnode_t a_vp; |
1c79356b A |
930 | off_t a_length; |
931 | u_int32_t a_flags; | |
932 | off_t *a_bytesallocated; | |
0b4e3aa0 | 933 | off_t a_offset; |
91447636 | 934 | vfs_context_t a_context; |
1c79356b | 935 | }; |
91447636 | 936 | |
b0d623f7 A |
937 | /*! |
938 | @function VNOP_ALLOCATE | |
939 | @abstract Pre-allocate space for a file. | |
940 | @discussion VNOP_ALLOCATE() changes the amount of backing store set aside to | |
941 | a file. It can be used to either shrink or grow a file. If the file shrinks, | |
942 | its ubc size will be modified accordingly, but if it grows, then the ubc size is unchanged; | |
943 | space is set aside without being actively used by the file. VNOP_ALLOCATE() is currently only | |
944 | called as part of the F_PREALLOCATE fcntl, and is supported only by AFP and HFS. | |
945 | @param vp The vnode for which to preallocate space. | |
946 | @param length Desired preallocated file length. | |
947 | @param flags | |
948 | PREALLOCATE: preallocate allocation blocks. | |
949 | ALLOCATECONTIG: allocate contigious space. | |
950 | ALLOCATEALL: allocate all requested space or no space at all. | |
951 | FREEREMAINDER: deallocate allocated but unfilled blocks. | |
952 | ALLOCATEFROMPEOF: allocate from the physical eof. | |
953 | ALLOCATEFROMVOL: allocate from the volume offset. | |
954 | @param bytesallocated Additional bytes set aside for file. Set to 0 if none are allocated | |
955 | OR if the file is contracted. | |
956 | @param offset Hint for where to find free blocks. | |
957 | @param ctx Context to authenticate for allocation request. | |
958 | @return 0 for success, or an error code. | |
91447636 | 959 | */ |
b0d623f7 A |
960 | #ifdef XNU_KERNEL_PRIVATE |
961 | extern errno_t VNOP_ALLOCATE(vnode_t, off_t, u_int32_t, off_t *, off_t, vfs_context_t); | |
962 | #endif /* XNU_KERNEL_PRIVATE */ | |
963 | ||
91447636 | 964 | struct vnop_pagein_args { |
1c79356b | 965 | struct vnodeop_desc *a_desc; |
91447636 | 966 | vnode_t a_vp; |
1c79356b | 967 | upl_t a_pl; |
b0d623f7 | 968 | upl_offset_t a_pl_offset; |
1c79356b A |
969 | off_t a_f_offset; |
970 | size_t a_size; | |
1c79356b | 971 | int a_flags; |
91447636 | 972 | vfs_context_t a_context; |
1c79356b | 973 | }; |
91447636 | 974 | |
b0d623f7 A |
975 | /*! |
976 | @function VNOP_PAGEIN | |
977 | @abstract Pull file data into memory. | |
978 | @discussion VNOP_PAGEIN() is called by when a process faults on data mapped from a file or | |
979 | when madvise() demands pre-fetching. It is conceptually somewhat similar to VNOP_READ(). Filesystems | |
980 | are typically expected to call cluster_pagein() to handle the labor of mapping and committing the UPL. | |
981 | @param vp The vnode for which to page in data. | |
982 | @param pl UPL describing pages needing to be paged in. | |
983 | @param pl_offset Offset in UPL at which to start placing data. | |
984 | @param f_offset Offset in file of data needing to be paged in. | |
985 | @param size Amount of data to page in (in bytes). | |
986 | @param flags UPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC. | |
987 | Filesystems should generally leave it to the cluster layer to handle these flags. See the | |
988 | memory_object_types.h header in the kernel framework if interested. | |
989 | @param ctx Context to authenticate for pagein request. | |
990 | @return 0 for success, or an error code. | |
91447636 | 991 | */ |
b0d623f7 A |
992 | #ifdef XNU_KERNEL_PRIVATE |
993 | extern errno_t VNOP_PAGEIN(vnode_t, upl_t, upl_offset_t, off_t, size_t, int, vfs_context_t); | |
994 | #endif /* XNU_KERNEL_PRIVATE */ | |
995 | ||
91447636 | 996 | struct vnop_pageout_args { |
1c79356b | 997 | struct vnodeop_desc *a_desc; |
91447636 | 998 | vnode_t a_vp; |
1c79356b | 999 | upl_t a_pl; |
b0d623f7 | 1000 | upl_offset_t a_pl_offset; |
1c79356b A |
1001 | off_t a_f_offset; |
1002 | size_t a_size; | |
1c79356b | 1003 | int a_flags; |
91447636 | 1004 | vfs_context_t a_context; |
1c79356b | 1005 | }; |
91447636 | 1006 | |
b0d623f7 A |
1007 | /*! |
1008 | @function VNOP_PAGEOUT | |
1009 | @abstract Write data from a mapped file back to disk. | |
1010 | @discussion VNOP_PAGEOUT() is called when data from a mapped file needs to be flushed to disk, either | |
1011 | because of an msync() call or due to memory pressure. Filesystems are for the most part expected to | |
1012 | just call cluster_pageout(). | |
1013 | @param vp The vnode for which to page out data. | |
1014 | @param pl UPL describing pages needing to be paged out. | |
1015 | @param pl_offset Offset in UPL from which to start paging out data. | |
1016 | @param f_offset Offset in file of data needing to be paged out. | |
1017 | @param size Amount of data to page out (in bytes). | |
1018 | @param flags UPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC. | |
1019 | Filesystems should generally leave it to the cluster layer to handle these flags. See the | |
1020 | memory_object_types.h header in the kernel framework if interested. | |
1021 | @param ctx Context to authenticate for pageout request. | |
1022 | @return 0 for success, or an error code. | |
91447636 | 1023 | */ |
b0d623f7 A |
1024 | #ifdef XNU_KERNEL_PRIVATE |
1025 | extern errno_t VNOP_PAGEOUT(vnode_t, upl_t, upl_offset_t, off_t, size_t, int, vfs_context_t); | |
1026 | #endif /* XNU_KERNEL_PRIVATE */ | |
1027 | ||
91447636 | 1028 | struct vnop_searchfs_args { |
1c79356b | 1029 | struct vnodeop_desc *a_desc; |
91447636 | 1030 | vnode_t a_vp; |
1c79356b A |
1031 | void *a_searchparams1; |
1032 | void *a_searchparams2; | |
1033 | struct attrlist *a_searchattrs; | |
b0d623f7 | 1034 | uint32_t a_maxmatches; |
1c79356b A |
1035 | struct timeval *a_timelimit; |
1036 | struct attrlist *a_returnattrs; | |
b0d623f7 A |
1037 | uint32_t *a_nummatches; |
1038 | uint32_t a_scriptcode; | |
1039 | uint32_t a_options; | |
1c79356b A |
1040 | struct uio *a_uio; |
1041 | struct searchstate *a_searchstate; | |
91447636 | 1042 | vfs_context_t a_context; |
1c79356b | 1043 | }; |
91447636 | 1044 | |
b0d623f7 A |
1045 | #ifdef XNU_KERNEL_PRIVATE |
1046 | extern errno_t VNOP_SEARCHFS(vnode_t, void *, void *, struct attrlist *, uint32_t, struct timeval *, struct attrlist *, uint32_t *, uint32_t, uint32_t, struct uio *, struct searchstate *, vfs_context_t); | |
1047 | #endif /* XNU_KERNEL_PRIVATE */ | |
91447636 | 1048 | |
91447636 | 1049 | struct vnop_copyfile_args { |
1c79356b | 1050 | struct vnodeop_desc *a_desc; |
91447636 A |
1051 | vnode_t a_fvp; |
1052 | vnode_t a_tdvp; | |
1053 | vnode_t a_tvp; | |
1c79356b A |
1054 | struct componentname *a_tcnp; |
1055 | int a_mode; | |
1056 | int a_flags; | |
91447636 | 1057 | vfs_context_t a_context; |
1c79356b | 1058 | }; |
91447636 | 1059 | |
b0d623f7 A |
1060 | #ifdef XNU_KERNEL_PRIVATE |
1061 | extern errno_t VNOP_COPYFILE(vnode_t, vnode_t, vnode_t, struct componentname *, int, int, vfs_context_t); | |
1062 | #endif /* XNU_KERNEL_PRIVATE */ | |
91447636 A |
1063 | |
1064 | struct vnop_getxattr_args { | |
1c79356b | 1065 | struct vnodeop_desc *a_desc; |
91447636 | 1066 | vnode_t a_vp; |
2d21ac55 | 1067 | const char * a_name; |
91447636 A |
1068 | uio_t a_uio; |
1069 | size_t *a_size; | |
1070 | int a_options; | |
1071 | vfs_context_t a_context; | |
1072 | }; | |
1073 | extern struct vnodeop_desc vnop_getxattr_desc; | |
b0d623f7 A |
1074 | |
1075 | /*! | |
1076 | @function VNOP_GETXATTR | |
1077 | @abstract Get extended file attributes. | |
1078 | @param vp The vnode to get extended attributes for. | |
1079 | @param name Which property to extract. | |
1080 | @param uio Destination information for attribute value. | |
1081 | @param size Should be set to the amount of data written. | |
1082 | @param options XATTR_NOSECURITY: bypass security-checking. | |
1083 | @param ctx Context to authenticate for getxattr request. | |
1084 | @return 0 for success, or an error code. | |
1085 | */ | |
91447636 A |
1086 | extern errno_t VNOP_GETXATTR(vnode_t, const char *, uio_t, size_t *, int, vfs_context_t); |
1087 | ||
1088 | struct vnop_setxattr_args { | |
1089 | struct vnodeop_desc *a_desc; | |
1090 | vnode_t a_vp; | |
2d21ac55 | 1091 | const char * a_name; |
91447636 A |
1092 | uio_t a_uio; |
1093 | int a_options; | |
1094 | vfs_context_t a_context; | |
1095 | }; | |
1096 | extern struct vnodeop_desc vnop_setxattr_desc; | |
b0d623f7 A |
1097 | |
1098 | /*! | |
1099 | @function VNOP_SETXATTR | |
1100 | @abstract Set extended file attributes. | |
1101 | @param vp The vnode to set extended attributes for. | |
1102 | @param name Which property to extract. | |
1103 | @param uio Source information for attribute value. | |
1104 | @param options XATTR_NOSECURITY: bypass security-checking. XATTR_CREATE: set value, fail if exists. | |
1105 | XATTR_REPLACE: set value, fail if does not exist. | |
1106 | @param ctx Context to authenticate for setxattr request. | |
1107 | @return 0 for success, or an error code. | |
1108 | */ | |
91447636 A |
1109 | extern errno_t VNOP_SETXATTR(vnode_t, const char *, uio_t, int, vfs_context_t); |
1110 | ||
1111 | struct vnop_removexattr_args { | |
1112 | struct vnodeop_desc *a_desc; | |
1113 | vnode_t a_vp; | |
2d21ac55 | 1114 | const char * a_name; |
91447636 A |
1115 | int a_options; |
1116 | vfs_context_t a_context; | |
1117 | }; | |
1118 | extern struct vnodeop_desc vnop_removexattr_desc; | |
b0d623f7 A |
1119 | |
1120 | /*! | |
1121 | @function VNOP_REMOVEXATTR | |
1122 | @abstract Remove extended file attributes. | |
1123 | @param vp The vnode from which to remove extended attributes. | |
1124 | @param name Which attribute to delete. | |
1125 | @param options XATTR_NOSECURITY: bypass security-checking. | |
1126 | @param ctx Context to authenticate for attribute delete request. | |
1127 | @return 0 for success, or an error code. | |
1128 | */ | |
1129 | #ifdef XNU_KERNEL_PRIVATE | |
91447636 | 1130 | extern errno_t VNOP_REMOVEXATTR(vnode_t, const char *, int, vfs_context_t); |
b0d623f7 | 1131 | #endif /* XNU_KERNEL_PRIVATE */ |
91447636 A |
1132 | |
1133 | struct vnop_listxattr_args { | |
1134 | struct vnodeop_desc *a_desc; | |
1135 | vnode_t a_vp; | |
1136 | uio_t a_uio; | |
1137 | size_t *a_size; | |
1138 | int a_options; | |
1139 | vfs_context_t a_context; | |
1140 | }; | |
1141 | extern struct vnodeop_desc vnop_listxattr_desc; | |
91447636 | 1142 | |
b0d623f7 A |
1143 | /*! |
1144 | @function VNOP_LISTXATTR | |
1145 | @abstract List extended attribute keys. | |
1146 | @discussion Should write a sequence of unseparated, null-terminated extended-attribute | |
1147 | names into the space described by the provided uio. These keys can then be passed to | |
1148 | getxattr() (and VNOP_GETXATTR()). | |
1149 | @param vp The vnode for which to get extended attribute keys. | |
1150 | @param uio Description of target memory for attribute keys. | |
1151 | @param size Should be set to amount of data written to buffer. | |
1152 | @param options XATTR_NOSECURITY: bypass security checking. | |
1153 | @param ctx Context to authenticate for attribute name request. | |
91447636 | 1154 | */ |
b0d623f7 A |
1155 | #ifdef XNU_KERNEL_PRIVATE |
1156 | extern errno_t VNOP_LISTXATTR(vnode_t, uio_t, size_t *, int, vfs_context_t); | |
1157 | #endif /* XNU_KERNEL_PRIVATE */ | |
1158 | ||
91447636 A |
1159 | struct vnop_blktooff_args { |
1160 | struct vnodeop_desc *a_desc; | |
1161 | vnode_t a_vp; | |
1162 | daddr64_t a_lblkno; | |
1c79356b A |
1163 | off_t *a_offset; |
1164 | }; | |
91447636 | 1165 | |
b0d623f7 A |
1166 | /*! |
1167 | @function VNOP_BLKTOOFF | |
1168 | @abstract Call down to a filesystem to convert a logical block number to a file offset. | |
1169 | @discussion VNOP_BLKTOOFF() converts a logical block to a file offset in bytes. That offset | |
1170 | can be passed to VNOP_BLOCKMAP(), then, to get a physical block number--buf_strategy() does this. | |
1171 | @param vp The vnode for which to convert a logical block to an offset. | |
1172 | @param lblkno Logical block number to turn into offset. | |
1173 | @param offset Destination for file offset. | |
1174 | @return 0 for success, else an error code. | |
91447636 | 1175 | */ |
b0d623f7 A |
1176 | #ifdef XNU_KERNEL_PRIVATE |
1177 | extern errno_t VNOP_BLKTOOFF(vnode_t, daddr64_t, off_t *); | |
1178 | #endif /* XNU_KERNEL_PRIVATE */ | |
1179 | ||
91447636 | 1180 | struct vnop_offtoblk_args { |
1c79356b | 1181 | struct vnodeop_desc *a_desc; |
91447636 | 1182 | vnode_t a_vp; |
1c79356b | 1183 | off_t a_offset; |
91447636 | 1184 | daddr64_t *a_lblkno; |
1c79356b | 1185 | }; |
91447636 | 1186 | |
b0d623f7 A |
1187 | /*! |
1188 | @function VNOP_OFFTOBLK | |
1189 | @abstract Call down to a filesystem to convert a file offset to a logical block number. | |
1190 | @param vp The vnode for which to convert an offset to a logical block number. | |
1191 | @param offset File offset to convert. | |
1192 | @param lblkno Destination for corresponding logical block number. | |
1193 | @return 0 for success, else an error code. | |
91447636 | 1194 | */ |
b0d623f7 A |
1195 | #ifdef XNU_KERNEL_PRIVATE |
1196 | extern errno_t VNOP_OFFTOBLK(vnode_t, off_t, daddr64_t *); | |
1197 | #endif /* XNU_KERNEL_PRIVATE */ | |
1198 | ||
91447636 | 1199 | struct vnop_blockmap_args { |
1c79356b | 1200 | struct vnodeop_desc *a_desc; |
91447636 | 1201 | vnode_t a_vp; |
1c79356b A |
1202 | off_t a_foffset; |
1203 | size_t a_size; | |
91447636 | 1204 | daddr64_t *a_bpn; |
1c79356b A |
1205 | size_t *a_run; |
1206 | void *a_poff; | |
91447636 A |
1207 | int a_flags; |
1208 | vfs_context_t a_context; | |
1c79356b | 1209 | }; |
b0d623f7 A |
1210 | |
1211 | /*! | |
1212 | @function VNOP_BLOCKMAP | |
1213 | @abstract Call down to a filesystem to get information about the on-disk layout of a file region. | |
1214 | @discussion VNOP_BLOCKMAP() returns the information required to pass a request for a contiguous region | |
1215 | down to a device's strategy routine. | |
1216 | @param vp The vnode for which to get on-disk information. | |
1217 | @param foffset Offset (in bytes) at which region starts. | |
1218 | @param size Size of region. | |
1219 | @param bpn Destination for physical block number at which region begins on disk. | |
1220 | @param run Destination for number of bytes which can be found contiguously on-disk before | |
1221 | first discontinuity. | |
1222 | @param poff Currently unused. | |
1223 | @param flags VNODE_READ: request is for a read. VNODE_WRITE: request is for a write. | |
1224 | @param ctx Context to authenticate for blockmap request; currently often set to NULL. | |
1225 | @return 0 for success, else an error code. | |
1226 | */ | |
1227 | #ifdef XNU_KERNEL_PRIVATE | |
91447636 A |
1228 | extern errno_t VNOP_BLOCKMAP(vnode_t, off_t, size_t, daddr64_t *, size_t *, void *, |
1229 | int, vfs_context_t); | |
b0d623f7 | 1230 | #endif /* XNU_KERNEL_PRIVATE */ |
1c79356b | 1231 | |
91447636 | 1232 | struct vnop_strategy_args { |
1c79356b A |
1233 | struct vnodeop_desc *a_desc; |
1234 | struct buf *a_bp; | |
1235 | }; | |
b0d623f7 A |
1236 | |
1237 | /*! | |
1238 | @function VNOP_STRATEGY | |
1239 | @abstract Initiate I/O on a file (both read and write). | |
1240 | @discussion A filesystem strategy routine takes a buffer, performs whatever manipulations are necessary for passing | |
1241 | the I/O request down to the device layer, and calls the appropriate device's strategy routine. Most filesystems should | |
1242 | just call buf_strategy() with "bp" as the argument. | |
1243 | @param bp Complete specificiation of requested I/O: region of data involved, whether request is for read or write, and so on. | |
1244 | @return 0 for success, else an error code. | |
1245 | */ | |
91447636 A |
1246 | extern errno_t VNOP_STRATEGY(struct buf *bp); |
1247 | ||
1248 | struct vnop_bwrite_args { | |
1c79356b | 1249 | struct vnodeop_desc *a_desc; |
91447636 | 1250 | buf_t a_bp; |
1c79356b | 1251 | }; |
91447636 | 1252 | |
b0d623f7 A |
1253 | /*! |
1254 | @function VNOP_BWRITE | |
1255 | @abstract Write a buffer to backing store. | |
1256 | @discussion VNOP_BWRITE() is called by buf_bawrite() (asynchronous write) and potentially by buf_bdwrite() (delayed write) | |
1257 | but not by buf_bwrite(). A filesystem may choose to perform some kind of manipulation of the buffer in this routine; it | |
1258 | generally will end up calling VFS's default implementation, vn_bwrite() (which calls buf_bwrite() without further ado). | |
1259 | @param bp The buffer to write. | |
1260 | @return 0 for success, else an error code. | |
1261 | */ | |
1262 | extern errno_t VNOP_BWRITE(buf_t); | |
91447636 A |
1263 | |
1264 | struct vnop_kqfilt_add_args { | |
1265 | struct vnodeop_desc *a_desc; | |
1266 | struct vnode *a_vp; | |
1267 | struct knote *a_kn; | |
1268 | vfs_context_t a_context; | |
1269 | }; | |
1270 | extern struct vnodeop_desc vnop_kqfilt_add_desc; | |
b0d623f7 A |
1271 | |
1272 | #ifdef XNU_KERNEL_PRIVATE | |
91447636 | 1273 | extern errno_t VNOP_KQFILT_ADD(vnode_t , struct knote *, vfs_context_t); |
b0d623f7 | 1274 | #endif /* XNU_KERNEL_PRIVATE */ |
91447636 A |
1275 | |
1276 | struct vnop_kqfilt_remove_args { | |
1277 | struct vnodeop_desc *a_desc; | |
1278 | struct vnode *a_vp; | |
1279 | uintptr_t a_ident; | |
1280 | vfs_context_t a_context; | |
1281 | }; | |
1282 | extern struct vnodeop_desc vnop_kqfilt_remove_desc; | |
b0d623f7 A |
1283 | |
1284 | #ifdef XNU_KERNEL_PRIVATE | |
91447636 | 1285 | errno_t VNOP_KQFILT_REMOVE(vnode_t , uintptr_t , vfs_context_t); |
b0d623f7 A |
1286 | #endif /* XNU_KERNEL_PRIVATE */ |
1287 | ||
1288 | ||
1289 | #ifdef KERNEL_PRIVATE | |
1290 | #define VNODE_MONITOR_BEGIN 0x01 | |
1291 | #define VNODE_MONITOR_END 0x02 | |
1292 | #define VNODE_MONITOR_UPDATE 0x04 | |
1293 | struct vnop_monitor_args { | |
1294 | struct vnodeop_desc *a_desc; | |
1295 | vnode_t a_vp; | |
1296 | uint32_t a_events; | |
1297 | uint32_t a_flags; | |
1298 | void *a_handle; | |
1299 | vfs_context_t a_context; | |
1300 | }; | |
1301 | extern struct vnodeop_desc vnop_monitor_desc; | |
1302 | #endif /* KERNEL_PRIVATE */ | |
1303 | ||
1304 | #ifdef XNU_KERNEL_PRIVATE | |
1305 | /*! | |
1306 | @function VNOP_MONITOR | |
1307 | @abstract Indicate to a filesystem that the number of watchers of a file has changed. | |
1308 | @param vp The vnode whose watch state has changed. | |
1309 | @param events Unused. Filesystems can ignore this parameter. | |
1310 | @param flags Type of change to the watch state. VNODE_MONITOR_BEGIN is passed when the kernel | |
1311 | begins tracking a new watcher of a file. VNODE_MONITOR_END is passed when a watcher stops watching a file. | |
1312 | VNODE_MONITOR_UPDATE is currently unused. A filesystem is guaranteed that each VNODE_MONITOR_BEGIN | |
1313 | will be matched by a VNODE_MONITOR_END with the same "handle" argument. | |
1314 | @param handle Unique identifier for a given watcher. A VNODE_MONITOR_BEGIN for a given handle will be matched with a | |
1315 | VNODE_MONITOR_END for the same handle; a filesystem need not consider this parameter unless | |
1316 | it for some reason wants be able to match specific VNOP_MONITOR calls rather than just keeping | |
1317 | a count. | |
1318 | @param ctx The context which is starting to monitor a file or ending a watch on a file. A matching | |
1319 | pair of VNODE_MONITOR_BEGIN and VNODE_MONITOR_END need not have the same context. | |
1320 | @discussion VNOP_MONITOR() is intended to let networked filesystems know when they should bother | |
1321 | listening for changes to files which occur remotely, so that they can post notifications using | |
1322 | vnode_notify(). Local filesystems should not implement a monitor vnop. | |
1323 | It is called when there is a new watcher for a file or when a watcher for a file goes away. | |
1324 | Each BEGIN will be matched with an END with the same handle. Note that vnode_ismonitored() can | |
1325 | be used to see if there are currently watchers for a file. | |
1326 | */ | |
1327 | errno_t VNOP_MONITOR(vnode_t , uint32_t, uint32_t, void*, vfs_context_t); | |
1328 | #endif /* XNU_KERNEL_PRIVATE */ | |
91447636 | 1329 | |
2d21ac55 A |
1330 | struct label; |
1331 | struct vnop_setlabel_args { | |
1332 | struct vnodeop_desc *a_desc; | |
1333 | struct vnode *a_vp; | |
1334 | struct label *a_vl; | |
1335 | vfs_context_t a_context; | |
1336 | }; | |
1337 | extern struct vnodeop_desc vnop_setlabel_desc; | |
b0d623f7 A |
1338 | |
1339 | /*! | |
1340 | @function VNOP_SETLABEL | |
1341 | @abstract Associate a MACF label with a file. | |
1342 | @param vp The vnode to label. | |
1343 | @param label The desired label. | |
1344 | @param ctx Context to authenticate for label change. | |
1345 | @return 0 for success, else an error code. | |
1346 | */ | |
1347 | #ifdef XNU_KERNEL_PRIVATE | |
2d21ac55 | 1348 | errno_t VNOP_SETLABEL(vnode_t, struct label *, vfs_context_t); |
b0d623f7 | 1349 | #endif /* XNU_KERNEL_PRIVATE */ |
2d21ac55 A |
1350 | |
1351 | #ifdef __APPLE_API_UNSTABLE | |
1352 | ||
1353 | #if NAMEDSTREAMS | |
1354 | ||
1355 | enum nsoperation { NS_OPEN, NS_CREATE, NS_DELETE }; | |
1356 | ||
1357 | struct vnop_getnamedstream_args { | |
1358 | struct vnodeop_desc *a_desc; | |
1359 | vnode_t a_vp; | |
1360 | vnode_t *a_svpp; | |
1361 | const char *a_name; | |
1362 | enum nsoperation a_operation; | |
1363 | int a_flags; | |
1364 | vfs_context_t a_context; | |
1365 | }; | |
b0d623f7 A |
1366 | |
1367 | /*! | |
1368 | @function VNOP_GETNAMEDSTREAM | |
1369 | @abstract Get a named stream associated with a file. | |
1370 | @discussion If this call sucecss, svpp should be returned with an iocount which the caller | |
1371 | will drop. VFS provides a facility for simulating named streams when interacting with filesystems | |
1372 | which do not support them. | |
1373 | @param vp The vnode for which to get a named stream. | |
1374 | @param svpp Destination for pointer to named stream's vnode. | |
1375 | @param name The name of the named stream, e.g. "com.apple.ResourceFork". | |
1376 | @param operation Operation to perform. In HFS and AFP, this parameter is only considered as follows: | |
1377 | if the resource fork has not been opened and the operation is not NS_OPEN, fail with ENOATTR. Currently | |
1378 | only passed as NS_OPEN by VFS. | |
1379 | @param flags Currently unused. | |
1380 | @param ctx Context to authenticate for getting named stream. | |
1381 | @return 0 for success, else an error code. | |
1382 | */ | |
1383 | #ifdef XNU_KERNEL_PRIVATE | |
2d21ac55 | 1384 | extern errno_t VNOP_GETNAMEDSTREAM(vnode_t, vnode_t *, const char *, enum nsoperation, int flags, vfs_context_t); |
b0d623f7 | 1385 | #endif /* XNU_KERNEL_PRIVATE */ |
2d21ac55 A |
1386 | |
1387 | struct vnop_makenamedstream_args { | |
1388 | struct vnodeop_desc *a_desc; | |
1389 | vnode_t *a_svpp; | |
1390 | vnode_t a_vp; | |
1391 | const char *a_name; | |
1392 | int a_flags; | |
1393 | vfs_context_t a_context; | |
1394 | }; | |
b0d623f7 A |
1395 | |
1396 | /*! | |
1397 | @function VNOP_MAKENAMEDSTREAM | |
1398 | @abstract Create a named stream associated with a file. | |
1399 | @discussion If this call succeeds, svpp should be returned with an iocount which the caller will drop. | |
1400 | VFS provides a facility for simulating named streams when interacting with filesystems | |
1401 | which do not support them. | |
1402 | @param vp The vnode for which to get a named stream. | |
1403 | @param svpp Destination for pointer to named stream's vnode. | |
1404 | @param name The name of the named stream, e.g. "com.apple.ResourceFork". | |
1405 | @param flags Currently unused. | |
1406 | @param ctx Context to authenticate creating named stream. | |
1407 | @return 0 for success, else an error code. | |
1408 | */ | |
1409 | #ifdef XNU_KERNEL_PRIVATE | |
2d21ac55 | 1410 | extern errno_t VNOP_MAKENAMEDSTREAM(vnode_t, vnode_t *, const char *, int flags, vfs_context_t); |
b0d623f7 | 1411 | #endif /* XNU_KERNEL_PRIVATE */ |
2d21ac55 A |
1412 | |
1413 | struct vnop_removenamedstream_args { | |
1414 | struct vnodeop_desc *a_desc; | |
1415 | vnode_t a_vp; | |
1416 | vnode_t a_svp; | |
1417 | const char *a_name; | |
1418 | int a_flags; | |
1419 | vfs_context_t a_context; | |
1420 | }; | |
b0d623f7 A |
1421 | |
1422 | /*! | |
1423 | @function VNOP_REMOVENAMEDSTREAM | |
1424 | @abstract Delete a named stream associated with a file. | |
1425 | @discussion VFS provides a facility for simulating named streams when interacting with filesystems | |
1426 | which do not support them. | |
1427 | @param vp The vnode to which the named stream belongs. | |
1428 | @param svp The named stream's vnode. | |
1429 | @param name The name of the named stream, e.g. "com.apple.ResourceFork". | |
1430 | @param flags Currently unused. | |
1431 | @param ctx Context to authenticate deleting named stream. | |
1432 | @return 0 for success, else an error code. | |
1433 | */ | |
1434 | #ifdef XNU_KERNEL_PRIVATE | |
2d21ac55 | 1435 | extern errno_t VNOP_REMOVENAMEDSTREAM(vnode_t, vnode_t, const char *, int flags, vfs_context_t); |
b0d623f7 | 1436 | #endif /* XNU_KERNEL_PRIVATE */ |
2d21ac55 A |
1437 | #endif |
1438 | ||
1439 | #endif | |
1440 | ||
91447636 A |
1441 | __END_DECLS |
1442 | ||
1443 | #endif /* KERNEL */ | |
1444 | ||
9bccf70c | 1445 | #endif /* !_SYS_VNODE_IF_H_ */ |