Properly maintain a free block list. Change your disc format so that as well as having a superblock and a root directory and free space for creating files, it also has a free block list. Calculate how many blocks this list will require for itself. You can easily find the total number of blocks that your disc has. There will need to be enough space in the free list for one int/word per potentially free block. (The superblock, root directory, and free list are not potentially free so do not need to be counted, but it is much easier to just pretend they are and calculate on that basis). Each block in the free list can hold 128 ints, so the calculation is easy. Make sure that if the number is not exactly divisible by 128 you round up rather than down. This free list will work exactly the way that was extensively discussed and illustrated in class on Tuesday 13th February. What follows is only a summary. The block numbers for every free block must be written into consecutive words in the free block list. To avoid confusion you should fill any unused words in the last block with zeros. Do not be unnecessarily wasteful. In particular do not use newvec to create an "array" with as many entries as there are free blocks, fill it with the block numbers, then write it to disc. Use only an ordinary block size (128 word) vec to build up the numbers. The free list will behave like a stack. When a free block is needed use the one whose number appears at the top of the stack, and of course pop. When a used block becomes free again push it back onto the top of the stack. You will need to record in the superblock the first and last block numbers occupied by the free list as well as the block number for the root directory, along with the free block list's stack pointer. The stack pointer simply records the number of originally free blocks that have been allocated so far, that is of course the index of the top of the stack, in words, measured from the first. You must also record the number of remaining free blocks. These values must be written into the superblock when the disc is formatted. While your program is running, you must also store in memory some essential things: A two-block sized window into the free block list, this will always contain a copy of the two blocks from the free block list that are closest to the top of the stack. You will also need to record in memory which two blocks are currently in the "window", the top-of-stack index, measured from the start of the window, and the total number of free blocks, not just in the window, but in the whole free block list. When your system starts up, either you will enter the command to format the disc, or the disc will be "mounted": made ready for re-use, keeping all existing content. It is best to automatically mount the disc the first time any disc operation (except for formatting) is performed. In either case, format or mount, the information from the superblock that pertains to the free list must be read and kept in memory. From the superblock's record of the top of the stack, you can easily calculate which two blocks must be read into the in-memory window and the value of the stack pointer measure from the beginning of the window rather than the beginning of the whole on-disc list. Also make sure that when your system stops, the disc is "dismounted", so that all the in-memory information is converted back to the correct on-disc values, and the free block list window is also written back over the appropriate two blocks. Also include a dismount or save-all command so the user can make sure everything is safe before trying something that is still under development and may crash your program. In order to test this, unless you have already created your level-1 index file system, you will need to add some temporary commands, one asking for some number of free block to be allocated, pretending to create a long file. The other doing the reverse, pretending to delete a file and returning blocks to the free list, and another to verify that everything is correct by printing out the relevant variables and at least a few words from the free list surrounding the stack pointer.