]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
593a1d5f | 2 | * Copyright (c) 2000-2008 Apple 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) 1989, 1991, 1993 | |
31 | * The Regents of the University of California. All rights reserved. | |
32 | * | |
33 | * Redistribution and use in source and binary forms, with or without | |
34 | * modification, are permitted provided that the following conditions | |
35 | * are met: | |
36 | * 1. Redistributions of source code must retain the above copyright | |
37 | * notice, this list of conditions and the following disclaimer. | |
38 | * 2. Redistributions in binary form must reproduce the above copyright | |
39 | * notice, this list of conditions and the following disclaimer in the | |
40 | * documentation and/or other materials provided with the distribution. | |
41 | * 3. All advertising materials mentioning features or use of this software | |
42 | * must display the following acknowledgement: | |
43 | * This product includes software developed by the University of | |
44 | * California, Berkeley and its contributors. | |
45 | * 4. Neither the name of the University nor the names of its contributors | |
46 | * may be used to endorse or promote products derived from this software | |
47 | * without specific prior written permission. | |
48 | * | |
49 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
50 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
51 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | |
60 | * | |
61 | * @(#)mount.h 8.21 (Berkeley) 5/20/95 | |
62 | */ | |
2d21ac55 A |
63 | /* |
64 | * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce | |
65 | * support for mandatory and extensible security protections. This notice | |
66 | * is included in support of clause 2.2 (b) of the Apple Public License, | |
67 | * Version 2.0. | |
68 | */ | |
69 | ||
1c79356b A |
70 | |
71 | #ifndef _SYS_MOUNT_H_ | |
72 | #define _SYS_MOUNT_H_ | |
73 | ||
9bccf70c | 74 | #include <sys/appleapiopts.h> |
91447636 A |
75 | #include <sys/cdefs.h> |
76 | #include <sys/attr.h> /* needed for vol_capabilities_attr_t */ | |
77 | ||
1c79356b | 78 | #ifndef KERNEL |
91447636 | 79 | #include <stdint.h> |
1c79356b | 80 | #include <sys/ucred.h> |
91447636 | 81 | #include <sys/queue.h> /* XXX needed for user builds */ |
593a1d5f | 82 | #include <Availability.h> |
91447636 A |
83 | #else |
84 | #include <sys/kernel_types.h> | |
1c79356b | 85 | #endif |
1c79356b A |
86 | |
87 | typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */ | |
88 | ||
1c79356b A |
89 | /* |
90 | * file system statistics | |
91 | */ | |
92 | ||
93 | #define MFSNAMELEN 15 /* length of fs type name, not inc. null */ | |
2d21ac55 | 94 | #define MFSTYPENAMELEN 16 /* length of fs type name including null */ |
1c79356b A |
95 | #define MNAMELEN 90 /* length of buffer for returned name */ |
96 | ||
2d21ac55 A |
97 | #define __DARWIN_STRUCT_STATFS64 { \ |
98 | uint32_t f_bsize; /* fundamental file system block size */ \ | |
99 | int32_t f_iosize; /* optimal transfer block size */ \ | |
100 | uint64_t f_blocks; /* total data blocks in file system */ \ | |
101 | uint64_t f_bfree; /* free blocks in fs */ \ | |
102 | uint64_t f_bavail; /* free blocks avail to non-superuser */ \ | |
103 | uint64_t f_files; /* total file nodes in file system */ \ | |
104 | uint64_t f_ffree; /* free file nodes in fs */ \ | |
105 | fsid_t f_fsid; /* file system id */ \ | |
106 | uid_t f_owner; /* user that mounted the filesystem */ \ | |
107 | uint32_t f_type; /* type of filesystem */ \ | |
108 | uint32_t f_flags; /* copy of mount exported flags */ \ | |
109 | uint32_t f_fssubtype; /* fs sub-type (flavor) */ \ | |
110 | char f_fstypename[MFSTYPENAMELEN]; /* fs type name */ \ | |
111 | char f_mntonname[MAXPATHLEN]; /* directory on which mounted */ \ | |
112 | char f_mntfromname[MAXPATHLEN]; /* mounted filesystem */ \ | |
113 | uint32_t f_reserved[8]; /* For future use */ \ | |
114 | } | |
115 | ||
593a1d5f A |
116 | #if !__DARWIN_ONLY_64_BIT_INO_T |
117 | ||
2d21ac55 A |
118 | struct statfs64 __DARWIN_STRUCT_STATFS64; |
119 | ||
593a1d5f A |
120 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ |
121 | ||
2d21ac55 A |
122 | #if __DARWIN_64_BIT_INO_T |
123 | ||
124 | struct statfs __DARWIN_STRUCT_STATFS64; | |
125 | ||
126 | #else /* !__DARWIN_64_BIT_INO_T */ | |
127 | ||
91447636 A |
128 | /* |
129 | * LP64 - WARNING - must be kept in sync with struct user_statfs in mount_internal.h. | |
130 | */ | |
1c79356b A |
131 | struct statfs { |
132 | short f_otype; /* TEMPORARY SHADOW COPY OF f_type */ | |
133 | short f_oflags; /* TEMPORARY SHADOW COPY OF f_flags */ | |
134 | long f_bsize; /* fundamental file system block size */ | |
135 | long f_iosize; /* optimal transfer block size */ | |
136 | long f_blocks; /* total data blocks in file system */ | |
137 | long f_bfree; /* free blocks in fs */ | |
138 | long f_bavail; /* free blocks avail to non-superuser */ | |
139 | long f_files; /* total file nodes in file system */ | |
140 | long f_ffree; /* free file nodes in fs */ | |
141 | fsid_t f_fsid; /* file system id */ | |
142 | uid_t f_owner; /* user that mounted the filesystem */ | |
143 | short f_reserved1; /* spare for later */ | |
144 | short f_type; /* type of filesystem */ | |
2d21ac55 | 145 | long f_flags; /* copy of mount exported flags */ |
1c79356b A |
146 | long f_reserved2[2]; /* reserved for future use */ |
147 | char f_fstypename[MFSNAMELEN]; /* fs type name */ | |
148 | char f_mntonname[MNAMELEN]; /* directory on which mounted */ | |
149 | char f_mntfromname[MNAMELEN];/* mounted filesystem */ | |
150 | #if COMPAT_GETFSSTAT | |
151 | char f_reserved3[0]; /* For alignment */ | |
152 | long f_reserved4[0]; /* For future use */ | |
153 | #else | |
154 | char f_reserved3; /* For alignment */ | |
155 | long f_reserved4[4]; /* For future use */ | |
156 | #endif | |
157 | }; | |
158 | ||
2d21ac55 | 159 | #endif /* __DARWIN_64_BIT_INO_T */ |
91447636 | 160 | |
0c530ab8 | 161 | #pragma pack(4) |
91447636 A |
162 | |
163 | struct vfsstatfs { | |
164 | uint32_t f_bsize; /* fundamental file system block size */ | |
165 | size_t f_iosize; /* optimal transfer block size */ | |
166 | uint64_t f_blocks; /* total data blocks in file system */ | |
167 | uint64_t f_bfree; /* free blocks in fs */ | |
168 | uint64_t f_bavail; /* free blocks avail to non-superuser */ | |
169 | uint64_t f_bused; /* free blocks avail to non-superuser */ | |
170 | uint64_t f_files; /* total file nodes in file system */ | |
171 | uint64_t f_ffree; /* free file nodes in fs */ | |
172 | fsid_t f_fsid; /* file system id */ | |
173 | uid_t f_owner; /* user that mounted the filesystem */ | |
174 | uint64_t f_flags; /* copy of mount exported flags */ | |
175 | char f_fstypename[MFSTYPENAMELEN];/* fs type name inclus */ | |
176 | char f_mntonname[MAXPATHLEN];/* directory on which mounted */ | |
177 | char f_mntfromname[MAXPATHLEN];/* mounted filesystem */ | |
178 | uint32_t f_fssubtype; /* fs sub-type (flavor) */ | |
179 | void *f_reserved[2]; /* For future use == 0 */ | |
180 | }; | |
181 | ||
0c530ab8 | 182 | #pragma pack() |
91447636 | 183 | |
2d21ac55 A |
184 | #ifdef KERNEL |
185 | /* | |
186 | * Kernel level support for the VFS_GETATTR(), VFS_SETATTR() for use in | |
187 | * implementation of filesystem KEXTs, and by the vfs_getattr() and | |
188 | * vfs_setattr() KPIs. | |
189 | */ | |
190 | ||
91447636 A |
191 | #define VFSATTR_INIT(s) ((s)->f_supported = (s)->f_active = 0LL) |
192 | #define VFSATTR_SET_SUPPORTED(s, a) ((s)->f_supported |= VFSATTR_ ## a) | |
193 | #define VFSATTR_IS_SUPPORTED(s, a) ((s)->f_supported & VFSATTR_ ## a) | |
194 | #define VFSATTR_CLEAR_ACTIVE(s, a) ((s)->f_active &= ~VFSATTR_ ## a) | |
195 | #define VFSATTR_IS_ACTIVE(s, a) ((s)->f_active & VFSATTR_ ## a) | |
196 | #define VFSATTR_ALL_SUPPORTED(s) (((s)->f_active & (s)->f_supported) == (s)->f_active) | |
197 | #define VFSATTR_WANTED(s, a) ((s)->f_active |= VFSATTR_ ## a) | |
198 | #define VFSATTR_RETURN(s, a, x) do { (s)-> a = (x); VFSATTR_SET_SUPPORTED(s, a);} while(0) | |
199 | ||
200 | #define VFSATTR_f_objcount (1LL<< 0) | |
201 | #define VFSATTR_f_filecount (1LL<< 1) | |
202 | #define VFSATTR_f_dircount (1LL<< 2) | |
203 | #define VFSATTR_f_maxobjcount (1LL<< 3) | |
204 | #define VFSATTR_f_bsize (1LL<< 4) | |
205 | #define VFSATTR_f_iosize (1LL<< 5) | |
206 | #define VFSATTR_f_blocks (1LL<< 6) | |
207 | #define VFSATTR_f_bfree (1LL<< 7) | |
208 | #define VFSATTR_f_bavail (1LL<< 8) | |
209 | #define VFSATTR_f_bused (1LL<< 9) | |
210 | #define VFSATTR_f_files (1LL<< 10) | |
211 | #define VFSATTR_f_ffree (1LL<< 11) | |
212 | #define VFSATTR_f_fsid (1LL<< 12) | |
213 | #define VFSATTR_f_owner (1LL<< 13) | |
214 | #define VFSATTR_f_capabilities (1LL<< 14) | |
215 | #define VFSATTR_f_attributes (1LL<< 15) | |
216 | #define VFSATTR_f_create_time (1LL<< 16) | |
217 | #define VFSATTR_f_modify_time (1LL<< 17) | |
218 | #define VFSATTR_f_access_time (1LL<< 18) | |
219 | #define VFSATTR_f_backup_time (1LL<< 19) | |
220 | #define VFSATTR_f_fssubtype (1LL<< 20) | |
221 | #define VFSATTR_f_vol_name (1LL<< 21) | |
222 | #define VFSATTR_f_signature (1LL<< 22) | |
223 | #define VFSATTR_f_carbon_fsid (1LL<< 23) | |
224 | ||
1c79356b | 225 | /* |
2d21ac55 | 226 | * Argument structure. |
1c79356b | 227 | */ |
0c530ab8 | 228 | #pragma pack(4) |
91447636 A |
229 | |
230 | struct vfs_attr { | |
231 | uint64_t f_supported; | |
232 | uint64_t f_active; | |
233 | ||
234 | uint64_t f_objcount; /* number of filesystem objects in volume */ | |
235 | uint64_t f_filecount; /* ... files */ | |
236 | uint64_t f_dircount; /* ... directories */ | |
237 | uint64_t f_maxobjcount; /* maximum number of filesystem objects */ | |
238 | ||
239 | uint32_t f_bsize; /* block size for the below size values */ | |
240 | size_t f_iosize; /* optimal transfer block size */ | |
241 | uint64_t f_blocks; /* total data blocks in file system */ | |
242 | uint64_t f_bfree; /* free blocks in fs */ | |
243 | uint64_t f_bavail; /* free blocks avail to non-superuser */ | |
244 | uint64_t f_bused; /* blocks in use */ | |
245 | uint64_t f_files; /* total file nodes in file system */ | |
246 | uint64_t f_ffree; /* free file nodes in fs */ | |
247 | fsid_t f_fsid; /* file system id */ | |
248 | uid_t f_owner; /* user that mounted the filesystem */ | |
249 | ||
250 | vol_capabilities_attr_t f_capabilities; | |
251 | vol_attributes_attr_t f_attributes; | |
252 | ||
253 | struct timespec f_create_time; /* creation time */ | |
254 | struct timespec f_modify_time; /* last modification time */ | |
255 | struct timespec f_access_time; /* time of last access */ | |
256 | struct timespec f_backup_time; /* last backup time */ | |
257 | ||
258 | uint32_t f_fssubtype; /* filesystem subtype */ | |
259 | ||
260 | char *f_vol_name; /* volume name */ | |
261 | ||
262 | uint16_t f_signature; /* used for ATTR_VOL_SIGNATURE, Carbon's FSVolumeInfo.signature */ | |
263 | uint16_t f_carbon_fsid; /* same as Carbon's FSVolumeInfo.filesystemID */ | |
1c79356b | 264 | }; |
91447636 | 265 | |
0c530ab8 | 266 | #pragma pack() |
1c79356b | 267 | |
2d21ac55 A |
268 | #endif /* KERNEL */ |
269 | ||
1c79356b A |
270 | /* |
271 | * User specifiable flags. | |
272 | * | |
273 | * Unmount uses MNT_FORCE flag. | |
274 | */ | |
275 | #define MNT_RDONLY 0x00000001 /* read only filesystem */ | |
276 | #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */ | |
277 | #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */ | |
278 | #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */ | |
279 | #define MNT_NODEV 0x00000010 /* don't interpret special files */ | |
280 | #define MNT_UNION 0x00000020 /* union with underlying filesystem */ | |
281 | #define MNT_ASYNC 0x00000040 /* file system written asynchronously */ | |
1c79356b A |
282 | |
283 | /* | |
284 | * NFS export related mount flags. | |
285 | */ | |
1c79356b | 286 | #define MNT_EXPORTED 0x00000100 /* file system is exported */ |
1c79356b | 287 | |
2d21ac55 A |
288 | /* |
289 | * MAC labeled / "quarantined" flag | |
290 | */ | |
291 | #define MNT_QUARANTINE 0x00000400 /* file system is quarantined */ | |
292 | ||
1c79356b A |
293 | /* |
294 | * Flags set by internal operations. | |
295 | */ | |
296 | #define MNT_LOCAL 0x00001000 /* filesystem is stored locally */ | |
297 | #define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */ | |
298 | #define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */ | |
2d21ac55 A |
299 | #define MNT_DOVOLFS 0x00008000 /* FS supports volfs (deprecated flag in Mac OS X 10.5) */ |
300 | ||
301 | ||
302 | #define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */ | |
303 | #define MNT_IGNORE_OWNERSHIP 0x00200000 /* VFS will ignore ownership information on filesystem objects */ | |
304 | #define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */ | |
305 | #define MNT_JOURNALED 0x00800000 /* filesystem is journaled */ | |
306 | #define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */ | |
307 | #define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */ | |
308 | #define MNT_MULTILABEL 0x04000000 /* MAC support for individual labels */ | |
309 | #define MNT_NOATIME 0x10000000 /* disable update of file access time */ | |
310 | ||
311 | /* backwards compatibility only */ | |
312 | #define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP | |
313 | ||
1c79356b A |
314 | |
315 | /* | |
316 | * XXX I think that this could now become (~(MNT_CMDFLAGS)) | |
317 | * but the 'mount' program may need changing to handle this. | |
318 | */ | |
319 | #define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \ | |
320 | MNT_NOSUID | MNT_NODEV | MNT_UNION | \ | |
2d21ac55 A |
321 | MNT_ASYNC | MNT_EXPORTED | MNT_QUARANTINE | \ |
322 | MNT_LOCAL | MNT_QUOTA | \ | |
1c79356b | 323 | MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \ |
2d21ac55 A |
324 | MNT_IGNORE_OWNERSHIP | MNT_AUTOMOUNTED | MNT_JOURNALED | \ |
325 | MNT_NOUSERXATTR | MNT_DEFWRITE | MNT_MULTILABEL | MNT_NOATIME) | |
1c79356b A |
326 | /* |
327 | * External filesystem command modifier flags. | |
328 | * Unmount can use the MNT_FORCE flag. | |
329 | * XXX These are not STATES and really should be somewhere else. | |
330 | * External filesystem control flags. | |
331 | */ | |
332 | #define MNT_UPDATE 0x00010000 /* not a real mount, just an update */ | |
1c79356b A |
333 | #define MNT_RELOAD 0x00040000 /* reload filesystem data */ |
334 | #define MNT_FORCE 0x00080000 /* force unmount or readonly change */ | |
91447636 A |
335 | #define MNT_CMDFLAGS (MNT_UPDATE|MNT_RELOAD|MNT_FORCE) |
336 | ||
337 | ||
1c79356b | 338 | |
1c79356b A |
339 | /* |
340 | * Sysctl CTL_VFS definitions. | |
341 | * | |
342 | * Second level identifier specifies which filesystem. Second level | |
343 | * identifier VFS_GENERIC returns information about all filesystems. | |
344 | */ | |
345 | #define VFS_GENERIC 0 /* generic filesystem information */ | |
346 | #define VFS_NUMMNTOPS 1 /* int: total num of vfs mount/unmount operations */ | |
347 | /* | |
348 | * Third level identifiers for VFS_GENERIC are given below; third | |
349 | * level identifiers for specific filesystems are given in their | |
350 | * mount specific header files. | |
351 | */ | |
352 | #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */ | |
353 | #define VFS_CONF 2 /* struct: vfsconf for filesystem given | |
354 | as next argument */ | |
91447636 | 355 | #define VFS_SET_PACKAGE_EXTS 3 /* set package extension list */ |
55e303ae | 356 | |
1c79356b A |
357 | /* |
358 | * Flags for various system call interfaces. | |
359 | * | |
360 | * waitfor flags to vfs_sync() and getfsstat() | |
361 | */ | |
362 | #define MNT_WAIT 1 /* synchronously wait for I/O to complete */ | |
363 | #define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */ | |
364 | ||
1c79356b | 365 | |
91447636 A |
366 | #ifndef KERNEL |
367 | struct mount; | |
368 | typedef struct mount * mount_t; | |
369 | struct vnode; | |
370 | typedef struct vnode * vnode_t; | |
371 | #endif | |
1c79356b | 372 | |
1c79356b A |
373 | struct vfsconf { |
374 | struct vfsops *vfc_vfsops; /* filesystem operations vector */ | |
375 | char vfc_name[MFSNAMELEN]; /* filesystem type name */ | |
376 | int vfc_typenum; /* historic filesystem type number */ | |
377 | int vfc_refcount; /* number mounted of this type */ | |
378 | int vfc_flags; /* permanent flags */ | |
91447636 | 379 | int (*vfc_mountroot)(mount_t, vnode_t); /* if != NULL, routine to mount root */ |
1c79356b A |
380 | struct vfsconf *vfc_next; /* next in list */ |
381 | }; | |
382 | ||
55e303ae A |
383 | struct vfsidctl { |
384 | int vc_vers; /* should be VFSIDCTL_VERS1 (below) */ | |
385 | fsid_t vc_fsid; /* fsid to operate on. */ | |
386 | void *vc_ptr; /* pointer to data structure. */ | |
387 | size_t vc_len; /* sizeof said structure. */ | |
388 | u_int32_t vc_spare[12]; /* spare (must be zero). */ | |
389 | }; | |
390 | ||
91447636 | 391 | |
55e303ae A |
392 | /* vfsidctl API version. */ |
393 | #define VFS_CTL_VERS1 0x01 | |
394 | ||
91447636 | 395 | #ifdef KERNEL |
91447636 A |
396 | |
397 | /* LP64 version of vfsconf. all pointers | |
398 | * grow when we're dealing with a 64-bit process. | |
399 | * WARNING - keep in sync with vfsconf | |
400 | */ | |
91447636 A |
401 | struct user_vfsconf { |
402 | user_addr_t vfc_vfsops; /* filesystem operations vector */ | |
403 | char vfc_name[MFSNAMELEN]; /* filesystem type name */ | |
404 | int vfc_typenum; /* historic filesystem type number */ | |
405 | int vfc_refcount; /* number mounted of this type */ | |
406 | int vfc_flags; /* permanent flags */ | |
0c530ab8 | 407 | user_addr_t vfc_mountroot __attribute((aligned(8))); /* if != NULL, routine to mount root */ |
91447636 A |
408 | user_addr_t vfc_next; /* next in list */ |
409 | }; | |
410 | ||
411 | struct user_vfsidctl { | |
412 | int vc_vers; /* should be VFSIDCTL_VERS1 (below) */ | |
413 | fsid_t vc_fsid; /* fsid to operate on. */ | |
0c530ab8 | 414 | user_addr_t vc_ptr __attribute((aligned(8))); /* pointer to data structure. */ |
91447636 A |
415 | user_size_t vc_len; /* sizeof said structure. */ |
416 | u_int32_t vc_spare[12]; /* spare (must be zero). */ | |
417 | }; | |
418 | ||
91447636 A |
419 | #endif /* KERNEL */ |
420 | ||
55e303ae A |
421 | /* |
422 | * New style VFS sysctls, do not reuse/conflict with the namespace for | |
423 | * private sysctls. | |
424 | */ | |
425 | #define VFS_CTL_STATFS 0x00010001 /* statfs */ | |
426 | #define VFS_CTL_UMOUNT 0x00010002 /* unmount */ | |
427 | #define VFS_CTL_QUERY 0x00010003 /* anything wrong? (vfsquery) */ | |
428 | #define VFS_CTL_NEWADDR 0x00010004 /* reconnect to new address */ | |
429 | #define VFS_CTL_TIMEO 0x00010005 /* set timeout for vfs notification */ | |
e5568f75 | 430 | #define VFS_CTL_NOLOCKS 0x00010006 /* disable file locking */ |
55e303ae A |
431 | |
432 | struct vfsquery { | |
433 | u_int32_t vq_flags; | |
434 | u_int32_t vq_spare[31]; | |
435 | }; | |
436 | ||
437 | /* vfsquery flags */ | |
438 | #define VQ_NOTRESP 0x0001 /* server down */ | |
439 | #define VQ_NEEDAUTH 0x0002 /* server bad auth */ | |
440 | #define VQ_LOWDISK 0x0004 /* we're low on space */ | |
441 | #define VQ_MOUNT 0x0008 /* new filesystem arrived */ | |
442 | #define VQ_UNMOUNT 0x0010 /* filesystem has left */ | |
443 | #define VQ_DEAD 0x0020 /* filesystem is dead, needs force unmount */ | |
91447636 | 444 | #define VQ_ASSIST 0x0040 /* filesystem needs assistance from external program */ |
e5568f75 | 445 | #define VQ_NOTRESPLOCK 0x0080 /* server lockd down */ |
91447636 | 446 | #define VQ_UPDATE 0x0100 /* filesystem information has changed */ |
55e303ae A |
447 | #define VQ_FLAG0200 0x0200 /* placeholder */ |
448 | #define VQ_FLAG0400 0x0400 /* placeholder */ | |
449 | #define VQ_FLAG0800 0x0800 /* placeholder */ | |
450 | #define VQ_FLAG1000 0x1000 /* placeholder */ | |
451 | #define VQ_FLAG2000 0x2000 /* placeholder */ | |
452 | #define VQ_FLAG4000 0x4000 /* placeholder */ | |
453 | #define VQ_FLAG8000 0x8000 /* placeholder */ | |
454 | ||
55e303ae | 455 | |
9bccf70c | 456 | #ifdef KERNEL |
1c79356b | 457 | |
91447636 A |
458 | /* Structure for setting device IO parameters per mount point */ |
459 | struct vfsioattr { | |
460 | u_int32_t io_maxreadcnt; /* Max. byte count for read */ | |
461 | u_int32_t io_maxwritecnt; /* Max. byte count for write */ | |
462 | u_int32_t io_segreadcnt; /* Max. segment count for read */ | |
463 | u_int32_t io_segwritecnt; /* Max. segment count for write */ | |
464 | u_int32_t io_maxsegreadsize; /* Max. segment read size */ | |
465 | u_int32_t io_maxsegwritesize; /* Max. segment write size */ | |
466 | u_int32_t io_devblocksize; /* the underlying device block size */ | |
2d21ac55 A |
467 | u_int32_t io_flags; /* flags for underlying device */ |
468 | void * io_reserved[2]; /* extended attribute information */ | |
91447636 A |
469 | }; |
470 | ||
2d21ac55 | 471 | #define VFS_IOATTR_FLAGS_FUA 0x01 /* Write-through cache supported */ |
1c79356b A |
472 | |
473 | /* | |
91447636 | 474 | * Filesystem Registration information |
1c79356b | 475 | */ |
2d21ac55 A |
476 | #define VFS_TBLTHREADSAFE 0x0001 |
477 | #define VFS_TBLFSNODELOCK 0x0002 | |
478 | #define VFS_TBLNOTYPENUM 0x0008 | |
479 | #define VFS_TBLLOCALVOL 0x0010 | |
480 | #define VFS_TBL64BITREADY 0x0020 | |
481 | #define VFS_TBLNATIVEXATTR 0x0040 | |
482 | #define VFS_TBLDIRLINKS 0x0080 | |
483 | #define VFS_TBLUNMOUNT_PREFLIGHT 0x0100 /* does a preflight check before unmounting */ | |
484 | #define VFS_TBLGENERICMNTARGS 0x0200 /* force generic mount args for local fs */ | |
485 | #define VFS_TBLREADDIR_EXTENDED 0x0400 /* fs supports VNODE_READDIR_EXTENDED */ | |
486 | #define VFS_TBLNOMACLABEL 0x1000 | |
91447636 A |
487 | |
488 | struct vfs_fsentry { | |
489 | struct vfsops * vfe_vfsops; /* vfs operations */ | |
490 | int vfe_vopcnt; /* # of vnodeopv_desc being registered (reg, spec, fifo ...) */ | |
491 | struct vnodeopv_desc ** vfe_opvdescs; /* null terminated; */ | |
492 | int vfe_fstypenum; /* historic filesystem type number */ | |
493 | char vfe_fsname[MFSNAMELEN]; /* filesystem type name */ | |
494 | uint32_t vfe_flags; /* defines the FS capabilities */ | |
495 | void * vfe_reserv[2]; /* reserved for future use; set this to zero*/ | |
496 | }; | |
497 | ||
498 | ||
1c79356b A |
499 | |
500 | struct vfsops { | |
91447636 A |
501 | int (*vfs_mount)(struct mount *mp, vnode_t devvp, user_addr_t data, vfs_context_t context); |
502 | int (*vfs_start)(struct mount *mp, int flags, vfs_context_t context); | |
503 | int (*vfs_unmount)(struct mount *mp, int mntflags, vfs_context_t context); | |
504 | int (*vfs_root)(struct mount *mp, struct vnode **vpp, vfs_context_t context); | |
505 | int (*vfs_quotactl)(struct mount *mp, int cmds, uid_t uid, caddr_t arg, vfs_context_t context); | |
506 | int (*vfs_getattr)(struct mount *mp, struct vfs_attr *, vfs_context_t context); | |
507 | /* int (*vfs_statfs)(struct mount *mp, struct vfsstatfs *sbp, vfs_context_t context);*/ | |
508 | int (*vfs_sync)(struct mount *mp, int waitfor, vfs_context_t context); | |
509 | int (*vfs_vget)(struct mount *mp, ino64_t ino, struct vnode **vpp, vfs_context_t context); | |
510 | int (*vfs_fhtovp)(struct mount *mp, int fhlen, unsigned char *fhp, struct vnode **vpp, | |
511 | vfs_context_t context); | |
512 | int (*vfs_vptofh)(struct vnode *vp, int *fhlen, unsigned char *fhp, vfs_context_t context); | |
513 | int (*vfs_init)(struct vfsconf *); | |
514 | int (*vfs_sysctl)(int *, u_int, user_addr_t, size_t *, user_addr_t, size_t, vfs_context_t context); | |
515 | int (*vfs_setattr)(struct mount *mp, struct vfs_attr *, vfs_context_t context); | |
516 | void *vfs_reserved[7]; | |
1c79356b A |
517 | }; |
518 | ||
1c79356b A |
519 | |
520 | /* | |
91447636 | 521 | * flags passed into vfs_iterate |
1c79356b | 522 | */ |
1c79356b A |
523 | |
524 | /* | |
91447636 | 525 | * return values from callback |
1c79356b | 526 | */ |
91447636 A |
527 | #define VFS_RETURNED 0 /* done with vnode, reference can be dropped */ |
528 | #define VFS_RETURNED_DONE 1 /* done with vnode, reference can be dropped, terminate iteration */ | |
529 | #define VFS_CLAIMED 2 /* don't drop reference */ | |
530 | #define VFS_CLAIMED_DONE 3 /* don't drop reference, terminate iteration */ | |
1c79356b | 531 | |
91447636 A |
532 | |
533 | __BEGIN_DECLS | |
1c79356b | 534 | /* |
91447636 | 535 | * prototypes for exported VFS operations |
1c79356b | 536 | */ |
91447636 A |
537 | extern int VFS_MOUNT(mount_t, vnode_t, user_addr_t, vfs_context_t); |
538 | extern int VFS_START(mount_t, int, vfs_context_t); | |
539 | extern int VFS_UNMOUNT(mount_t, int, vfs_context_t); | |
540 | extern int VFS_ROOT(mount_t, vnode_t *, vfs_context_t); | |
541 | extern int VFS_QUOTACTL(mount_t, int, uid_t, caddr_t, vfs_context_t); | |
2d21ac55 A |
542 | extern int VFS_GETATTR(mount_t, struct vfs_attr *, vfs_context_t); |
543 | extern int VFS_SETATTR(mount_t, struct vfs_attr *, vfs_context_t); | |
91447636 A |
544 | extern int VFS_SYNC(mount_t, int, vfs_context_t); |
545 | extern int VFS_VGET(mount_t, ino64_t, vnode_t *, vfs_context_t); | |
546 | extern int VFS_FHTOVP(mount_t, int, unsigned char *, vnode_t *, vfs_context_t); | |
547 | extern int VFS_VPTOFH(vnode_t, int *, unsigned char *, vfs_context_t); | |
548 | ||
549 | /* The file system registrartion KPI */ | |
550 | int vfs_fsadd(struct vfs_fsentry *, vfstable_t *); | |
551 | int vfs_fsremove(vfstable_t); | |
552 | int vfs_iterate(int, int (*)(struct mount *, void *), void *); | |
553 | ||
554 | uint64_t vfs_flags(mount_t); | |
555 | void vfs_setflags(mount_t, uint64_t); | |
556 | void vfs_clearflags(mount_t, uint64_t); | |
557 | ||
558 | int vfs_issynchronous(mount_t); | |
559 | int vfs_iswriteupgrade(mount_t); | |
560 | int vfs_isupdate(mount_t); | |
561 | int vfs_isreload(mount_t); | |
562 | int vfs_isforce(mount_t); | |
563 | int vfs_isrdonly(mount_t); | |
564 | int vfs_isrdwr(mount_t); | |
565 | int vfs_authopaque(mount_t); | |
566 | int vfs_authopaqueaccess(mount_t); | |
567 | void vfs_setauthopaque(mount_t); | |
568 | void vfs_setauthopaqueaccess(mount_t); | |
569 | void vfs_clearauthopaque(mount_t); | |
570 | void vfs_clearauthopaqueaccess(mount_t); | |
571 | int vfs_extendedsecurity(mount_t); | |
572 | void vfs_setextendedsecurity(mount_t); | |
573 | void vfs_clearextendedsecurity(mount_t); | |
574 | void vfs_setlocklocal(mount_t); | |
2d21ac55 A |
575 | int vfs_authcache_ttl(mount_t); |
576 | void vfs_setauthcache_ttl(mount_t, int); | |
577 | void vfs_clearauthcache_ttl(mount_t); | |
578 | void vfs_markdependency(mount_t); | |
91447636 | 579 | |
2d21ac55 A |
580 | /* |
581 | * return value from vfs_cachedrights_ttl if | |
582 | * neither MNTK_AUTH_OPAQUE | MNTK_AUTH_CACHE_TTL | |
583 | * is set in mnt_kern_flag.. it indicates | |
584 | * that no TTL is being applied to the vnode rights cache | |
585 | */ | |
586 | #define CACHED_RIGHT_INFINITE_TTL ~0 | |
91447636 A |
587 | |
588 | ||
589 | uint32_t vfs_maxsymlen(mount_t); | |
590 | void vfs_setmaxsymlen(mount_t, uint32_t); | |
591 | void * vfs_fsprivate(mount_t); | |
592 | void vfs_setfsprivate(mount_t, void *mntdata); | |
593 | ||
594 | struct vfsstatfs * vfs_statfs(mount_t); | |
2d21ac55 A |
595 | #define VFS_USER_EVENT 0 |
596 | #define VFS_KERNEL_EVENT 1 | |
597 | int vfs_update_vfsstat(mount_t, vfs_context_t, int eventtype); | |
91447636 A |
598 | int vfs_getattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx); |
599 | int vfs_setattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx); | |
600 | ||
601 | int vfs_typenum(mount_t); | |
602 | void vfs_name(mount_t, char *); | |
603 | int vfs_devblocksize(mount_t); | |
604 | void vfs_ioattr(mount_t, struct vfsioattr *); | |
605 | void vfs_setioattr(mount_t, struct vfsioattr *); | |
606 | int vfs_64bitready(mount_t); | |
607 | ||
608 | ||
2d21ac55 | 609 | #define LK_NOWAIT 1 |
91447636 A |
610 | int vfs_busy(mount_t, int); |
611 | void vfs_unbusy(mount_t); | |
612 | ||
613 | void vfs_getnewfsid(struct mount *); | |
614 | mount_t vfs_getvfs(fsid_t *); | |
2d21ac55 | 615 | mount_t vfs_getvfs_by_mntonname(char *); |
91447636 | 616 | int vfs_mountedon(struct vnode *); |
2d21ac55 | 617 | int vfs_unmountbyfsid(fsid_t *, int, vfs_context_t); |
91447636 | 618 | |
55e303ae A |
619 | void vfs_event_signal(fsid_t *, u_int32_t, intptr_t); |
620 | void vfs_event_init(void); | |
91447636 A |
621 | __END_DECLS |
622 | ||
623 | #endif /* KERNEL */ | |
1c79356b | 624 | |
91447636 A |
625 | #ifndef KERNEL |
626 | ||
627 | /* | |
628 | * Generic file handle | |
629 | */ | |
2d21ac55 A |
630 | #define NFS_MAX_FH_SIZE NFSV4_MAX_FH_SIZE |
631 | #define NFSV4_MAX_FH_SIZE 128 | |
632 | #define NFSV3_MAX_FH_SIZE 64 | |
91447636 A |
633 | #define NFSV2_MAX_FH_SIZE 32 |
634 | struct fhandle { | |
635 | int fh_len; /* length of file handle */ | |
636 | unsigned char fh_data[NFS_MAX_FH_SIZE]; /* file handle value */ | |
637 | }; | |
638 | typedef struct fhandle fhandle_t; | |
1c79356b | 639 | |
1c79356b A |
640 | |
641 | __BEGIN_DECLS | |
91447636 | 642 | int fhopen(const struct fhandle *, int); |
2d21ac55 | 643 | int fstatfs(int, struct statfs *) __DARWIN_INODE64(fstatfs); |
593a1d5f A |
644 | #if !__DARWIN_ONLY_64_BIT_INO_T |
645 | int fstatfs64(int, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); | |
646 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ | |
91447636 | 647 | int getfh(const char *, fhandle_t *); |
2d21ac55 | 648 | int getfsstat(struct statfs *, int, int) __DARWIN_INODE64(getfsstat); |
593a1d5f A |
649 | #if !__DARWIN_ONLY_64_BIT_INO_T |
650 | int getfsstat64(struct statfs64 *, int, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); | |
651 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ | |
2d21ac55 | 652 | int getmntinfo(struct statfs **, int) __DARWIN_INODE64(getmntinfo); |
593a1d5f A |
653 | #if !__DARWIN_ONLY_64_BIT_INO_T |
654 | int getmntinfo64(struct statfs64 **, int) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); | |
655 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ | |
91447636 | 656 | int mount(const char *, const char *, int, void *); |
2d21ac55 | 657 | int statfs(const char *, struct statfs *) __DARWIN_INODE64(statfs); |
593a1d5f A |
658 | #if !__DARWIN_ONLY_64_BIT_INO_T |
659 | int statfs64(const char *, struct statfs64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5,__MAC_10_6,__IPHONE_NA,__IPHONE_NA); | |
660 | #endif /* !__DARWIN_ONLY_64_BIT_INO_T */ | |
91447636 A |
661 | int unmount(const char *, int); |
662 | int getvfsbyname(const char *, struct vfsconf *); | |
1c79356b A |
663 | __END_DECLS |
664 | ||
665 | #endif /* KERNEL */ | |
666 | #endif /* !_SYS_MOUNT_H_ */ |