Closed kallisti5 closed 7 years ago
Hm, a little troubleshooting:
diff --git a/src/fat/image.rs b/src/fat/image.rs
index 9357cf3..d874fad 100644
--- a/src/fat/image.rs
+++ b/src/fat/image.rs
@@ -75,6 +75,7 @@ impl Image {
// TODO: Make this an iterator
pub fn root_entries(&self) -> Vec<RootEntry> {
+ println!("root_dir: {:?}", self.root_dir);
self.root_dir
.chunks(BYTES_PER_ROOT_ENTRY)
.map(|chunk| {
@@ -83,10 +84,11 @@ impl Image {
let entry: RootEntry;
unsafe { entry = mem::transmute(entry_bytes); }
+ println!("entry: {:?}", entry);
entry
})
.filter(|entry| { entry.filename[0] != 0xe5 })
- .take_while(|entry| { entry.filename[0] != 0 })
+ //.take_while(|entry| { entry.filename[0] != 0 })
.collect::<Vec<RootEntry>>()
}
Full data attached.
$ file ~/fat12.img
/home/kallisti5/fat12.img: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 16, reserved sectors 16, root entries 512, sectors 32768 (volumes <=32 MB) , Media descriptor 0xf8, sectors/FAT 16, sectors/track 32, heads 64, serial number 0xa658378, unlabeled, FAT (12 bit)
Looks like:
After using the data from the BIOS Param Block instead of making assumptions on sector sizes, starting to see some life from fatr on fat12 images created under Linux:
kallisti5@nyx fatr :) $ ./target/debug/fatr ls ~/fat12.img
BIOSParam { bytes_per_sector: 512, sectors_per_cluster: 4, reserved_sectors: 1, fat_count: 2, max_roots: 512, sectors: 8192, media_id: 248, sectors_per_fat: 6 }
HAIKU . 0
Atest.. 4294967295
TEST .TXT 7
Creating a new 16MiB image, attempting to inject 84K file via fatr:
Injecting the file with linux mount, but not showing via fatr ls: