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