Well I thought I'd post something for all those filesystem designers out there. I wrote a c++ class to handle disk images(read,writing to and from sectors). I'm using this in the program that will manipulate my rwfs filesystem.
PS. Ignore the rwfs class, that is something I'm writing at the moment for my own program...
Also, you will need to remove the "#include "fs_struct.h" " at the top, again that is rwfs specific.
NOTE In keeping with lba, the first sector is 1 instead of zero
For all those FS designers out there
For all those FS designers out there
Last edited by nekros on Wed Mar 25, 2009 10:46 pm, edited 2 times in total.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Re: For all those FS designers out there
Well first of all is incorrectly defined, a sector should contain 512 bytes (not 511).
Code: Select all
typedef unsigned char sector_t[511];
Re: For all those FS designers out there
Arrays start at 0,but for readability maybe I should have that,btw.skyking wrote:Well first of allis incorrectly defined, a sector should contain 512 bytes (not 511).Code: Select all
typedef unsigned char sector_t[511];
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Re: For all those FS designers out there
'char x[512]' assigns a 512-byte array, indexed 0..511.nekros wrote:Arrays start at 0,but for readability maybe I should have that,btw.skyking wrote:Well first of allis incorrectly defined, a sector should contain 512 bytes (not 511).Code: Select all
typedef unsigned char sector_t[511];
Every good solution is obvious once you've found it.
Re: For all those FS designers out there
Ah, I keep thinking of verilog here, *facepalm. Either way, I changed it.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc