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