Revert "Merge branch 'clone_grant_using_fmap' into 'master'"

This reverts merge request !190
This commit is contained in:
Jeremy Soller
2022-03-30 14:54:49 +00:00
parent 37ebef2d35
commit 87b3bef06c
5 changed files with 39 additions and 55 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ use crate::scheme::{self, SchemeNamespace, SchemeId};
use crate::syscall::error::{Result, Error, EBADF};
/// A file description
#[derive(Clone, Copy, Debug)]
#[derive(Debug)]
pub struct FileDescription {
/// The namespace the file was opened from (used for debugging)
pub namespace: SchemeNamespace,
+8 -14
View File
@@ -290,15 +290,7 @@ pub struct Grant {
mapped: bool,
owned: bool,
//TODO: This is probably a very heavy way to keep track of fmap'd files, perhaps move to the context?
pub desc_opt: Option<GrantFileRef>,
}
#[derive(Clone, Debug)]
pub struct GrantFileRef {
pub desc: FileDescriptor,
pub offset: usize,
// TODO: Can the flags maybe be stored together with the page flags. Should some flags be kept,
// and others discarded when re-fmapping on clone?
pub flags: MapFlags,
pub desc_opt: Option<FileDescriptor>,
}
impl Grant {
@@ -371,7 +363,7 @@ impl Grant {
}
}
pub fn map_inactive(src: VirtualAddress, dst: VirtualAddress, size: usize, flags: PageFlags<RmmA>, desc_opt: Option<GrantFileRef>, inactive_table: &mut InactivePageTable) -> Grant {
pub fn map_inactive(src: VirtualAddress, dst: VirtualAddress, size: usize, flags: PageFlags<RmmA>, desc_opt: Option<FileDescriptor>, inactive_table: &mut InactivePageTable) -> Grant {
let active_table = unsafe { ActivePageTable::new(src.kind()) };
let mut inactive_mapper = inactive_table.mapper();
@@ -515,9 +507,10 @@ impl Grant {
flush_all.flush();
if let Some(file_ref) = self.desc_opt.take() {
if let Some(desc) = self.desc_opt.take() {
println!("Grant::unmap: close desc {:?}", desc);
//TODO: This imposes a large cost on unmapping, but that cost cannot be avoided without modifying fmap and funmap
let _ = file_ref.desc.close();
let _ = desc.close();
}
self.mapped = false;
@@ -540,9 +533,10 @@ impl Grant {
ipi(IpiKind::Tlb, IpiTarget::Other);
if let Some(file_ref) = self.desc_opt.take() {
if let Some(desc) = self.desc_opt.take() {
println!("Grant::unmap_inactive: close desc {:?}", desc);
//TODO: This imposes a large cost on unmapping, but that cost cannot be avoided without modifying fmap and funmap
let _ = file_ref.desc.close();
let _ = desc.close();
}
self.mapped = false;