diff options
author | Yecheng Zhao <zyecheng@google.com> | 2024-06-19 01:07:01 +0000 |
---|---|---|
committer | Yecheng Zhao <zyecheng@google.com> | 2024-06-20 19:44:09 +0000 |
commit | 8afbc79687a40a370fdbd16b3bf0ed31a0d148c9 (patch) | |
tree | 236cc9a03a80d3efa78713b7ab82d15310b7be1b /gbl/libgbl/src/fastboot/vars.rs | |
parent | cc6d0a56ce4a3aa97d2911555dcce6389b9a74c3 (diff) | |
download | libbootloader-8afbc79687a40a370fdbd16b3bf0ed31a0d148c9.tar.gz |
Refactor libstorage to provide async APIs
Bug: 338439051
Change-Id: I9226e5ed01616fea9380232130256345b348b422
Diffstat (limited to 'gbl/libgbl/src/fastboot/vars.rs')
-rw-r--r-- | gbl/libgbl/src/fastboot/vars.rs | 12 |
1 files changed, 8 insertions, 4 deletions
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() })?; |