initfs: Actually use Length newtype

This commit is contained in:
bjorn3
2026-02-17 20:54:02 +01:00
parent 7248eda128
commit 200ba82e57
3 changed files with 3 additions and 4 deletions
+1 -2
View File
@@ -141,8 +141,7 @@ impl<'initfs> InodeStruct<'initfs> {
}
fn data(&self) -> Result<&'initfs [u8]> {
let start: usize = self.inode.offset.0.get().try_into().map_err(|_| Error)?;
let length: usize = self.inode.length.get().try_into().map_err(|_| Error)?;
let length: usize = self.inode.length.0.get().try_into().map_err(|_| Error)?;
let end = start.checked_add(length).ok_or(Error)?;
+1 -1
View File
@@ -81,7 +81,7 @@ const _: () = {
#[derive(Clone, Copy, Debug)]
pub struct InodeHeader {
pub type_: U32,
pub length: U32,
pub length: Length,
pub offset: Offset,
}
+1 -1
View File
@@ -253,7 +253,7 @@ fn write_inode(
*inode_hdr = initfs::InodeHeader {
type_: (ty as u32).into(),
length: write_result.size.into(),
length: initfs::Length(write_result.size.into()),
offset: initfs::Offset(write_result.offset.into()),
};