Add a rust user-space Capability struct.
This is a thin wrapper around a capability ptr that releases the capability when it is done and prevents copying/cloning it. To get a copy a caller must explicitly use duplicate.
This commit is contained in:
parent
19a8ab41d4
commit
7e68c1b641
18 changed files with 215 additions and 152 deletions
|
|
@ -1,14 +1,14 @@
|
|||
use crate::buffer::ByteBuffer;
|
||||
use crate::message::YunqMessage;
|
||||
use alloc::vec::Vec;
|
||||
use mammoth::zion::z_cap_t;
|
||||
use mammoth::cap::Capability;
|
||||
use mammoth::zion::ZError;
|
||||
|
||||
pub fn call_endpoint<Req: YunqMessage, Resp: YunqMessage, const N: usize>(
|
||||
request_id: u64,
|
||||
req: &Req,
|
||||
byte_buffer: &mut ByteBuffer<N>,
|
||||
endpoint_cap: z_cap_t,
|
||||
endpoint_cap: &Capability,
|
||||
) -> Result<Resp, ZError> {
|
||||
let mut cap_buffer = Vec::new();
|
||||
let length = req.serialize_as_request(request_id, byte_buffer, &mut cap_buffer)?;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use crate::buffer::ByteBuffer;
|
||||
use alloc::vec::Vec;
|
||||
use mammoth::cap::Capability;
|
||||
use mammoth::syscall;
|
||||
use mammoth::zion::z_cap_t;
|
||||
use mammoth::zion::ZError;
|
||||
|
|
@ -36,7 +37,7 @@ pub trait YunqServer {
|
|||
}
|
||||
}
|
||||
|
||||
fn endpoint_cap(&self) -> z_cap_t;
|
||||
fn endpoint_cap(&self) -> &Capability;
|
||||
fn handle_request(
|
||||
&self,
|
||||
method_number: u64,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue