Skip to main content

bux_e2fs/
lib.rs

1//! Ext4 filesystem image creation via [`libext2fs`] — static FFI bindings and safe Rust API.
2//!
3//! # Architecture
4//!
5//! - **[`sys`]** — Raw FFI bindings (auto-generated by `bindgen`).
6//! - **[`Filesystem`]** — RAII wrapper around `ext2_filsys` with safe operations.
7//! - **[`create_from_dir`]** / **[`inject_file`]** — Convenience functions for common tasks.
8//!
9//! # Quick Start
10//!
11//! ```no_run
12//! use std::path::Path;
13//!
14//! let size = bux_e2fs::estimate_image_size(Path::new("/tmp/rootfs")).unwrap();
15//! bux_e2fs::create_from_dir(
16//!     Path::new("/tmp/rootfs"),
17//!     Path::new("/tmp/image.raw"),
18//!     size,
19//! ).unwrap();
20//! ```
21//!
22//! [`libext2fs`]: https://e2fsprogs.sourceforge.net/
23
24#![cfg_attr(docsrs, feature(doc_cfg))]
25
26pub mod sys;
27
28mod error;
29mod ext4;
30
31pub use error::{Error, Result};
32pub use ext4::{
33    BlockSize, CreateOptions, FileType, Filesystem, create_from_dir, estimate_image_size,
34    inject_file,
35};