Reading a FAT root directory
Posted: Wed Mar 30, 2011 10:19 pm
Greetings,
I have a quick question regarding the root directory of a FAT file system (specifically, FAT12).
I'm writing myself a bootloader from scratch, it's not really gotten far beyond booting, as I realised that I'm very soon going to require a file system if I want to do much. With this in mind, I started to implement a FAT12 fs for my boot floppy.
Right now I've got the boot sector coded so that it reads a FAT off the disk into memory (I cheated a little for testing and used a windows-formatted floppy image and overwrote the first sector with my own). this works, but now i want to read the root directory. My question is, given that this is a floppy I'm using here, and there's 14 sectors allocated to the root directory, should a properly designed FAT12 fs try to keep all directory entries at the top of the root directory space? At the moment there's only one example text file on the image in question, and I'm wondering how I check for the last directory entry while reading the contents, and what should happen were i to add 2 more files, and then delete the second, does this result in a fragmentation, or should the rest of the directory entries be moved down one whenever this happens?
I have a quick question regarding the root directory of a FAT file system (specifically, FAT12).
I'm writing myself a bootloader from scratch, it's not really gotten far beyond booting, as I realised that I'm very soon going to require a file system if I want to do much. With this in mind, I started to implement a FAT12 fs for my boot floppy.
Right now I've got the boot sector coded so that it reads a FAT off the disk into memory (I cheated a little for testing and used a windows-formatted floppy image and overwrote the first sector with my own). this works, but now i want to read the root directory. My question is, given that this is a floppy I'm using here, and there's 14 sectors allocated to the root directory, should a properly designed FAT12 fs try to keep all directory entries at the top of the root directory space? At the moment there's only one example text file on the image in question, and I'm wondering how I check for the last directory entry while reading the contents, and what should happen were i to add 2 more files, and then delete the second, does this result in a fragmentation, or should the rest of the directory entries be moved down one whenever this happens?