pub struct AddressSpace { /* private fields */ }
Expand description

An address space implementation with region hotplug capability.

The AddressSpace is a wrapper over AddressSpaceBase to support hotplug of address space regions.

Implementations§

source§

impl AddressSpace

source

pub fn convert_into_vm_as( gm: GuestMemoryMmap ) -> GuestMemoryAtomic<GuestMemoryMmap>

Convert a GuestMemoryMmap object into GuestMemoryAtomic<GuestMemoryMmap>.

source

pub fn from_regions( regions: Vec<Arc<AddressSpaceRegion>>, layout: AddressSpaceLayout ) -> Self

Create an instance of AddressSpace from an AddressSpaceRegion array.

To achieve better performance by using binary search algorithm, the regions vector will gotten sorted by guest physical address.

Note, panicking if some regions intersects with each other.

Arguments
  • regions - prepared regions to managed by the address space instance.
  • layout - prepared address space layout configuration.
source

pub fn insert_region( &mut self, region: Arc<AddressSpaceRegion> ) -> Result<(), AddressSpaceError>

Insert a new address space region into the address space.

Arguments
  • region - the new region to be inserted.
source

pub fn walk_regions<F>(&self, cb: F) -> Result<(), AddressSpaceError>where F: FnMut(&Arc<AddressSpaceRegion>) -> Result<(), AddressSpaceError>,

Enumerate all regions in the address space.

Arguments
  • cb - the callback function to apply to each region.
source

pub fn layout(&self) -> AddressSpaceLayout

Get address space layout associated with the address space.

source

pub fn last_addr(&self) -> GuestAddress

Get maximum of guest physical address in the address space.

source

pub fn is_dax_region(&self, guest_addr: GuestAddress) -> bool

Check whether the guest physical address guest_addr belongs to a DAX memory region.

Arguments
  • guest_addr - the guest physical address to inquire
source

pub fn prot_flags( &self, guest_addr: GuestAddress ) -> Result<i32, AddressSpaceError>

Get protection flags of memory region that guest physical address guest_addr belongs to.

Arguments
  • guest_addr - the guest physical address to inquire
source

pub fn numa_node_id(&self, gpa: u64) -> Option<u32>

Get optional NUMA node id associated with guest physical address gpa.

Arguments
  • gpa - guest physical address to query.

Trait Implementations§

source§

impl Clone for AddressSpace

source§

fn clone(&self) -> AddressSpace

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.