Struct AtomicBitmap
pub struct AtomicBitmap { /* private fields */ }Expand description
AtomicBitmap implements a simple bit map on the page level with test and set operations.
It is page-size aware, so it converts addresses to page numbers before setting or clearing
the bits.
Implementations§
§impl AtomicBitmap
impl AtomicBitmap
pub fn new(byte_size: usize, page_size: NonZero<usize>) -> AtomicBitmap
pub fn new(byte_size: usize, page_size: NonZero<usize>) -> AtomicBitmap
Create a new bitmap of byte_size, with one bit per page. This is effectively
rounded up, and we get a new vector of the next multiple of 64 bigger than bit_size.
pub fn enlarge(&mut self, additional_size: usize)
pub fn enlarge(&mut self, additional_size: usize)
Enlarge this bitmap with enough bits to track additional_size additional bytes at page granularity.
New bits are initialized to zero.
pub fn is_bit_set(&self, index: usize) -> bool
pub fn is_bit_set(&self, index: usize) -> bool
Is bit n set? Bits outside the range of the bitmap are always unset.
pub fn is_addr_set(&self, addr: usize) -> bool
pub fn is_addr_set(&self, addr: usize) -> bool
Is the bit corresponding to address addr set?
pub fn set_addr_range(&self, start_addr: usize, len: usize)
pub fn set_addr_range(&self, start_addr: usize, len: usize)
Set a range of len bytes starting at start_addr. The first bit set in the bitmap
is for the page corresponding to start_addr, and the last bit that we set corresponds
to address start_addr + len - 1.
pub fn reset_addr_range(&self, start_addr: usize, len: usize)
pub fn reset_addr_range(&self, start_addr: usize, len: usize)
Reset a range of len bytes starting at start_addr. The first bit set in the bitmap
is for the page corresponding to start_addr, and the last bit that we set corresponds
to address start_addr + len - 1.
pub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the length of the bitmap in bits (i.e. in how many pages it can represent).
pub fn byte_size(&self) -> usize
pub fn byte_size(&self) -> usize
Get the size in bytes i.e how many bytes the bitmap can represent, one bit per page.
pub fn get_and_reset(&self) -> Vec<u64>
pub fn get_and_reset(&self) -> Vec<u64>
Atomically get and reset the dirty page bitmap.
pub fn reset(&self)
pub fn reset(&self)
Reset all bitmap bits to 0.
Trait Implementations§
§impl Bitmap for AtomicBitmap
impl Bitmap for AtomicBitmap
§fn mark_dirty(&self, offset: usize, len: usize)
fn mark_dirty(&self, offset: usize, len: usize)
offset and len as dirtied.§fn slice_at(&self, offset: usize) -> <AtomicBitmap as WithBitmapSlice<'_>>::S
fn slice_at(&self, offset: usize) -> <AtomicBitmap as WithBitmapSlice<'_>>::S
<Self as WithBitmapSlice>::S slice of the current bitmap, starting at
the specified offset.§impl Clone for AtomicBitmap
impl Clone for AtomicBitmap
§fn clone(&self) -> AtomicBitmap
fn clone(&self) -> AtomicBitmap
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for AtomicBitmap
impl Debug for AtomicBitmap
§impl Default for AtomicBitmap
impl Default for AtomicBitmap
§fn default() -> AtomicBitmap
fn default() -> AtomicBitmap
§impl NewBitmap for AtomicBitmap
impl NewBitmap for AtomicBitmap
§fn with_len(len: usize) -> AtomicBitmap
fn with_len(len: usize) -> AtomicBitmap
§impl<'a> WithBitmapSlice<'a> for AtomicBitmap
impl<'a> WithBitmapSlice<'a> for AtomicBitmap
§type S = BaseSlice<&'a AtomicBitmap>
type S = BaseSlice<&'a AtomicBitmap>
Auto Trait Implementations§
impl Freeze for AtomicBitmap
impl RefUnwindSafe for AtomicBitmap
impl Send for AtomicBitmap
impl Sync for AtomicBitmap
impl Unpin for AtomicBitmap
impl UnsafeUnpin for AtomicBitmap
impl UnwindSafe for AtomicBitmap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.