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