For all those FS designers out there

Programming, for all ages and all languages.
Post Reply
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

For all those FS designers out there

Post 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
Attachments
disk.h
(795 Bytes) Downloaded 95 times
disk.cpp
(1.48 KiB) Downloaded 135 times
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
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: For all those FS designers out there

Post by earlz »

sweet! I may use this soon enough lol
skyking
Member
Member
Posts: 174
Joined: Sun Jan 06, 2008 8:41 am

Re: For all those FS designers out there

Post 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).
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Re: For all those FS designers out there

Post 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.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: For all those FS designers out there

Post 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.
Every good solution is obvious once you've found it.
User avatar
nekros
Member
Member
Posts: 391
Joined: Wed Mar 05, 2008 9:10 pm
Contact:

Re: For all those FS designers out there

Post by nekros »

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
Post Reply