pub struct MappingIndex { /* private fields */ }Expand description
Reverse index from capability ID to live mappings.
The inline capacity of 4 covers the common case (a memory region mapped
in the kernel + up to 3 user address spaces) without heap allocation.
If a capability ever acquires more than 4 mappings, SmallVec spills to
the heap while the SpinLock is held. This is not an IRQ path and the
heap lock order (mapping_index → heap) does not conflict with any other
known lock order, so the spill is not a correctness issue : only a minor
latency concern noted in ticket #49.
Implementations§
Source§impl MappingIndex
impl MappingIndex
Sourcepub fn register(&self, cap_id: CapId, mapping: MappingRef)
pub fn register(&self, cap_id: CapId, mapping: MappingRef)
Registers a mapping for the given capability.
Sourcepub fn unregister(&self, cap_id: CapId, pid: Pid, vaddr: VirtAddr)
pub fn unregister(&self, cap_id: CapId, pid: Pid, vaddr: VirtAddr)
Removes a single mapping for the given capability.
Sourcepub fn lookup(&self, cap_id: CapId) -> SmallVec<[MappingRef; 4]>
pub fn lookup(&self, cap_id: CapId) -> SmallVec<[MappingRef; 4]>
Returns a snapshot of the mappings for the given capability.
Sourcepub fn remove_all(&self, cap_id: CapId) -> SmallVec<[MappingRef; 4]>
pub fn remove_all(&self, cap_id: CapId) -> SmallVec<[MappingRef; 4]>
Removes and returns every mapping associated with the given capability.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MappingIndex
impl !RefUnwindSafe for MappingIndex
impl Send for MappingIndex
impl Sync for MappingIndex
impl Unpin for MappingIndex
impl UnsafeUnpin for MappingIndex
impl UnwindSafe for MappingIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more