Skip to main content

PagedSegment

Struct PagedSegment 

Source
pub struct PagedSegment<'a> { /* private fields */ }
Expand description

Memory segment that allows customized page fault handling in user space.

Implementations§

Source§

impl<'a> PagedSegment<'a>

Source

pub unsafe fn from_raw<S: PageStore + Send + 'static>( base: *mut u8, size: usize, store: S, page_size: Option<usize>, ) -> Result<PagedSegment<'static>, Error>

Make the user-space paged segement at an existing memory location.

Source

pub fn new<S: PageStore + Send + 'static>( length: usize, store: S, page_size: Option<usize>, ) -> Result<PagedSegment<'static>, Error>

Allocate a new segment to be user-space paged.

Source

pub fn as_slice_mut(&mut self) -> &mut [u8]

Source

pub fn as_slice(&self) -> &[u8]

Source

pub fn as_raw_parts(&self) -> (*mut u8, usize)

Source

pub fn page_size(&self) -> usize

Return the page size in use.

Source

pub fn reset_write_detection( &self, offset: usize, size: usize, ) -> Result<(), Error>

Mark the entire PagedSegment to be aware of all subsequent writes, this will trigger write-access page faults again when write operation is made in the future, even though the location was previously written.

Source

pub fn release_page(&self, page_offset: usize) -> Result<(), Error>

Release the OS page with its content loaded from PageStore. The next access to an address within this page will trigger a page fault.

This operation punches “holes” on the managed segment to free the pages back to the OS. page_offset must be aligned to the beginning of a page. It should be one of the offsets historically passed to PageStore::page_fault.

Source

pub fn release_all_pages(&self) -> Result<(), Error>

Release all OS pages with their contents in this PagedSegment.

Source

pub fn make_shared( &self, offset: usize, shm: &SharedMemory, ) -> Result<(), Error>

Patch a SharedMemory to a part of this memory segment. The given shm will start with an offset from the beginning of PagedSegment, and cannot overrun the end of the segment. The given SharedMemory outlives this object once patched (even if it is shadowed by subsequent patches).

Trait Implementations§

Source§

impl<'a> Drop for PagedSegment<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PagedSegment<'a>

§

impl<'a> !RefUnwindSafe for PagedSegment<'a>

§

impl<'a> Send for PagedSegment<'a>

§

impl<'a> Sync for PagedSegment<'a>

§

impl<'a> Unpin for PagedSegment<'a>

§

impl<'a> !UnwindSafe for PagedSegment<'a>

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.