mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-08 22:05:20 +00:00
vmm: memory: Use fine grained mmap wrapper
In order to anticipate the need for special mmap flags when memory mapping the guest RAM, we need to switch from from_file() wrapper to build() wrapper. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
f0ab002ef1
commit
be4e1e8712
@ -436,9 +436,15 @@ impl MemoryManager {
|
||||
|
||||
f.set_len(size as u64).map_err(Error::SharedFileSetLen)?;
|
||||
|
||||
let mmap_flags = libc::MAP_NORESERVE | libc::MAP_SHARED;
|
||||
GuestRegionMmap::new(
|
||||
MmapRegion::from_file(FileOffset::new(f, 0), size)
|
||||
.map_err(Error::GuestMemoryRegion)?,
|
||||
MmapRegion::build(
|
||||
Some(FileOffset::new(f, 0)),
|
||||
size,
|
||||
libc::PROT_READ | libc::PROT_WRITE,
|
||||
mmap_flags,
|
||||
)
|
||||
.map_err(Error::GuestMemoryRegion)?,
|
||||
start_addr,
|
||||
)
|
||||
.map_err(Error::GuestMemory)?
|
||||
|
Loading…
Reference in New Issue
Block a user