Skip to main content

lamfold_cpio/
lib.rs

1//! # lamfold-cpio — the initramfs/cpio frontend of the lamfold stack.
2//!
3//! cpio is the archive format of the Linux initramfs/initrd — a flat stream of
4//! `(header, path, data)` records, not a block filesystem. The on-disk parsing
5//! is trivial and a permissive `no_std` reader already exists, so — per the SDS
6//! "reuse where licensing does not hinder" rule — this frontend **reuses**
7//! [`cpio_reader`] (MIT OR Apache-2.0) for record parsing and adds only what
8//! lamfold needs: build the flat path list into a directory tree and present it
9//! through [`lamfold::FoldFrontend`], so an initramfs reads through the same
10//! `dispatch_fs_over_source` path as a real filesystem.
11//!
12//! Scope: newc / CRC / portable-ASCII / old-binary cpio (all handled by
13//! `cpio_reader`), regular files, directories (explicit or implied by a nested
14//! path), and symlinks (`read_link`). The whole archive is read into memory
15//! (read-capped) — appropriate for an initramfs, which is resident anyway.
16
17#![cfg_attr(not(any(test, feature = "std")), no_std)]
18#![forbid(unsafe_code)]
19
20extern crate alloc;
21
22mod cpio;
23
24pub use cpio::Cpio;