To help I have written the low level LBA based read and write. The routines are in fsLow.c, the necessary header for you to include file is fsLow.h. You do NOT need to understand the code in fsLow, but you do need to understand the header file and the functions. There are 4 key functions:
startPartitionSystem – you specify a file name that is the “volume” of your hard drive. The volume size is rounded to even block size and is only used when creating the volume file. The block size must be a power of 2 (nominally 512 bytes).
On Return, the function will return 0 if success or a negative number if an error occurs. The values pointed to by volSize and blockSize are filled in with the values of the existing volume file.
int closePartitionSystem ();
closePartitionSystem – closes down the volume file and must be called prior to terminating the process, but no read or writes can happen after this call.
LBAread and LBAwrite take a buffer, a count of LBA blocks and the starting LBA block number (0 based). The buffer must be large enough for the number of blocks * the block size.
On return, these function returns the number of blocks read or written.
The source file fsLowDriver.c is a simple driver for the driver system and should not be part of your program.
In addition, I have written a hexdump utility that will allow you to analyze your volume file.
Your assignment is to write a file system and a test “main” that will be the driver to test you file system. The driver should be interactive (with all built in commands) to list directories, create directories, add and remove files, copy files, move files, setting meta data, and two “special commands” one to copy from the normal filesystem to your filesystem and the other from your filesystem to the normal filesystem.
This is deliberately vague, as it is dependent on your filesystem design. And this is about all you will get initially for a realworld assignment
For our purposes use 10,000,000 or less (minimum 500,000) bytes for the volume size and 512 bytes per sector. These are the values to pass into startPartitionSystem.