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, notfiles. The embedded extBuildPlan(built with theblock_sizepassed to the analyzer) powers the ext inode/block estimates; it is not part of the public surface. - Analysis
Report - Flat, serialisable view of an
Analysis— whatfstool analyze --jsonemits and the human formatter consumes.
Constants§
- SIZED_
FS_ TYPES - Filesystem types whose destination size
Analysis::recommended_sizecan compute — the fixed-size block filesystems the--shrinkpath 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/convertuse when they have the source mounted for the copy). - analyze_
source - Analyze any
Source— a filesystem image (optionally apath:Npartition), a plain or compressed tar (streamed, no tempfile), a host directory, or a layered stack.block_sizeparameterises the ext size estimate only.