diff --git a/src/fs/iso/iso9660.rs b/src/fs/iso/iso9660.rs index 82e7354..726f6d7 100644 --- a/src/fs/iso/iso9660.rs +++ b/src/fs/iso/iso9660.rs @@ -75,6 +75,14 @@ impl IsoDir { pub fn get_idf(&self) -> &[u8] { unsafe { core::slice::from_raw_parts(self.idf.as_ptr(), self.idf_len as usize) } } + + pub fn next_entry(&self) -> &IsoDir { + crate::utils::ref_raw_offset(self, self.dir_size as isize) + } + + pub fn matches(&self, path: &str) -> bool { + self.get_idf() == path.as_bytes() + } } // Primary volume descriptor structure diff --git a/src/fs/iso/mod.rs b/src/fs/iso/mod.rs index 8ef8d39..6587016 100644 --- a/src/fs/iso/mod.rs +++ b/src/fs/iso/mod.rs @@ -46,7 +46,7 @@ impl FileSystem for IsoFS { serial_println!("{:?}", curr_entry.idf_len); serial_println!("{:?}", alloc::str::from_utf8(curr_entry.get_idf()).unwrap()); - if curr_entry.get_idf() == path_component.as_bytes() { + if curr_entry.matches(path_component) { serial_println!("Found {}", path_component); curr_entry_block = read_block(curr_entry.data_blk.le).await; curr_entry = unserialize(curr_entry_block.as_ptr()); @@ -54,7 +54,7 @@ impl FileSystem for IsoFS { } // Next entry - curr_entry = next_entry(curr_entry); + curr_entry = curr_entry.next_entry(); } } @@ -64,9 +64,6 @@ impl FileSystem for IsoFS { } } -pub fn next_entry(entry: &IsoDir) -> &IsoDir { - crate::utils::ref_raw_offset(entry, entry.dir_size as isize) -} pub async fn get_prim_vol_desc() -> IsoPrimVolDesc { let desc_block = read_block(iso9660::ISO_PRIM_VOLDESC_BLOCK).await;