mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-08 21:06:48 +00:00
modify some code of the static_cap and option
This commit is contained in:
parent
b3215a8d6f
commit
ef61b860f9
@ -5,7 +5,10 @@ use kxos_frame::prelude::Result;
|
||||
use kxos_frame::{vm::VmIo, Error};
|
||||
use kxos_rights_proc::require;
|
||||
|
||||
use crate::{rights::*, vm::vmo::Vmo};
|
||||
use crate::{
|
||||
rights::{Dup, Read, Rights, TRights},
|
||||
vm::vmo::Vmo,
|
||||
};
|
||||
|
||||
use super::{
|
||||
options::{VmarChildOptions, VmarMapOptions},
|
||||
@ -163,12 +166,12 @@ impl<R: TRights> Vmar<R> {
|
||||
|
||||
impl<R: TRights> VmIo for Vmar<R> {
|
||||
fn read_bytes(&self, offset: usize, buf: &mut [u8]) -> Result<()> {
|
||||
// self.check_rights!(Rights::READ)?;
|
||||
self.check_rights(Rights::READ)?;
|
||||
self.0.read(offset, buf)
|
||||
}
|
||||
|
||||
fn write_bytes(&self, offset: usize, buf: &[u8]) -> Result<()> {
|
||||
// self.check_rights!(Rights::WRITE)?;
|
||||
self.check_rights(Rights::WRITE)?;
|
||||
self.0.write(offset, buf)
|
||||
}
|
||||
}
|
||||
|
@ -313,12 +313,13 @@ impl<R: TRights> VmoChildOptions<R, VmoCowChild> {
|
||||
///
|
||||
/// The child VMO is initially assigned all the parent's access rights
|
||||
/// plus the Write right.
|
||||
pub fn alloc<TRights>(mut self) -> Result<Vmo<TRights>>
|
||||
// TODO: R1 must contain the Write right. To do so at the type level,
|
||||
// we need to implement a type-level operator
|
||||
// (say, `TRightsExtend(L, F)`)
|
||||
// that may extend a list (`L`) of type-level flags with an extra flag `F`.
|
||||
// TRightsExtend<R, Write>
|
||||
pub fn alloc<R1>(mut self) -> Result<Vmo<R1>>
|
||||
where
|
||||
R1: TRights, // TODO: R1 must contain the Write right. To do so at the type level,
|
||||
// we need to implement a type-level operator
|
||||
// (say, `TRightsExtend(L, F)`)
|
||||
// that may extend a list (`L`) of type-level flags with an extra flag `F`.
|
||||
// TRightsExtend<R, Write>
|
||||
{
|
||||
todo!()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user