#include <sys/mount.h>
sys/mount.h
structstatfs
| 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[16] | f_fstypename | fs type name |
| char[1024] | f_mntonname | directory on which mounted |
| char[1024] | f_mntfromname | mounted filesystem |
| uint32_t | f_flags_ext | extended flags |
| uint32_t[7] | f_reserved | For future use |
structvfsstatfs
| uint32_t | f_bsize | fundamental file system block size |
| size_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_bused | 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 |
| uint64_t | f_flags | copy of mount exported flags |
| char[16] | f_fstypename | fs type name inclus |
| char[1024] | f_mntonname | directory on which mounted |
| char[1024] | f_mntfromname | mounted filesystem |
| uint32_t | f_fssubtype | fs sub-type (flavor) |
| void *[2] | f_reserved | For future use == 0 |
macroMNT_RDONLY
User specifiable flags.
Unmount uses MNT_FORCE flag.
#define MNT_RDONLY 0x00000001
read only filesystem
macroMNT_EXPORTED
NFS export related mount flags.
#define MNT_EXPORTED 0x00000100
file system is exported
macroMNT_REMOVABLE
#define MNT_REMOVABLE 0x00000200
macroMNT_QUARANTINE
MAC labeled / "quarantined" flag
#define MNT_QUARANTINE 0x00000400
file system is quarantined
macroMNT_LOCAL
Flags set by internal operations.
#define MNT_LOCAL 0x00001000
filesystem is stored locally
macroMNT_DONTBROWSE
#define MNT_DONTBROWSE 0x00100000
file system is not appropriate path to user data
macroMNT_IGNORE_OWNERSHIP
#define MNT_IGNORE_OWNERSHIP 0x00200000
VFS will ignore ownership information on filesystem objects
macroMNT_UNKNOWNPERMISSIONS
backwards compatibility only
#define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP
macroMNT_VISFLAGMASK
XXX I think that this could now become (~(MNT_CMDFLAGS))
but the 'mount' program may need changing to handle this.
#define MNT_VISFLAGMASK (MNT_RDONLY | MNT_SYNCHRONOUS | MNT_NOEXEC | MNT_NOSUID | MNT_NODEV | MNT_UNION | MNT_ASYNC | MNT_EXPORTED | MNT_QUARANTINE | MNT_LOCAL | MNT_QUOTA | MNT_REMOVABLE | MNT_ROOTFS | MNT_DOVOLFS | MNT_DONTBROWSE | MNT_IGNORE_OWNERSHIP | MNT_AUTOMOUNTED | MNT_JOURNALED | MNT_NOUSERXATTR | MNT_DEFWRITE | MNT_MULTILABEL | MNT_NOFOLLOW | MNT_NOATIME | MNT_STRICTATIME | MNT_SNAPSHOT | MNT_CPROTECT)
macroMNT_UPDATE
External filesystem command modifier flags.
Unmount can use the MNT_FORCE flag.
XXX These are not STATES and really should be somewhere else.
External filesystem control flags.
#define MNT_UPDATE 0x00010000
not a real mount, just an update
macroMNT_CMDFLAGS
#define MNT_CMDFLAGS (MNT_UPDATE|MNT_NOBLOCK|MNT_RELOAD|MNT_FORCE)
macroVFS_GENERIC
Sysctl CTL_VFS definitions.
Second level identifier specifies which filesystem. Second level
identifier VFS_GENERIC returns information about all filesystems.
#define VFS_GENERIC 0
generic filesystem information
macroVFS_MAXTYPENUM
Third level identifiers for VFS_GENERIC are given below; third
level identifiers for specific filesystems are given in their
mount specific header files.
#define VFS_MAXTYPENUM 1
int: highest defined filesystem type
macroMNT_WAIT
Flags for various system call interfaces.
waitfor flags to vfs_sync() and getfsstat()
#define MNT_WAIT 1
synchronized I/O file integrity completion
structvfsconf
Reserved fields preserve binary compatibility
| uint32_t | vfc_reserved1 | opaque |
| char[15] | vfc_name | filesystem type name |
| int | vfc_typenum | historic filesystem type number |
| int | vfc_refcount | number mounted of this type |
| int | vfc_flags | permanent flags |
| uint32_t | vfc_reserved2 | opaque |
| uint32_t | vfc_reserved3 | opaque |
structvfsidctl
| int | vc_vers | should be VFSIDCTL_VERS1 (below) |
| fsid_t | vc_fsid | fsid to operate on. |
| void * | vc_ptr | pointer to data structure. |
| size_t | vc_len | sizeof said structure. |
| u_int32_t[12] | vc_spare | spare (must be zero). |
macroVFS_CTL_OSTATFS
New style VFS sysctls, do not reuse/conflict with the namespace for
private sysctls.
#define VFS_CTL_OSTATFS 0x00010001
old legacy statfs
macroVFS_CTL_STATFS
Automatically select the correct VFS_CTL_*STATFS* flavor based
on what "struct statfs" layout the client will use.
#define VFS_CTL_STATFS VFS_CTL_STATFS64
structvfs_server
| int32_t | vs_minutes | minutes until server goes down. |
| u_int8_t[768] | vs_server_name | UTF8 server name to display (null terminated) |
structnetfs_status
NetFS mount status - returned by VFS_CTL_NSTATUS
| u_int32_t | ns_status | Current status of mount (vfsquery flags) |
| char[512] | ns_mountopts | Significant mount options |
| uint32_t | ns_waittime | Time waiting for reply (sec) |
| uint32_t | ns_threadcount | Number of threads blocked on network calls |
| uint64_t[0] | ns_threadids | Thread IDs of those blocked threads |
macroVQ_SYNCEVENT
#define VQ_SYNCEVENT 0x0400
a sync just happened (not set by kernel starting Mac OS X 10.9)
macroVQ_FREE_SPACE_CHANGE
#define VQ_FREE_SPACE_CHANGE 0x8000
free disk space has significantly changed
macroVQ_PURGEABLE_SPACE_CHANGE
#define VQ_PURGEABLE_SPACE_CHANGE 0x10000
purgeable disk space has significantly changed
macroVQ_IDLE_PURGE_NOTIFY
#define VQ_IDLE_PURGE_NOTIFY 0x20000
Above nearlowdisk and below desired disk space
macroNFSV4_MAX_FH_SIZE
#define NFSV4_MAX_FH_SIZE 128
macroNFSV3_MAX_FH_SIZE
#define NFSV3_MAX_FH_SIZE 64
macroNFSV2_MAX_FH_SIZE
#define NFSV2_MAX_FH_SIZE 32
structfhandle
| unsigned int | fh_len | length of file handle |
| unsigned char[128] | fh_data | file handle value |
macroCRYPTEX_AUTH_STRUCT_VERSION
Cryptex authentication
Note: these 2 enums are used in conjunction, graftdmg_type is used for authentication while grafting
cryptexes and cryptex_auth_type is currently used for authentication while mounting generic
cryptexes. We need to make sure we do not use the reserved values in each for a new authentication type.
bump up the version for any change that has kext dependency
#define CRYPTEX_AUTH_STRUCT_VERSION 2
enumgraftdmg_type_t
| GRAFTDMG_CRYPTEX_BOOT | 1 | |
| GRAFTDMG_CRYPTEX_PREBOOT | 2 | |
| GRAFTDMG_CRYPTEX_DOWNLEVEL | 3 | |
| GRAFTDMG_CRYPTEX_AUTH_ENV_GENERIC | 4 | |
| GRAFTDMG_CRYPTEX_PDI_NONCE | 6 | |
| GRAFTDMG_CRYPTEX_EFFECTIVE_AP | 7 | |
| GRAFTDMG_CRYPTEX_MOBILE_ASSET | 8 | |
| GRAFTDMG_CRYPTEX_MOBILE_ASSET_WITH_CODE | 9 | |
| GRAFTDMG_CRYPTEX_MAX | 9 |
typedefgraftdmg_type_t
typedef enum graftdmg_type_t graftdmg_type_t;
enumcryptex_auth_type_t
| CRYPTEX1_AUTH_ENV_GENERIC | 4 | |
| CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL | 5 | |
| CRYPTEX_AUTH_PDI_NONCE | 6 | |
| CRYPTEX_AUTH_MOBILE_ASSET | 8 | |
| CRYPTEX_AUTH_MOBILE_ASSET_WITH_CODE | 9 | |
| CRYPTEX_AUTH_MAX | 9 |
typedefcryptex_auth_type_t
typedef enum cryptex_auth_type_t cryptex_auth_type_t;
functionfhopen
int fhopen(const struct fhandle *, int)
man page · January 9, 2007
fhopen(2) — open a file by file handlefunctionfstatfs
__DARWIN_INODE64(fstatfs) int fstatfs(int, struct statfs *)
man page · August 14, 2008
fstatfs(2) — get file system statisticsfunctiongetfh
int getfh(const char *, fhandle_t *)
man page · January 9, 2007
getfh(2) — get file handlefunctiongetfsstat
__DARWIN_INODE64(getfsstat) int getfsstat(struct statfs *, int, int)
man page · Oct 28, 2008
getfsstat(2) — get list of all mounted file systemsfunctiongetmntinfo
__DARWIN_INODE64(getmntinfo) int getmntinfo(struct statfs **, int)
man page · April 12, 2017
getmntinfo(3) — get information about mounted file systemsfunctiongetmntinfo_r_np
__DARWIN_INODE64(getmntinfo_r_np) __OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0) int getmntinfo_r_np(struct statfs **, int)
man page · April 12, 2017
getmntinfo_r_np(3) — get information about mounted file systemsfunctionmount
int mount(const char *, const char *, int, void *)
man page · December 11, 1993
mount(2) — mount or dismount a filesystemfunctionfmount
__OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0) __TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0)
int fmount(const char *, int, int, void *)man page · December 11, 1993
fmount(2) — mount or dismount a filesystemfunctionstatfs
__DARWIN_INODE64(statfs)
int statfs(const char *, struct statfs *)man page · August 14, 2008
statfs(2) — get file system statisticsfunctionunmount
int unmount(const char *, int)
man page · December 11, 1993
unmount(2) — mount or dismount a filesystemfunctionfunmount
__OSX_AVAILABLE(16.0) __IOS_AVAILABLE(19.0) __TVOS_AVAILABLE(19.0) __WATCHOS_AVAILABLE(12.0)
int funmount(int, int)man page · December 11, 1993
funmount(2) — mount or dismount a filesystemfunctiongetvfsbyname
int getvfsbyname(const char *, struct vfsconf *)
man page · May 4, 1995
getvfsbyname(3) — get information about a filesystem