summaryrefslogtreecommitdiff
path: root/gbl/libgbl
diff options
context:
space:
mode:
Diffstat (limited to 'gbl/libgbl')
-rw-r--r--gbl/libgbl/src/fastboot/mod.rs2
-rw-r--r--gbl/libgbl/src/fastboot/vars.rs12
-rw-r--r--gbl/libgbl/src/ops.rs11
-rw-r--r--gbl/libgbl/tests/integration_tests.rs4
4 files changed, 17 insertions, 12 deletions
diff --git a/gbl/libgbl/src/fastboot/mod.rs b/gbl/libgbl/src/fastboot/mod.rs
index dcdb081..06057e8 100644
--- a/gbl/libgbl/src/fastboot/mod.rs
+++ b/gbl/libgbl/src/fastboot/mod.rs
@@ -141,7 +141,7 @@ impl<'a> GblFastboot<'a> {
let (blk_id, max_size) = match part {
"" => {
let blk_id = blk_id.ok_or("Must provide a block device ID")?;
- (blk_id, devs.get(blk_id)?.total_size()?)
+ (blk_id, devs.get(blk_id)?.info().total_size()?)
}
gpt => match blk_id {
Some(id) => (id, devs.get(id)?.find_partition(gpt)?.size()?),
diff --git a/gbl/libgbl/src/fastboot/vars.rs b/gbl/libgbl/src/fastboot/vars.rs
index 521205a..d1b08fa 100644
--- a/gbl/libgbl/src/fastboot/vars.rs
+++ b/gbl/libgbl/src/fastboot/vars.rs
@@ -140,8 +140,8 @@ impl Variable for BlockDevice {
let id = next_arg_u64(&mut args, Err("Missing block device ID".into()))?;
let val_type = next_arg(&mut args, Err("Missing value type".into()))?;
let val = match val_type {
- TOTAL_BLOCKS => gbl_fb.storage().get(id)?.num_blocks()?,
- BLOCK_SIZE => gbl_fb.storage().get(id)?.block_size()?,
+ TOTAL_BLOCKS => gbl_fb.storage().get(id)?.info().num_blocks,
+ BLOCK_SIZE => gbl_fb.storage().get(id)?.info().block_size,
_ => return Err("Invalid type".into()),
};
Some(snprintf!(out, "{:#x}", val).len())
@@ -161,8 +161,12 @@ impl Variable for BlockDevice {
let mut id_str = [0u8; 32];
let id = snprintf!(id_str, "{:x}", id);
res = (|| {
- f(BLOCK_DEVICE, &[id, "total-blocks"], snprintf!(val, "{:#x}", blk.num_blocks()?))?;
- f(BLOCK_DEVICE, &[id, "block-size"], snprintf!(val, "{:#x}", blk.block_size()?))
+ f(
+ BLOCK_DEVICE,
+ &[id, "total-blocks"],
+ snprintf!(val, "{:#x}", blk.info().num_blocks),
+ )?;
+ f(BLOCK_DEVICE, &[id, "block-size"], snprintf!(val, "{:#x}", blk.info().block_size))
})();
res.is_err()
})?;
diff --git a/gbl/libgbl/src/ops.rs b/gbl/libgbl/src/ops.rs
index 20e04c6..768dae4 100644
--- a/gbl/libgbl/src/ops.rs
+++ b/gbl/libgbl/src/ops.rs
@@ -25,7 +25,7 @@ use core::{
result::Result,
};
use gbl_storage::{
- required_scratch_size, AsBlockDevice, AsMultiBlockDevices, BlockDevice, BlockIo,
+ required_scratch_size, AsBlockDevice, AsMultiBlockDevices, BlockDevice, BlockIoSync,
};
use safemath::SafeNum;
@@ -75,7 +75,7 @@ pub trait GblOps {
/// be returned. Dynamic media change is not supported for now.
fn visit_block_devices(
&mut self,
- f: &mut dyn FnMut(&mut dyn BlockIo, u64, u64),
+ f: &mut dyn FnMut(&mut dyn BlockIoSync, u64, u64),
) -> Result<(), GblOpsError>;
/// Prints a ASCII character to the platform console.
@@ -129,7 +129,7 @@ pub trait GblOps {
let mut res = Ok(());
self.visit_block_devices(&mut |io, id, max_gpt_entries| {
res = (|| {
- total += required_scratch_size(io, max_gpt_entries).unwrap();
+ total += required_scratch_size(io.info(), max_gpt_entries).unwrap();
Ok(())
})();
})?;
@@ -172,7 +172,8 @@ impl<T: GblOps> AsMultiBlockDevices for GblUtils<'_, '_, T> {
self.ops
.visit_block_devices(&mut |io, id, max_gpt_entries| {
// Not expected to fail as `Self::new()` should have checked any overflow.
- let scratch_size: usize = required_scratch_size(io, max_gpt_entries).unwrap();
+ let scratch_size: usize =
+ required_scratch_size(io.info(), max_gpt_entries).unwrap();
let scratch =
&mut self.scratch[scratch_offset.try_into().unwrap()..][..scratch_size];
scratch_offset += scratch_size;
@@ -198,7 +199,7 @@ pub struct DefaultGblOps {}
impl GblOps for DefaultGblOps {
fn visit_block_devices(
&mut self,
- f: &mut dyn FnMut(&mut dyn BlockIo, u64, u64),
+ f: &mut dyn FnMut(&mut dyn BlockIoSync, u64, u64),
) -> Result<(), GblOpsError> {
Err(GblOpsError(Some("unimplemented")))
}
diff --git a/gbl/libgbl/tests/integration_tests.rs b/gbl/libgbl/tests/integration_tests.rs
index ebbdcb4..95609d7 100644
--- a/gbl/libgbl/tests/integration_tests.rs
+++ b/gbl/libgbl/tests/integration_tests.rs
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-use gbl_storage::BlockIo;
+use gbl_storage::BlockIoSync;
use gbl_storage_testlib::TestBlockIo;
use libgbl::{BootImages, FuchsiaBootImages, GblBuilder, GblOps, GblOpsError};
use std::{collections::VecDeque, vec::Vec};
@@ -51,7 +51,7 @@ impl TestGblOps<'_> {
impl GblOps for TestGblOps<'_> {
fn visit_block_devices(
&mut self,
- f: &mut dyn FnMut(&mut dyn BlockIo, u64, u64),
+ f: &mut dyn FnMut(&mut dyn BlockIoSync, u64, u64),
) -> Result<(), GblOpsError> {
for (idx, ele) in self.block_io.iter_mut().enumerate() {
f(&mut ele.io, idx.try_into().unwrap(), ele.max_gpt_entries);