Commit 5cc8f1b0 authored by LiHanChi's avatar LiHanChi
Browse files

Update bitmap.rs

No related merge requests found
Showing with 3 additions and 0 deletions
+3 -0
......@@ -29,6 +29,7 @@ impl Bitmap {
blocks, // how many blocks used
}
}
pub fn alloc(&self, block_device: &Arc<dyn BlockDevice>) -> Option<usize> {
for block_id in 0..self.blocks {
let pos = get_block_cache(
......@@ -57,6 +58,7 @@ impl Bitmap {
}
None
}
pub fn dealloc(&self, block_device: &Arc<dyn BlockDevice>, bit: usize) {
let (block_pos, bits64_pos, inner_pos) = decomposition(bit);
get_block_cache(
......@@ -67,6 +69,7 @@ impl Bitmap {
bitmap_block[bits64_pos] -= 1u64 << inner_pos;
});
}
pub fn maximum(&self) -> usize {
self.blocks * BLOCK_BITS
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment