pub struct VmaMap { /* private fields */ }Expand description
A persistent, path-copy interval tree.
Each update only allocates the nodes on the search path. Readers retain an
Arc<VmaMap> (or an Arc<VmaSnapshot>) and therefore continue to observe a
coherent tree while another mutation publishes a successor root.
Implementations§
Source§impl VmaMap
impl VmaMap
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn lookup(&self, address: VirtAddr) -> Option<Arc<VmaSnapshot>>
Sourcepub fn for_each_overlapping(
&self,
range: VirtAddrRange,
visit: impl FnMut(&Arc<VmaSnapshot>) -> bool,
)
pub fn for_each_overlapping( &self, range: VirtAddrRange, visit: impl FnMut(&Arc<VmaSnapshot>) -> bool, )
Visits every VMA intersecting range in ascending order, stopping as
soon as visit returns false.
VMAs never overlap, so each subtree covers one contiguous stretch of
address space and two facts prune the descent: a left subtree ends at
or before its parent’s start, so it can only reach range when the
parent starts after range.start; a right subtree starts at or after
its parent’s end, so it holds nothing once range ends there. What is
left is the search path plus the matches, without materialising the
tree or touching a single reference count for a VMA that does not
intersect.
Sourcepub fn lookup_range(&self, range: VirtAddrRange) -> Vec<Arc<VmaSnapshot>>
pub fn lookup_range(&self, range: VirtAddrRange) -> Vec<Arc<VmaSnapshot>>
Looks up every VMA intersecting a checked range. Returned snapshots own their metadata and can safely be used after the publication lock is released or while a backend performs I/O.
pub fn contains_range(&self, start: VirtAddr, size: usize) -> bool
Sourcepub fn with_huge_page_advice(
&self,
range: VirtAddrRange,
advice: HugePageAdvice,
) -> Option<Self>
pub fn with_huge_page_advice( &self, range: VirtAddrRange, advice: HugePageAdvice, ) -> Option<Self>
Returns a successor root with advice applied to a fully mapped range.
Every affected interval is replaced through path-copy updates. The original root remains a complete rollback preimage until the caller publishes the successor through its address-space mutation gate.
Sourcepub fn find_free_area(
&self,
hint: VirtAddr,
size: usize,
limit: VirtAddrRange,
align: usize,
) -> Option<VirtAddr>
pub fn find_free_area( &self, hint: VirtAddr, size: usize, limit: VirtAddrRange, align: usize, ) -> Option<VirtAddr>
Finds a free, aligned interval without exposing mutable tree nodes.
pub fn remove(&self, start: VirtAddr) -> Option<(Self, Arc<VmaSnapshot>)>
pub fn iter(&self) -> impl Iterator<Item = Arc<VmaSnapshot>>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for VmaMap
impl !UnwindSafe for VmaMap
impl Freeze for VmaMap
impl Send for VmaMap
impl Sync for VmaMap
impl Unpin for VmaMap
impl UnsafeUnpin for VmaMap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DirectoryReadState for T
impl<T> DirectoryReadState for T
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> ⓘ
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> ⓘ
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