modify some code of the static_cap and option

This commit is contained in:
sdww0 2022-11-21 10:46:21 +08:00
parent b3215a8d6f
commit ef61b860f9
2 changed files with 13 additions and 9 deletions

View File

@ -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)
}
}

View File

@ -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!()
}