CS 351 File System Exercise
Last modified: Tue Oct 5 09:45:53 MDT 1999
The goal of this exercise is to expose students to reference
counts and to introduce the structures used in file systems.
Due Date: Thursday October 28, 1999 at the start of class
You are to write a file systems that only supports directory files
and links (i.e., no data files). For this exercise, directory
names must be composed of (upper and lower case) letters (i.e., no
punctuation or special characters). Pathnames may also include the
special characters "/" and ".".
Each file system command will be read from standard input and
will appear on a single line. Blank lines and lines starting with
the "#" should be ignored. Normal output from commands should be
written to standard output.
The specific commands that you must support are:
Create a new directory with the path name pathname.
ln oldpath newpath
Create a new link with the path name newpath that links
to the directory identified by the path name oldpath.
List the contents of pathname or the current directory.
The names of subdirectories along with their reference counts (in
parentheses) should be listed one per line. For example, the
output might look like:
Remove the link with the path name pathname.
Set the current directory to pathname. The current
directory is used in relative pathnames and in the ls
Pathnames should be interpreted as that are in Unix-like
systems. That is, "/" is the directory separator; absolute
pathnames start with "/"; "." refers to the current directory; and
".." refers to the parent directory.
You should check for valid command names and valid pathnames.
Any errors should be written to standard error.
You should start by implementing the commands cr,
ln, rm, and ls using only absolute
pathnames (i.e., pathnames that start with '/') without "." and
"..". After you get this part of the code working, add in support
for relative pathnames and the cd command. Finally, add
in support for "." and "..".