Crate rsmount

Source
Expand description

§Description

The rsmount library is a safe Rust wrapper around util-linux/libmount.

rsmount allows users to, among other things:

  • mount devices on an operating system’s file hierarchy,
  • list/manage mount points in /proc/<pid>/mountinfo,
  • consult the system’s swap usage from /proc/swaps,
  • compose/edit /etc/fstab, the file describing all devices an OS should mount at boot.
  • etc.

§Examples

Mount a device on a operating system’s file tree.

use rsmount::device::BlockDevice;
use rsmount::flags::MountFlag;
use rsmount::fs::FileSystem;
use rsmount::mount::Mount;

fn main() -> rsmount::Result<()> {
    // Configure the `Mount` struct.
    let block_device: BlockDevice = "/dev/vda".parse()?;
    let mut mount = Mount::builder()
        // Device to mount.
        .source(block_device)
        // Location of the mount point in the file tree.
        .target("/mnt")
        // Do not allow writing to the file system while it is mounted.
        .mount_flags(vec![MountFlag::ReadOnly])
        // Gives a hint about the file system used by the device (optional).
        .file_system(FileSystem::Ext4)
        .build()?;

    // Mount `/dev/vda` at `/mnt`.
    mount.mount_device()?;

    Ok(())
}

Create an fstab.

use std::str::FromStr;
use rsmount::tables::FsTab;
use rsmount::entries::FsTabEntry;
use rsmount::device::BlockDevice;
use rsmount::device::Pseudo;
use rsmount::device::Source;
use rsmount::device::Tag;
use rsmount::fs::FileSystem;

fn main() -> rsmount::Result<()> {
    let mut fstab = FsTab::new()?;

    fstab.set_intro_comments("# /etc/fstab\n")?;
    fstab.append_to_intro_comments("# Example from scratch\n")?;

    // Mount the device with the following UUID as the root file system.
    let uuid = Tag::from_str("UUID=dd476616-1ce4-415e-9dbd-8c2fa8f42f0f")?;
    let entry1 = FsTabEntry::builder()
        .source(uuid)
        .target("/")
        .file_system_type(FileSystem::Ext4)
        // Comma-separated list of mount options.
        .mount_options("rw,relatime")
        // Interval, in days, between file system backups by the dump command on ext2/3/4
        // file systems.
        .backup_frequency(0)
        // Order in which file systems are checked by the `fsck` command.
        .fsck_checking_order(1)
        .build()?;

    // Mount the removable device `/dev/usbdisk` on demand.
    let block_device = BlockDevice::from_str("/dev/usbdisk")?;
    let entry2 = FsTabEntry::builder()
        .source(block_device)
        .target("/media/usb")
        .file_system_type(FileSystem::VFAT)
        .mount_options("noauto")
        .backup_frequency(0)
        .fsck_checking_order(0)
        .build()?;

    // Mount a pseudo-filesystem (tmpfs) at `/tmp`
    let entry3 = FsTabEntry::builder()
        .source(Pseudo::None)
        .target("/tmp")
        .file_system_type(FileSystem::Tmpfs)
        .mount_options("nosuid,nodev")
        .backup_frequency(0)
        .fsck_checking_order(0)
        .build()?;

    fstab.push(entry1);
    fstab.push(entry2);
    fstab.push(entry3);

    println!("{}", fstab);

    // Example output
    //
    // # /etc/fstab
    // # Example from scratch
    //
    // UUID=dd476616-1ce4-415e-9dbd-8c2fa8f42f0f / ext4 rw,relatime 0 1
    // /dev/usbdisk /media/usb vfat noauto 0 0
    // none /tmp tmpfs nosuid,nodev 0 0

    Ok(())
}

§API structure

rsmount’s API is roughly divided into two main modules:

  • tables: a module for manipulating file system descriptions tables (/etc/fstab, /proc/self/mountinfo, /proc/swaps, /run/mount/utab).
  • mount: a module to mount devices on the system’s file tree.

Finally, look to the debug module if you need to consult debug messages during development.

§From libmount to rsmount API

This section maps libmount functions to rsmount methods. It follows the same layout as libmount’s documentation. You can use it as a reference to ease the transition from one API to the other.

§Higher-level API

§Library high-level context
libmountrsmount
struct libmnt_contextMount
Unmount
struct libmnt_nsMountNamespace
MNT_ERR_AMBIFSErrorCode::FsCollision
MNT_ERR_APPLYFLAGSErrorCode::ApplyFlags
MNT_ERR_LOOPDEVErrorCode::LoopDevice
MNT_ERR_MOUNTOPTErrorCode::UserspaceMountOptions
MNT_ERR_NOFSTABErrorCode::FsTabMissingEntry
MNT_ERR_NOFSTYPEErrorCode::NoFsType
MNT_ERR_NOSOURCEErrorCode::UndefinedMountSource
MNT_ERR_LOOPOVERLAPErrorCode::LoopDeviceOverlap
MNT_ERR_LOCKErrorCode::Lock
MNT_ERR_NAMESPACEErrorCode::NamespaceSwitch
MNT_EX_SUCCESSExitCode::Success
MNT_EX_USAGEExitCode::InvalidUsage
MNT_EX_SYSERRExitCode::SystemError
MNT_EX_SOFTWAREExitCode::InternalError
MNT_EX_USERExitCode::UserInterrupt
MNT_EX_FILEIOExitCode::IoError
MNT_EX_FAILExitCode::Failure
MNT_EX_SOMEOKExitCode::PartialSuccess
mnt_free_contextMount and Unmount are automatically deallocated when they go out of scope.
mnt_new_contextMount::builder
Unmount::builder
mnt_reset_contextNot implemented.
mnt_context_append_optionsMount::append_mount_options
mnt_context_apply_fstab
mnt_context_disable_canonicalizeMountBuilder::disable_path_canonicalization
UnmountBuilder::disable_path_canonicalization
mnt_context_disable_helpersMountBuilder::disable_helpers
UnmountBuilder::disable_helpers
mnt_context_disable_mtabMountBuilder::do_not_update_utab
UnmountBuilder::do_not_update_utab
mnt_context_disable_swapmatchMountBuilder::disable_mount_point_lookup
mnt_context_enable_fakeMountBuilder::dry_run
UnmountBuilder::dry_run
mnt_context_enable_forceUnmountBuilder::force_unmount
mnt_context_enable_forkMountBuilder::parallel_mount
mnt_context_enable_lazyUnmountBuilder::lazy_unmount
mnt_context_enable_loopdelUnmountBuilder::detach_loop_device
mnt_context_enable_noautofsMountBuilder::ignore_autofs
mnt_context_enable_onlyonceMountBuilder::mount_only_once
mnt_context_enable_rdonly_umountUnmountBuilder::on_fail_remount_read_only
mnt_context_enable_rwonly_mountMountBuilder::force_mount_read_write
mnt_context_enable_sloppyMountBuilder::ignore_unsupported_mount_options
mnt_context_enable_verboseMountBuilder::verbose
UnmountBuilder::verbose
mnt_context_forced_rdonlyMount::is_mounted_read_only
mnt_context_force_unrestrictedMountBuilder::force_user_mount
mnt_context_get_cacheMount::cache
mnt_context_get_excodeNot implemented, managed internally.
mnt_context_get_fsMount::internal_table_entry
mnt_context_get_fstabMount::fstab
mnt_context_get_fstab_userdataMount::fstab_user_data
mnt_context_get_fstypeMount::file_system_type
mnt_context_get_fs_userdataMount::internal_table_entry_user_data
mnt_context_get_helper_statusMount::mount_helper_exit_status
Unmount::umount_helper_exit_status
mnt_context_get_lockMount::utab_file_lock
mnt_context_get_mflagsMount::mount_flags
mnt_context_get_mtabMount::mountinfo
mnt_context_get_mtab_userdataMount::mountinfo_user_data
mnt_context_get_optionsMount::mount_options
mnt_context_get_optsmodeMount::mount_options_mode
mnt_context_get_origin_nsMount::original_namespace
mnt_context_get_sourceMount::source
mnt_context_get_statusMount::is_mount_successful
mnt_context_get_syscall_errnoMount::mount_syscall_errno
Unmount::umount_syscall_errno
mnt_context_get_tableNot implemented. Use FsTab::import_file
mnt_context_get_targetMount::target
mnt_context_get_target_nsMount::target_namespace
mnt_context_get_target_prefixMount::target_prefix
mnt_context_get_user_mflagsMount::userspace_mount_flags
mnt_context_helper_executedMount::has_run_mount_helper
Unmount::has_run_umount_helper
mnt_context_helper_setopt
mnt_context_init_helper
mnt_context_is_childMount::is_child_process
mnt_context_is_fakeMount::is_dry_run
Unmount::is_dry_run
mnt_context_is_forceUnmount::forces_unmount
mnt_context_is_forkMount::does_parallel_mount
mnt_context_is_fs_mountedMount::is_entry_mounted
mnt_context_is_lazyUnmount::does_lazy_unmount
mnt_context_is_loopdelUnmount::detaches_loop_device
mnt_context_is_nocanonicalizeMount::disabled_path_canonicalization
Unmount::disabled_path_canonicalization
mnt_context_is_nohelpersMount::has_disabled_helpers
Unmount::has_disabled_helpers
mnt_context_is_nomtabMount::does_not_update_utab
Unmount::does_not_update_utab
mnt_context_is_onlyonceMount::mounts_only_once
mnt_context_is_parentMount::is_parent_process
mnt_context_is_rdonly_umountUnmount::on_fail_remounts_read_only
mnt_context_is_restrictedMount::is_user_mount
mnt_context_is_rwonly_mountMount::forces_mount_read_write
mnt_context_is_sloppyMount::ignores_unsupported_mount_options
mnt_context_is_swapmatchMount::disabled_mount_point_lookup
mnt_context_is_verboseMount::is_verbose
Unmount::is_verbose
mnt_context_reset_statusMount::reset_syscall_exit_status
Unmount::reset_syscall_exit_status
mnt_context_set_cacheMountBuilder::override_cache
mnt_context_set_fsNot implemented.
mnt_context_set_fstabMountBuilder::override_fstab
mnt_context_set_fstypeMountBuilder::file_system
mnt_context_set_fstype_patternMountBuilder::match_file_systems
UnmountBuilder::match_file_systems
mnt_context_set_mflagsMountBuilder::mount_flags
mnt_context_set_mountdataMountBuilder::mount_data
mnt_context_set_optionsMountBuilder::mount_options
mnt_context_set_options_patternMountBuilder::match_mount_options
UnmountBuilder::match_mount_options
mnt_context_set_optsmodeMountBuilder::mount_options_mode
mnt_context_set_passwd_cbDeprecated.
mnt_context_set_sourceMountBuilder::source
UnmountBuilder::source
mnt_context_set_syscall_statusMount::set_syscall_exit_status
Unmount::set_syscall_exit_status
mnt_context_set_tables_errcbCan not implement it without a data pointer in the callback function see Passing Rust closure to C
mnt_context_set_targetMountBuilder::target
UnmountBuilder::target
mnt_context_set_target_nsMountBuilder::target_namespace
UnmountBuilder::target_namespace
mnt_context_set_target_prefixMountBuilder::target_prefix
mnt_context_set_user_mflagsMountBuilder::userspace_mount_flags
mnt_context_strerrorDeprecated.
mnt_context_switch_nsMount::switch_to_namespace
Unmount::switch_to_namespace
mnt_context_switch_origin_nsMount::switch_to_original_namespace
Unmount::switch_to_original_namespace
mnt_context_switch_target_nsMount::switch_to_target_namespace
Unmount::switch_to_target_namespace
mnt_context_syscall_calledMount::has_called_mount_syscall
Unmount::has_called_umount_syscall
mnt_context_tab_applied
mnt_context_wait_for_childrenMount::wait_on_children
§Mount context
libmountrsmount
MNT_MS_COMMENTUserspaceMountFlag::Comment
MNT_MS_GROUPUserspaceMountFlag::Group
MNT_MS_HELPERUserspaceMountFlag::MountHelper
MNT_MS_LOOPUserspaceMountFlag::LoopDevice
MNT_MS_NETDEVUserspaceMountFlag::DeviceRequiresNetwork
MNT_MS_NOAUTOUserspaceMountFlag::NoAuto
MNT_MS_NOFAILUserspaceMountFlag::NoFail
MNT_MS_OFFSETUserspaceMountFlag::LoopDeviceOffset
MNT_MS_OWNERUserspaceMountFlag::Owner
MNT_MS_SIZELIMITUserspaceMountFlag::LoopDeviceSizeLimit
MNT_MS_ENCRYPTIONUserspaceMountFlag::LoopDeviceEncryption
MNT_MS_UHELPERUserspaceMountFlag::UmountHelper
MNT_MS_USERUserspaceMountFlag::User
MNT_MS_USERSUserspaceMountFlag::Users
MNT_MS_XCOMMENTUserspaceMountFlag::XUTabComment
MNT_MS_XFSTABCOMMUserspaceMountFlag::XFstabComment
MNT_MS_HASH_DEVICEUserspaceMountFlag::HashDevice
MNT_MS_ROOT_HASHUserspaceMountFlag::RootHash
MNT_MS_HASH_OFFSETUserspaceMountFlag::HashOffset
MNT_MS_ROOT_HASH_FILEUserspaceMountFlag::RootHashFile
MNT_MS_FEC_DEVICEUserspaceMountFlag::ForwardErrorCorrectionDevice
MNT_MS_FEC_OFFSETUserspaceMountFlag::ForwardErrorCorrectionOffset
MNT_MS_FEC_ROOTSUserspaceMountFlag::ForwardErrorCorrectionRoots
MNT_MS_ROOT_HASH_SIGUserspaceMountFlag::RootHashSignature
MS_BINDMountFlag::Bind
MS_DIRSYNCMountFlag::SynchronizeDirectories
MS_I_VERSIONMountFlag::IVersion
MS_MANDLOCKMountFlag::MandatoryLocking
MS_MGC_MSKMountFlag::MagicMask
MS_MGC_VALMountFlag::MagicValue
MS_MOVEMountFlag::Move
MS_NOATIMEMountFlag::NoUpdateAccessTime
MS_NODEVMountFlag::NoDeviceAccess
MS_NODIRATIMEMountFlag::NoUpdateDirectoryAccessTime
MS_NOEXECMountFlag::NoExecute
MS_NOSUIDMountFlag::NoSuid
MS_OWNERSECUREMountFlag::OwnerSecure
MS_PRIVATEMountFlag::Private
MS_PROPAGATIONMountFlag::Propagation
MS_RDONLYMountFlag::ReadOnly
MS_RECMountFlag::Recursive
MS_RELATIMEMountFlag::RelativeAcessTime
MS_REMOUNTMountFlag::Remount
MS_SECUREMountFlag::Secure
MS_SHAREDMountFlag::Shared
MS_SILENTMountFlag::Silent
MS_SLAVEMountFlag::Slave
MS_STRICTATIMEMountFlag::StrictUpdateAccessTime
MS_SYNCHRONOUSMountFlag::Synchronous
MS_UNBINDABLEMountFlag::Unbindable
MS_LAZYTIMEMountFlag::LazyTime
mnt_context_do_mountMount::call_mount_syscall
mnt_context_finalize_mountMount::finalize_mount
mnt_context_mountMount::mount_device
mnt_context_next_mountMount::seq_mount
mnt_context_next_remountMount::seq_remount
mnt_context_prepare_mountMount::prepare_mount
§Umount context

§Files parsing

§Table of filesystems
libmountrsmount
struct libmnt_tableFsTab
MountInfo
Swaps
UTab
mnt_free_tableFsTab, MountInfo, Swaps, UTab are automatically deallocated when they go out of scope.
mnt_new_tableFsTab::new
MountInfo::new
Swaps::new
UTab::new
mnt_reset_tableFsTab::clear
UTab::clear
mnt_ref_tableManaged automatically.
mnt_unref_tableManaged automatically.
mnt_new_table_from_dirFsTab::new_from_directory
mnt_new_table_from_fileFsTab::new_from_file
mnt_table_add_fsFsTab::push
FsTab::try_push
UTab::push
mnt_table_append_intro_commentFsTab::append_to_intro_comments
mnt_table_append_trailing_commentFsTab::append_to_trailing_comments
mnt_table_enable_commentsFsTab::import_with_comments
FsTab::import_without_comments
FsTab::export_with_comments
FsTab::export_without_comments
mnt_table_find_devnoMountInfo::find_device
MountInfo::find_back_device
mnt_table_find_fsFsTab::contains
FsTab::position
MountInfo::position
Swaps::position
UTab::contains
UTab::position
mnt_table_find_mountpointMountInfo::find_mount_point
MountInfo::find_back_mount_point
mnt_table_find_next_fsFsTab::find_first
FsTab::find_back_first
MountInfo::find_first
MountInfo::find_back_first
Swaps::find_first
Swaps::find_back_first
UTab::find_first
UTab::find_back_first
mnt_table_find_pairFsTab::find_pair
FsTab::find_back_pair
MountInfo::find_pair
MountInfo::find_back_pair
UTab::find_pair
UTab::find_back_pair
mnt_table_find_sourceFsTab::find_source
FsTab::find_back_source
MountInfo::find_source
MountInfo::find_back_source
Swaps::find_source
Swaps::find_back_source
UTab::find_source
UTab::find_back_source
mnt_table_find_srcpathFsTab::find_source_path
FsTab::find_back_source_path
MountInfo::find_source_path
MountInfo::find_back_source_path
Swaps::find_source_path
Swaps::find_back_source_path
UTab::find_source_path
UTab::find_back_source_path
mnt_table_find_tagFsTab::find_source_tag
FsTab::find_back_source_tag
mnt_table_find_targetFsTab::find_target
FsTab::find_back_target
MountInfo::find_target
MountInfo::find_back_target
UTab::find_target
UTab::find_back_target
mnt_table_find_target_with_optionFsTab::find_target_with_option
FsTab::find_back_target_with_option
FsTab::find_target_with_exact_option
FsTab::find_back_target_with_exact_option
MountInfo::find_target_with_option
MountInfo::find_back_target_with_option
MountInfo::find_target_with_exact_option
MountInfo::find_back_target_with_exact_option
UTab::find_target_with_option
UTab::find_back_target_with_option
UTab::find_target_with_exact_option
UTab::find_back_target_with_exact_option
mnt_table_first_fsFsTab::first
MountInfo::first
Swaps::first
UTab::first
mnt_table_get_cacheFsTab::cache
MountInfo::cache
Swaps::cache
UTab::cache
mnt_table_get_intro_commentFsTab::intro_comments
mnt_table_get_nentsFsTab::len
MountInfo::len
Swaps::len
UTab::len
mnt_table_get_root_fsMountInfo::root
mnt_table_get_trailing_commentFsTab::trailing_comments
mnt_table_get_userdataManaged internally.
mnt_table_insert_fsFsTab::push_front
FsTab::try_push_front
FsTab::insert
FsTab::try_insert
UTab::push_front
UTab::insert
mnt_table_is_emptyFsTab::is_empty
MountInfo::is_empty
Swaps::is_empty
UTab::is_empty
mnt_table_is_fs_mountedMountInfo::is_mounted
mnt_table_last_fsFsTab::last
MountInfo::last
Swaps::last
UTab::last
mnt_table_move_fsFsTab::transfer
UTab::transfer
mnt_table_next_child_fsMountInfo::iter_children
MountInfo::try_iter_children
mnt_table_next_fsFsTab::iter
FsTab::try_iter
FsTab::iter_mut
FsTab::try_iter_mut
MountInfo::iter
MountInfo::try_iter
Swaps::iter
Swaps::try_iter
UTab::iter
UTab::try_iter
UTab::iter_mut
UTab::try_iter_mut
mnt_table_over_fsMountInfo::iter_overmounts
mnt_table_parse_dirFsTab::import_directory
mnt_table_parse_fileFsTab::import_file
mnt_table_parse_fstabFsTab::import_etc_fstab
mnt_table_parse_mtabMountInfo::import_mountinfo
mnt_table_parse_streamFsTab::import_from_stream
mnt_table_parse_swapsSwaps::import_proc_swaps
mnt_table_remove_fsFsTab::remove
UTab::remove
mnt_table_set_cacheFsTab::set_cache
MountInfo::set_cache
Swaps::set_cache
UTab::set_cache
mnt_table_set_intro_commentFsTab::set_intro_comments
mnt_table_set_iterFsTabIter::advance_to
FsTabIterMut::advance_to
MountInfoIter::advance_to
SwapsIter::advance_to
UTabIter::advance_to
UTabIterMut::advance_to
mnt_table_set_parser_errcbFsTab::set_parser_error_handler
MountInfo::set_parser_error_handler
Swaps::set_parser_error_handler
UTab::set_parser_error_handler
mnt_table_set_trailing_commentFsTab::set_trailing_comments
mnt_table_set_userdataManaged internally.
mnt_table_uniq_fsFsTab::dedup_first_by
FsTab::dedup_last_by
MountInfo::dedup_first_by
MountInfo::dedup_last_by
MountInfo::distinct_first_by
MountInfo::distinct_last_by
Swaps::dedup_first_by
Swaps::dedup_last_by
UTab::dedup_first_by
UTab::dedup_last_by
mnt_table_with_commentsFsTab::is_importing_comments
FsTab::is_exporting_comments
§Filesystem
libmountrsmount
struct libmnt_fsFsTabEntry
MountInfoEntry
SwapsEntry
UTabEntry
mnt_copy_fsFsTabEntry::complete
FsTabEntry::copy
MountInfoEntry::copy
SwapsEntry::copy
UTabEntry::complete
UTabEntry::copy
mnt_free_fsFsTabEntry, MountInfoEntry, SwapsEntry, UTabEntry are automatically deallocated when they go out of scope.
mnt_free_mntentMntEnt is automatically deallocated when it goes out of scope.
mnt_ref_fsManaged automatically.
mnt_unref_fsManaged automatically.
mnt_fs_append_attributesUTabEntry::append_attributes
mnt_fs_append_commentFsTabEntry::append_comment
mnt_fs_append_optionsFsTabEntry::append_options
mnt_fs_get_attributeUTabEntry::attribute_value
mnt_fs_get_attributesUTabEntry::attributes
mnt_fs_get_bindsrcUTabEntry::bind_source
mnt_fs_get_commentFsTabEntry::comment
mnt_fs_get_devnoMountInfoEntry::device_id
mnt_fs_get_freqFsTabEntry::backup_frequency
mnt_fs_get_fs_optionsMountInfoEntry::fs_specific_options
mnt_fs_get_fstypeFsTabEntry::file_system_type
MountInfoEntry::file_system_type
mnt_fs_get_idMountInfoEntry::mount_id
UTabEntry::mount_id
mnt_fs_get_optionFsTabEntry::option_value
mnt_fs_get_optional_fieldsMountInfoEntry::optional_fields
mnt_fs_get_optionsFsTabEntry::mount_options
mnt_fs_get_parent_idMountInfoEntry::parent_id
mnt_fs_get_passnoFsTabEntry::fsck_checking_order
mnt_fs_get_prioritySwapsEntry::priority
mnt_fs_get_propagationMountInfoEntry::propagation_flags
mnt_fs_get_rootMountInfoEntry::root
UTabEntry::root
mnt_fs_get_sizeSwapsEntry::size
mnt_fs_get_sourceFsTabEntry::source
mnt_fs_get_srcpathFsTabEntry::source_path
MountInfoEntry::source_path
SwapsEntry::source_path
UTabEntry::source_path
mnt_fs_get_swaptypeSwapsEntry::swap_type
mnt_fs_get_tagFsTabEntry::tag
mnt_fs_get_tableNot implemented.
mnt_fs_get_targetFsTabEntry::target
MountInfoEntry::target
mnt_fs_get_tidMountInfoEntry::pid
mnt_fs_get_usedsizeSwapsEntry::size_used
mnt_fs_get_userdataManaged internally.
mnt_fs_get_user_optionsUTabEntry::mount_options
mnt_fs_get_vfs_optionsMountInfoEntry::fs_independent_options
mnt_fs_get_vfs_options_allMountInfoEntry::fs_independent_options_full
mnt_fs_is_kernelFsTabEntry::is_from_kernel
MountInfoEntry::is_from_kernel
SwapsEntry::is_from_kernel
UTabEntry::is_from_kernel
mnt_fs_is_netfsFsTabEntry::is_net_fs
MountInfoEntry::is_net_fs
SwapsEntry::is_net_fs
UTabEntry::is_net_fs
mnt_fs_is_pseudofsFsTabEntry::is_pseudo_fs
MountInfoEntry::is_pseudo_fs
SwapsEntry::is_pseudo_fs
UTabEntry::is_pseudo_fs
mnt_fs_is_regularfsFsTabEntry::is_regular_fs
MountInfoEntry::is_regular_fs
SwapsEntry::is_regular_fs
UTabEntry::is_regular_fs
mnt_fs_is_swapareaFsTabEntry::is_swap
MountInfoEntry::is_swap
SwapsEntry::is_swap
UTabEntry::is_swap
mnt_fs_match_fstypeFsTabEntry::has_any_fs_type
MountInfoEntry::has_any_fs_type
mnt_fs_match_optionsFsTabEntry::has_any_option
UTabEntry::has_any_option
mnt_fs_match_sourceFsTabEntry::is_source
MountInfoEntry::is_source
SwapsEntry::is_source
UTabEntry::is_source
mnt_fs_match_targetFsTabEntry::is_target
MountInfoEntry::is_target
UTabEntry::is_target
mnt_fs_prepend_attributesUTabEntry::prepend_attributes
mnt_fs_prepend_optionsFsTabEntry::prepend_options
mnt_fs_print_debugFsTabEntry::print_debug_to
MountInfoEntry::print_debug_to
mnt_fs_set_attributesUTabEntry::set_attributes
mnt_fs_set_bindsrcUTabEntry::set_bind_source
mnt_fs_set_commentFsTabEntry::set_comment
mnt_fs_set_freqFsTabEntry::set_backup_frequency
mnt_fs_set_fstypeFsTabEntry::set_file_system_type
mnt_fs_set_optionsFsTabEntry::set_mount_options
mnt_fs_set_passnoFsTabEntry::set_fsck_checking_order
mnt_fs_set_prioritySwapsEntry::set_priority
mnt_fs_set_rootUTabEntry::set_root
mnt_fs_set_sourceFsTabEntry::set_source
UTabEntry::set_source_path
mnt_fs_set_targetFsTabEntry::set_target
mnt_fs_set_userdataManaged internally.
mnt_fs_strdup_optionsMountInfoEntry::fs_options
mnt_fs_streq_srcpathFsTabEntry::is_exact_source
MountInfoEntry::is_exact_source
SwapsEntry::is_exact_source
UTabEntry::is_exact_source
mnt_fs_streq_targetFsTabEntry::is_exact_target
MountInfoEntry::is_exact_target
UTabEntry::is_exact_target
mnt_fs_to_mntentFsTabEntry::to_mnt_ent
mnt_new_fsFsTabEntry::builder
mnt_reset_fsNot supported.

§Tables management

§Locking
§Tables update
§Monitor
§Compare changes in mount tables

§Mount options

§Options string
§Option maps

§Misc

§Library initialization
§Cache
libmountrsmount
struct libmnt_cacheCache
mnt_new_cacheCache::new
mnt_free_cacheCache is automatically deallocated when it goes out of scope.
mnt_ref_cacheManaged automatically.
mnt_unref_cacheManaged automatically.
mnt_cache_device_has_tagCache::device_has_tag
mnt_cache_find_tag_valueCache::find_tag_value
mnt_cache_read_tagsCache::import_tags
mnt_cache_set_targetsCache::import_paths
mnt_cache_set_sbprobeCache::collect_fs_properties
mnt_get_fstypeCache::find_file_system_type
Cache::find_and_cache_file_system_type
mnt_pretty_pathCache::canonicalize
Cache::canonicalize_and_cache
mnt_resolve_pathCache::resolve
Cache::resolve_and_cache
mnt_resolve_specNot implemented. Use the specialized functions corresponding to mnt_resolve_path or mnt_resolve_tag as applicable.
mnt_resolve_tagCache::find_first_device_with_tag
Cache::find_and_cache_first_device_with_tag
mnt_resolve_targetCache::find_device_mounted_at
Cache::find_and_cache_device_mounted_at
§Iterator
§Utils
§Version functions

Modules§

cache
High-level API to handle device identification, and tag extraction.
debug
Activate debug message output.
device
Module describing supported mount sources.
entries
Collection of data structures representing lines in file system description files.
errors
Runtime errors.
flags
Configuration flags.
fs
Module for working with file systems.
iter
File system description file iterators.
mount
High-level API to mount/unmount devices.
optstring
Low-level functions to manipulate mount option strings.
tables
Module for working with file system description files.
utils
Miscellaneous utilities.
version
Functions to get library version data.

Enums§

RsMountError
Library-level runtime errors.

Type Aliases§

Result
A specialized Result type for rsmount.