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>
impl<'a> GrantKernelData<'a>
sourcepub fn schedule_upcall(
&self,
subscribe_num: usize,
r: (usize, usize, usize)
) -> Result<(), UpcallError>
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_num
s are indexed starting at zero.
sourcepub fn get_readonly_processbuffer(
&self,
allow_ro_num: usize
) -> Result<ReadOnlyProcessBufferRef<'_>, Error>
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
.
sourcepub fn get_readwrite_processbuffer(
&self,
allow_rw_num: usize
) -> Result<ReadWriteProcessBufferRef<'_>, Error>
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
.