pub struct OverlayFs { /* private fields */ }Expand description
Overlay filesystem combining multiple layers.
Implementations§
Source§impl OverlayFs
impl OverlayFs
Sourcepub fn add_lower_layer(&mut self, layer: OverlayLayer)
pub fn add_lower_layer(&mut self, layer: OverlayLayer)
Add a read-only lower layer (bottom-most first).
Sourcepub fn lookup(&self, path: &str) -> Option<&OverlayEntry>
pub fn lookup(&self, path: &str) -> Option<&OverlayEntry>
Look up a file: check upper layer first, then lower layers top to bottom.
Sourcepub fn write_file(
&mut self,
path: &str,
content: Vec<u8>,
mode: u32,
) -> Result<(), KernelError>
pub fn write_file( &mut self, path: &str, content: Vec<u8>, mode: u32, ) -> Result<(), KernelError>
Write a file to the upper layer. If the file exists in a lower layer, performs copy-up first.
Sourcepub fn delete_file(&mut self, path: &str) -> Result<(), KernelError>
pub fn delete_file(&mut self, path: &str) -> Result<(), KernelError>
Delete a file by creating a whiteout in the upper layer.
Sourcepub fn make_opaque_dir(&mut self, dir_path: &str) -> Result<(), KernelError>
pub fn make_opaque_dir(&mut self, dir_path: &str) -> Result<(), KernelError>
Make a directory opaque (hides all entries from lower layers).
Sourcepub fn list_dir(&self, dir_path: &str) -> Vec<&OverlayEntry>
pub fn list_dir(&self, dir_path: &str) -> Vec<&OverlayEntry>
List directory contents merging all layers. Upper entries take precedence. Whited-out entries are excluded.