Skip to main content

Module analyze

Module analyze 

Source
Expand description

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.

This is the single home of the “how big should the destination be” logic that repack/convert use for --shrink sizing (Analysis::recommended_size), and it backs the fstool analyze CLI command. It reuses the existing walk machinery wholesale (crate::repack::walk_source_into_sink / walk_anyfs) via a single accumulating RepackSink.

Structs§

Analysis
Aggregate result of walking a source. Counts are of directory entries: a hard link is counted under hardlinks, not files. The embedded ext BuildPlan (built with the block_size passed to the analyzer) powers the ext inode/block estimates; it is not part of the public surface.
AnalysisReport
Flat, serialisable view of an Analysis — what fstool analyze --json emits and the human formatter consumes.

Constants§

SIZED_FS_TYPES
Filesystem types whose destination size Analysis::recommended_size can compute — the fixed-size block filesystems the --shrink path formats to fit. Streamed / archive outputs (tar, zip, cpio, ar, grf, iso) grow-then-truncate and need no content-fit size, so they are deliberately absent.

Functions§

analyze_fs
Analyze an already-open filesystem (the form repack/convert use when they have the source mounted for the copy).
analyze_source
Analyze any Source — a filesystem image (optionally a path:N partition), a plain or compressed tar (streamed, no tempfile), a host directory, or a layered stack. block_size parameterises the ext size estimate only.