Struct kernel::grant::GrantKernelData

source ·
pub struct GrantKernelData<'a> { /* private fields */ }
Expand description

This GrantKernelData object provides a handle to access upcalls and process buffers stored on behalf of a particular grant/driver.

Capsules gain access to a GrantKernelData object by calling Grant::enter(). From there, they can schedule upcalls or access process buffers.

It is expected that this type will only exist as a short-lived stack allocation, so its size is not a significant concern.

Implementations§

source§

impl<'a> GrantKernelData<'a>

source

pub fn schedule_upcall( &self, subscribe_num: usize, r: (usize, usize, usize) ) -> Result<(), UpcallError>

Schedule the specified upcall for the process with r0, r1, r2 as provided values.

Capsules call this function to schedule upcalls, and upcalls are identified by the subscribe_num, which must match the subscribe number used when the upcall was originally subscribed by a process. subscribe_nums are indexed starting at zero.

source

pub fn get_readonly_processbuffer( &self, allow_ro_num: usize ) -> Result<ReadOnlyProcessBufferRef<'_>, Error>

Returns a lifetime limited reference to the requested ReadOnlyProcessBuffer.

The len of the returned ReadOnlyProcessBuffer must be checked by the caller to ensure that a buffer has in fact been allocated. An unallocated buffer will be returned as a ReadOnlyProcessBuffer of length 0.

The ReadOnlyProcessBuffer is only valid for as long as this object is valid, i.e. the lifetime of the app enter closure.

If the specified allow number is invalid, then a AddressOutOfBounds will be returned. This returns a process::Error to allow for easy chaining of this function with the ReadOnlyProcessBuffer::enter function with and_then.

source

pub fn get_readwrite_processbuffer( &self, allow_rw_num: usize ) -> Result<ReadWriteProcessBufferRef<'_>, Error>

Returns a lifetime limited reference to the requested ReadWriteProcessBuffer.

The len of the returned ReadWriteProcessBuffer must be checked by the caller to ensure that a buffer has in fact been allocated. An unallocated buffer will be returned as a ReadWriteProcessBuffer of length 0.

The ReadWriteProcessBuffer is only value for as long as this object is valid, i.e. the lifetime of the app enter closure.

If the specified allow number is invalid, then a AddressOutOfBounds will be return. This returns a process::Error to allow for easy chaining of this function with the ReadWriteProcessBuffer::enter() function with and_then.

Auto Trait Implementations§

§

impl<'a> Freeze for GrantKernelData<'a>

§

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

§

impl<'a> !Send for GrantKernelData<'a>

§

impl<'a> !Sync for GrantKernelData<'a>

§

impl<'a> Unpin for GrantKernelData<'a>

§

impl<'a> !UnwindSafe for GrantKernelData<'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> SizedTypeProperties for T

source§

#[doc(hidden)] const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

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

§

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

§

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.