Skip to main content

Crate fstool

Crate fstool 

Source
Expand description

fstool — build disk images and filesystems from a directory tree and TOML spec.

The crate is organised as a stack of trait-based layers:

  • deviceSectorDriver and FlashDriver: the storage a driver implements, for the filesystems that run without an allocator. It is the only layer that is always compiled.
  • blockBlockDevice: raw seekable byte storage. Backends include on-disk files, in-memory buffers (for tests), sub-range slices used to give each partition an isolated view, and the disk-image containers: qcow2 (with backing files and encryption), LUKS1/LUKS2 volumes, and read-only DMG.
  • partPartitionTable: MBR, GPT and APM.
  • fsFilesystem: one trait over every backend — ext2/3/4, FAT12/16/32, exFAT, XFS, HFS+, HFS, AFFS, APFS, NTFS, F2FS, littlefs, SquashFS, ISO 9660, GRF, tar and the archive formats.

High-level entry points: spec::build builds an image from a TOML spec, inspect opens and walks an existing one, repack converts between formats, and memconv / memedit do both in memory.

alloc is a feature of that stack rather than a floor beneath it. fs::fat works with or without a heap through the same API, and turning alloc on adds the hosted fs::Filesystem surface and an in-memory allocation table — never a different shape to call.

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

analyze
Generic source analysis: walk a filesystem image, tar archive, host directory, or layered source once and report the aggregate metrics that determine how big a destination image needs to be — file / dir / symlink / device counts, total file bytes, and an ext inode/block estimate.
base64
Standard-alphabet base64 (RFC 4648) encode + decode.
block
Block-device abstraction — the bottom layer of the hosted fstool stack.
compression
Compression / decompression codecs.
concurrent
Shared-access wrappers for the otherwise-single-threaded Ext API.
crc
CRC-32 variants the filesystems need, in the flavours compcol does not expose.
device
The storage a driver talks to — the bottom of the allocator-free stack.
error
Error type and Result alias for the crate.
format_opts
Filesystem-format options bag.
fs
Filesystem layer.
inspect
Unified read-side API: probe an image, identify the filesystem on it, and expose a small inspection surface (list / cat / info) that the CLI can drive without knowing which filesystem it’s talking to.
io
The I/O traits the block and filesystem layers are written against.
macroman
MacRoman → Unicode decoding for classic-Mac byte strings.
memconv
In-memory inspection and conversion — the byte-in / byte-out surface.
memedit
In-memory authoring — create a blank filesystem or a partitioned disk, edit it, and export the bytes at any point.
merge
Layered source merging with whiteout / opaque-dir semantics.
part
Partition-table layer.
path
Paths inside an image: Path and PathBuf.
path_style
Path-spelling styles for the CLI and interactive shell.
repack
Repack — copy file trees from one source into a freshly-formatted destination filesystem.
resfork
Macintosh resource-fork parser + decoders for a few common types.
spec
TOML image-specification schema and the build driver.

Macros§

impl_archive_fs_filesystem
Generate the Filesystem impl for a format newtype struct Foo(ArchiveFs) by forwarding every method to the inner ArchiveFs.