Is this filesystem too fat ?
- Due :
- 5 December
- Points :
- 4
- Teams :
- You may do this in teams of up to three people.
Description
In this assignment you are going to extend the interpreter used in the shell assignment so it will be able to manipulate (in small ways) a FAT filesystem.
There are several files for this assignment. These include :
- Python Source
- This is the python source code based on a limited version of the interpreter (from the shell assignment) and that provides functions to look at some parts of a fat filesystem.
- Extra Source
- This file takes the offsets and names (from the wikipedia entry on the fat filesystem) and generates python getter and setter functions for those names. The setter functions have not been extensively tested, so beware. When run, it produces this file which is loaded by the interpreter. You don't need to use these functions if you don't want, and you should feel free to adapt or modify them as required. You may well find that they are too low level (and seriously ugly) - I built the code to generate them because it was less work (and less boring and hence less error-prone) than doing each of them by hand.
- Sample Fat
- This file is a sample fat with several directories and files in it. You should use this as a starting point and probably save a copy for later reference.
- Sample Commands
- This file contains several unix commands that may be useful. These include a command for generating a new fat filesystem in a file, a convenient way to dump the contents of a binary file, a mount command (usable by root only) to mount a fat filesystem and a fat integrity checker command.
- Test Script
- This file is an example of a test script that tries some of the commands you should implement, and that should be considered the kind of thing I'll run when grading your assignment.
The interpreter when run provides several commands :
- load
- loads a fat filesystem in a file into the program. Do not quote the name of the fat file: "load sample.fat"
- read
- loads a fat filesystem in a file for read only access. Currently the program doesn't try to write anything to the fat so there is no real difference between "load" and "read" but you may find it useful later to ensure that you can not write anything to a file.
- show-boot
- Once a fat has been loaded several commands are useful to examine it. "show-boot" displays the information in the first sector of the fat.
- show-fat
- Displays the information in the fat itself. This is the part of the filesystem that keeps track of which blocks are in which files. (Note that it only shows information in one copy of the fat - you may find it useful to be able to show another copy - if there is one.)
- show-root
- Displays detailed information about the root directory.
What to do
Implement the following commands in the interpreter. You are not limited to these commands and you may find it useful to invent commands of your own for use in debugging your program, or just because you find them easy to do and useful.
- show-clusters
- Given a cluster number, display all the cluster numbers (in order) composing the file given.
- show-file-info
- Given a filename in the current directory, show all the information you can find out about that file.
- dir-cluster
- Given a cluster for a directory, display the filenames in that directory.
- dir
- Given a directory name as the first argument, print out the contents (file names, sizes and directory names) for that directory.
- set-dir
- Set the interpreter's notion of the current directory to be the directory (if any) named by the first argument.
- make-file
- Create a file with name being the first argument and the contents being read from the file named by the second argument in the host filesystem. You may have to truncate extensions. Thus "make-file foo.bar /etc/password" The second file may be in your current (unix) directory.
- show-file
- Display the contents of the files named in the arguments. (That is, just dump them to the interpreter's current output.)
- save
- Save the currently loaded fat into the file from which it was read.
What to Submit
- Submit your code and test scripts (as in the shell assignment).

