Pass MunmapFlags to scheme.

This commit is contained in:
4lDO2
2023-07-21 11:09:29 +02:00
parent c9aa5ca851
commit 3cfec39b47
4 changed files with 21 additions and 16 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ use alloc::{
sync::Arc,
vec::Vec,
};
use syscall::CallerCtx;
use syscall::{CallerCtx, MunmapFlags};
use core::sync::atomic::AtomicUsize;
use spin::{Once, RwLock, RwLockReadGuard, RwLockWriteGuard};
@@ -311,7 +311,7 @@ pub trait KernelScheme: Scheme + Send + Sync + 'static {
fn kfmap(&self, number: usize, addr_space: &Arc<RwLock<AddrSpace>>, map: &crate::syscall::data::Map, consume: bool) -> Result<usize> {
Err(Error::new(EOPNOTSUPP))
}
fn kfunmap(&self, number: usize, offset: usize, size: usize) -> Result<()> {
fn kfunmap(&self, number: usize, offset: usize, size: usize, flags: MunmapFlags) -> Result<()> {
Err(Error::new(EOPNOTSUPP))
}
+3 -3
View File
@@ -2,7 +2,7 @@ use alloc::sync::{Arc, Weak};
use alloc::boxed::Box;
use alloc::collections::BTreeMap;
use alloc::vec::Vec;
use syscall::{SKMSG_FRETURNFD, CallerCtx, SKMSG_PROVIDE_MMAP, MAP_FIXED_NOREPLACE};
use syscall::{SKMSG_FRETURNFD, CallerCtx, SKMSG_PROVIDE_MMAP, MAP_FIXED_NOREPLACE, MunmapFlags};
use core::num::NonZeroUsize;
use core::sync::atomic::{AtomicBool, Ordering};
use core::{mem, usize};
@@ -834,14 +834,14 @@ impl KernelScheme for UserScheme {
inner.fmap_inner(Arc::clone(addr_space), file, map)
}
fn kfunmap(&self, number: usize, offset: usize, size: usize) -> Result<()> {
fn kfunmap(&self, number: usize, offset: usize, size: usize, flags: MunmapFlags) -> Result<()> {
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
let res = inner.call_extended(CallerCtx {
pid: context::context_id().into(),
uid: offset as u32,
gid: (offset >> 32) as u32,
}, [KSMSG_MUNMAP, number, size, 0])?;
}, [KSMSG_MUNMAP, number, size, flags.bits()])?;
match res {
Response::Regular(_) => Ok(()),