pub fn create_guest_memory(
    regions: &[(Option<FileOffset>, GuestAddress, usize)],
    track_dirty_pages: bool,
) -> std::result::Result<GuestMemoryMmap, Error> {
    let prot = libc::PROT_READ | libc::PROT_WRITE;
    let mut mmap_regions = Vec::with_capacity(regions.len());

    for region in regions {
        let flags = match region.0 {
            None => libc::MAP_NORESERVE | libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
            Some(_) => libc::MAP_NORESERVE | libc::MAP_PRIVATE,
        };

        let mmap_region =
            build_guarded_region(region.0.clone(), region.2, prot, flags, track_dirty_pages)
                .map_err(Error::MmapRegion)?;

        mmap_regions.push(GuestRegionMmap::new(mmap_region, region.1)?);
    }

    GuestMemoryMmap::from_regions(mmap_regions)
}
/// Helper for creating the guest memory.
Helper for creating the guest memory.
Helper for creating the guest memory .
pub fn create_guest_memory(
    regions: &[(Option<FileOffset>, GuestAddress, usize)],
    track_dirty_pages: bool,
) -> std::result::Result<GuestMemoryMmap, Error> {
    let prot = libc::PROT_READ | libc::PROT_WRITE;
    let mut mmap_regions = Vec::with_capacity(regions.len());
    for region in regions {
        let flags = match region.0 {
            None => libc::MAP_NORESERVE | libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
            Some(_) => libc::MAP_NORESERVE | libc::MAP_PRIVATE,
        };
        let mmap_region =
            build_guarded_region(region.0.clone(), region.2, prot, flags, track_dirty_pages)
                .map_err(Error::MmapRegion)?;
        mmap_regions.push(GuestRegionMmap::new(mmap_region, region.1)?);
    }
    GuestMemoryMmap::from_regions(mmap_regions)
}
pub fn create_guest_memory ( regions : & [ ( Option < FileOffset > , GuestAddress , usize ) ] , track_dirty_pages : bool , ) -> std :: result :: Result < GuestMemoryMmap , Error > { let prot = libc :: PROT_READ | libc :: PROT_WRITE ; let mut mmap_regions = Vec :: with_capacity ( regions . len ( ) ) ; for region in regions { let flags = match region . 0 { None => libc :: MAP_NORESERVE | libc :: MAP_PRIVATE | libc :: MAP_ANONYMOUS , Some ( _ ) => libc :: MAP_NORESERVE | libc :: MAP_PRIVATE , } ; let mmap_region = build_guarded_region ( region . 0 . clone ( ) , region . 2 , prot , flags , track_dirty_pages ) . map_err ( Error :: MmapRegion ) ? ; mmap_regions . push ( GuestRegionMmap :: new ( mmap_region , region . 1 ) ? ) ; } GuestMemoryMmap :: from_regions ( mmap_regions ) }
Helper for creating the guest memory.
Helper for creating the guest memory .
regions
&[(Option<FileOffset>, GuestAddress, usize)]
track_dirty_pages
bool
regions
&[(Option<FileOffset>, GuestAddress, usize)]
track_dirty_pages
bool