#include <sys/mount.h>

sys/mount.h

82 macros · 12 functions · 8 structs · 3 typedefs · 2 enums

macroMFSNAMELEN

#define MFSNAMELEN 15
length of fs type name, not inc. null

macroMFSTYPENAMELEN

#define MFSTYPENAMELEN 16
length of fs type name including null

macroMNAMELEN

#define MNAMELEN MAXPATHLEN
length of buffer for returned name

macroMNT_EXT_ROOT_DATA_VOL

#define MNT_EXT_ROOT_DATA_VOL 0x00000001
Data volume of root volume group

macroMNT_EXT_FSKIT

#define MNT_EXT_FSKIT 0x00000002
this is an FSKit mount

structstatfs

size 2168, align 8
uint32_tf_bsizefundamental file system block size
int32_tf_iosizeoptimal transfer block size
uint64_tf_blockstotal data blocks in file system
uint64_tf_bfreefree blocks in fs
uint64_tf_bavailfree blocks avail to non-superuser
uint64_tf_filestotal file nodes in file system
uint64_tf_ffreefree file nodes in fs
fsid_tf_fsidfile system id
uid_tf_owneruser that mounted the filesystem
uint32_tf_typetype of filesystem
uint32_tf_flagscopy of mount exported flags
uint32_tf_fssubtypefs sub-type (flavor)
char[16]f_fstypenamefs type name
char[1024]f_mntonnamedirectory on which mounted
char[1024]f_mntfromnamemounted filesystem
uint32_tf_flags_extextended flags
uint32_t[7]f_reservedFor future use

structvfsstatfs

size 2164, align 4
uint32_tf_bsizefundamental file system block size
size_tf_iosizeoptimal transfer block size
uint64_tf_blockstotal data blocks in file system
uint64_tf_bfreefree blocks in fs
uint64_tf_bavailfree blocks avail to non-superuser
uint64_tf_busedfree blocks avail to non-superuser
uint64_tf_filestotal file nodes in file system
uint64_tf_ffreefree file nodes in fs
fsid_tf_fsidfile system id
uid_tf_owneruser that mounted the filesystem
uint64_tf_flagscopy of mount exported flags
char[16]f_fstypenamefs type name inclus
char[1024]f_mntonnamedirectory on which mounted
char[1024]f_mntfromnamemounted filesystem
uint32_tf_fssubtypefs sub-type (flavor)
void *[2]f_reservedFor future use == 0

macroMNT_RDONLY

User specifiable flags. Unmount uses MNT_FORCE flag.
#define MNT_RDONLY 0x00000001
read only filesystem

macroMNT_SYNCHRONOUS

#define MNT_SYNCHRONOUS 0x00000002
file system written synchronously

macroMNT_NOEXEC

#define MNT_NOEXEC 0x00000004
can't exec from filesystem

macroMNT_NOSUID

#define MNT_NOSUID 0x00000008
don't honor setuid bits on fs

macroMNT_NODEV

#define MNT_NODEV 0x00000010
don't interpret special files

macroMNT_UNION

#define MNT_UNION 0x00000020
union with underlying filesystem

macroMNT_ASYNC

#define MNT_ASYNC 0x00000040
file system written asynchronously

macroMNT_CPROTECT

#define MNT_CPROTECT 0x00000080
file system supports content protection

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_QUOTA

#define MNT_QUOTA 0x00002000
quotas are enabled on filesystem

macroMNT_ROOTFS

#define MNT_ROOTFS 0x00004000
identifies the root filesystem

macroMNT_DOVOLFS

#define MNT_DOVOLFS 0x00008000
FS supports volfs (deprecated flag in Mac OS X 10.5)

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_AUTOMOUNTED

#define MNT_AUTOMOUNTED 0x00400000
filesystem was mounted by automounter

macroMNT_JOURNALED

#define MNT_JOURNALED 0x00800000
filesystem is journaled

macroMNT_NOUSERXATTR

#define MNT_NOUSERXATTR 0x01000000
Don't allow user extended attributes

macroMNT_DEFWRITE

#define MNT_DEFWRITE 0x02000000
filesystem should defer writes

macroMNT_MULTILABEL

#define MNT_MULTILABEL 0x04000000
MAC support for individual labels

macroMNT_NOFOLLOW

#define MNT_NOFOLLOW 0x08000000
don't follow symlink when resolving mount point

macroMNT_NOATIME

#define MNT_NOATIME 0x10000000
disable update of file access time

macroMNT_SNAPSHOT

#define MNT_SNAPSHOT 0x40000000
The mount is a snapshot

macroMNT_STRICTATIME

#define MNT_STRICTATIME 0x80000000
enable strict update of file access time

macroMNT_UNKNOWNPERMISSIONS

backwards compatibility only
#define MNT_UNKNOWNPERMISSIONS MNT_IGNORE_OWNERSHIP

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_NOBLOCK

#define MNT_NOBLOCK 0x00020000
don't block unmount if not responding

macroMNT_RELOAD

#define MNT_RELOAD 0x00040000
reload filesystem data

macroMNT_FORCE

#define MNT_FORCE 0x00080000
force unmount or readonly change

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_NUMMNTOPS

#define VFS_NUMMNTOPS 1
int: total num of vfs mount/unmount operations

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

macroVFS_CONF

#define VFS_CONF 2
struct: vfsconf for filesystem given as next argument

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

macroMNT_NOWAIT

#define MNT_NOWAIT 2
start all I/O, but do not wait for it

macroMNT_DWAIT

#define MNT_DWAIT 4
synchronized I/O data integrity completion

structvfsconf

Reserved fields preserve binary compatibility
size 40, align 4
uint32_tvfc_reserved1opaque
char[15]vfc_namefilesystem type name
intvfc_typenumhistoric filesystem type number
intvfc_refcountnumber mounted of this type
intvfc_flagspermanent flags
uint32_tvfc_reserved2opaque
uint32_tvfc_reserved3opaque

structvfsidctl

size 80, align 8
intvc_versshould be VFSIDCTL_VERS1 (below)
fsid_tvc_fsidfsid to operate on.
void *vc_ptrpointer to data structure.
size_tvc_lensizeof said structure.
u_int32_t[12]vc_sparespare (must be zero).

macroVFS_CTL_VERS1

vfsidctl API version.
#define VFS_CTL_VERS1 0x01

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_UMOUNT

#define VFS_CTL_UMOUNT 0x00010002
unmount

macroVFS_CTL_QUERY

#define VFS_CTL_QUERY 0x00010003
anything wrong? (vfsquery)

macroVFS_CTL_NEWADDR

#define VFS_CTL_NEWADDR 0x00010004
reconnect to new address

macroVFS_CTL_TIMEO

#define VFS_CTL_TIMEO 0x00010005
set timeout for vfs notification

macroVFS_CTL_NOLOCKS

#define VFS_CTL_NOLOCKS 0x00010006
disable file locking

macroVFS_CTL_SADDR

#define VFS_CTL_SADDR 0x00010007
get server address

macroVFS_CTL_DISC

#define VFS_CTL_DISC 0x00010008
server disconnected

macroVFS_CTL_SERVERINFO

#define VFS_CTL_SERVERINFO 0x00010009
information about fs server

macroVFS_CTL_NSTATUS

#define VFS_CTL_NSTATUS 0x0001000A
netfs mount status

macroVFS_CTL_STATFS64

#define VFS_CTL_STATFS64 0x0001000B
statfs64

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

structvfsquery

size 128, align 4
u_int32_tvq_flags
u_int32_t[31]vq_spare

structvfs_server

size 772, align 4
int32_tvs_minutesminutes until server goes down.
u_int8_t[768]vs_server_nameUTF8 server name to display (null terminated)

structnetfs_status

NetFS mount status - returned by VFS_CTL_NSTATUS
size 528, align 8
u_int32_tns_statusCurrent status of mount (vfsquery flags)
char[512]ns_mountoptsSignificant mount options
uint32_tns_waittimeTime waiting for reply (sec)
uint32_tns_threadcountNumber of threads blocked on network calls
uint64_t[0]ns_threadidsThread IDs of those blocked threads

macroVQ_NOTRESP

vfsquery flags
#define VQ_NOTRESP 0x0001
server down

macroVQ_NEEDAUTH

#define VQ_NEEDAUTH 0x0002
server bad auth

macroVQ_LOWDISK

#define VQ_LOWDISK 0x0004
we're low on space

macroVQ_MOUNT

#define VQ_MOUNT 0x0008
new filesystem arrived

macroVQ_UNMOUNT

#define VQ_UNMOUNT 0x0010
filesystem has left

macroVQ_DEAD

#define VQ_DEAD 0x0020
filesystem is dead, needs force unmount

macroVQ_ASSIST

#define VQ_ASSIST 0x0040
filesystem needs assistance from external program

macroVQ_NOTRESPLOCK

#define VQ_NOTRESPLOCK 0x0080
server lockd down

macroVQ_UPDATE

#define VQ_UPDATE 0x0100
filesystem information has changed

macroVQ_VERYLOWDISK

#define VQ_VERYLOWDISK 0x0200
file system has *very* little disk space left

macroVQ_SYNCEVENT

#define VQ_SYNCEVENT 0x0400
a sync just happened (not set by kernel starting Mac OS X 10.9)

macroVQ_SERVEREVENT

#define VQ_SERVEREVENT 0x0800
server issued notification/warning

macroVQ_QUOTA

#define VQ_QUOTA 0x1000
a user quota has been hit

macroVQ_NEARLOWDISK

#define VQ_NEARLOWDISK 0x2000
Above lowdisk and below desired disk space

macroVQ_DESIRED_DISK

#define VQ_DESIRED_DISK 0x4000
the desired disk space

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

macroVQ_FLAG40000

#define VQ_FLAG40000 0x40000
placeholder

macroNFS_MAX_FH_SIZE

Generic file handle
#define NFS_MAX_FH_SIZE NFSV4_MAX_FH_SIZE

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

size 132, align 4
unsigned intfh_lenlength of file handle
unsigned char[128]fh_datafile handle value

typedeffhandle_t

typedef struct fhandle fhandle_t

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

underlying type uint32_t
GRAFTDMG_CRYPTEX_BOOT1
GRAFTDMG_CRYPTEX_PREBOOT2
GRAFTDMG_CRYPTEX_DOWNLEVEL3
GRAFTDMG_CRYPTEX_AUTH_ENV_GENERIC4
GRAFTDMG_CRYPTEX_PDI_NONCE6
GRAFTDMG_CRYPTEX_EFFECTIVE_AP7
GRAFTDMG_CRYPTEX_MOBILE_ASSET8
GRAFTDMG_CRYPTEX_MOBILE_ASSET_WITH_CODE9
GRAFTDMG_CRYPTEX_MAX9

typedefgraftdmg_type_t

typedef enum graftdmg_type_t graftdmg_type_t;

enumcryptex_auth_type_t

underlying type uint32_t
CRYPTEX1_AUTH_ENV_GENERIC4
CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL5
CRYPTEX_AUTH_PDI_NONCE6
CRYPTEX_AUTH_MOBILE_ASSET8
CRYPTEX_AUTH_MOBILE_ASSET_WITH_CODE9
CRYPTEX_AUTH_MAX9

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 handle

functionfstatfs

__DARWIN_INODE64(fstatfs)
int fstatfs(int, struct statfs *)
man page · August 14, 2008
fstatfs(2) — get file system statistics

functiongetfh

int getfh(const char *, fhandle_t *)
man page · January 9, 2007
getfh(2) — get file handle

functiongetfsstat

__DARWIN_INODE64(getfsstat)
int getfsstat(struct statfs *, int, int)
man page · Oct 28, 2008
getfsstat(2) — get list of all mounted file systems

functiongetmntinfo

__DARWIN_INODE64(getmntinfo)
int getmntinfo(struct statfs **, int)
man page · April 12, 2017
getmntinfo(3) — get information about mounted file systems

functiongetmntinfo_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 systems

functionmount

int mount(const char *, const char *, int, void *)
man page · December 11, 1993
mount(2) — mount or dismount a filesystem

functionfmount

__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 filesystem

functionstatfs

__DARWIN_INODE64(statfs)
int statfs(const char *, struct statfs *)
man page · August 14, 2008
statfs(2) — get file system statistics

functionunmount

int unmount(const char *, int)
man page · December 11, 1993
unmount(2) — mount or dismount a filesystem

functionfunmount

__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 filesystem

functiongetvfsbyname

int getvfsbyname(const char *, struct vfsconf *)
man page · May 4, 1995
getvfsbyname(3) — get information about a filesystem