Personal tools

What to do...

What you need to do for this assignment.

Information

Due Date : 29 February
Points : 5
Team : You may do this assignment in teams of up to three people.

What to do


You are to build a FAT 32 filesystem in a file.

Using the command interpreter framework from the first assignment you should build the following commands. Directory names and filenames are to be separated by ":". Thus ":a:b:c" is the same as the unix "/a/b/c" or the windows (assuming you are in partition c:) "c:\a\b\c". The current directory is to be named "@", and the directory one level up is "+". So the unix "./foo" would be "@:foo" and the unix "../foo" would be "+:foo". Filenames are (as in unix or windows) relative to the current directory unless a leading ":" is provided.

You do not have to cope with long file names (8.3 is fine).

You should be able to mount your file in unix (a copy of Damn Small Linux that will run in vmplayer will be available) using the loopback mount and use normal unix commands on it to traverse the directories.   If it fails to mount or work properly, your grades will reflect that lack. 

The commands

Note that arguments in square brackets ("[foo]") indicate that that argument is optional.  Ellipses ("...") indicate that any number of repeats of the argument are allowed.    Commands may be limited in the number of arguments they may take in your implementation, but you should be able to handle at least 42 arguments. 

init filename size
Initialize a fat filesystem in the file "filename" and with the given size. This should be a correct empty filesystem.
read filename 
Read in a fat filesystem (either one you make with your program, or one that you may have constructed with other tools). 
check 
Verify that your filesystem is in fact correct.  
save [filename] 
Write your current filesystem to a file.   If no filename is given, use the filename given in the "init" command or that in the "read" command.  (Being able to save a copy to another file may be helpful in debugging.) 
run-away 
Quit immediately.   Do not write out the filesystem.
quit
Quit.   Write out the filesystem to the name provided in either the "init" or the "read" command.  
md dirname
Make a directory with the given name
rd dirname
Remove the directory with the given name and all of its contents (including other directories if any).
file external-file-name internal-file-name
Create a file with internal-file-name as its name (that is in the fat filesystem), and with the contents of the file named by external-file-name (in the host filesystem). Create any needed directories according to the internal-file-name (so ":a:b:c" would need to create directories "a" and "b" if they did not already exist). The external file name should use unix conventions for separating directories and files (so "/").
del filename
Remove the file with the given name.  This should only work on a directory if the directory is empty. 
xfile filename str len
Create a file with the given file name and with len copies of str as its contents. So if the command "xfile pinky narf 1000" were executed a file name "pinky" with contents "narfnarfnarfnarf....." (1000 times) would be created.
cd dir
Set the current directory to be dir. Note that "cd :" should set the current directory to be the top level directory in the filesystem, "cd @" should do essentially nothing, and that "cd +" should move up one level in the directory tree.
files [-r] [f1 ...]
If file arguments (f1, f2...) are given print information on each of those files including the name of the file,  the date created,  and the size of the file.   If there are no arguments given, do this on all the files in the current directory.   Each file listing should be on a separate line and should be formatted to line the fields up nicely.   If the (optional) "-r" flag is given, recursively list any directories in the file list (or the current directory if no file arguments are given). 
vfiles [-r] [f1 ...]
Just like files (above) but give all the information you can.   This might well include lots of information useful for debugging, but of no interest to anyone else.    Again, format things for readability.  
cmp external-file-name internal-file-name
Compare the external file (in the host filesystem) with the internal file (in the fat filesystem).
xcmp filename str len
Compare the file (probably created with xfile) to see if it consists of len copies of str.

What to hand in

Submit :
  1. All your c code.
  2. Your makefile
  3. A suite of test scripts.  You should have a script that tests every command. You should have a test that fills your filesystem, then deletes files and makes new ones (to show that you can reclaim space appropriately).    You should have a  test that fills your filesystem and then removes all the files.    You should have a test that seriously fragments your filesystem.    This is not an exhaustive list of tests and the tests you write and the completeness of those tests will be a factor in your grade.
  4. A writeup that
    1. Describes the fat file system and how it is constructed
    2. Describes how you do the essential commands (which are???)
    3. Describes problems you had in doing the implementation
    4. Gives references to any and all web pages, papers... you used in doing the assignment.

    Document Actions