]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
fe8ab488 | 2 | * Copyright (c) 2000-2014 Apple Computer, Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
29 | /*- | |
30 | * Copyright (c) 1982, 1986, 1990, 1993, 1994 | |
31 | * The Regents of the University of California. All rights reserved. | |
32 | * (c) UNIX System Laboratories, Inc. | |
33 | * All or some portions of this file are derived from material licensed | |
34 | * to the University of California by American Telephone and Telegraph | |
35 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
36 | * the permission of UNIX System Laboratories, Inc. | |
37 | * | |
38 | * Redistribution and use in source and binary forms, with or without | |
39 | * modification, are permitted provided that the following conditions | |
40 | * are met: | |
41 | * 1. Redistributions of source code must retain the above copyright | |
42 | * notice, this list of conditions and the following disclaimer. | |
43 | * 2. Redistributions in binary form must reproduce the above copyright | |
44 | * notice, this list of conditions and the following disclaimer in the | |
45 | * documentation and/or other materials provided with the distribution. | |
46 | * 3. All advertising materials mentioning features or use of this software | |
47 | * must display the following acknowledgement: | |
48 | * This product includes software developed by the University of | |
49 | * California, Berkeley and its contributors. | |
50 | * 4. Neither the name of the University nor the names of its contributors | |
51 | * may be used to endorse or promote products derived from this software | |
52 | * without specific prior written permission. | |
53 | * | |
54 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
55 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
56 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
64 | * SUCH DAMAGE. | |
65 | * | |
66 | * @(#)fsctl.h 8.6 (Berkeley) 3/28/94 | |
67 | */ | |
68 | ||
69 | #ifndef _SYS_FSCTL_H_ | |
70 | #define _SYS_FSCTL_H_ | |
71 | ||
72 | #include <sys/ioccom.h> | |
6d2010ae | 73 | #include <sys/mount.h> |
1c79356b | 74 | |
6d2010ae | 75 | #ifdef XNU_KERNEL_PRIVATE |
b0d623f7 | 76 | |
39236c6e | 77 | /* Userland structs for namespace handler */ |
6d2010ae A |
78 | typedef struct user64_namespace_handler_info { |
79 | user64_addr_t token; | |
80 | user64_addr_t flags; | |
81 | user64_addr_t fdptr; | |
82 | } user64_namespace_handler_info; | |
83 | ||
84 | typedef struct user32_namespace_handler_info { | |
85 | user32_addr_t token; | |
86 | user32_addr_t flags; | |
87 | user32_addr_t fdptr; | |
88 | } user32_namespace_handler_info; | |
89 | ||
39236c6e A |
90 | |
91 | /* Kernel-internal of namespace handler info */ | |
6d2010ae A |
92 | typedef struct namespace_handler_info { |
93 | user_addr_t token; | |
94 | user_addr_t flags; | |
95 | user_addr_t fdptr; | |
96 | } namespace_handler_info; | |
97 | ||
39236c6e A |
98 | |
99 | /* Userland structs for extended namespace handler */ | |
6d2010ae A |
100 | typedef struct user64_namespace_handler_info_ext { |
101 | user64_addr_t token; | |
102 | user64_addr_t flags; | |
103 | user64_addr_t fdptr; | |
104 | user64_addr_t infoptr; | |
105 | } user64_namespace_handler_info_ext; | |
106 | ||
107 | typedef struct user32_namespace_handler_info_ext { | |
108 | user32_addr_t token; | |
109 | user32_addr_t flags; | |
110 | user32_addr_t fdptr; | |
111 | user32_addr_t infoptr; | |
112 | } user32_namespace_handler_info_ext; | |
113 | ||
39236c6e A |
114 | |
115 | /* Kernel-internal of extended namespace handler */ | |
6d2010ae A |
116 | typedef struct namespace_handler_info_ext { |
117 | user_addr_t token; | |
118 | user_addr_t flags; | |
119 | user_addr_t fdptr; | |
120 | user_addr_t infoptr; | |
121 | } namespace_handler_info_ext; | |
122 | ||
39236c6e A |
123 | /* Size-Augmented namespace_handler_info */ |
124 | /* 64 bit userland*/ | |
125 | typedef struct user64_namespace_handler_data { | |
126 | user64_addr_t token; | |
127 | user64_addr_t flags; | |
128 | user64_addr_t fdptr; | |
129 | user64_addr_t infoptr; | |
130 | user64_addr_t objid; | |
131 | user64_addr_t reserved1; | |
132 | user64_addr_t reserved2; | |
133 | user64_addr_t reserved3; | |
134 | } user64_namespace_handler_data; | |
135 | ||
136 | /*32 bit userland*/ | |
137 | typedef struct user32_namespace_handler_data { | |
138 | user32_addr_t token; | |
139 | user32_addr_t flags; | |
140 | user32_addr_t fdptr; | |
141 | user32_addr_t infoptr; | |
142 | user32_addr_t objid; | |
143 | user32_addr_t reserved1; | |
144 | user32_addr_t reserved2; | |
145 | user32_addr_t reserved3; | |
146 | } user32_namespace_handler_data; | |
147 | ||
148 | /* kernel-internal */ | |
149 | typedef struct namespace_handler_data { | |
150 | user_addr_t token; | |
151 | user_addr_t flags; | |
152 | user_addr_t fdptr; | |
153 | user_addr_t infoptr; | |
154 | user_addr_t objid; | |
155 | user_addr_t reserved1; | |
156 | user_addr_t reserved2; | |
157 | user_addr_t reserved3; | |
158 | } namespace_handler_data; | |
159 | ||
160 | ||
161 | #define NSPACE_REARM_NO_ARG ((void *)1) | |
6d2010ae A |
162 | extern int resolve_nspace_item(struct vnode *vp, uint64_t op); |
163 | extern int resolve_nspace_item_ext(struct vnode *vp, uint64_t op, void *arg); | |
164 | extern int get_nspace_item_status(struct vnode *vp, int32_t *status); | |
165 | ||
166 | #else | |
167 | ||
168 | typedef struct namespace_handler_info { | |
169 | int32_t *token; | |
170 | int64_t *flags; | |
171 | int32_t *fdptr; | |
172 | } namespace_handler_info; | |
173 | ||
174 | typedef struct namespace_handler_info_ext { | |
175 | int32_t *token; | |
176 | int64_t *flags; | |
177 | int32_t *fdptr; | |
178 | int64_t *infoptr; // for snapshot write events, the kernel puts an offset/length pair here | |
179 | } namespace_handler_info_ext; | |
180 | ||
39236c6e A |
181 | typedef struct namespace_handler_data { |
182 | int32_t *token; | |
183 | int64_t *flags; | |
184 | int32_t *fdptr; | |
185 | int64_t *infoptr; // for snapshot write events, the kernel puts an offset/length pair here | |
186 | int64_t *objid; | |
187 | uint32_t *reserved1; | |
188 | uint32_t *reserved2; | |
189 | uint32_t *reserved3; | |
190 | } namespace_handler_data; | |
6d2010ae A |
191 | |
192 | #endif /* XNU_KERNEL_PRIVATE */ | |
193 | ||
194 | #define NAMESPACE_HANDLER_READ_OP 0x0001 | |
195 | #define NAMESPACE_HANDLER_WRITE_OP 0x0002 | |
196 | #define NAMESPACE_HANDLER_DELETE_OP 0x0004 | |
197 | #define NAMESPACE_HANDLER_TRUNCATE_OP 0x0008 | |
198 | #define NAMESPACE_HANDLER_RENAME_OP 0x0010 | |
199 | #define NAMESPACE_HANDLER_METADATA_WRITE_OP 0x0020 | |
200 | #define NAMESPACE_HANDLER_METADATA_DELETE_OP 0x0040 | |
201 | #define NAMESPACE_HANDLER_METADATA_MOD 0x0080 | |
39236c6e | 202 | // #define NAMESPACE_HANDLER_OP_DO_NOT_USE 0x0100 // SNAPSHOT_EVENT uses this value |
6d2010ae | 203 | #define NAMESPACE_HANDLER_LINK_CREATE 0x0200 |
39236c6e A |
204 | #define NAMESPACE_HANDLER_RENAME_SUCCESS_OP 0x0400 |
205 | #define NAMESPACE_HANDLER_RENAME_FAILED_OP 0x0800 | |
6d2010ae A |
206 | |
207 | #define NAMESPACE_HANDLER_NSPACE_EVENT 0x1000 | |
208 | #define NAMESPACE_HANDLER_SNAPSHOT_EVENT 0x0100 | |
209 | #define NAMESPACE_HANDLER_TRACK_EVENT 0x2000 | |
210 | ||
211 | #define NAMESPACE_HANDLER_EVENT_TYPE_MASK (NAMESPACE_HANDLER_NSPACE_EVENT | NAMESPACE_HANDLER_SNAPSHOT_EVENT | NAMESPACE_HANDLER_TRACK_EVENT) | |
212 | ||
213 | #define DATALESS_CMPFS_TYPE 0x80000001 | |
b0d623f7 A |
214 | |
215 | ||
6d2010ae A |
216 | typedef int32_t nspace_handler_info[2]; |
217 | typedef char fstypename_t[MFSTYPENAMELEN]; | |
218 | ||
219 | #ifdef KERNEL | |
220 | ||
221 | typedef struct user64_package_ext_info { | |
222 | user64_addr_t strings; | |
223 | uint32_t num_entries; | |
224 | uint32_t max_width; | |
225 | } user64_package_ext_info; | |
226 | ||
227 | typedef struct user32_package_ext_info { | |
228 | user32_addr_t strings; | |
229 | uint32_t num_entries; | |
230 | uint32_t max_width; | |
231 | } user32_package_ext_info; | |
232 | ||
233 | #endif // KERNEL | |
234 | ||
b0d623f7 A |
235 | typedef struct package_ext_info { |
236 | const char *strings; | |
237 | uint32_t num_entries; | |
238 | uint32_t max_width; | |
239 | } package_ext_info; | |
240 | ||
6d2010ae A |
241 | #define FSCTL_SYNC_FULLSYNC (1<<0) /* Flush the data fully to disk, if supported by the filesystem */ |
242 | #define FSCTL_SYNC_WAIT (1<<1) /* Wait for the sync to complete */ | |
243 | ||
244 | ||
245 | #define FSIOC_SYNC_VOLUME _IOW('A', 1, uint32_t) | |
246 | #define FSCTL_SYNC_VOLUME IOCBASECMD(FSIOC_SYNC_VOLUME) | |
247 | ||
248 | #define FSIOC_SET_PACKAGE_EXTS _IOW('A', 2, struct package_ext_info) | |
249 | #define FSCTL_SET_PACKAGE_EXTS IOCBASECMD(FSIOC_SET_PACKAGE_EXTS) | |
250 | ||
39236c6e A |
251 | /* Unsupported - previously FSIOC_WAIT_FOR_SYNC */ |
252 | #define FSIOC_UNSUPPORTED _IOR('A', 3, int32_t) | |
6d2010ae A |
253 | |
254 | #define FSIOC_NAMESPACE_HANDLER_GET _IOW('A', 4, struct namespace_handler_info) | |
255 | #define FSCTL_NAMESPACE_HANDLER_GET IOCBASECMD(FSIOC_NAMESPACE_HANDLER_GET) | |
256 | ||
257 | #define FSIOC_NAMESPACE_HANDLER_UPDATE _IOW('A', 5, nspace_handler_info) | |
258 | #define FSCTL_NAMESPACE_HANDLER_UPDATE IOCBASECMD(FSIOC_NAMESPACE_HANDLER_UPDATE) | |
259 | ||
260 | #define FSIOC_NAMESPACE_HANDLER_UNBLOCK _IOW('A', 6, nspace_handler_info) | |
261 | #define FSCTL_NAMESPACE_HANDLER_UNBLOCK IOCBASECMD(FSIOC_NAMESPACE_HANDLER_UNBLOCK) | |
b0d623f7 | 262 | |
6d2010ae A |
263 | #define FSIOC_NAMESPACE_HANDLER_CANCEL _IOW('A', 7, nspace_handler_info) |
264 | #define FSCTL_NAMESPACE_HANDLER_CANCEL IOCBASECMD(FSIOC_NAMESPACE_HANDLER_CANCEL) | |
b0d623f7 | 265 | |
6d2010ae A |
266 | #define FSIOC_NAMESPACE_HANDLER_SET_SNAPSHOT_TIME _IOW('A', 8, int32_t) |
267 | #define FSCTL_NAMESPACE_HANDLER_SET_SNAPSHOT_TIME IOCBASECMD(FSIOC_NAMESPACE_HANDLER_SET_SNAPSHOT_TIME) | |
268 | ||
269 | #define FSIOC_OLD_SNAPSHOT_HANDLER_GET _IOW('A', 9, struct namespace_handler_info) | |
270 | #define FSCTL_OLD_SNAPSHOT_HANDLER_GET IOCBASECMD(FSIOC_OLD_SNAPSHOT_HANDLER_GET) | |
271 | ||
272 | #define FSIOC_SET_FSTYPENAME_OVERRIDE _IOW('A', 10, fstypename_t) | |
273 | #define FSCTL_SET_FSTYPENAME_OVERRIDE IOCBASECMD(FSIOC_SET_FSTYPENAME_OVERRIDE) | |
274 | ||
275 | #define FSIOC_NAMESPACE_ALLOW_DMG_SNAPSHOT_EVENTS _IOW('A', 11, int32_t) | |
276 | #define FSCTL_NAMESPACE_ALLOW_DMG_SNAPSHOT_EVENTS IOCBASECMD(FSIOC_NAMESPACE_ALLOW_DMG_SNAPSHOT_EVENTS) | |
277 | ||
fe8ab488 A |
278 | /* 12 was used for TRACKED_HANDLER_GET which has now been removed |
279 | as it is no longer used. */ | |
6d2010ae A |
280 | |
281 | #define FSIOC_SNAPSHOT_HANDLER_GET_EXT _IOW('A', 13, struct namespace_handler_info_ext) | |
282 | #define FSCTL_SNAPSHOT_HANDLER_GET_EXT IOCBASECMD(FSIOC_SNAPSHOT_HANDLER_GET_EXT) | |
283 | ||
fe8ab488 A |
284 | /* 14 was used for NAMESPACE_HANDLER_GETDATA which has now been |
285 | removed as it is no longer used. */ | |
39236c6e | 286 | |
6d2010ae | 287 | // |
39236c6e | 288 | // IO commands 15, 16, and 17 are currently unused |
6d2010ae | 289 | // |
b0d623f7 A |
290 | |
291 | // | |
292 | // Spotlight and fseventsd use these fsctl()'s to find out | |
293 | // the mount time of a volume and the last time it was | |
294 | // unmounted. Both HFS and ZFS support these calls. | |
295 | // | |
296 | // User space code should pass the "_IOC_" macros while the | |
297 | // kernel should test for the "_FSCTL_" variant of the macro | |
298 | // in its vnop_ioctl function. | |
299 | // | |
300 | // NOTE: the values for these defines should _not_ be changed | |
301 | // or else it will break binary compatibility with mds | |
302 | // and fseventsd. | |
303 | // | |
6d2010ae A |
304 | #define SPOTLIGHT_IOC_GET_MOUNT_TIME _IOR('h', 18, u_int32_t) |
305 | #define SPOTLIGHT_FSCTL_GET_MOUNT_TIME IOCBASECMD(SPOTLIGHT_IOC_GET_MOUNT_TIME) | |
306 | #define SPOTLIGHT_IOC_GET_LAST_MTIME _IOR('h', 19, u_int32_t) | |
307 | #define SPOTLIGHT_FSCTL_GET_LAST_MTIME IOCBASECMD(SPOTLIGHT_IOC_GET_LAST_MTIME) | |
b0d623f7 A |
308 | |
309 | ||
1c79356b A |
310 | #ifndef KERNEL |
311 | ||
312 | #include <sys/cdefs.h> | |
313 | ||
314 | __BEGIN_DECLS | |
b0d623f7 A |
315 | |
316 | int fsctl(const char *,unsigned long,void*,unsigned int); | |
317 | int ffsctl(int,unsigned long,void*,unsigned int); | |
318 | ||
1c79356b A |
319 | __END_DECLS |
320 | ||
321 | #endif /* !KERNEL */ | |
322 | #endif /* !_SYS_FSCTL_H_ */ |