pub struct RegionAllocator { /* private fields */ }Implementations§
Source§impl RegionAllocator
impl RegionAllocator
pub fn lock_mu(&self) -> impl PinInit<RegionAllocatorMuGuard<'_>, Infallible>
pub fn lock_mu_policy<P: LockPolicy<RawMutex, AcquireArgs = ()>>( &self, ) -> impl PinInit<RegionAllocatorMuGuard<'_, P>, Infallible>
pub fn lock_mu_aliased<'a, AliasClass: LockClass, M2: RawLock>( &'a self, alias: &'a KMutex<AliasClass, M2>, ) -> impl PinInit<KMutexAliasedGuard<'a, RegionAllocatorMuClass, AliasClass, RawMutex, M2>, Infallible>
pub fn lock_mu_aliased_policy<'a, AliasClass: LockClass, M2: RawLock, P: LockPolicy<RawMutex, AcquireArgs = ()>>( &'a self, alias: &'a KMutex<AliasClass, M2>, ) -> impl PinInit<KMutexAliasedGuard<'a, RegionAllocatorMuClass, AliasClass, RawMutex, M2, P>, Infallible>
pub fn guard_mu<'b, 'a>( &'b self, token: &'b LockToken<'a, RegionAllocatorMuClass>, ) -> RegionAllocatorMuTokenGuard<'b, 'a>
pub fn guard_mu_mut<'b, 'a>( &'b self, token: &'b mut LockToken<'a, RegionAllocatorMuClass>, ) -> RegionAllocatorMuTokenGuardMut<'b, 'a>
Source§impl RegionAllocator
impl RegionAllocator
pub const REGION_POOL_SLAB_SIZE: usize = 4096
pub fn init() -> impl PinInit<Self, Infallible>
Sourcepub fn init_with_pool(
pool: RefPtr<RegionPool>,
) -> impl PinInit<Self, Infallible>
pub fn init_with_pool( pool: RefPtr<RegionPool>, ) -> impl PinInit<Self, Infallible>
Initialize a RegionAllocator with a specified RegionPool.
pub fn has_region_pool(&self) -> bool
pub fn set_region_pool(&self, pool: RefPtr<RegionPool>) -> Result<(), Status>
pub fn reset(&self)
pub fn add_region( &self, region: RegionSpan, allow_overlap: AllowOverlap, ) -> Result<(), Status>
pub fn subtract_region( &self, to_subtract: RegionSpan, allow_incomplete: AllowIncomplete, ) -> Result<(), Status>
pub fn get_region( &self, size: u64, alignment: u64, ) -> Result<UniquePtr<Region>, Status>
Sourcepub fn get_region_pointer_aligned(
&self,
size: u64,
) -> Result<UniquePtr<Region>, Status>
pub fn get_region_pointer_aligned( &self, size: u64, ) -> Result<UniquePtr<Region>, Status>
Get a region out of the set of currently available regions which has a
specified size and is pointer-aligned (aligned to core::mem::size_of::<*const ()>()).
pub fn get_region_specific( &self, requested_region: RegionSpan, ) -> Result<UniquePtr<Region>, Status>
pub fn test_region_intersects( &self, region: RegionSpan, which: TestRegionSet, ) -> Result<bool, Status>
pub fn test_region_contained_by( &self, region: RegionSpan, which: TestRegionSet, ) -> Result<bool, Status>
pub fn allocated_region_count(&self) -> usize
pub fn available_region_count(&self) -> usize
Sourcepub fn walk_allocated_regions<F>(&self, cb: F)where
F: FnMut(&Region) -> bool,
pub fn walk_allocated_regions<F>(&self, cb: F)where
F: FnMut(&Region) -> bool,
Walk the allocated regions and call the user provided callback for each entry. Stop when out of entries or the callback returns false.
§Warning
It is absolutely required that the user callback must not call into any other
RegionAllocator public APIs, and should likely not acquire any locks of any
kind. This method cannot protect against deadlocks and lock inversions that
are possible by acquiring the allocation lock before calling the user provided
callback. Because KMutex is not recursive, calling back into the allocator
from within the callback will deadlock.
Sourcepub fn walk_available_regions<F>(&self, cb: F)where
F: FnMut(&Region) -> bool,
pub fn walk_available_regions<F>(&self, cb: F)where
F: FnMut(&Region) -> bool,
Walk the available regions and call the user provided callback for each entry. Stop when out of entries or the callback returns false.
§Warning
It is absolutely required that the user callback must not call into any other
RegionAllocator public APIs, and should likely not acquire any locks of any
kind. This method cannot protect against deadlocks and lock inversions that
are possible by acquiring the allocation lock before calling the user provided
callback. Because KMutex is not recursive, calling back into the allocator
from within the callback will deadlock.
Trait Implementations§
Source§impl Drop for RegionAllocator
impl Drop for RegionAllocator
Source§impl HasPinData for RegionAllocator
impl HasPinData for RegionAllocator
Source§impl PinnedDrop for RegionAllocator
impl PinnedDrop for RegionAllocator
impl Send for RegionAllocator
impl Sync for RegionAllocator
Auto Trait Implementations§
impl !Freeze for RegionAllocator
impl !RefUnwindSafe for RegionAllocator
impl !UnsafeUnpin for RegionAllocator
impl !UnwindSafe for RegionAllocator
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), !>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), !>
slot. Read moreSource§fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>where
F: FnOnce(Pin<&mut T>) -> Result<(), E>,
fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>where
F: FnOnce(Pin<&mut T>) -> Result<(), E>,
self then calls the function f with the initialized
value. Read more