/*
- * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
/*
*
* @(#)mount.h 8.21 (Berkeley) 5/20/95
*/
+/*
+ * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
+ * support for mandatory and extensible security protections. This notice
+ * is included in support of clause 2.2 (b) of the Apple Public License,
+ * Version 2.0.
+ */
+
#ifndef _SYS_MOUNT_H_
#define _SYS_MOUNT_H_
*/
#define MFSNAMELEN 15 /* length of fs type name, not inc. null */
+#define MFSTYPENAMELEN 16 /* length of fs type name including null */
#define MNAMELEN 90 /* length of buffer for returned name */
+#define __DARWIN_STRUCT_STATFS64 { \
+ uint32_t f_bsize; /* fundamental file system block size */ \
+ int32_t f_iosize; /* optimal transfer block size */ \
+ uint64_t f_blocks; /* total data blocks in file system */ \
+ uint64_t f_bfree; /* free blocks in fs */ \
+ uint64_t f_bavail; /* free blocks avail to non-superuser */ \
+ uint64_t f_files; /* total file nodes in file system */ \
+ uint64_t f_ffree; /* free file nodes in fs */ \
+ fsid_t f_fsid; /* file system id */ \
+ uid_t f_owner; /* user that mounted the filesystem */ \
+ uint32_t f_type; /* type of filesystem */ \
+ uint32_t f_flags; /* copy of mount exported flags */ \
+ uint32_t f_fssubtype; /* fs sub-type (flavor) */ \
+ char f_fstypename[MFSTYPENAMELEN]; /* fs type name */ \
+ char f_mntonname[MAXPATHLEN]; /* directory on which mounted */ \
+ char f_mntfromname[MAXPATHLEN]; /* mounted filesystem */ \
+ uint32_t f_reserved[8]; /* For future use */ \
+}
+
+struct statfs64 __DARWIN_STRUCT_STATFS64;
+
+#if __DARWIN_64_BIT_INO_T
+
+struct statfs __DARWIN_STRUCT_STATFS64;
+
+#else /* !__DARWIN_64_BIT_INO_T */
+
/*
* LP64 - WARNING - must be kept in sync with struct user_statfs in mount_internal.h.
*/
uid_t f_owner; /* user that mounted the filesystem */
short f_reserved1; /* spare for later */
short f_type; /* type of filesystem */
- long f_flags; /* copy of mount exported flags */
+ long f_flags; /* copy of mount exported flags */
long f_reserved2[2]; /* reserved for future use */
char f_fstypename[MFSNAMELEN]; /* fs type name */
char f_mntonname[MNAMELEN]; /* directory on which mounted */
#endif
};
+#endif /* __DARWIN_64_BIT_INO_T */
-#define MFSTYPENAMELEN 16 /* length of fs type name including null */
-
-#if __DARWIN_ALIGN_POWER
-#pragma options align=power
-#endif
+#pragma pack(4)
struct vfsstatfs {
uint32_t f_bsize; /* fundamental file system block size */
void *f_reserved[2]; /* For future use == 0 */
};
-#if __DARWIN_ALIGN_POWER
-#pragma options align=reset
-#endif
+#pragma pack()
+
+#ifdef KERNEL
+/*
+ * Kernel level support for the VFS_GETATTR(), VFS_SETATTR() for use in
+ * implementation of filesystem KEXTs, and by the vfs_getattr() and
+ * vfs_setattr() KPIs.
+ */
#define VFSATTR_INIT(s) ((s)->f_supported = (s)->f_active = 0LL)
#define VFSATTR_SET_SUPPORTED(s, a) ((s)->f_supported |= VFSATTR_ ## a)
#define VFSATTR_f_carbon_fsid (1LL<< 23)
/*
- * New VFS_STAT argument structure.
+ * Argument structure.
*/
-#if __DARWIN_ALIGN_POWER
-#pragma options align=power
-#endif
+#pragma pack(4)
struct vfs_attr {
uint64_t f_supported;
uint16_t f_carbon_fsid; /* same as Carbon's FSVolumeInfo.filesystemID */
};
-#if __DARWIN_ALIGN_POWER
-#pragma options align=reset
-#endif
+#pragma pack()
+
+#endif /* KERNEL */
/*
* User specifiable flags.
#define MNT_NODEV 0x00000010 /* don't interpret special files */
#define MNT_UNION 0x00000020 /* union with underlying filesystem */
#define MNT_ASYNC 0x00000040 /* file system written asynchronously */
-#define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */
-#define MNT_IGNORE_OWNERSHIP 0x00200000 /* VFS will ignore ownership information on filesystem
- * objects */
-#define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */
-#define MNT_JOURNALED 0x00800000 /* filesystem is journaled */
-#define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */
-#define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */
-
-/* backwards compatibility only */
-#define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
/*
* NFS export related mount flags.
*/
#define MNT_EXPORTED 0x00000100 /* file system is exported */
+/*
+ * MAC labeled / "quarantined" flag
+ */
+#define MNT_QUARANTINE 0x00000400 /* file system is quarantined */
+
/*
* Flags set by internal operations.
*/
#define MNT_LOCAL 0x00001000 /* filesystem is stored locally */
#define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */
#define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */
-#define MNT_DOVOLFS 0x00008000 /* FS supports volfs */
+#define MNT_DOVOLFS 0x00008000 /* FS supports volfs (deprecated flag in Mac OS X 10.5) */
+
+
+#define MNT_DONTBROWSE 0x00100000 /* file system is not appropriate path to user data */
+#define MNT_IGNORE_OWNERSHIP 0x00200000 /* VFS will ignore ownership information on filesystem objects */
+#define MNT_AUTOMOUNTED 0x00400000 /* filesystem was mounted by automounter */
+#define MNT_JOURNALED 0x00800000 /* filesystem is journaled */
+#define MNT_NOUSERXATTR 0x01000000 /* Don't allow user extended attributes */
+#define MNT_DEFWRITE 0x02000000 /* filesystem should defer writes */
+#define MNT_MULTILABEL 0x04000000 /* MAC support for individual labels */
+#define MNT_NOATIME 0x10000000 /* disable update of file access time */
+
+/* backwards compatibility only */
+#define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
+
/*
* XXX I think that this could now become (~(MNT_CMDFLAGS))
*/
#define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | \
MNT_NOSUID | MNT_NODEV | MNT_UNION | \
- MNT_ASYNC | MNT_EXPORTED | \
- MNT_LOCAL | MNT_QUOTA | \
+ MNT_ASYNC | MNT_EXPORTED | MNT_QUARANTINE | \
+ MNT_LOCAL | MNT_QUOTA | \
MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | \
- MNT_UNKNOWNPERMISSIONS | MNT_AUTOMOUNTED | MNT_JOURNALED | \
- MNT_DEFWRITE)
+ MNT_IGNORE_OWNERSHIP | MNT_AUTOMOUNTED | MNT_JOURNALED | \
+ MNT_NOUSERXATTR | MNT_DEFWRITE | MNT_MULTILABEL | MNT_NOATIME)
/*
* External filesystem command modifier flags.
* Unmount can use the MNT_FORCE flag.
#define VFS_CTL_VERS1 0x01
#ifdef KERNEL
-// LP64todo - should this move?
/* LP64 version of vfsconf. all pointers
* grow when we're dealing with a 64-bit process.
* WARNING - keep in sync with vfsconf
*/
-#if __DARWIN_ALIGN_NATURAL
-#pragma options align=natural
-#endif
-
struct user_vfsconf {
user_addr_t vfc_vfsops; /* filesystem operations vector */
char vfc_name[MFSNAMELEN]; /* filesystem type name */
int vfc_typenum; /* historic filesystem type number */
int vfc_refcount; /* number mounted of this type */
int vfc_flags; /* permanent flags */
- user_addr_t vfc_mountroot; /* if != NULL, routine to mount root */
+ user_addr_t vfc_mountroot __attribute((aligned(8))); /* if != NULL, routine to mount root */
user_addr_t vfc_next; /* next in list */
};
struct user_vfsidctl {
int vc_vers; /* should be VFSIDCTL_VERS1 (below) */
fsid_t vc_fsid; /* fsid to operate on. */
- user_addr_t vc_ptr; /* pointer to data structure. */
+ user_addr_t vc_ptr __attribute((aligned(8))); /* pointer to data structure. */
user_size_t vc_len; /* sizeof said structure. */
u_int32_t vc_spare[12]; /* spare (must be zero). */
};
-#if __DARWIN_ALIGN_NATURAL
-#pragma options align=reset
-#endif
-
#endif /* KERNEL */
/*
u_int32_t io_maxsegreadsize; /* Max. segment read size */
u_int32_t io_maxsegwritesize; /* Max. segment write size */
u_int32_t io_devblocksize; /* the underlying device block size */
- void * io_reserved[3]; /* extended attribute information */
+ u_int32_t io_flags; /* flags for underlying device */
+ void * io_reserved[2]; /* extended attribute information */
};
+#define VFS_IOATTR_FLAGS_FUA 0x01 /* Write-through cache supported */
/*
* Filesystem Registration information
*/
-
-#define VFS_TBLTHREADSAFE 0x01
-#define VFS_TBLFSNODELOCK 0x02
-#define VFS_TBLNOTYPENUM 0x08
-#define VFS_TBLLOCALVOL 0x10
-#define VFS_TBL64BITREADY 0x20
+#define VFS_TBLTHREADSAFE 0x0001
+#define VFS_TBLFSNODELOCK 0x0002
+#define VFS_TBLNOTYPENUM 0x0008
+#define VFS_TBLLOCALVOL 0x0010
+#define VFS_TBL64BITREADY 0x0020
+#define VFS_TBLNATIVEXATTR 0x0040
+#define VFS_TBLDIRLINKS 0x0080
+#define VFS_TBLUNMOUNT_PREFLIGHT 0x0100 /* does a preflight check before unmounting */
+#define VFS_TBLGENERICMNTARGS 0x0200 /* force generic mount args for local fs */
+#define VFS_TBLREADDIR_EXTENDED 0x0400 /* fs supports VNODE_READDIR_EXTENDED */
+#define VFS_TBLNOMACLABEL 0x1000
struct vfs_fsentry {
struct vfsops * vfe_vfsops; /* vfs operations */
extern int VFS_UNMOUNT(mount_t, int, vfs_context_t);
extern int VFS_ROOT(mount_t, vnode_t *, vfs_context_t);
extern int VFS_QUOTACTL(mount_t, int, uid_t, caddr_t, vfs_context_t);
+extern int VFS_GETATTR(mount_t, struct vfs_attr *, vfs_context_t);
+extern int VFS_SETATTR(mount_t, struct vfs_attr *, vfs_context_t);
extern int VFS_SYNC(mount_t, int, vfs_context_t);
extern int VFS_VGET(mount_t, ino64_t, vnode_t *, vfs_context_t);
extern int VFS_FHTOVP(mount_t, int, unsigned char *, vnode_t *, vfs_context_t);
void vfs_setextendedsecurity(mount_t);
void vfs_clearextendedsecurity(mount_t);
void vfs_setlocklocal(mount_t);
+int vfs_authcache_ttl(mount_t);
+void vfs_setauthcache_ttl(mount_t, int);
+void vfs_clearauthcache_ttl(mount_t);
+void vfs_markdependency(mount_t);
+/*
+ * return value from vfs_cachedrights_ttl if
+ * neither MNTK_AUTH_OPAQUE | MNTK_AUTH_CACHE_TTL
+ * is set in mnt_kern_flag.. it indicates
+ * that no TTL is being applied to the vnode rights cache
+ */
+#define CACHED_RIGHT_INFINITE_TTL ~0
uint32_t vfs_maxsymlen(mount_t);
void vfs_setfsprivate(mount_t, void *mntdata);
struct vfsstatfs * vfs_statfs(mount_t);
-int vfs_update_vfsstat(mount_t, vfs_context_t);
+#define VFS_USER_EVENT 0
+#define VFS_KERNEL_EVENT 1
+int vfs_update_vfsstat(mount_t, vfs_context_t, int eventtype);
int vfs_getattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx);
int vfs_setattr(mount_t mp, struct vfs_attr *vfa, vfs_context_t ctx);
int vfs_64bitready(mount_t);
+#define LK_NOWAIT 1
int vfs_busy(mount_t, int);
void vfs_unbusy(mount_t);
void vfs_getnewfsid(struct mount *);
mount_t vfs_getvfs(fsid_t *);
-mount_t vfs_getvfs_by_mntonname(u_char *);
+mount_t vfs_getvfs_by_mntonname(char *);
int vfs_mountedon(struct vnode *);
+int vfs_unmountbyfsid(fsid_t *, int, vfs_context_t);
void vfs_event_signal(fsid_t *, u_int32_t, intptr_t);
void vfs_event_init(void);
/*
* Generic file handle
*/
-#define NFS_MAX_FH_SIZE 64
+#define NFS_MAX_FH_SIZE NFSV4_MAX_FH_SIZE
+#define NFSV4_MAX_FH_SIZE 128
+#define NFSV3_MAX_FH_SIZE 64
#define NFSV2_MAX_FH_SIZE 32
struct fhandle {
int fh_len; /* length of file handle */
__BEGIN_DECLS
int fhopen(const struct fhandle *, int);
-int fstatfs(int, struct statfs *);
+int fstatfs(int, struct statfs *) __DARWIN_INODE64(fstatfs);
+int fstatfs64(int, struct statfs64 *);
int getfh(const char *, fhandle_t *);
-int getfsstat(struct statfs *, int, int);
-int getmntinfo(struct statfs **, int);
+int getfsstat(struct statfs *, int, int) __DARWIN_INODE64(getfsstat);
+int getfsstat64(struct statfs64 *, int, int);
+int getmntinfo(struct statfs **, int) __DARWIN_INODE64(getmntinfo);
+int getmntinfo64(struct statfs64 **, int);
int mount(const char *, const char *, int, void *);
-int statfs(const char *, struct statfs *);
+int statfs(const char *, struct statfs *) __DARWIN_INODE64(statfs);
+int statfs64(const char *, struct statfs64 *);
int unmount(const char *, int);
int getvfsbyname(const char *, struct vfsconf *);
__END_DECLS