pub struct Ext4Fs { /* private fields */ }Expand description
An ext4 filesystem instance.
This is the main entry point for filesystem operations. Create an instance by mounting a block device, then use the various methods to manipulate files and directories.
§Example
use ext4_lwext4::{Ext4Fs, FileBlockDevice, OpenFlags};
// Open a disk image and mount
let device = FileBlockDevice::open("disk.img").unwrap();
let fs = Ext4Fs::mount(device, false).unwrap();
// Create a directory
fs.mkdir("/data", 0o755).unwrap();
// Write a file (use a block to ensure file is dropped before umount)
{
let mut file = fs.open("/data/hello.txt", OpenFlags::CREATE | OpenFlags::WRITE).unwrap();
// ... write operations ...
}
// Unmount when done
fs.umount().unwrap();Implementations§
Source§impl Ext4Fs
impl Ext4Fs
Sourcepub fn mount<B: BlockDevice + 'static>(
device: B,
read_only: bool,
) -> Result<Self>
pub fn mount<B: BlockDevice + 'static>( device: B, read_only: bool, ) -> Result<Self>
Sourcepub fn umount(self) -> Result<()>
pub fn umount(self) -> Result<()>
Unmount the filesystem.
This flushes all pending writes and releases the block device.
Sourcepub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Check if filesystem is mounted read-only.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ext4Fs
impl !RefUnwindSafe for Ext4Fs
impl Send for Ext4Fs
impl Sync for Ext4Fs
impl Unpin for Ext4Fs
impl UnsafeUnpin for Ext4Fs
impl !UnwindSafe for Ext4Fs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more