Page 1 of 1

For all those FS designers out there

Posted: Wed Mar 25, 2009 4:18 pm
by nekros
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

Re: For all those FS designers out there

Posted: Wed Mar 25, 2009 7:51 pm
by earlz
sweet! I may use this soon enough lol

Re: For all those FS designers out there

Posted: Thu Mar 26, 2009 1:41 am
by skyking
Well first of all

Code: Select all

typedef unsigned char sector_t[511];
is incorrectly defined, a sector should contain 512 bytes (not 511).

Re: For all those FS designers out there

Posted: Thu Mar 26, 2009 6:45 am
by nekros
skyking wrote:Well first of all

Code: Select all

typedef unsigned char sector_t[511];
is incorrectly defined, a sector should contain 512 bytes (not 511).
Arrays start at 0,but for readability maybe I should have that,btw.

Re: For all those FS designers out there

Posted: Thu Mar 26, 2009 7:42 am
by Solar
nekros wrote:
skyking wrote:Well first of all

Code: Select all

typedef unsigned char sector_t[511];
is incorrectly defined, a sector should contain 512 bytes (not 511).
Arrays start at 0,but for readability maybe I should have that,btw.
'char x[512]' assigns a 512-byte array, indexed 0..511.

Re: For all those FS designers out there

Posted: Thu Mar 26, 2009 8:44 am
by nekros
Ah, I keep thinking of verilog here, *facepalm. Either way, I changed it.