Skip to content

Commit cfd89ae

Browse files
vireshkroypat
authored andcommitted
guest_memory: Don't use MmapRegion:new()
A new implementation of MmapRegion may not support the same prototype for `MmapRegion::new(size: usize)` helper. As most of the tests already use GuestRegionMmap::from_range() already, lets migrate to that instead. This is required for a later commit, which introduces Xen's support, whose `MmapRegion::new()` helper expects different arguments. Signed-off-by: Viresh Kumar <[email protected]>
1 parent 2a5e492 commit cfd89ae

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/guest_memory.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,8 @@ pub trait GuestMemoryRegion: Bytes<MemoryRegionAddress, E = Error> {
272272
/// # use vm_memory::{GuestAddress, MmapRegion, GuestRegionMmap, GuestMemoryRegion};
273273
/// # use vm_memory::volatile_memory::{VolatileMemory, VolatileSlice, VolatileRef};
274274
/// #
275-
/// let region = MmapRegion::<()>::new(0x400).expect("Could not create mmap region");
276-
/// let region =
277-
/// GuestRegionMmap::new(region, GuestAddress(0x0)).expect("Could not create guest memory");
275+
/// let region = GuestRegionMmap::<()>::from_range(GuestAddress(0x0), 0x400, None)
276+
/// .expect("Could not create guest memory");
278277
/// let slice = region
279278
/// .as_volatile_slice()
280279
/// .expect("Could not get volatile slice");

0 commit comments

Comments
 (0)