pub struct AddressSpaceRegion {
    pub ty: AddressSpaceRegionType,
    pub base: GuestAddress,
    pub size: GuestUsize,
    pub host_numa_node_id: Option<u32>,
    /* private fields */
}
Expand description

Struct to maintain configuration information about a guest address region.

Fields

ty: AddressSpaceRegionType

Type of address space regions.

base: GuestAddress

Base address of the region in virtual machine’s physical address space.

size: GuestUsize

Size of the address space region.

host_numa_node_id: Option<u32>

Host NUMA node ids assigned to this region.

Implementations

Create an address space region with default configuration.

Create an address space region with all configurable information.

Arguments
  • ty - Type of the address region
  • base - Base address in VM to map content
  • size - Length of content to map
  • numa_node_id - Optional NUMA node id to allocate memory from
  • file_offset - Optional file descriptor and offset to map content from
  • perm_flags - mmap permission flags
  • is_hotplug - Whether it’s a region for hotplug.

Create an address space region to map memory into the virtual machine.

Arguments
  • base - Base address in VM to map content
  • size - Length of content to map
  • numa_node_id - Optional NUMA node id to allocate memory from
  • mem_type - Memory mapping from, ‘shmem’ or ‘hugetlbfs’
  • mem_file_path - Memory file path
  • mem_prealloc - Whether to enable pre-allocation of guest memory
  • is_hotplug - Whether it’s a region for hotplug.

Create an address space region to map memory from memfd/hugetlbfs into the virtual machine.

Arguments
  • base - Base address in VM to map content
  • size - Length of content to map
  • numa_node_id - Optional NUMA node id to allocate memory from
  • mem_type - Memory mapping from, ‘shmem’ or ‘hugetlbfs’
  • mem_file_path - Memory file path
  • mem_prealloc - Whether to enable pre-allocation of guest memory
  • is_hotplug - Whether it’s a region for hotplug.

Create an address region for device MMIO.

Arguments
  • base - Base address in VM to map content
  • size - Length of content to map

Get type of the address space region.

Get size of region.

Get the inclusive start physical address of the region.

Get the inclusive end physical address of the region.

Get mmap permission flags of the address space region.

Set mmap permission flags for the address space region.

Get host_numa_node_id flags

Set associated NUMA node ID to allocate memory from for this region.

Check whether the address space region is backed by a memory file.

Get optional file associated with the region.

Set associated file/offset pair for the region.

Set the hotplug hint.

Get the hotplug hint.

Set hugepage hint for madvise(), only takes effect when the memory type is shmem.

Get the hugepage hint.

Set the anonymous memory hint.

Get the anonymous memory hint.

Check whether the address space region is valid.

Check whether the address space region intersects with another one.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.