Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
OS-Contest-2021-Kernel-Preliminary
kcore2021-kcore
Commits
5cc8f1b0
Commit
5cc8f1b0
authored
4 years ago
by
LiHanChi
Browse files
Options
Download
Patches
Plain Diff
Update bitmap.rs
parent
74d65d6e
master
link-error
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kcore-fs/src/bitmap.rs
+3
-0
kcore-fs/src/bitmap.rs
with
3 additions
and
0 deletions
+3
-0
kcore-fs/src/bitmap.rs
+
3
−
0
View file @
5cc8f1b0
...
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets