The file system should be built on a simulated disk that can only be accessed using low level I/O functions.
All I/O to the disk is done in blocks or clusters of 1024 bytes.
Note that the functions are not "sequential". You must always
specify the block address. Block addresses start at zero and
go up by one to the maximum size of the disk.
*/
/* BLOCKSIZE defines the size of blocks or clusters (in bytes) on the simulated disk. */
#define BLOCKSIZE 1024
/* DISKSIZE defines the number of blocks on the simulated disk. The total size
of the disk system is BLOCKSIZE*DISKSIZE bytes. */
#define DISKSIZE 256
/* writeDisk
Write one block of data to the given location on the disk.
Parameters:
location - The number of the disk block that is to be written.
bytes - A pointer to the data to be written to the disk.
length - The number of bytes to write to the disk. This must
be less than or equal to the BLOCKSIZE.
*/
void writeDisk(int location, void *bytes, int length);
/* readDisk
Read one block of data from the given location on the disk.
Parameters:
location - The number of the disk block that is to be read.
bytes - A pointer to a buffer to receive the data.
length - The number of bytes to read from the disk. This must
be less than or equal to the BLOCKSIZE.
*/
void readDisk(int location, void *bytes, int length);
Hey I can do this for you. We had to do a similar assignment, but on a bigger scale. we had to simulate an entire OS, not just the Disk :) so its pretty easy for me.