diff --git a/apps/system/components/kata-os-common/src/slot-allocator/Cargo.toml b/apps/system/components/kata-os-common/src/slot-allocator/Cargo.toml index 8ee9b02..54a670d 100644 --- a/apps/system/components/kata-os-common/src/slot-allocator/Cargo.toml +++ b/apps/system/components/kata-os-common/src/slot-allocator/Cargo.toml @@ -9,7 +9,6 @@ default = [] TRACE_OPS = [] [dependencies] -# TODO(sleffler): v1.0 requires rust edition2021 -bitvec = { version = "0.22", default-features = false, features = ["alloc"] } +bitvec = { version = "1.0", default-features = false, features = ["alloc"] } log = "0.4" spin = "0.9" diff --git a/apps/system/components/kata-os-common/src/slot-allocator/src/lib.rs b/apps/system/components/kata-os-common/src/slot-allocator/src/lib.rs index d751766..a12f289 100644 --- a/apps/system/components/kata-os-common/src/slot-allocator/src/lib.rs +++ b/apps/system/components/kata-os-common/src/slot-allocator/src/lib.rs @@ -12,7 +12,7 @@ use log::trace; use spin::Mutex; struct Slots { - bits: Option>, + bits: Option>, used: usize, name: &'static str, // Component name // TODO(sleffler): maybe track last alloc for O(1) sequential allocations @@ -20,7 +20,7 @@ struct Slots { impl Slots { fn new(name: &'static str, size: usize) -> Self { Slots { - bits: Some(bitvec![Lsb0, u8; 0; size].into_boxed_bitslice()), + bits: Some(bitvec![u8, Lsb0; 0; size].into_boxed_bitslice()), used: 0, name, } @@ -33,7 +33,7 @@ impl Slots { } } fn init(&mut self, name: &'static str, size: usize) { - self.bits = Some(bitvec![Lsb0, u8; 0; size].into_boxed_bitslice()); + self.bits = Some(bitvec![u8, Lsb0; 0; size].into_boxed_bitslice()); self.name = name; } fn used_slots(&self) -> usize { self.used } @@ -57,11 +57,11 @@ impl Slots { let bslice = &mut bits.as_mut_bitslice()[range]; if value { assert!(bslice.not_any()); - bslice.set_all(true); + bslice.fill(true); self.used = self.used + count; } else { assert!(bslice.all()); - bslice.set_all(false); + bslice.fill(false); self.used = self.used - count; } }