mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
For use in QEMU, I would like GuestMemoryRegion to return a BitmapSlice instead of a &Bitmap. This adds some flexibility that QEMU needs in order to support a single global dirty bitmap that is sliced by the various GuestMemoryRegions. However, this removes access to the methods of AtomicBitmap, and in particular reset() and get_and_reset(). Fortunately, cloud-hypervisor always uses GuestMemoryMmap, and therefore `region` is known to be a &GuestRegionMmap. Dereferencing it returns the MmapRegion to which the bitmap is attached, thus calling MmapRegion::bitmap(); this has the same effect as `<GuestRegionMmap as GuestRegion>::bitmap()`, and works both with or without https://github.com/rust-vmm/vm-memory/pull/324. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>