| 1 | 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/; |
| 2 | 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#}; |
| 3 | 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/::metadatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/metadata().; |
| 4 | 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#, CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#}; |
| 5 | 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/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/fs/::MetadataExtrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/fs/MetadataExt#; |
| 6 | 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#; |
| 7 | |
| 8 | 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().}; |
| 9 | |
| 10 | use util::{path_to_cstring, as_path}; |
| 11 | use {OSErrorrust-analyzer cargo libmount 0.1.15 OSError#, Errorrust-analyzer cargo libmount 0.1.15 Error#}; |
| 12 | use explain::{Explainable, exists, user}; |
| 13 | |
| 14 | |
| 15 | /// An overlay mount point |
| 16 | /// |
| 17 | /// This requires linux kernel of at least 3.18. |
| 18 | /// |
| 19 | /// To use overlayfs in user namespace you need a kernel patch (which is |
| 20 | /// enabled by default in ubuntu). At least this is still true for mainline |
| 21 | /// kernel 4.5.0. |
| 22 | #[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:)] |
| 23 | pub struct Overlayrust-analyzer cargo libmount 0.1.15 overlay/Overlay# { |
| 24 | lowerdirsrust-analyzer cargo libmount 0.1.15 overlay/Overlay#lowerdirs.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>, |
| 25 | upperdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#upperdir.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>, |
| 26 | workdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#workdir.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>, |
| 27 | targetrust-analyzer cargo libmount 0.1.15 overlay/Overlay#target.: CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#, |
| 28 | } |
| 29 | |
| 30 | impl Overlayrust-analyzer cargo libmount 0.1.15 overlay/Overlay# { |
| 31 | /// A constructor for read-only overlayfs mount |
| 32 | /// |
| 33 | /// You must have at least two directories in the list (for single |
| 34 | /// dir it might be equal to bind mount, but kernel return EINVAL for |
| 35 | /// such options). |
| 36 | /// |
| 37 | /// The top-most directory will be first in the list. |
| 38 | pub fn readonlyrust-analyzer cargo libmount 0.1.15 overlay/impl#[Overlay]readonly().<'x, I, T>(dirs: I, target: T) -> Overlayrust-analyzer cargo libmount 0.1.15 overlay/Overlay# |
| 39 | where I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#=&'x Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>, T: 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#> |
| 40 | { |
| 41 | Overlayrust-analyzer cargo libmount 0.1.15 overlay/Overlay# { |
| 42 | lowerdirsrust-analyzer cargo libmount 0.1.15 overlay/Overlay#lowerdirs.: dirs.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|x| x.to_path_bufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_path_buf().()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 43 | upperdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#upperdir.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 44 | workdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#workdir.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 45 | targetrust-analyzer cargo libmount 0.1.15 overlay/Overlay#target.: path_to_cstringrust-analyzer cargo libmount 0.1.15 util/path_to_cstring().(target.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().()), |
| 46 | } |
| 47 | } |
| 48 | /// A constructor for writable overlayfs mount |
| 49 | /// |
| 50 | /// The upperdir and workdir must be on the same filesystem. |
| 51 | /// |
| 52 | /// The top-most directory will be first in the list of lowerdirs. |
| 53 | pub fn writablerust-analyzer cargo libmount 0.1.15 overlay/impl#[Overlay]writable().<'x, I, B, C, D>(lowerdirs: I, upperdir: B, |
| 54 | workdir: C, target: D) |
| 55 | -> Overlayrust-analyzer cargo libmount 0.1.15 overlay/Overlay# |
| 56 | where I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#=&'x Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>, B: 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#>, |
| 57 | C: 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#>, D: 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#>, |
| 58 | { |
| 59 | Overlayrust-analyzer cargo libmount 0.1.15 overlay/Overlay# { |
| 60 | lowerdirsrust-analyzer cargo libmount 0.1.15 overlay/Overlay#lowerdirs.: lowerdirs.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|x| x.to_path_bufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]to_path_buf().()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 61 | upperdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#upperdir.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(upperdir.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().()), |
| 62 | workdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#workdir.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(workdir.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().()), |
| 63 | targetrust-analyzer cargo libmount 0.1.15 overlay/Overlay#target.: path_to_cstringrust-analyzer cargo libmount 0.1.15 util/path_to_cstring().(target.as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#as_ref().()), |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | /// Execute an overlay mount |
| 68 | pub fn bare_mountrust-analyzer cargo libmount 0.1.15 overlay/impl#[Overlay]bare_mount().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), OSErrorrust-analyzer cargo libmount 0.1.15 OSError#> { |
| 69 | let mut options = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 70 | options.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<&'a T>`]extend().(b"lowerdir="); |
| 71 | for (i, p) in self.lowerdirsrust-analyzer cargo libmount 0.1.15 overlay/Overlay#lowerdirs..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 72 | if i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 { |
| 73 | options.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b':') |
| 74 | } |
| 75 | append_escaperust-analyzer cargo libmount 0.1.15 overlay/append_escape().(&mut options, p); |
| 76 | } |
| 77 | if let (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(u), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(w)) = (self.upperdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#upperdir..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), self.workdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#workdir..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()) { |
| 78 | options.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<&'a T>`]extend().(b",upperdir="); |
| 79 | append_escaperust-analyzer cargo libmount 0.1.15 overlay/append_escape().(&mut options, u); |
| 80 | options.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<&'a T>`]extend().(b",workdir="); |
| 81 | append_escaperust-analyzer cargo libmount 0.1.15 overlay/append_escape().(&mut options, w); |
| 82 | } |
| 83 | mountrust-analyzer cargo nix 0.31.3 mount/linux/mount().( |
| 84 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#::from_bytes_with_nulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]from_bytes_with_nul().(b"overlay\0").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()), |
| 85 | &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString][Deref]deref().self.targetrust-analyzer cargo libmount 0.1.15 overlay/Overlay#target., |
| 86 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#::from_bytes_with_nulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]from_bytes_with_nul().(b"overlay\0").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()), |
| 87 | MsFlagsrust-analyzer cargo nix 0.31.3 mount/linux/MsFlags#::emptyrust-analyzer cargo nix 0.31.3 mount/linux/impl#[MsFlags]empty().(), |
| 88 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Deref]deref().options), |
| 89 | ).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))) |
| 90 | } |
| 91 | |
| 92 | /// Execute an overlay mount and explain the error immediately |
| 93 | pub fn mountrust-analyzer cargo libmount 0.1.15 overlay/impl#[Overlay]mount().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo libmount 0.1.15 Error#> { |
| 94 | self.bare_mountrust-analyzer cargo libmount 0.1.15 overlay/impl#[Overlay]bare_mount().().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().) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | /// Escape the path to put it into options string for overlayfs |
| 99 | /// |
| 100 | /// The rules here are not documented anywhere as far as I know and was |
| 101 | /// derived experimentally. |
| 102 | fn append_escaperust-analyzer cargo libmount 0.1.15 overlay/append_escape().(dest: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, path: &Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) { |
| 103 | for &byte in path.as_os_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]as_os_str().().as_bytesrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/ffi/os_str/impl#[OsStr][OsStrExt]as_bytes().().iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 104 | match byte { |
| 105 | // This is escape char |
| 106 | b'\\' => { dest.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b'\\'); dest.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b'\\'); } |
| 107 | // This is used as a path separator in lowerdir |
| 108 | b':' => { dest.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b'\\'); dest.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b':'); } |
| 109 | // This is used as a argument separator |
| 110 | b',' => { dest.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b'\\'); dest.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(b','); } |
| 111 | x => dest.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(x), |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | 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 Overlayrust-analyzer cargo libmount 0.1.15 overlay/Overlay# { |
| 117 | fn fmtrust-analyzer cargo libmount 0.1.15 overlay/impl#[Overlay][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# { |
| 118 | if let (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(udir), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(wdir)) = |
| 119 | (self.upperdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#upperdir..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), self.workdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#workdir..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()) |
| 120 | { |
| 121 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "overlayfs \ |
| 122 | {},upperdir={:?},workdir={:?} -> {:?}", |
| 123 | self.lowerdirsrust-analyzer cargo libmount 0.1.15 overlay/Overlay#lowerdirs..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|x| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", x)) |
| 124 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>().joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(":"), |
| 125 | udir, wdir, as_pathrust-analyzer cargo libmount 0.1.15 util/as_path().(&self.targetrust-analyzer cargo libmount 0.1.15 overlay/Overlay#target.)) |
| 126 | } else { |
| 127 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(fmt, "overlayfs \ |
| 128 | {} -> {:?}", |
| 129 | self.lowerdirsrust-analyzer cargo libmount 0.1.15 overlay/Overlay#lowerdirs..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|x| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", x)) |
| 130 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>().joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(":"), |
| 131 | as_pathrust-analyzer cargo libmount 0.1.15 util/as_path().(&self.targetrust-analyzer cargo libmount 0.1.15 overlay/Overlay#target.)) |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | impl Explainablerust-analyzer cargo libmount 0.1.15 explain/Explainable# for Overlayrust-analyzer cargo libmount 0.1.15 overlay/Overlay# { |
| 137 | fn explainrust-analyzer cargo libmount 0.1.15 overlay/impl#[Overlay][Explainable]explain().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 138 | let mut info = self.lowerdirsrust-analyzer cargo libmount 0.1.15 overlay/Overlay#lowerdirs..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 139 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|x| formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}: {}", x, existsrust-analyzer cargo libmount 0.1.15 explain/exists().(x))) |
| 140 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>(); |
| 141 | if let (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(udir), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(wdir)) = |
| 142 | (self.upperdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#upperdir..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().(), self.workdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#workdir..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().()) |
| 143 | { |
| 144 | let umeta = metadatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/metadata().(&udir).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 145 | let wmeta = metadatarust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/metadata().(&wdir).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(); |
| 146 | info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("upperdir: {}", existsrust-analyzer cargo libmount 0.1.15 explain/exists().(&udir))); |
| 147 | info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("workdir: {}", existsrust-analyzer cargo libmount 0.1.15 explain/exists().(&wdir))); |
| 148 | |
| 149 | if let (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(u), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(w)) = (umeta, wmeta) { |
| 150 | info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", if u.devrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/fs/impl#[`fs::Metadata`][MetadataExt]dev().() == w.devrust-analyzer cargo std https://github.com/rust-lang/rust/library/std os/unix/fs/impl#[`fs::Metadata`][MetadataExt]dev().() |
| 151 | { "same-fs" } else { "different-fs" })); |
| 152 | } |
| 153 | if udir.starts_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]starts_with().(wdir) { |
| 154 | info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("upperdir-prefix-of-workdir".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 155 | } else if wdir.starts_withrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]starts_with().(udir) { |
| 156 | info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("workdir-prefix-of-upperdir".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 157 | } |
| 158 | info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("target: {}", existsrust-analyzer cargo libmount 0.1.15 explain/exists().(as_pathrust-analyzer cargo libmount 0.1.15 util/as_path().(&self.targetrust-analyzer cargo libmount 0.1.15 overlay/Overlay#target.)))); |
| 159 | } |
| 160 | if self.lowerdirsrust-analyzer cargo libmount 0.1.15 overlay/Overlay#lowerdirs..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().1 { |
| 161 | info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("no-lowerdirs".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 162 | } else if self.upperdirrust-analyzer cargo libmount 0.1.15 overlay/Overlay#upperdir..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() && self.lowerdirsrust-analyzer cargo libmount 0.1.15 overlay/Overlay#lowerdirs..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().2 { |
| 163 | info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("single-lowerdir".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 164 | } |
| 165 | info.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(userrust-analyzer cargo libmount 0.1.15 explain/user().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 166 | info.joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(", ") |
| 167 | } |
| 168 | } |
| 169 |