Struct GuestRegionRaw

Source
pub struct GuestRegionRaw<B = ()> { /* private fields */ }
Expand description

Guest memory region for virtio-fs DAX window.

Implementations§

Source§

impl<B: NewBitmap> GuestRegionRaw<B>

Source

pub unsafe fn new(guest_base: GuestAddress, addr: *mut u8, size: usize) -> Self

Create a GuestRegionRaw object from raw pointer.

§Safety

Caller needs to ensure addr and size are valid with static lifetime.

Trait Implementations§

Source§

impl<B: Bitmap> Bytes<MemoryRegionAddress> for GuestRegionRaw<B>

Source§

type E = Error

Associated error codes
Source§

fn write(&self, buf: &[u8], addr: MemoryRegionAddress) -> Result<usize>

Writes a slice into the container at addr. Read more
Source§

fn read(&self, buf: &mut [u8], addr: MemoryRegionAddress) -> Result<usize>

Reads data from the container at addr into a slice. Read more
Source§

fn write_slice(&self, buf: &[u8], addr: MemoryRegionAddress) -> Result<()>

Writes the entire content of a slice into the container at addr. Read more
Source§

fn read_slice(&self, buf: &mut [u8], addr: MemoryRegionAddress) -> Result<()>

Reads data from the container at addr to fill an entire slice. Read more
Source§

fn read_from<F>( &self, addr: MemoryRegionAddress, src: &mut F, count: usize, ) -> Result<usize>
where F: Read,

Reads up to count bytes from an object and writes them into the container at addr. Read more
Source§

fn read_exact_from<F>( &self, addr: MemoryRegionAddress, src: &mut F, count: usize, ) -> Result<()>
where F: Read,

Reads exactly count bytes from an object and writes them into the container at addr. Read more
Source§

fn write_to<F>( &self, addr: MemoryRegionAddress, dst: &mut F, count: usize, ) -> Result<usize>
where F: Write,

Reads up to count bytes from the container at addr and writes them it into an object. Read more
Source§

fn write_all_to<F>( &self, addr: MemoryRegionAddress, dst: &mut F, count: usize, ) -> Result<()>
where F: Write,

Reads exactly count bytes from the container at addr and writes them into an object. Read more
Source§

fn store<T: AtomicAccess>( &self, val: T, addr: MemoryRegionAddress, order: Ordering, ) -> Result<()>

Atomically store a value at the specified address.
Source§

fn load<T: AtomicAccess>( &self, addr: MemoryRegionAddress, order: Ordering, ) -> Result<T>

Atomically load a value from the specified address.
Source§

fn write_obj<T>(&self, val: T, addr: A) -> Result<(), Self::E>
where T: ByteValued,

Writes an object into the container at addr. Read more
Source§

fn read_obj<T>(&self, addr: A) -> Result<T, Self::E>
where T: ByteValued,

Reads an object from the container at addr. Read more
Source§

impl<B: Debug> Debug for GuestRegionRaw<B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: Bitmap> GuestMemoryRegion for GuestRegionRaw<B>

Source§

type B = B

Type used for dirty memory tracking.
Source§

fn len(&self) -> GuestUsize

Returns the size of the region.
Source§

fn start_addr(&self) -> GuestAddress

Returns the minimum (inclusive) address managed by the region.
Source§

fn bitmap(&self) -> &Self::B

Borrow the associated Bitmap object.
Source§

fn get_host_address(&self, addr: MemoryRegionAddress) -> Result<*mut u8>

Returns the host virtual address corresponding to the region address. Read more
Source§

fn file_offset(&self) -> Option<&FileOffset>

Returns information regarding the file and offset backing this memory region.
Source§

unsafe fn as_slice(&self) -> Option<&[u8]>

Returns a slice corresponding to the data in the region. Read more
Source§

unsafe fn as_mut_slice(&self) -> Option<&mut [u8]>

Returns a mutable slice corresponding to the data in the region. Read more
Source§

fn get_slice( &self, offset: MemoryRegionAddress, count: usize, ) -> Result<VolatileSlice<'_, BS<'_, B>>>

Returns a VolatileSlice of count bytes starting at offset.
Source§

fn is_hugetlbfs(&self) -> Option<bool>

Show if the region is based on the HugeTLBFS. Returns Some(true) if the region is backed by hugetlbfs. None represents that no information is available. Read more
Source§

fn last_addr(&self) -> GuestAddress

Returns the maximum (inclusive) address managed by the region.
Source§

fn check_address( &self, addr: MemoryRegionAddress, ) -> Option<MemoryRegionAddress>

Returns the given address if it is within this region.
Source§

fn address_in_range(&self, addr: MemoryRegionAddress) -> bool

Returns true if the given address is within this region.
Source§

fn checked_offset( &self, base: MemoryRegionAddress, offset: usize, ) -> Option<MemoryRegionAddress>

Returns the address plus the offset if it is in this region.
Source§

fn to_region_addr(&self, addr: GuestAddress) -> Option<MemoryRegionAddress>

Tries to convert an absolute address to a relative address within this region. Read more
Source§

fn as_volatile_slice( &self, ) -> Result<VolatileSlice<'_, <Self::B as WithBitmapSlice<'_>>::S>, Error>

Gets a slice of memory for the entire region that supports volatile access. Read more

Auto Trait Implementations§

§

impl<B> Freeze for GuestRegionRaw<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for GuestRegionRaw<B>
where B: RefUnwindSafe,

§

impl<B = ()> !Send for GuestRegionRaw<B>

§

impl<B = ()> !Sync for GuestRegionRaw<B>

§

impl<B> Unpin for GuestRegionRaw<B>
where B: Unpin,

§

impl<B> UnwindSafe for GuestRegionRaw<B>
where B: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.