Expand description
§libmount-sys: Unsafe Rust bindings for libmount of util-linux
The libmount library is used to, among other things:
- Parse
/etc/fstab,/etc/mtaband/proc/self/mountinfofiles, - Manage the
mtabfile, - Evaluate mount options.
This crate is Linux-specific. Building it for non-Linux platforms, or for the Linux kernel, results in an empty crate.
This crate links to libmount, and requires it to be installed.
See below for example installation instructions.
§Installing libmount
This crate links to libmount, and requires it to be installed.
The library, its C header files, and the clang compiler need to be installed on the build machine.
On Debian, for example, one can install that as follows:
sudo apt install clang libmount-devIf the library is linked dynamically (most typical configuration), then it needs to be installed on the target computer in order to run the resulting program. On Debian, for example, one can install it as follows:
sudo apt install libmount1§Supported environment variables
This crate depends on some environment variables, and variants of those.
For each environment variable (e.g., CC), the following are the accepted
variants of it:
<var>_<target>, e.g.,CC_aarch64-unknown-linux-gnu.<var>_<target-with-underscores>, e.g.,CC_aarch64_unknown_linux_gnu.TARGET_<var>, e.g.,TARGET_CC.<var>, e.g.,CC.
The following environment variables (and their variants) affect how this crate is built:
LIBMOUNT_STATICLIBMOUNT_PATHLIBMOUNT_INCLUDE_DIRLIBMOUNT_LIB_DIRSYSROOTCCCFLAGS
§Dynamic or static linking
This crate links to libmount dynamically if possible, except when targeting
platforms based on the musl C library.
This behavior can be changed either by setting the environment variable
LIBMOUNT_STATIC to 1, or by enabling the crate feature static.
If both are defined, then the value of LIBMOUNT_STATIC takes precedence.
Setting LIBMOUNT_STATIC to 0 mandates dynamic linking.
§Finding libmount library and headers
By default, this crate finds libmount headers and library based on the default
target C compiler.
This behavior can be changed by:
- Either defining the environment variable
LIBMOUNT_PATHto the path of a directory containing the subdirectoriesincludeandlibwhere the headers and library are installed. - Or by defining one or both of the environment variables
LIBMOUNT_INCLUDE_DIRandLIBMOUNT_LIB_DIRto paths to the directories where headers and library are present. IfLIBMOUNT_PATHis also defined, thenLIBMOUNT_INCLUDE_DIRandLIBMOUNT_LIB_DIRtake precedence.
§Depending on this crate
This crate provides the following variables to other crates that depend on it:
DEP_LIBMOUNT_INCLUDE: Path of the directory where library C header files reside.DEP_LIBMOUNT_LIB: Path of the directory where the library binary resides.
§Versioning
This project adheres to Semantic Versioning.
The CHANGELOG.md file details notable changes over time.
Structs§
- libmnt_
cache - libmnt_
context - libmnt_
fs - libmnt_
iter - libmnt_
lock - libmnt_
monitor - libmnt_
ns - libmnt_
optmap - libmnt_
tabdiff - libmnt_
table - libmnt_
update - mntent
Constants§
- LIBMOUNT_
MAJOR_ VERSION - LIBMOUNT_
MINOR_ VERSION - LIBMOUNT_
PATCH_ VERSION - LIBMOUNT_
VERSION - MNT_
ACT_ MOUNT - MNT_
ACT_ UMOUNT - MNT_
ERR_ AMBIFS - MNT_
ERR_ APPLYFLAGS - MNT_
ERR_ CHMOD - MNT_
ERR_ CHOWN - MNT_
ERR_ IDMAP - MNT_
ERR_ LOCK - MNT_
ERR_ LOOPDEV - MNT_
ERR_ LOOPOVERLAP - MNT_
ERR_ MOUNTOPT - MNT_
ERR_ NAMESPACE - MNT_
ERR_ NOFSTAB - MNT_
ERR_ NOFSTYPE - MNT_
ERR_ NOSOURCE - MNT_
ERR_ ONLYONCE - MNT_
EX_ FAIL - MNT_
EX_ FILEIO - MNT_
EX_ SOFTWARE - MNT_
EX_ SOMEOK - MNT_
EX_ SUCCESS - MNT_
EX_ SYSERR - MNT_
EX_ USAGE - MNT_
EX_ USER - MNT_
INVERT - MNT_
ITER_ BACKWARD - MNT_
ITER_ FORWARD - MNT_
LINUX_ MAP - MNT_
MONITOR_ TYPE_ KERNEL - MNT_
MONITOR_ TYPE_ USERSPACE - MNT_
MS_ COMMENT - MNT_
MS_ ENCRYPTION - MNT_
MS_ FEC_ DEVICE - MNT_
MS_ FEC_ OFFSET - MNT_
MS_ FEC_ ROOTS - MNT_
MS_ GROUP - MNT_
MS_ HASH_ DEVICE - MNT_
MS_ HASH_ OFFSET - MNT_
MS_ HELPER - MNT_
MS_ LOOP - MNT_
MS_ NETDEV - MNT_
MS_ NOAUTO - MNT_
MS_ NOFAIL - MNT_
MS_ OFFSET - MNT_
MS_ OWNER - MNT_
MS_ ROOT_ HASH - MNT_
MS_ ROOT_ HASH_ FILE - MNT_
MS_ ROOT_ HASH_ SIG - MNT_
MS_ SIZELIMIT - MNT_
MS_ UHELPER - MNT_
MS_ USER - MNT_
MS_ USERS - MNT_
MS_ VERITY_ ON_ CORRUPTION - MNT_
MS_ XCOMMENT - MNT_
MS_ XFSTABCOMM - MNT_
NOFSTAB - MNT_
NOHLPS - MNT_
NOMTAB - MNT_
OMODE_ APPEND - MNT_
OMODE_ AUTO - MNT_
OMODE_ FORCE - MNT_
OMODE_ FSTAB - MNT_
OMODE_ IGNORE - MNT_
OMODE_ MTAB - MNT_
OMODE_ NOTAB - MNT_
OMODE_ PREPEND - MNT_
OMODE_ REPLACE - MNT_
OMODE_ USER - MNT_
PREFIX - MNT_
SUPERBLOCK - MNT_
TABDIFF_ MOUNT - MNT_
TABDIFF_ MOVE - MNT_
TABDIFF_ PROPAGATION - MNT_
TABDIFF_ REMOUNT - MNT_
TABDIFF_ UMOUNT - MNT_
UNIQ_ FORWARD - MNT_
UNIQ_ KEEPTREE - MNT_
USERSPACE_ MAP - MS_BIND
- MS_
DIRSYNC - MS_
I_ VERSION - MS_
LAZYTIME - MS_
MANDLOCK - MS_
MGC_ MSK - MS_
MGC_ VAL - MS_MOVE
- MS_
NOATIME - MS_
NODEV - MS_
NODIRATIME - MS_
NOEXEC - MS_
NOSUID - MS_
NOSYMFOLLOW - MS_
OWNERSECURE - MS_
PRIVATE - MS_
PROPAGATION - MS_
RDONLY - MS_REC
- MS_
RELATIME - MS_
REMOUNT - MS_
SECURE - MS_
SHARED - MS_
SILENT - MS_
SLAVE - MS_
STRICTATIME - MS_
SYNCHRONOUS - MS_
UNBINDABLE
Functions§
- mnt_
cache_ ⚠device_ has_ tag - mnt_
cache_ ⚠find_ tag_ value - mnt_
cache_ ⚠read_ tags - mnt_
cache_ ⚠set_ sbprobe - mnt_
cache_ ⚠set_ targets - mnt_
context_ ⚠append_ options - mnt_
context_ ⚠apply_ fstab - mnt_
context_ ⚠disable_ canonicalize - mnt_
context_ ⚠disable_ helpers - mnt_
context_ ⚠disable_ mtab - mnt_
context_ ⚠disable_ swapmatch - mnt_
context_ ⚠do_ mount - mnt_
context_ ⚠do_ umount - mnt_
context_ ⚠enable_ fake - mnt_
context_ ⚠enable_ force - mnt_
context_ ⚠enable_ fork - mnt_
context_ ⚠enable_ lazy - mnt_
context_ ⚠enable_ loopdel - mnt_
context_ ⚠enable_ noautofs - mnt_
context_ ⚠enable_ onlyonce - mnt_
context_ ⚠enable_ rdonly_ umount - mnt_
context_ ⚠enable_ rwonly_ mount - mnt_
context_ ⚠enable_ sloppy - mnt_
context_ ⚠enable_ verbose - mnt_
context_ ⚠finalize_ mount - mnt_
context_ ⚠finalize_ umount - mnt_
context_ ⚠find_ umount_ fs - mnt_
context_ ⚠force_ unrestricted - mnt_
context_ ⚠forced_ rdonly - mnt_
context_ ⚠get_ cache - mnt_
context_ ⚠get_ excode - mnt_
context_ ⚠get_ fs - mnt_
context_ ⚠get_ fs_ userdata - mnt_
context_ ⚠get_ fstab - mnt_
context_ ⚠get_ fstab_ userdata - mnt_
context_ ⚠get_ fstype - mnt_
context_ ⚠get_ helper_ status - mnt_
context_ ⚠get_ lock - mnt_
context_ ⚠get_ mflags - mnt_
context_ ⚠get_ mtab - mnt_
context_ ⚠get_ mtab_ userdata - mnt_
context_ ⚠get_ options - mnt_
context_ ⚠get_ optsmode - mnt_
context_ ⚠get_ origin_ ns - mnt_
context_ ⚠get_ source - mnt_
context_ ⚠get_ status - mnt_
context_ ⚠get_ syscall_ errno - mnt_
context_ ⚠get_ table - mnt_
context_ ⚠get_ target - mnt_
context_ ⚠get_ target_ ns - mnt_
context_ ⚠get_ target_ prefix - mnt_
context_ ⚠get_ user_ mflags - mnt_
context_ ⚠helper_ executed - mnt_
context_ ⚠helper_ setopt - mnt_
context_ ⚠init_ helper - mnt_
context_ ⚠is_ child - mnt_
context_ ⚠is_ fake - mnt_
context_ ⚠is_ force - mnt_
context_ ⚠is_ fork - mnt_
context_ ⚠is_ fs_ mounted - mnt_
context_ ⚠is_ lazy - mnt_
context_ ⚠is_ loopdel - mnt_
context_ ⚠is_ nocanonicalize - mnt_
context_ ⚠is_ nohelpers - mnt_
context_ ⚠is_ nomtab - mnt_
context_ ⚠is_ onlyonce - mnt_
context_ ⚠is_ parent - mnt_
context_ ⚠is_ rdonly_ umount - mnt_
context_ ⚠is_ restricted - mnt_
context_ ⚠is_ rwonly_ mount - mnt_
context_ ⚠is_ sloppy - mnt_
context_ ⚠is_ swapmatch - mnt_
context_ ⚠is_ verbose - mnt_
context_ ⚠mount - mnt_
context_ ⚠next_ mount - mnt_
context_ ⚠next_ remount - mnt_
context_ ⚠next_ umount - mnt_
context_ ⚠prepare_ mount - mnt_
context_ ⚠prepare_ umount - mnt_
context_ ⚠reset_ status - mnt_
context_ ⚠set_ cache - mnt_
context_ ⚠set_ fs - mnt_
context_ ⚠set_ fstab - mnt_
context_ ⚠set_ fstype - mnt_
context_ ⚠set_ fstype_ pattern - mnt_
context_ ⚠set_ mflags - mnt_
context_ ⚠set_ mountdata - mnt_
context_ ⚠set_ options - mnt_
context_ ⚠set_ options_ pattern - mnt_
context_ ⚠set_ optsmode - mnt_
context_ ⚠set_ passwd_ cb - mnt_
context_ ⚠set_ source - mnt_
context_ ⚠set_ syscall_ status - mnt_
context_ ⚠set_ tables_ errcb - mnt_
context_ ⚠set_ target - mnt_
context_ ⚠set_ target_ ns - mnt_
context_ ⚠set_ target_ prefix - mnt_
context_ ⚠set_ user_ mflags - mnt_
context_ ⚠strerror - mnt_
context_ ⚠switch_ ns - mnt_
context_ ⚠switch_ origin_ ns - mnt_
context_ ⚠switch_ target_ ns - mnt_
context_ ⚠syscall_ called - mnt_
context_ ⚠tab_ applied - mnt_
context_ ⚠umount - mnt_
context_ ⚠wait_ for_ children - mnt_
copy_ ⚠fs - mnt_
diff_ ⚠tables - mnt_
free_ ⚠cache - mnt_
free_ ⚠context - mnt_
free_ ⚠fs - mnt_
free_ ⚠iter - mnt_
free_ ⚠lock - mnt_
free_ ⚠mntent - mnt_
free_ ⚠tabdiff - mnt_
free_ ⚠table - mnt_
free_ ⚠update - mnt_
fs_ ⚠append_ attributes - mnt_
fs_ ⚠append_ comment - mnt_
fs_ ⚠append_ options - mnt_
fs_ ⚠get_ attribute - mnt_
fs_ ⚠get_ attributes - mnt_
fs_ ⚠get_ bindsrc - mnt_
fs_ ⚠get_ comment - mnt_
fs_ ⚠get_ devno - mnt_
fs_ ⚠get_ freq - mnt_
fs_ ⚠get_ fs_ options - mnt_
fs_ ⚠get_ fstype - mnt_
fs_ ⚠get_ id - mnt_
fs_ ⚠get_ option - mnt_
fs_ ⚠get_ optional_ fields - mnt_
fs_ ⚠get_ options - mnt_
fs_ ⚠get_ parent_ id - mnt_
fs_ ⚠get_ passno - mnt_
fs_ ⚠get_ priority - mnt_
fs_ ⚠get_ propagation - mnt_
fs_ ⚠get_ root - mnt_
fs_ ⚠get_ size - mnt_
fs_ ⚠get_ source - mnt_
fs_ ⚠get_ srcpath - mnt_
fs_ ⚠get_ swaptype - mnt_
fs_ ⚠get_ table - mnt_
fs_ ⚠get_ tag - mnt_
fs_ ⚠get_ target - mnt_
fs_ ⚠get_ tid - mnt_
fs_ ⚠get_ usedsize - mnt_
fs_ ⚠get_ user_ options - mnt_
fs_ ⚠get_ userdata - mnt_
fs_ ⚠get_ vfs_ options - mnt_
fs_ ⚠get_ vfs_ options_ all - mnt_
fs_ ⚠is_ kernel - mnt_
fs_ ⚠is_ netfs - mnt_
fs_ ⚠is_ pseudofs - mnt_
fs_ ⚠is_ regularfs - mnt_
fs_ ⚠is_ swaparea - mnt_
fs_ ⚠match_ fstype - mnt_
fs_ ⚠match_ options - mnt_
fs_ ⚠match_ source - mnt_
fs_ ⚠match_ target - mnt_
fs_ ⚠prepend_ attributes - mnt_
fs_ ⚠prepend_ options - mnt_
fs_ ⚠print_ debug - mnt_
fs_ ⚠set_ attributes - mnt_
fs_ ⚠set_ bindsrc - mnt_
fs_ ⚠set_ comment - mnt_
fs_ ⚠set_ freq - mnt_
fs_ ⚠set_ fstype - mnt_
fs_ ⚠set_ options - mnt_
fs_ ⚠set_ passno - mnt_
fs_ ⚠set_ priority - mnt_
fs_ ⚠set_ root - mnt_
fs_ ⚠set_ source - mnt_
fs_ ⚠set_ target - mnt_
fs_ ⚠set_ userdata - mnt_
fs_ ⚠strdup_ options - mnt_
fs_ ⚠streq_ srcpath - mnt_
fs_ ⚠streq_ target - mnt_
fs_ ⚠to_ mntent - mnt_
fstype_ ⚠is_ netfs - mnt_
fstype_ ⚠is_ pseudofs - mnt_
get_ ⚠builtin_ optmap - mnt_
get_ ⚠fstab_ path - mnt_
get_ ⚠fstype - mnt_
get_ ⚠library_ features - mnt_
get_ ⚠library_ version - mnt_
get_ ⚠mountpoint - mnt_
get_ ⚠mtab_ path - mnt_
get_ ⚠swaps_ path - mnt_
guess_ ⚠system_ root - mnt_
has_ ⚠regular_ mtab - mnt_
init_ ⚠debug - mnt_
iter_ ⚠get_ direction - mnt_
lock_ ⚠block_ signals - mnt_
lock_ ⚠file - mnt_
mangle ⚠ - mnt_
match_ ⚠fstype - mnt_
match_ ⚠options - mnt_
monitor_ ⚠close_ fd - mnt_
monitor_ ⚠enable_ kernel - mnt_
monitor_ ⚠enable_ userspace - mnt_
monitor_ ⚠event_ cleanup - mnt_
monitor_ ⚠get_ fd - mnt_
monitor_ ⚠next_ change - mnt_
monitor_ ⚠wait - mnt_
new_ ⚠cache - mnt_
new_ ⚠context - mnt_
new_ ⚠fs - mnt_
new_ ⚠iter - mnt_
new_ ⚠lock - mnt_
new_ ⚠monitor - mnt_
new_ ⚠tabdiff - mnt_
new_ ⚠table - mnt_
new_ ⚠table_ from_ dir - mnt_
new_ ⚠table_ from_ file - mnt_
new_ ⚠update - mnt_
optstr_ ⚠append_ option - mnt_
optstr_ ⚠apply_ flags - mnt_
optstr_ ⚠deduplicate_ option - mnt_
optstr_ ⚠get_ flags - mnt_
optstr_ ⚠get_ option - mnt_
optstr_ ⚠get_ options - mnt_
optstr_ ⚠next_ option - mnt_
optstr_ ⚠prepend_ option - mnt_
optstr_ ⚠remove_ option - mnt_
optstr_ ⚠set_ option - mnt_
parse_ ⚠version_ string - mnt_
pretty_ ⚠path - mnt_
ref_ ⚠cache - mnt_
ref_ ⚠fs - mnt_
ref_ ⚠monitor - mnt_
ref_ ⚠table - mnt_
reset_ ⚠context - mnt_
reset_ ⚠fs - mnt_
reset_ ⚠iter - mnt_
reset_ ⚠table - mnt_
resolve_ ⚠path - mnt_
resolve_ ⚠spec - mnt_
resolve_ ⚠tag - mnt_
resolve_ ⚠target - mnt_
split_ ⚠optstr - mnt_
tabdiff_ ⚠next_ change - mnt_
table_ ⚠add_ fs - mnt_
table_ ⚠append_ intro_ comment - mnt_
table_ ⚠append_ trailing_ comment - mnt_
table_ ⚠enable_ comments - mnt_
table_ ⚠find_ devno - mnt_
table_ ⚠find_ fs - mnt_
table_ ⚠find_ mountpoint - mnt_
table_ ⚠find_ next_ fs - mnt_
table_ ⚠find_ pair - mnt_
table_ ⚠find_ source - mnt_
table_ ⚠find_ srcpath - mnt_
table_ ⚠find_ tag - mnt_
table_ ⚠find_ target - mnt_
table_ ⚠find_ target_ with_ option - mnt_
table_ ⚠first_ fs - mnt_
table_ ⚠get_ cache - mnt_
table_ ⚠get_ intro_ comment - mnt_
table_ ⚠get_ nents - mnt_
table_ ⚠get_ root_ fs - mnt_
table_ ⚠get_ trailing_ comment - mnt_
table_ ⚠get_ userdata - mnt_
table_ ⚠insert_ fs - mnt_
table_ ⚠is_ empty - mnt_
table_ ⚠is_ fs_ mounted - mnt_
table_ ⚠last_ fs - mnt_
table_ ⚠move_ fs - mnt_
table_ ⚠next_ child_ fs - mnt_
table_ ⚠next_ fs - mnt_
table_ ⚠over_ fs - mnt_
table_ ⚠parse_ dir - mnt_
table_ ⚠parse_ file - mnt_
table_ ⚠parse_ fstab - mnt_
table_ ⚠parse_ mtab - mnt_
table_ ⚠parse_ stream - mnt_
table_ ⚠parse_ swaps - mnt_
table_ ⚠remove_ fs - mnt_
table_ ⚠replace_ file - mnt_
table_ ⚠set_ cache - mnt_
table_ ⚠set_ intro_ comment - mnt_
table_ ⚠set_ iter - mnt_
table_ ⚠set_ parser_ errcb - mnt_
table_ ⚠set_ trailing_ comment - mnt_
table_ ⚠set_ userdata - mnt_
table_ ⚠uniq_ fs - mnt_
table_ ⚠with_ comments - mnt_
table_ ⚠write_ file - mnt_
tag_ ⚠is_ valid - mnt_
unlock_ ⚠file - mnt_
unmangle ⚠ - mnt_
unref_ ⚠cache - mnt_
unref_ ⚠fs - mnt_
unref_ ⚠monitor - mnt_
unref_ ⚠table - mnt_
update_ ⚠force_ rdonly - mnt_
update_ ⚠get_ filename - mnt_
update_ ⚠get_ fs - mnt_
update_ ⚠get_ mflags - mnt_
update_ ⚠is_ ready - mnt_
update_ ⚠set_ fs - mnt_
update_ ⚠table