Skip to content

Commit 00096ec

Browse files
committed
update bitvec to 0.17
1 parent 8902cfa commit 00096ec

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

rcore-fs-sefs/Cargo.toml

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ edition = "2018"
77
[dependencies]
88
rcore-fs = { path = "../rcore-fs" }
99
static_assertions = "0.3"
10-
spin = "0.4"
10+
spin = "0.5"
1111
log = "0.4"
12-
13-
[dependencies.bitvec]
14-
version = "0.9"
15-
default-features = false
16-
features = ["alloc"]
12+
bitvec = { version = "0.17", default-features = false, features = ["alloc"] }
1713

1814
[features]
1915
std = ["rcore-fs/std"]

rcore-fs-sefs/src/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use core::any::Any;
1313
use core::fmt::{Debug, Error, Formatter};
1414
use core::mem::MaybeUninit;
1515

16-
use bitvec::BitVec;
16+
use bitvec::prelude::*;
1717
use rcore_fs::dev::TimeProvider;
1818
use rcore_fs::dirty::Dirty;
1919
use rcore_fs::vfs::{self, FileSystem, FsError, INode, Timespec};
@@ -452,7 +452,7 @@ pub struct SEFS {
452452
/// on-disk superblock
453453
super_block: RwLock<Dirty<SuperBlock>>,
454454
/// blocks in use are marked 0
455-
free_map: RwLock<Dirty<BitVec>>,
455+
free_map: RwLock<Dirty<BitVec<Lsb0, u8>>>,
456456
/// inode list
457457
inodes: RwLock<BTreeMap<INodeId, Weak<INodeImpl>>>,
458458
/// device
@@ -486,7 +486,7 @@ impl SEFS {
486486
let block_id = Self::get_freemap_block_id_of_group(i);
487487
meta_file.read_block(
488488
block_id,
489-
&mut free_map.as_mut()[BLKSIZE * i..BLKSIZE * (i + 1)],
489+
&mut free_map.as_mut_slice()[BLKSIZE * i..BLKSIZE * (i + 1)],
490490
)?;
491491
}
492492

@@ -673,7 +673,7 @@ impl vfs::FileSystem for SEFS {
673673
let mut free_map = self.free_map.write();
674674
if free_map.dirty() {
675675
for i in 0..super_block.groups as usize {
676-
let slice = &free_map.as_ref()[BLKSIZE * i..BLKSIZE * (i + 1)];
676+
let slice = &free_map.as_slice()[BLKSIZE * i..BLKSIZE * (i + 1)];
677677
self.meta_file
678678
.write_all_at(slice, BLKSIZE * Self::get_freemap_block_id_of_group(i))?;
679679
}
@@ -720,7 +720,7 @@ trait BitsetAlloc {
720720
fn alloc(&mut self) -> Option<usize>;
721721
}
722722

723-
impl BitsetAlloc for BitVec {
723+
impl BitsetAlloc for BitVec<Lsb0, u8> {
724724
fn alloc(&mut self) -> Option<usize> {
725725
// TODO: more efficient
726726
let id = (0..self.len()).find(|&i| self[i]);
@@ -731,7 +731,7 @@ impl BitsetAlloc for BitVec {
731731
}
732732
}
733733

734-
impl AsBuf for BitVec {
734+
impl AsBuf for BitVec<Lsb0, u8> {
735735
fn as_buf(&self) -> &[u8] {
736736
self.as_ref()
737737
}

rcore-fs-sfs/Cargo.toml

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ edition = "2018"
77
[dependencies]
88
rcore-fs = { path = "../rcore-fs" }
99
static_assertions = "0.3"
10-
spin = "0.4"
10+
spin = "0.5"
1111
log = "0.4"
12-
13-
[dependencies.bitvec]
14-
version = "0.9"
15-
default-features = false
16-
features = ["alloc"]
12+
bitvec = { version = "0.17", default-features = false, features = ["alloc"] }
1713

1814
[dev-dependencies]
19-
tempfile = "3.0.7"
15+
tempfile = "3.0.7"

rcore-fs-sfs/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use core::any::Any;
1515
use core::fmt::{Debug, Error, Formatter};
1616
use core::mem::MaybeUninit;
1717

18-
use bitvec::BitVec;
18+
use bitvec::prelude::*;
1919
use spin::RwLock;
2020

2121
use rcore_fs::dev::Device;
@@ -724,7 +724,7 @@ pub struct SimpleFileSystem {
724724
/// on-disk superblock
725725
super_block: RwLock<Dirty<SuperBlock>>,
726726
/// blocks in use are mared 0
727-
free_map: RwLock<Dirty<BitVec>>,
727+
free_map: RwLock<Dirty<BitVec<Lsb0, u8>>>,
728728
/// inode list
729729
inodes: RwLock<BTreeMap<INodeId, Weak<INodeImpl>>>,
730730
/// device
@@ -982,7 +982,7 @@ trait BitsetAlloc {
982982
fn alloc(&mut self) -> Option<usize>;
983983
}
984984

985-
impl BitsetAlloc for BitVec {
985+
impl BitsetAlloc for BitVec<Lsb0, u8> {
986986
fn alloc(&mut self) -> Option<usize> {
987987
// TODO: more efficient
988988
let id = (0..self.len()).find(|&i| self[i]);
@@ -993,7 +993,7 @@ impl BitsetAlloc for BitVec {
993993
}
994994
}
995995

996-
impl AsBuf for BitVec {
996+
impl AsBuf for BitVec<Lsb0, u8> {
997997
fn as_buf(&self) -> &[u8] {
998998
self.as_ref()
999999
}

0 commit comments

Comments
 (0)