2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
30 * Copyright (c) 1989, 1991, 1993
31 * The Regents of the University of California. All rights reserved.
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
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.
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
61 * @(#)mount.h 8.21 (Berkeley) 5/20/95
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,
74 #include <sys/appleapiopts.h>
75 #include <sys/cdefs.h>
76 #include <sys/attr.h> /* needed for vol_capabilities_attr_t */
80 #include <sys/ucred.h>
81 #include <sys/queue.h> /* XXX needed for user builds */
83 #include <sys/kernel_types.h>
86 typedef struct fsid
{ int32_t val
[2]; } fsid_t
; /* file system id type */
89 * file system statistics
92 #define MFSNAMELEN 15 /* length of fs type name, not inc. null */
93 #define MFSTYPENAMELEN 16 /* length of fs type name including null */
94 #define MNAMELEN 90 /* length of buffer for returned name */
96 #define __DARWIN_STRUCT_STATFS64 { \
97 uint32_t f_bsize; /* fundamental file system block size */ \
98 int32_t f_iosize; /* optimal transfer block size */ \
99 uint64_t f_blocks; /* total data blocks in file system */ \
100 uint64_t f_bfree; /* free blocks in fs */ \
101 uint64_t f_bavail; /* free blocks avail to non-superuser */ \
102 uint64_t f_files; /* total file nodes in file system */ \
103 uint64_t f_ffree; /* free file nodes in fs */ \
104 fsid_t f_fsid; /* file system id */ \
105 uid_t f_owner; /* user that mounted the filesystem */ \
106 uint32_t f_type; /* type of filesystem */ \
107 uint32_t f_flags; /* copy of mount exported flags */ \
108 uint32_t f_fssubtype; /* fs sub-type (flavor) */ \
109 char f_fstypename[MFSTYPENAMELEN]; /* fs type name */ \
110 char f_mntonname[MAXPATHLEN]; /* directory on which mounted */ \
111 char f_mntfromname[MAXPATHLEN]; /* mounted filesystem */ \
112 uint32_t f_reserved[8]; /* For future use */ \
115 struct statfs64 __DARWIN_STRUCT_STATFS64
;
117 #if __DARWIN_64_BIT_INO_T
119 struct statfs __DARWIN_STRUCT_STATFS64
;
121 #else /* !__DARWIN_64_BIT_INO_T */
124 * LP64 - WARNING - must be kept in sync with struct user_statfs in mount_internal.h.
127 short f_otype
; /* TEMPORARY SHADOW COPY OF f_type */
128 short f_oflags
; /* TEMPORARY SHADOW COPY OF f_flags */
129 long f_bsize
; /* fundamental file system block size */
130 long f_iosize
; /* optimal transfer block size */
131 long f_blocks
; /* total data blocks in file system */
132 long f_bfree
; /* free blocks in fs */
133 long f_bavail
; /* free blocks avail to non-superuser */
134 long f_files
; /* total file nodes in file system */
135 long f_ffree
; /* free file nodes in fs */
136 fsid_t f_fsid
; /* file system id */
137 uid_t f_owner
; /* user that mounted the filesystem */
138 short f_reserved1
; /* spare for later */
139 short f_type
; /* type of filesystem */
140 long f_flags
; /* copy of mount exported flags */
141 long f_reserved2
[2]; /* reserved for future use */
142 char f_fstypename
[MFSNAMELEN
]; /* fs type name */
143 char f_mntonname
[MNAMELEN
]; /* directory on which mounted */
144 char f_mntfromname
[MNAMELEN
];/* mounted filesystem */
146 char f_reserved3
[0]; /* For alignment */
147 long f_reserved4
[0]; /* For future use */
149 char f_reserved3
; /* For alignment */
150 long f_reserved4
[4]; /* For future use */
154 #endif /* __DARWIN_64_BIT_INO_T */
159 uint32_t f_bsize
; /* fundamental file system block size */
160 size_t f_iosize
; /* optimal transfer block size */
161 uint64_t f_blocks
; /* total data blocks in file system */
162 uint64_t f_bfree
; /* free blocks in fs */
163 uint64_t f_bavail
; /* free blocks avail to non-superuser */
164 uint64_t f_bused
; /* free blocks avail to non-superuser */
165 uint64_t f_files
; /* total file nodes in file system */
166 uint64_t f_ffree
; /* free file nodes in fs */
167 fsid_t f_fsid
; /* file system id */
168 uid_t f_owner
; /* user that mounted the filesystem */
169 uint64_t f_flags
; /* copy of mount exported flags */
170 char f_fstypename
[MFSTYPENAMELEN
];/* fs type name inclus */
171 char f_mntonname
[MAXPATHLEN
];/* directory on which mounted */
172 char f_mntfromname
[MAXPATHLEN
];/* mounted filesystem */
173 uint32_t f_fssubtype
; /* fs sub-type (flavor) */
174 void *f_reserved
[2]; /* For future use == 0 */
181 * Kernel level support for the VFS_GETATTR(), VFS_SETATTR() for use in
182 * implementation of filesystem KEXTs, and by the vfs_getattr() and
183 * vfs_setattr() KPIs.
186 #define VFSATTR_INIT(s) ((s)->f_supported = (s)->f_active = 0LL)
187 #define VFSATTR_SET_SUPPORTED(s, a) ((s)->f_supported |= VFSATTR_ ## a)
188 #define VFSATTR_IS_SUPPORTED(s, a) ((s)->f_supported & VFSATTR_ ## a)
189 #define VFSATTR_CLEAR_ACTIVE(s, a) ((s)->f_active &= ~VFSATTR_ ## a)
190 #define VFSATTR_IS_ACTIVE(s, a) ((s)->f_active & VFSATTR_ ## a)
191 #define VFSATTR_ALL_SUPPORTED(s) (((s)->f_active & (s)->f_supported) == (s)->f_active)
192 #define VFSATTR_WANTED(s, a) ((s)->f_active |= VFSATTR_ ## a)
193 #define VFSATTR_RETURN(s, a, x) do { (s)-> a = (x); VFSATTR_SET_SUPPORTED(s, a);} while(0)
195 #define VFSATTR_f_objcount (1LL<< 0)
196 #define VFSATTR_f_filecount (1LL<< 1)
197 #define VFSATTR_f_dircount (1LL<< 2)
198 #define VFSATTR_f_maxobjcount (1LL<< 3)
199 #define VFSATTR_f_bsize (1LL<< 4)
200 #define VFSATTR_f_iosize (1LL<< 5)
201 #define VFSATTR_f_blocks (1LL<< 6)
202 #define VFSATTR_f_bfree (1LL<< 7)
203 #define VFSATTR_f_bavail (1LL<< 8)
204 #define VFSATTR_f_bused (1LL<< 9)
205 #define VFSATTR_f_files (1LL<< 10)
206 #define VFSATTR_f_ffree (1LL<< 11)
207 #define VFSATTR_f_fsid (1LL<< 12)
208 #define VFSATTR_f_owner (1LL<< 13)
209 #define VFSATTR_f_capabilities (1LL<< 14)
210 #define VFSATTR_f_attributes (1LL<< 15)
211 #define VFSATTR_f_create_time (1LL<< 16)
212 #define VFSATTR_f_modify_time (1LL<< 17)
213 #define VFSATTR_f_access_time (1LL<< 18)
214 #define VFSATTR_f_backup_time (1LL<< 19)
215 #define VFSATTR_f_fssubtype (1LL<< 20)
216 #define VFSATTR_f_vol_name (1LL<< 21)
217 #define VFSATTR_f_signature (1LL<< 22)
218 #define VFSATTR_f_carbon_fsid (1LL<< 23)
221 * Argument structure.
226 uint64_t f_supported
;
229 uint64_t f_objcount
; /* number of filesystem objects in volume */
230 uint64_t f_filecount
; /* ... files */
231 uint64_t f_dircount
; /* ... directories */
232 uint64_t f_maxobjcount
; /* maximum number of filesystem objects */
234 uint32_t f_bsize
; /* block size for the below size values */
235 size_t f_iosize
; /* optimal transfer block size */
236 uint64_t f_blocks
; /* total data blocks in file system */
237 uint64_t f_bfree
; /* free blocks in fs */
238 uint64_t f_bavail
; /* free blocks avail to non-superuser */
239 uint64_t f_bused
; /* blocks in use */
240 uint64_t f_files
; /* total file nodes in file system */
241 uint64_t f_ffree
; /* free file nodes in fs */
242 fsid_t f_fsid
; /* file system id */
243 uid_t f_owner
; /* user that mounted the filesystem */
245 vol_capabilities_attr_t f_capabilities
;
246 vol_attributes_attr_t f_attributes
;
248 struct timespec f_create_time
; /* creation time */
249 struct timespec f_modify_time
; /* last modification time */
250 struct timespec f_access_time
; /* time of last access */
251 struct timespec f_backup_time
; /* last backup time */
253 uint32_t f_fssubtype
; /* filesystem subtype */
255 char *f_vol_name
; /* volume name */
257 uint16_t f_signature
; /* used for ATTR_VOL_SIGNATURE, Carbon's FSVolumeInfo.signature */
258 uint16_t f_carbon_fsid
; /* same as Carbon's FSVolumeInfo.filesystemID */
266 * User specifiable flags.
268 * Unmount uses MNT_FORCE flag.
270 #define MNT_RDONLY 0x00000001 /* read only filesystem */
271 #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */
272 #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */
273 #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
274 #define MNT_NODEV 0x00000010 /* don't interpret special files */
275 #define MNT_UNION 0x00000020 /* union with underlying filesystem */
276 #define MNT_ASYNC 0x00000040 /* file system written asynchronously */
279 * NFS export related mount flags.
281 #define MNT_EXPORTED 0x00000100 /* file system is exported */
284 * MAC labeled / "quarantined" flag
286 #define MNT_QUARANTINE 0x00000400 /* file system is quarantined */
289 * Flags set by internal operations.
291 #define MNT_LOCAL 0x00001000 /* filesystem is stored locally */
292 #define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */
293 #define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */
294 #define MNT_DOVOLFS 0x00008000 /* FS supports volfs (deprecated flag in Mac OS X 10.5) */
297 #define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */
298 #define MNT_IGNORE_OWNERSHIP 0x00200000 /* VFS will ignore ownership information on filesystem objects */
299 #define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */
300 #define MNT_JOURNALED 0x00800000 /* filesystem is journaled */
301 #define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */
302 #define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */
303 #define MNT_MULTILABEL 0x04000000 /* MAC support for individual labels */
304 #define MNT_NOATIME 0x10000000 /* disable update of file access time */
306 /* backwards compatibility only */
307 #define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
311 * XXX I think that this could now become (~(MNT_CMDFLAGS))
312 * but the 'mount' program may need changing to handle this.
314 #define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \
315 MNT_NOSUID | MNT_NODEV | MNT_UNION | \
316 MNT_ASYNC | MNT_EXPORTED | MNT_QUARANTINE | \
317 MNT_LOCAL | MNT_QUOTA | \
318 MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \
319 MNT_IGNORE_OWNERSHIP | MNT_AUTOMOUNTED | MNT_JOURNALED | \
320 MNT_NOUSERXATTR | MNT_DEFWRITE | MNT_MULTILABEL | MNT_NOATIME)
322 * External filesystem command modifier flags.
323 * Unmount can use the MNT_FORCE flag.
324 * XXX These are not STATES and really should be somewhere else.
325 * External filesystem control flags.
327 #define MNT_UPDATE 0x00010000 /* not a real mount, just an update */
328 #define MNT_RELOAD 0x00040000 /* reload filesystem data */
329 #define MNT_FORCE 0x00080000 /* force unmount or readonly change */
330 #define MNT_CMDFLAGS (MNT_UPDATE|MNT_RELOAD|MNT_FORCE)
335 * Sysctl CTL_VFS definitions.
337 * Second level identifier specifies which filesystem. Second level
338 * identifier VFS_GENERIC returns information about all filesystems.
340 #define VFS_GENERIC 0 /* generic filesystem information */
341 #define VFS_NUMMNTOPS 1 /* int: total num of vfs mount/unmount operations */
343 * Third level identifiers for VFS_GENERIC are given below; third
344 * level identifiers for specific filesystems are given in their
345 * mount specific header files.
347 #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */
348 #define VFS_CONF 2 /* struct: vfsconf for filesystem given
350 #define VFS_SET_PACKAGE_EXTS 3 /* set package extension list */
353 * Flags for various system call interfaces.
355 * waitfor flags to vfs_sync() and getfsstat()
357 #define MNT_WAIT 1 /* synchronously wait for I/O to complete */
358 #define MNT_NOWAIT 2 /* start all I/O, but do not wait for it */
363 typedef struct mount
* mount_t
;
365 typedef struct vnode
* vnode_t
;
369 struct vfsops
*vfc_vfsops
; /* filesystem operations vector */
370 char vfc_name
[MFSNAMELEN
]; /* filesystem type name */
371 int vfc_typenum
; /* historic filesystem type number */
372 int vfc_refcount
; /* number mounted of this type */
373 int vfc_flags
; /* permanent flags */
374 int (*vfc_mountroot
)(mount_t
, vnode_t
); /* if != NULL, routine to mount root */
375 struct vfsconf
*vfc_next
; /* next in list */
379 int vc_vers
; /* should be VFSIDCTL_VERS1 (below) */
380 fsid_t vc_fsid
; /* fsid to operate on. */
381 void *vc_ptr
; /* pointer to data structure. */
382 size_t vc_len
; /* sizeof said structure. */
383 u_int32_t vc_spare
[12]; /* spare (must be zero). */
387 /* vfsidctl API version. */
388 #define VFS_CTL_VERS1 0x01
392 /* LP64 version of vfsconf. all pointers
393 * grow when we're dealing with a 64-bit process.
394 * WARNING - keep in sync with vfsconf
396 struct user_vfsconf
{
397 user_addr_t vfc_vfsops
; /* filesystem operations vector */
398 char vfc_name
[MFSNAMELEN
]; /* filesystem type name */
399 int vfc_typenum
; /* historic filesystem type number */
400 int vfc_refcount
; /* number mounted of this type */
401 int vfc_flags
; /* permanent flags */
402 user_addr_t vfc_mountroot
__attribute((aligned(8))); /* if != NULL, routine to mount root */
403 user_addr_t vfc_next
; /* next in list */
406 struct user_vfsidctl
{
407 int vc_vers
; /* should be VFSIDCTL_VERS1 (below) */
408 fsid_t vc_fsid
; /* fsid to operate on. */
409 user_addr_t vc_ptr
__attribute((aligned(8))); /* pointer to data structure. */
410 user_size_t vc_len
; /* sizeof said structure. */
411 u_int32_t vc_spare
[12]; /* spare (must be zero). */
417 * New style VFS sysctls, do not reuse/conflict with the namespace for
420 #define VFS_CTL_STATFS 0x00010001 /* statfs */
421 #define VFS_CTL_UMOUNT 0x00010002 /* unmount */
422 #define VFS_CTL_QUERY 0x00010003 /* anything wrong? (vfsquery) */
423 #define VFS_CTL_NEWADDR 0x00010004 /* reconnect to new address */
424 #define VFS_CTL_TIMEO 0x00010005 /* set timeout for vfs notification */
425 #define VFS_CTL_NOLOCKS 0x00010006 /* disable file locking */
429 u_int32_t vq_spare
[31];
433 #define VQ_NOTRESP 0x0001 /* server down */
434 #define VQ_NEEDAUTH 0x0002 /* server bad auth */
435 #define VQ_LOWDISK 0x0004 /* we're low on space */
436 #define VQ_MOUNT 0x0008 /* new filesystem arrived */
437 #define VQ_UNMOUNT 0x0010 /* filesystem has left */
438 #define VQ_DEAD 0x0020 /* filesystem is dead, needs force unmount */
439 #define VQ_ASSIST 0x0040 /* filesystem needs assistance from external program */
440 #define VQ_NOTRESPLOCK 0x0080 /* server lockd down */
441 #define VQ_UPDATE 0x0100 /* filesystem information has changed */
442 #define VQ_FLAG0200 0x0200 /* placeholder */
443 #define VQ_FLAG0400 0x0400 /* placeholder */
444 #define VQ_FLAG0800 0x0800 /* placeholder */
445 #define VQ_FLAG1000 0x1000 /* placeholder */
446 #define VQ_FLAG2000 0x2000 /* placeholder */
447 #define VQ_FLAG4000 0x4000 /* placeholder */
448 #define VQ_FLAG8000 0x8000 /* placeholder */
453 /* Structure for setting device IO parameters per mount point */
455 u_int32_t io_maxreadcnt
; /* Max. byte count for read */
456 u_int32_t io_maxwritecnt
; /* Max. byte count for write */
457 u_int32_t io_segreadcnt
; /* Max. segment count for read */
458 u_int32_t io_segwritecnt
; /* Max. segment count for write */
459 u_int32_t io_maxsegreadsize
; /* Max. segment read size */
460 u_int32_t io_maxsegwritesize
; /* Max. segment write size */
461 u_int32_t io_devblocksize
; /* the underlying device block size */
462 u_int32_t io_flags
; /* flags for underlying device */
463 void * io_reserved
[2]; /* extended attribute information */
466 #define VFS_IOATTR_FLAGS_FUA 0x01 /* Write-through cache supported */
469 * Filesystem Registration information
471 #define VFS_TBLTHREADSAFE 0x0001
472 #define VFS_TBLFSNODELOCK 0x0002
473 #define VFS_TBLNOTYPENUM 0x0008
474 #define VFS_TBLLOCALVOL 0x0010
475 #define VFS_TBL64BITREADY 0x0020
476 #define VFS_TBLNATIVEXATTR 0x0040
477 #define VFS_TBLDIRLINKS 0x0080
478 #define VFS_TBLUNMOUNT_PREFLIGHT 0x0100 /* does a preflight check before unmounting */
479 #define VFS_TBLGENERICMNTARGS 0x0200 /* force generic mount args for local fs */
480 #define VFS_TBLREADDIR_EXTENDED 0x0400 /* fs supports VNODE_READDIR_EXTENDED */
481 #define VFS_TBLNOMACLABEL 0x1000
484 struct vfsops
* vfe_vfsops
; /* vfs operations */
485 int vfe_vopcnt
; /* # of vnodeopv_desc being registered (reg, spec, fifo ...) */
486 struct vnodeopv_desc
** vfe_opvdescs
; /* null terminated; */
487 int vfe_fstypenum
; /* historic filesystem type number */
488 char vfe_fsname
[MFSNAMELEN
]; /* filesystem type name */
489 uint32_t vfe_flags
; /* defines the FS capabilities */
490 void * vfe_reserv
[2]; /* reserved for future use; set this to zero*/
496 int (*vfs_mount
)(struct mount
*mp
, vnode_t devvp
, user_addr_t data
, vfs_context_t context
);
497 int (*vfs_start
)(struct mount
*mp
, int flags
, vfs_context_t context
);
498 int (*vfs_unmount
)(struct mount
*mp
, int mntflags
, vfs_context_t context
);
499 int (*vfs_root
)(struct mount
*mp
, struct vnode
**vpp
, vfs_context_t context
);
500 int (*vfs_quotactl
)(struct mount
*mp
, int cmds
, uid_t uid
, caddr_t arg
, vfs_context_t context
);
501 int (*vfs_getattr
)(struct mount
*mp
, struct vfs_attr
*, vfs_context_t context
);
502 /* int (*vfs_statfs)(struct mount *mp, struct vfsstatfs *sbp, vfs_context_t context);*/
503 int (*vfs_sync
)(struct mount
*mp
, int waitfor
, vfs_context_t context
);
504 int (*vfs_vget
)(struct mount
*mp
, ino64_t ino
, struct vnode
**vpp
, vfs_context_t context
);
505 int (*vfs_fhtovp
)(struct mount
*mp
, int fhlen
, unsigned char *fhp
, struct vnode
**vpp
,
506 vfs_context_t context
);
507 int (*vfs_vptofh
)(struct vnode
*vp
, int *fhlen
, unsigned char *fhp
, vfs_context_t context
);
508 int (*vfs_init
)(struct vfsconf
*);
509 int (*vfs_sysctl
)(int *, u_int
, user_addr_t
, size_t *, user_addr_t
, size_t, vfs_context_t context
);
510 int (*vfs_setattr
)(struct mount
*mp
, struct vfs_attr
*, vfs_context_t context
);
511 void *vfs_reserved
[7];
516 * flags passed into vfs_iterate
520 * return values from callback
522 #define VFS_RETURNED 0 /* done with vnode, reference can be dropped */
523 #define VFS_RETURNED_DONE 1 /* done with vnode, reference can be dropped, terminate iteration */
524 #define VFS_CLAIMED 2 /* don't drop reference */
525 #define VFS_CLAIMED_DONE 3 /* don't drop reference, terminate iteration */
530 * prototypes for exported VFS operations
532 extern int VFS_MOUNT(mount_t
, vnode_t
, user_addr_t
, vfs_context_t
);
533 extern int VFS_START(mount_t
, int, vfs_context_t
);
534 extern int VFS_UNMOUNT(mount_t
, int, vfs_context_t
);
535 extern int VFS_ROOT(mount_t
, vnode_t
*, vfs_context_t
);
536 extern int VFS_QUOTACTL(mount_t
, int, uid_t
, caddr_t
, vfs_context_t
);
537 extern int VFS_GETATTR(mount_t
, struct vfs_attr
*, vfs_context_t
);
538 extern int VFS_SETATTR(mount_t
, struct vfs_attr
*, vfs_context_t
);
539 extern int VFS_SYNC(mount_t
, int, vfs_context_t
);
540 extern int VFS_VGET(mount_t
, ino64_t
, vnode_t
*, vfs_context_t
);
541 extern int VFS_FHTOVP(mount_t
, int, unsigned char *, vnode_t
*, vfs_context_t
);
542 extern int VFS_VPTOFH(vnode_t
, int *, unsigned char *, vfs_context_t
);
544 /* The file system registrartion KPI */
545 int vfs_fsadd(struct vfs_fsentry
*, vfstable_t
*);
546 int vfs_fsremove(vfstable_t
);
547 int vfs_iterate(int, int (*)(struct mount
*, void *), void *);
549 uint64_t vfs_flags(mount_t
);
550 void vfs_setflags(mount_t
, uint64_t);
551 void vfs_clearflags(mount_t
, uint64_t);
553 int vfs_issynchronous(mount_t
);
554 int vfs_iswriteupgrade(mount_t
);
555 int vfs_isupdate(mount_t
);
556 int vfs_isreload(mount_t
);
557 int vfs_isforce(mount_t
);
558 int vfs_isrdonly(mount_t
);
559 int vfs_isrdwr(mount_t
);
560 int vfs_authopaque(mount_t
);
561 int vfs_authopaqueaccess(mount_t
);
562 void vfs_setauthopaque(mount_t
);
563 void vfs_setauthopaqueaccess(mount_t
);
564 void vfs_clearauthopaque(mount_t
);
565 void vfs_clearauthopaqueaccess(mount_t
);
566 int vfs_extendedsecurity(mount_t
);
567 void vfs_setextendedsecurity(mount_t
);
568 void vfs_clearextendedsecurity(mount_t
);
569 void vfs_setlocklocal(mount_t
);
570 int vfs_authcache_ttl(mount_t
);
571 void vfs_setauthcache_ttl(mount_t
, int);
572 void vfs_clearauthcache_ttl(mount_t
);
573 void vfs_markdependency(mount_t
);
576 * return value from vfs_cachedrights_ttl if
577 * neither MNTK_AUTH_OPAQUE | MNTK_AUTH_CACHE_TTL
578 * is set in mnt_kern_flag.. it indicates
579 * that no TTL is being applied to the vnode rights cache
581 #define CACHED_RIGHT_INFINITE_TTL ~0
584 uint32_t vfs_maxsymlen(mount_t
);
585 void vfs_setmaxsymlen(mount_t
, uint32_t);
586 void * vfs_fsprivate(mount_t
);
587 void vfs_setfsprivate(mount_t
, void *mntdata
);
589 struct vfsstatfs
* vfs_statfs(mount_t
);
590 #define VFS_USER_EVENT 0
591 #define VFS_KERNEL_EVENT 1
592 int vfs_update_vfsstat(mount_t
, vfs_context_t
, int eventtype
);
593 int vfs_getattr(mount_t mp
, struct vfs_attr
*vfa
, vfs_context_t ctx
);
594 int vfs_setattr(mount_t mp
, struct vfs_attr
*vfa
, vfs_context_t ctx
);
596 int vfs_typenum(mount_t
);
597 void vfs_name(mount_t
, char *);
598 int vfs_devblocksize(mount_t
);
599 void vfs_ioattr(mount_t
, struct vfsioattr
*);
600 void vfs_setioattr(mount_t
, struct vfsioattr
*);
601 int vfs_64bitready(mount_t
);
605 int vfs_busy(mount_t
, int);
606 void vfs_unbusy(mount_t
);
608 void vfs_getnewfsid(struct mount
*);
609 mount_t
vfs_getvfs(fsid_t
*);
610 mount_t
vfs_getvfs_by_mntonname(char *);
611 int vfs_mountedon(struct vnode
*);
612 int vfs_unmountbyfsid(fsid_t
*, int, vfs_context_t
);
614 void vfs_event_signal(fsid_t
*, u_int32_t
, intptr_t);
615 void vfs_event_init(void);
623 * Generic file handle
625 #define NFS_MAX_FH_SIZE NFSV4_MAX_FH_SIZE
626 #define NFSV4_MAX_FH_SIZE 128
627 #define NFSV3_MAX_FH_SIZE 64
628 #define NFSV2_MAX_FH_SIZE 32
630 int fh_len
; /* length of file handle */
631 unsigned char fh_data
[NFS_MAX_FH_SIZE
]; /* file handle value */
633 typedef struct fhandle fhandle_t
;
637 int fhopen(const struct fhandle
*, int);
638 int fstatfs(int, struct statfs
*) __DARWIN_INODE64(fstatfs
);
639 int fstatfs64(int, struct statfs64
*);
640 int getfh(const char *, fhandle_t
*);
641 int getfsstat(struct statfs
*, int, int) __DARWIN_INODE64(getfsstat
);
642 int getfsstat64(struct statfs64
*, int, int);
643 int getmntinfo(struct statfs
**, int) __DARWIN_INODE64(getmntinfo
);
644 int getmntinfo64(struct statfs64
**, int);
645 int mount(const char *, const char *, int, void *);
646 int statfs(const char *, struct statfs
*) __DARWIN_INODE64(statfs
);
647 int statfs64(const char *, struct statfs64
*);
648 int unmount(const char *, int);
649 int getvfsbyname(const char *, struct vfsconf
*);
653 #endif /* !_SYS_MOUNT_H_ */