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>

§

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>

§

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> 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 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, 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.