mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
write_pointer_table() used a BufWriter over a cloned fd because the per-entry callback also needs mutable access to QcowRawFile. That couples the final write location to the ambient kernel cursor while the callback is allowed to perform metadata I/O. Materialize the encoded entries first, then seek and write the table after callback execution has finished. This keeps the pointer-table write independent from current and future callback behavior without depending on proving that a cursor-moving callback is reachable in today's synchronous CH path. Apply the same materialize-then-write shape to write_pointer_table_direct() for consistent semantics, and cover both paths with unit tests. Assisted-by: Codex:GPT-5 Signed-off-by: Ian Klemm <hi@ianklemm.de>