Expand description
Phase-2 copy-on-write snapshot reconstruction.
Given a store’s block-descriptor list (the 0x0003 diff-area chain) and store bitmap (the 0x0006 chain), this module materializes the snapshot’s view of any 16384-byte volume block by overlaying the copy-on-write data saved in the store on top of the live volume.
The algorithm is the one validated byte-for-byte against libvshadow
(pyvshadow) over 1,415 blocks of the Magnet PC-MUS-001.E01 image — see
docs/RECONSTRUCTION.md. For one block at volume offset off (bn = off / 16384, base = bn * 16384):
- Descriptor set non-empty: the base is the last plain descriptor’s store block (a descriptor with none of forwarder/overlay/not-used set), or the live volume block when there is no plain. Then each overlay descriptor (overlay set, not-used clear) replaces the 512-byte sub-blocks selected by its allocation bitmap.
- Descriptor set empty, bitmap bit set: the block was unallocated in the snapshot — 16384 zero bytes.
- Descriptor set empty, bitmap bit clear: live passthrough.
Every offset read from the image is range-checked against the volume before seeking: a corrupt descriptor never panics or reads out of bounds — a plain/live block that is out of range reconstructs as zeros, and an out-of-range overlay contributes nothing (its sub-blocks are skipped).
Structs§
- Snapshot
- A reconstructed, read-only view of one shadow copy — the snapshot’s view of the volume, materialized block by block on demand.