| 1 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/; |
| 2 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 3 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#; |
| 4 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#; |
| 5 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#; |
| 6 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#}; |
| 7 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::current_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/current_dir().; |
| 8 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/::Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#; |
| 9 |
|
| 10 |
use nixrust-analyzer cargo nix 0.31.3 crate/::mountrust-analyzer cargo nix 0.31.3 mount/::{MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#, mountrust-analyzer cargo nix 0.31.3 mount/linux/mount().}; |
| 11 |
|
| 12 |
use {OSErrorrust-analyzer cargo libmount 0.1.15 OSError#, Errorrust-analyzer cargo libmount 0.1.15 Error#}; |
| 13 |
use util::path_to_cstring; |
| 14 |
use explain::{Explainable, exists, user}; |
| 15 |
use mountinfo::{parse_mount_point}; |
| 16 |
|
| 17 |
/// A remount definition |
| 18 |
/// |
| 19 |
/// Usually it is used to change mount flags for a mounted filesystem. |
| 20 |
/// Especially to make a readonly filesystem writable or vice versa. |
| 21 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 22 |
pub struct Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 23 |
pathrust-analyzer cargo libmount 0.1.15 remount/Remount#path.: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#, |
| 24 |
flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags.: MountFlagsrust-analyzer cargo libmount 0.1.15 remount/MountFlags#, |
| 25 |
} |
| 26 |
|
| 27 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 28 |
struct MountFlagsrust-analyzer cargo libmount 0.1.15 remount/MountFlags# { |
| 29 |
pub bindrust-analyzer cargo libmount 0.1.15 remount/MountFlags#bind.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 30 |
pub readonlyrust-analyzer cargo libmount 0.1.15 remount/MountFlags#readonly.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 31 |
pub nodevrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodev.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 32 |
pub noexecrust-analyzer cargo libmount 0.1.15 remount/MountFlags#noexec.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 33 |
pub nosuidrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nosuid.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 34 |
pub noatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#noatime.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 35 |
pub nodiratimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodiratime.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 36 |
pub relatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#relatime.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 37 |
pub strictatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#strictatime.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 38 |
pub dirsyncrust-analyzer cargo libmount 0.1.15 remount/MountFlags#dirsync.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 39 |
pub synchronousrust-analyzer cargo libmount 0.1.15 remount/MountFlags#synchronous.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 40 |
pub mandlockrust-analyzer cargo libmount 0.1.15 remount/MountFlags#mandlock.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, |
| 41 |
} |
| 42 |
|
| 43 |
impl MountFlagsrust-analyzer cargo libmount 0.1.15 remount/MountFlags# { |
| 44 |
fn apply_to_flagsrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags]apply_to_flags().(&self, flags: MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#) -> MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags# { |
| 45 |
let mut flags = flags; |
| 46 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_BINDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_BIND., self.bindrust-analyzer cargo libmount 0.1.15 remount/MountFlags#bind.); |
| 47 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RDONLYrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RDONLY., self.readonlyrust-analyzer cargo libmount 0.1.15 remount/MountFlags#readonly.); |
| 48 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODEVrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODEV., self.nodevrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodev.); |
| 49 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOEXECrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOEXEC., self.noexecrust-analyzer cargo libmount 0.1.15 remount/MountFlags#noexec.); |
| 50 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOSUIDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOSUID., self.nosuidrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nosuid.); |
| 51 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOATIME., self.noatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#noatime.); |
| 52 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODIRATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODIRATIME., self.nodiratimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodiratime.); |
| 53 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RELATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RELATIME., self.relatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#relatime.); |
| 54 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_STRICTATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_STRICTATIME., self.strictatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#strictatime.); |
| 55 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_DIRSYNCrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_DIRSYNC., self.dirsyncrust-analyzer cargo libmount 0.1.15 remount/MountFlags#dirsync.); |
| 56 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_SYNCHRONOUSrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_SYNCHRONOUS., self.synchronousrust-analyzer cargo libmount 0.1.15 remount/MountFlags#synchronous.); |
| 57 |
flags = apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_MANDLOCKrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_MANDLOCK., self.mandlockrust-analyzer cargo libmount 0.1.15 remount/MountFlags#mandlock.); |
| 58 |
flags |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
fn apply_flagrust-analyzer cargo libmount 0.1.15 remount/apply_flag().(flags: MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#, flag: MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#, set: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>) -> MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags# { |
| 63 |
match set { |
| 64 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) => flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().flag, |
| 65 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false) => flags rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitAnd<Self>`]bitand().&rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitAnd<Self>`]bitand(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitAnd<Self>`]bitand().!rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][Not]not().flag, |
| 66 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => flags, |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
quick_errorrust-analyzer cargo quick-error 2.0.1 quick_error!! { |
| 71 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 72 |
pub enum RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError# { |
| 73 |
Iorust-analyzer cargo libmount 0.1.15 remount/RemountError#Io#(msg: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, err: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) { |
| •74 |
source(err) |
| 75 |
display("{}: {}", msg, err) |
| 76 |
from(err: iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#) -> (Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(), err) |
| 77 |
} |
| 78 |
ParseMountInforust-analyzer cargo libmount 0.1.15 remount/RemountError#ParseMountInfo#(err: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) { |
| 79 |
display("{}", err) |
| 80 |
from() |
| 81 |
} |
| 82 |
UnknownMountPointrust-analyzer cargo libmount 0.1.15 remount/RemountError#UnknownMountPoint#(path: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#) { |
| 83 |
display("Cannot find mount point: {:?}", path) |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
impl Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 89 |
/// Create a new Remount operation |
| 90 |
/// |
| 91 |
/// By default it doesn't modify any flags. So is basically useless, you |
| 92 |
/// should set some flags to make it effective. |
| 93 |
pub fn newrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]new().<A: AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>>(path: A) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 94 |
Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 95 |
pathrust-analyzer cargo libmount 0.1.15 remount/Remount#path.: path.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().().to_path_bufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_path_buf().(), |
| 96 |
flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags.: Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags][Default]default().(), |
| 97 |
} |
| 98 |
} |
| 99 |
/// Set bind flag |
| 100 |
/// Note: remount readonly doesn't work without MS_BIND flag |
| 101 |
/// inside unpriviledged user namespaces |
| 102 |
pub fn bindrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]bind().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 103 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..bindrust-analyzer cargo libmount 0.1.15 remount/MountFlags#bind. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 104 |
self |
| 105 |
} |
| 106 |
/// Set readonly flag |
| 107 |
pub fn readonlyrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]readonly().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 108 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..readonlyrust-analyzer cargo libmount 0.1.15 remount/MountFlags#readonly. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 109 |
self |
| 110 |
} |
| 111 |
/// Set nodev flag |
| 112 |
pub fn nodevrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]nodev().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 113 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..nodevrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodev. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 114 |
self |
| 115 |
} |
| 116 |
/// Set noexec flag |
| 117 |
pub fn noexecrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]noexec().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 118 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..noexecrust-analyzer cargo libmount 0.1.15 remount/MountFlags#noexec. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 119 |
self |
| 120 |
} |
| 121 |
/// Set nosuid flag |
| 122 |
pub fn nosuidrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]nosuid().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 123 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..nosuidrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nosuid. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 124 |
self |
| 125 |
} |
| 126 |
/// Set noatime flag |
| 127 |
pub fn noatimerust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]noatime().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 128 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..noatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#noatime. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 129 |
self |
| 130 |
} |
| 131 |
/// Set nodiratime flag |
| 132 |
pub fn nodiratimerust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]nodiratime().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 133 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..nodiratimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodiratime. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 134 |
self |
| 135 |
} |
| 136 |
/// Set relatime flag |
| 137 |
pub fn relatimerust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]relatime().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 138 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..relatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#relatime. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 139 |
self |
| 140 |
} |
| 141 |
/// Set strictatime flag |
| 142 |
pub fn strictatimerust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]strictatime().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 143 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..strictatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#strictatime. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 144 |
self |
| 145 |
} |
| 146 |
/// Set dirsync flag |
| 147 |
pub fn dirsyncrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]dirsync().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 148 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..dirsyncrust-analyzer cargo libmount 0.1.15 remount/MountFlags#dirsync. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 149 |
self |
| 150 |
} |
| 151 |
/// Set synchronous flag |
| 152 |
pub fn synchronousrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]synchronous().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 153 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..synchronousrust-analyzer cargo libmount 0.1.15 remount/MountFlags#synchronous. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 154 |
self |
| 155 |
} |
| 156 |
/// Set mandlock flag |
| 157 |
pub fn mandlockrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]mandlock().(mut self, flag: bool) -> Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 158 |
self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..mandlockrust-analyzer cargo libmount 0.1.15 remount/MountFlags#mandlock. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flag); |
| 159 |
self |
| 160 |
} |
| 161 |
|
| 162 |
/// Execute a remount |
| 163 |
pub fn bare_remountrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]bare_remount().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), OSErrorrust-analyzer cargo libmount 0.1.15 OSError#> { |
| 164 |
let mut flags = match get_mountpoint_flagsrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags().(&self.pathrust-analyzer cargo libmount 0.1.15 remount/Remount#path.) { |
| 165 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(flags) => flags, |
| 166 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => { |
| 167 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(OSErrorrust-analyzer cargo libmount 0.1.15 OSError#::from_remountrust-analyzer cargo libmount 0.1.15 impl#[OSError]from_remount().(e, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(self))); |
| 168 |
}, |
| 169 |
}; |
| 170 |
flags = self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..apply_to_flagsrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags]apply_to_flags().(flags) rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_REMOUNTrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_REMOUNT.; |
| 171 |
mountrust-analyzer cargo nix 0.31.3 mount/linux/mount().( |
| 172 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#::<&CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#>, |
| 173 |
&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString][Deref]deref().path_to_cstringrust-analyzer cargo libmount 0.1.15 util/path_to_cstring().(&self.pathrust-analyzer cargo libmount 0.1.15 remount/Remount#path.), |
| 174 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#::<&CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#>, |
| 175 |
flags, |
| 176 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#::<&CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#>, |
| 177 |
).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| OSErrorrust-analyzer cargo libmount 0.1.15 OSError#::from_nixrust-analyzer cargo libmount 0.1.15 impl#[OSError]from_nix().(err, Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(self))) |
| 178 |
} |
| 179 |
|
| 180 |
/// Execute a remount and explain the error immediately |
| 181 |
pub fn remountrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]remount().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo libmount 0.1.15 Error#> { |
| 182 |
self.bare_remountrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]bare_remount().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(OSErrorrust-analyzer cargo libmount 0.1.15 OSError#::explainrust-analyzer cargo libmount 0.1.15 error/impl#[OSError]explain().) |
| 183 |
} |
| 184 |
} |
| 185 |
|
| 186 |
impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for MountFlagsrust-analyzer cargo libmount 0.1.15 remount/MountFlags# { |
| 187 |
fn fmtrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags][Display]fmt().(&self, fmt: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 188 |
let mut prefix = ""; |
| 189 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.bindrust-analyzer cargo libmount 0.1.15 remount/MountFlags#bind. { |
| 190 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}bind", prefix)); |
| 191 |
prefix = ","; |
| 192 |
} |
| 193 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.readonlyrust-analyzer cargo libmount 0.1.15 remount/MountFlags#readonly. { |
| 194 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}ro", prefix)); |
| 195 |
prefix = ","; |
| 196 |
} |
| 197 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.nodevrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodev. { |
| 198 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}nodev", prefix)); |
| 199 |
prefix = ","; |
| 200 |
} |
| 201 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.noexecrust-analyzer cargo libmount 0.1.15 remount/MountFlags#noexec. { |
| 202 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}noexec", prefix)); |
| 203 |
prefix = ","; |
| 204 |
} |
| 205 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.nosuidrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nosuid. { |
| 206 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}nosuid", prefix)); |
| 207 |
prefix = ","; |
| 208 |
} |
| 209 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.noatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#noatime. { |
| 210 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}noatime", prefix)); |
| 211 |
prefix = ","; |
| 212 |
} |
| 213 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.nodiratimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodiratime. { |
| 214 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}nodiratime", prefix)); |
| 215 |
prefix = ","; |
| 216 |
} |
| 217 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.relatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#relatime. { |
| 218 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}relatime", prefix)); |
| 219 |
prefix = ","; |
| 220 |
} |
| 221 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.strictatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#strictatime. { |
| 222 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}strictatime", prefix)); |
| 223 |
prefix = ","; |
| 224 |
} |
| 225 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.dirsyncrust-analyzer cargo libmount 0.1.15 remount/MountFlags#dirsync. { |
| 226 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}dirsync", prefix)); |
| 227 |
prefix = ","; |
| 228 |
} |
| 229 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.synchronousrust-analyzer cargo libmount 0.1.15 remount/MountFlags#synchronous. { |
| 230 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}sync", prefix)); |
| 231 |
prefix = ","; |
| 232 |
} |
| 233 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true) = self.mandlockrust-analyzer cargo libmount 0.1.15 remount/MountFlags#mandlock. { |
| 234 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{}mand", prefix)); |
| 235 |
} |
| 236 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 237 |
} |
| 238 |
} |
| 239 |
|
| 240 |
impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 241 |
fn fmtrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount][Display]fmt().(&self, fmt: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 242 |
if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags..apply_to_flagsrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags]apply_to_flags().(MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::emptyrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]empty().()).is_emptyrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]is_empty().() { |
| 243 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "{} ", self.flagsrust-analyzer cargo libmount 0.1.15 remount/Remount#flags.)); |
| 244 |
} |
| 245 |
writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "remount {:?}", &self.pathrust-analyzer cargo libmount 0.1.15 remount/Remount#path.) |
| 246 |
} |
| 247 |
} |
| 248 |
|
| 249 |
impl Explainablerust-analyzer cargo libmount 0.1.15 explain/Explainable# for Remountrust-analyzer cargo libmount 0.1.15 remount/Remount# { |
| 250 |
fn explainrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount][Explainable]explain().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 251 |
[ |
| 252 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("path: {}", existsrust-analyzer cargo libmount 0.1.15 explain/exists().(&self.pathrust-analyzer cargo libmount 0.1.15 remount/Remount#path.)), |
| 253 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", userrust-analyzer cargo libmount 0.1.15 explain/user().()), |
| 254 |
].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(", ") |
| 255 |
} |
| 256 |
} |
| 257 |
|
| 258 |
fn get_mountpoint_flagsrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags().(path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#, RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#> { |
| 259 |
let mount_path = if path.is_absoluterust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]is_absolute().() { |
| 260 |
path.to_path_bufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_path_buf().() |
| 261 |
} else { |
| 262 |
let mut mpath = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(current_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/current_dir().()); |
| 263 |
mpath.pushrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]push().(path); |
| 264 |
mpath |
| 265 |
}; |
| 266 |
let mut mountinfo_content = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().1024); |
| 267 |
let mountinfo_path = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/proc/self/mountinfo"); |
| 268 |
let mut mountinfo_file = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(Filerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/File#::openrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File]open().(mountinfo_path) |
| 269 |
.map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#::Iorust-analyzer cargo libmount 0.1.15 remount/RemountError#Io#( |
| 270 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Cannot open file: {:?}", mountinfo_path), e))); |
| 271 |
tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(mountinfo_file.read_to_endrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[File][Read]read_to_end().(&mut mountinfo_content) |
| 272 |
.map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#::Iorust-analyzer cargo libmount 0.1.15 remount/RemountError#Io#( |
| 273 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("Cannot read file: {:?}", mountinfo_path), e))); |
| 274 |
match get_mountpoint_flags_fromrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags_from().(&mountinfo_content, &mount_path) { |
| 275 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(flags)) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(flags), |
| 276 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#::UnknownMountPointrust-analyzer cargo libmount 0.1.15 remount/RemountError#UnknownMountPoint#(mount_path)), |
| 277 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e), |
| 278 |
} |
| 279 |
} |
| 280 |
|
| 281 |
fn get_mountpoint_flags_fromrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags_from().(content: &[u8], path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) |
| 282 |
-> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#>, RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#> |
| 283 |
{ |
| 284 |
// iterate from the end of the mountinfo file |
| 285 |
for line in content.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]split().(|c| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'\n').revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().() { |
| 286 |
let entry = parse_mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/parse_mount_point().(line) |
| 287 |
.map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#::ParseMountInforust-analyzer cargo libmount 0.1.15 remount/RemountError#ParseMountInfo#(e.0rust-analyzer cargo libmount 0.1.15 mountinfo/ParseRowError#0.))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 288 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mount_point) = entry { |
| 289 |
if mount_point.mount_pointrust-analyzer cargo libmount 0.1.15 mountinfo/MountPoint#mount_point. rust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[`Cow<'_, OsStr>`][`PartialEq<&Path>`]eq().==rust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[`Cow<'_, OsStr>`][`PartialEq<&Path>`]eq(). rust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[`Cow<'_, OsStr>`][`PartialEq<&Path>`]eq().path { |
| 290 |
return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mount_point.get_mount_flagsrust-analyzer cargo libmount 0.1.15 mountinfo/impl#[`MountPoint<'a>`]get_mount_flags().())); |
| 291 |
} |
| 292 |
} |
| 293 |
} |
| 294 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) |
| 295 |
} |
| 296 |
|
| 297 |
#[cfg(test)] |
| 298 |
mod testrust-analyzer cargo libmount 0.1.15 remount/test/ { |
| 299 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#; |
| 300 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#; |
| 301 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::osrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/::unixrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/::OsStrExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/OsStrExt#; |
| 302 |
|
| 303 |
use nixrust-analyzer cargo nix 0.31.3 crate/::mountrust-analyzer cargo nix 0.31.3 mount/::MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#; |
| 304 |
|
| 305 |
use Errorrust-analyzer cargo libmount 0.1.15 Error#; |
| 306 |
use superrust-analyzer cargo libmount 0.1.15 remount/::{Remountrust-analyzer cargo libmount 0.1.15 remount/Remount#, RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#, MountFlagsrust-analyzer cargo libmount 0.1.15 remount/MountFlags#}; |
| 307 |
use superrust-analyzer cargo libmount 0.1.15 remount/::{get_mountpoint_flagsrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags()., get_mountpoint_flags_fromrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags_from().}; |
| 308 |
|
| 309 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 310 |
fn test_mount_flagsrust-analyzer cargo libmount 0.1.15 remount/test/test_mount_flags().() { |
| 311 |
let flags = MountFlagsrust-analyzer cargo libmount 0.1.15 remount/MountFlags# { |
| 312 |
bindrust-analyzer cargo libmount 0.1.15 remount/MountFlags#bind.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 313 |
readonlyrust-analyzer cargo libmount 0.1.15 remount/MountFlags#readonly.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 314 |
nodevrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodev.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 315 |
noexecrust-analyzer cargo libmount 0.1.15 remount/MountFlags#noexec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 316 |
nosuidrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nosuid.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 317 |
noatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#noatime.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 318 |
nodiratimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodiratime.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 319 |
relatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#relatime.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 320 |
strictatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#strictatime.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 321 |
dirsyncrust-analyzer cargo libmount 0.1.15 remount/MountFlags#dirsync.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 322 |
synchronousrust-analyzer cargo libmount 0.1.15 remount/MountFlags#synchronous.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 323 |
mandlockrust-analyzer cargo libmount 0.1.15 remount/MountFlags#mandlock.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), |
| 324 |
}; |
| 325 |
let bits = (MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_BINDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_BIND. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RDONLYrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RDONLY. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODEVrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODEV. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOEXECrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOEXEC. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOSUIDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOSUID. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). |
| 326 |
MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOATIME. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODIRATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODIRATIME. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RELATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RELATIME. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_STRICTATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_STRICTATIME. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). |
| 327 |
MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_DIRSYNCrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_DIRSYNC. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_SYNCHRONOUSrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_SYNCHRONOUS. rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().|rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor().MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_MANDLOCKrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_MANDLOCK.).bitsrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]bits().(); |
| 328 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(flags.apply_to_flagsrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags]apply_to_flags().(MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::emptyrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]empty().()).bitsrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]bits().(), bits); |
| 329 |
|
| 330 |
let flags = MountFlagsrust-analyzer cargo libmount 0.1.15 remount/MountFlags# { |
| 331 |
bindrust-analyzer cargo libmount 0.1.15 remount/MountFlags#bind.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 332 |
readonlyrust-analyzer cargo libmount 0.1.15 remount/MountFlags#readonly.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 333 |
nodevrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodev.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 334 |
noexecrust-analyzer cargo libmount 0.1.15 remount/MountFlags#noexec.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 335 |
nosuidrust-analyzer cargo libmount 0.1.15 remount/MountFlags#nosuid.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 336 |
noatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#noatime.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 337 |
nodiratimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#nodiratime.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 338 |
relatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#relatime.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 339 |
strictatimerust-analyzer cargo libmount 0.1.15 remount/MountFlags#strictatime.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 340 |
dirsyncrust-analyzer cargo libmount 0.1.15 remount/MountFlags#dirsync.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 341 |
synchronousrust-analyzer cargo libmount 0.1.15 remount/MountFlags#synchronous.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 342 |
mandlockrust-analyzer cargo libmount 0.1.15 remount/MountFlags#mandlock.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(false), |
| 343 |
}; |
| 344 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(flags.apply_to_flagsrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags]apply_to_flags().(MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::from_bits_truncaterust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]from_bits_truncate().(bits)).bitsrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]bits().(), 0); |
| 345 |
|
| 346 |
let flags = MountFlagsrust-analyzer cargo libmount 0.1.15 remount/MountFlags#::defaultrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags][Default]default().(); |
| 347 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(flags.apply_to_flagsrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags]apply_to_flags().(MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::from_bits_truncaterust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]from_bits_truncate().(0)).bitsrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]bits().(), 0); |
| 348 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(flags.apply_to_flagsrust-analyzer cargo libmount 0.1.15 remount/impl#[MountFlags]apply_to_flags().(MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::from_bits_truncaterust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]from_bits_truncate().(bits)).bitsrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]bits().(), bits); |
| 349 |
} |
| 350 |
|
| 351 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 352 |
fn test_remountrust-analyzer cargo libmount 0.1.15 remount/test/test_remount().() { |
| 353 |
let remount = Remountrust-analyzer cargo libmount 0.1.15 remount/Remount#::newrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]new().("/"); |
| 354 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", remount), "remount \"/\""); |
| 355 |
|
| 356 |
let remount = Remountrust-analyzer cargo libmount 0.1.15 remount/Remount#::newrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]new().("/").readonlyrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]readonly().(true).nodevrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]nodev().(true); |
| 357 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", remount), "ro,nodev remount \"/\""); |
| 358 |
} |
| 359 |
|
| 360 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 361 |
fn test_get_mountpoint_flags_fromrust-analyzer cargo libmount 0.1.15 remount/test/test_get_mountpoint_flags_from().() { |
| 362 |
let content = b"19 24 0:4 / /proc rw,nosuid,nodev,noexec,relatime shared:12 - proc proc rw"; |
| 363 |
let flags = get_mountpoint_flags_fromrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags_from().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/proc")).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 364 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODEVrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODEV. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOEXECrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOEXEC. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOSUIDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOSUID. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_RELATIMErust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_RELATIME.); |
| 365 |
} |
| 366 |
|
| 367 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 368 |
fn test_get_mountpoint_flags_from_dupsrust-analyzer cargo libmount 0.1.15 remount/test/test_get_mountpoint_flags_from_dups().() { |
| 369 |
let content = b"11 18 0:4 / /tmp rw shared:28 - tmpfs tmpfs rw\n\ |
| 370 |
12 18 0:6 / /tmp rw,nosuid,nodev shared:29 - tmpfs tmpfs rw\n"; |
| 371 |
let flags = get_mountpoint_flags_fromrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags_from().(&content[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/tmp")).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 372 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(flags, MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NOSUIDrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NOSUID. |rust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags][`BitOr<Self>`]bitor(). MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::MS_NODEVrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]MS_NODEV.); |
| 373 |
} |
| 374 |
|
| 375 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 376 |
fn test_get_mountpoint_flagsrust-analyzer cargo libmount 0.1.15 remount/test/test_get_mountpoint_flags().() { |
| 377 |
let res = get_mountpoint_flagsrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags().(Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/")); |
| •378 |
match res { |
| 379 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(v) => {}, |
| 380 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#::UnknownMountPointrust-analyzer cargo libmount 0.1.15 remount/RemountError#UnknownMountPoint#(p)) => assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p, Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().("/")), // in some chroot environments mount point information on the / mountpoint may be unavailable. |
| 381 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("{}",e) |
| 382 |
} |
| 383 |
} |
| 384 |
|
| 385 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 386 |
fn test_get_mountpoint_flags_unknownrust-analyzer cargo libmount 0.1.15 remount/test/test_get_mountpoint_flags_unknown().() { |
| 387 |
let mount_point = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#::from_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]from_bytes().(b"/\xff")); |
| 388 |
let error = get_mountpoint_flagsrust-analyzer cargo libmount 0.1.15 remount/get_mountpoint_flags().(mount_point).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 389 |
match error { |
| 390 |
RemountErrorrust-analyzer cargo libmount 0.1.15 remount/RemountError#::UnknownMountPointrust-analyzer cargo libmount 0.1.15 remount/RemountError#UnknownMountPoint#(p) => assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(p, mount_point), |
| 391 |
_ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(), |
| 392 |
} |
| 393 |
} |
| 394 |
|
| 395 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 396 |
fn test_remount_unknown_mountpointrust-analyzer cargo libmount 0.1.15 remount/test/test_remount_unknown_mountpoint().() { |
| 397 |
let remount = Remountrust-analyzer cargo libmount 0.1.15 remount/Remount#::newrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]new().("/non-existent"); |
| 398 |
let error = remount.remountrust-analyzer cargo libmount 0.1.15 remount/impl#[Remount]remount().().unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().(); |
| 399 |
let Errorrust-analyzer cargo libmount 0.1.15 Error#(_, e, msg) = error; |
| 400 |
match e.get_refrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]get_ref().() { |
| 401 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(e) => { |
| 402 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 403 |
e.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 404 |
"Cannot find mount point: \"/non-existent\""); |
| 405 |
}, |
| 406 |
_ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(), |
| 407 |
} |
| 408 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(msg.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().( |
| 409 |
"Cannot find mount point: \"/non-existent\", path: missing, ")); |
| 410 |
} |
| 411 |
} |