Skip to main content

Crate arcbox_ext4

Crate arcbox_ext4 

Source
Expand description

Pure-Rust ext4 filesystem formatter and reader.

This crate creates and reads ext4 filesystem images entirely in userspace, with no kernel mount, no FUSE, and no C dependencies. It is designed for converting OCI container image layers into bootable block-device images.

§Quick start

use std::path::Path;
use arcbox_ext4::Formatter;

// Create a new ext4 image.
let mut fmt = Formatter::new(Path::new("rootfs.ext4"), 4096, 256 * 1024).unwrap();
fmt.create("/hello.txt", 0x8000 | 0o644, None, None,
    Some(&mut "hello world".as_bytes()), None, None, None).unwrap();
fmt.close().unwrap();

// Read it back.
let mut reader = arcbox_ext4::Reader::new(Path::new("rootfs.ext4")).unwrap();
let data = reader.read_file("/hello.txt", 0, None).unwrap();
assert_eq!(&data, b"hello world");

Re-exports§

pub use formatter::FileTimestamps;
pub use formatter::Formatter;
pub use reader::Reader;

Modules§

constants
dir
error
extent
file_tree
formatter
reader
reader_io
types
unpack
xattr