To provide the rust interface, lwext4 is abstracted in Rust language.
lwext4 is an ext2/ext3/ext4 filesystem library in C for microcontrollers
lwext4_rust
for x86_64, riscv64 and aarch64 on Rust OS is supported- File system mount and unmount operations
- Filetypes: regular, directories, softlinks
- Journal recovery & transactions
- memory as Block Cache
Wrap up the file operation struct Ext4File
.
It can provide the file system interfaces for the upper layer of Rust OS.
For the specific code, please refer to ext4fs.rs
Ext4File
operations include: file_read
, file_write
, file_seek
, file_open
, file_close
, file_rename
, lwext4_dir_entries
...
These operate the physical disk through the interface of disk driver.
impl KernelDevOp for Disk {
type DevType = Disk;
fn read() {}
fn write() {}
fn seek() {}
fn flush() {}
}
New a file system object, initialize and mount the ext4 file system.
let ext4fs =
Ext4BlockWrapper::<Disk>::new(disk).expect("failed to initialize EXT4 filesystem");
cargo build -vv --target x86_64-unknown-none | riscv64gc-unknown-none-elf | aarch64-unknown-none-softfloat
OR If you need to compile the lwext4 in C separately,
please run make musl-generic -C c/lwext4 ARCH=<x86_64|riscv64|aarch64>
- Rust development environment
- C musl-based cross compile toolchains