arcbox_ext4/lib.rs
1//! Pure-Rust ext4 filesystem formatter and reader.
2//!
3//! This crate creates and reads ext4 filesystem images entirely in userspace,
4//! with no kernel mount, no FUSE, and no C dependencies. It is designed for
5//! converting OCI container image layers into bootable block-device images.
6//!
7//! # Quick start
8//!
9//! ```no_run
10//! use std::path::Path;
11//! use arcbox_ext4::Formatter;
12//!
13//! // Create a new ext4 image.
14//! let mut fmt = Formatter::new(Path::new("rootfs.ext4"), 4096, 256 * 1024).unwrap();
15//! fmt.create("/hello.txt", 0x8000 | 0o644, None, None,
16//! Some(&mut "hello world".as_bytes()), None, None, None).unwrap();
17//! fmt.close().unwrap();
18//!
19//! // Read it back.
20//! let mut reader = arcbox_ext4::Reader::new(Path::new("rootfs.ext4")).unwrap();
21//! let data = reader.read_file("/hello.txt", 0, None).unwrap();
22//! assert_eq!(&data, b"hello world");
23//! ```
24
25pub mod constants;
26pub mod dir;
27pub mod error;
28pub mod extent;
29pub mod file_tree;
30pub mod formatter;
31pub mod reader;
32pub mod reader_io;
33pub mod types;
34pub mod unpack;
35pub mod xattr;
36
37// Re-export the primary public types at the crate root.
38pub use formatter::{FileTimestamps, Formatter};
39pub use reader::Reader;