Wrap unmap loop with handle_notify_files
This commit is contained in:
+3
-9
@@ -960,9 +960,7 @@ impl ContextHandle {
|
||||
|
||||
let unpin = false;
|
||||
let res = addrspace.munmap(page_span, unpin, token)?;
|
||||
for r in res {
|
||||
let _ = r.unmap(token);
|
||||
}
|
||||
handle_notify_files(res, token);
|
||||
}
|
||||
ADDRSPACE_OP_MPROTECT => {
|
||||
let page_span = crate::syscall::validate_region(next()??, next()??)?;
|
||||
@@ -1248,9 +1246,7 @@ impl ContextHandle {
|
||||
false,
|
||||
token,
|
||||
)?;
|
||||
for r in res {
|
||||
let _ = r.unmap(token);
|
||||
}
|
||||
handle_notify_files(res, token);
|
||||
}
|
||||
}
|
||||
crate::syscall::exit_this_context(None, token);
|
||||
@@ -1318,9 +1314,7 @@ impl ContextHandle {
|
||||
false,
|
||||
token,
|
||||
)?;
|
||||
for r in res {
|
||||
let _ = r.unmap(token);
|
||||
}
|
||||
handle_notify_files(res, token);
|
||||
}
|
||||
}
|
||||
crate::syscall::exit_this_context(None, token);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
context::{
|
||||
self,
|
||||
memory::{Grant, PageSpan},
|
||||
memory::{handle_notify_files, Grant, PageSpan},
|
||||
},
|
||||
memory::PAGE_SIZE,
|
||||
scheme,
|
||||
@@ -120,9 +120,7 @@ pub fn resource(token: &mut CleanLockToken) -> Result<Vec<u8>> {
|
||||
{
|
||||
let addr_space = Arc::clone(context::current().read(token.token()).addr_space()?);
|
||||
let res = addr_space.munmap(PageSpan::new(fpath_page, page_count.get()), false, token)?;
|
||||
for r in res {
|
||||
let _ = r.unmap(token);
|
||||
}
|
||||
handle_notify_files(res, token);
|
||||
}
|
||||
|
||||
res
|
||||
|
||||
+5
-11
@@ -19,8 +19,8 @@ use crate::{
|
||||
context::{bulk_add_fds, bulk_insert_fds, HardBlockedReason},
|
||||
file::{FileDescription, FileDescriptor, InternalFlags, LockedFileDescription},
|
||||
memory::{
|
||||
AddrSpace, AddrSpaceWrapper, BorrowedFmapSource, Grant, GrantFileRef, MmapMode,
|
||||
PageSpan, UnmapVec, DANGLING,
|
||||
handle_notify_files, AddrSpace, AddrSpaceWrapper, BorrowedFmapSource, Grant,
|
||||
GrantFileRef, MmapMode, PageSpan, UnmapVec, DANGLING,
|
||||
},
|
||||
BorrowedHtBuf, ContextLock, PreemptGuard, PreemptGuardL1, Status,
|
||||
},
|
||||
@@ -986,9 +986,7 @@ impl UserInner {
|
||||
|
||||
let unpin = true;
|
||||
let res = AddrSpace::current()?.munmap(callee_responsible, unpin, token)?;
|
||||
for r in res {
|
||||
let _ = r.unmap(token);
|
||||
}
|
||||
handle_notify_files(res, token);
|
||||
}
|
||||
},
|
||||
// invalid state
|
||||
@@ -1143,9 +1141,7 @@ impl UserInner {
|
||||
)?
|
||||
};
|
||||
|
||||
for map in notify_files {
|
||||
let _ = map.unmap(token);
|
||||
}
|
||||
handle_notify_files(notify_files, token);
|
||||
|
||||
Ok(dst_base.start_address().data())
|
||||
}
|
||||
@@ -1342,9 +1338,7 @@ impl<const READ: bool, const WRITE: bool> CaptureGuard<READ, WRITE> {
|
||||
if let Some(addrsp) = self.addrsp.take() {
|
||||
if !self.span.is_empty() {
|
||||
let res = addrsp.munmap(self.span, unpin, token)?;
|
||||
for r in res {
|
||||
let _ = r.unmap(token);
|
||||
}
|
||||
handle_notify_files(res, token);
|
||||
}
|
||||
if let Some(addrsp) = Arc::into_inner(addrsp) {
|
||||
addrsp.into_drop(token);
|
||||
|
||||
+4
-5
@@ -9,7 +9,9 @@ use crate::{
|
||||
context::{
|
||||
self,
|
||||
file::{FileDescription, FileDescriptor, InternalFlags, LockedFileDescription},
|
||||
memory::{AddrSpace, GenericFlusher, Grant, PageSpan, TlbShootdownActions},
|
||||
memory::{
|
||||
handle_notify_files, AddrSpace, GenericFlusher, Grant, PageSpan, TlbShootdownActions,
|
||||
},
|
||||
},
|
||||
memory::{Page, VirtualAddress, PAGE_SIZE},
|
||||
scheme::{self, FileHandle, KernelScheme, OpenResult, StrOrBytes},
|
||||
@@ -674,10 +676,7 @@ pub fn funmap(virtual_address: usize, length: usize, token: &mut CleanLockToken)
|
||||
.ok_or(Error::new(EINVAL))?;
|
||||
let unpin = false;
|
||||
let notify = addr_space.munmap(span, unpin, token)?;
|
||||
|
||||
for map in notify {
|
||||
let _ = map.unmap(token);
|
||||
}
|
||||
handle_notify_files(notify, token);
|
||||
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user