class myFileSystem { public FileSystem(char diskName[16]) { // open the file with the above name // this file will act as the "disk" for your file system } public int create(char name[8], int size) { //create a file with this name and this size // high level pseudo code for creating a new file // Step 1: check to see if we have sufficient free space on disk by // reading in the free block list. To do this: // move the file pointer to the start of the disk file. // Read the first 128 bytes (the free/in-use block information) // Scan the list to make sure you have sufficient free blocks to // allocate a new file of this size // Step 2: we look for a free inode om disk // Read in a inode // check the "used" field to see if it is free // If not, repeat the above two steps until you find a free inode // Set the "used" field to 1 // Copy the filename to the "name" field // Copy the file size (in units of blocks) to the "size" field // Step 3: Allocate data blocks to the file // for(i=0;i Read in 1024 bytes from this location into the buffer "buf" } // End read public int write(char name[8], int blockNum, char buf[1024]) { // write this block to this file // Step 1: locate the inode for this file // Move file pointer to the position of the 1st inode (129th byte) // Read in a inode // If the inode is in use, compare the "name" field with the above file // IF the file names don't match, repeat // Step 2: Write to the specified block // Check that blockNum < inode.size, else flag an error // Get the disk address of the specified block // That is, addr = inode.blockPointer[blockNum] // move the file pointer to the block location (i.e., byte # addr*1024) // Write the block! => Write 1024 bytes from the buffer "buff" to this location } // end write }