The objective of this assignment is to understand the workings of a simple file system.
This laboratory assignment consist of multiple programming assignments defined by tasks. Each task adds more functionality to your file system manager. You should submit only one program with all tasks completed. When you have not completed all tasks, you can still submit your code and earn partial credit. You need to write a report of two pages about your implementation.
You are allowed to work on this assignment in a team of at most two students.
Submit the source codes of the programming assignments to the TA. Use zip or tar formats. Include your name and last four digits of your SSN in all source codes.
You need to be able to write, compile, and debug C++ programs, be familiar with data structures such as linked lists, and STL maps, and have a basic undestanding of file systems as discussed in the textbook Chapters 10 and 11.
Use the man command to access the manual pages. If you cannot access the man pages, add this line to your .tcshrc file and then logoff/logon:
setenv MANPATH /usr/man:/usr/share/man:/usr/local/man:/usr/local/share/man
The examples shown in this document are in C++. However, you also need to get familiar with some C library functions for I/O operations:
You should consult the manual pages to understand these library functions.
Download the source code for this project from http://www.cs.fsu.edu/~engelen/courses/pr3.zip. The sources are documented with Doxygen: visit the Project 3 code documentation page.
There are eight types of objects in the file system (see also here):
The relationships between these objects are illustrated here and here.
Compile the demo program using 'make', then run 'fsdemo' to run a demo of the incomplete file system. You will notice that the program reports a number of 'TODO' items.
For this first task you must complete the file system implementation. Running the 'fsdemo' program should not report any 'TODO' items.
The 'fsdemo' program tests the basic functionality of the file system. You may want to add some of your own tests to verify your implementation (we will also apply a few more tests to check your implementation).
Note that 'fsdemo' generates some debugging messages. You can turn them off and also disable the assertions by modifying the Makefile to enable CFLAGS=-DNDEBUG.
For this task we will use the shell developed in Project 1 to create an interactive system for file manipulation with your file system.
When your shell starts, it should set up a RAM disk with 100 blocks (each 512 bytes) and a VDisk with 100 blocks (each 1024 bytes). The volume names are "A" and "B", respectively.
The volume names are used to identify RAM disk and VDisk files from local files on the UNIX/Linux file system. For example "A:/" is the root dir of the RAM disk, "B:/foo" is a foo file (or dir) on the VDisk, and "bar/abc" is a local file "abc" in the "bar" dir.
The shell should implement the following commands:
Note that these commands should also work on regular files (i.e. local files identified by the absence of a volume). To this end, use fork() and execvp() to execute a system command. Be careful not to remove any critical source code files when you test the 'rm' command!
Here is an example:
1> ls A: Volume A:/ (100 blocks, 98 free) Name Size Type Created 2> mkdir A:/foo 3> ls A: Volume A:/ (100 blocks, 96 free) Name Size Type Created foo 0 dir Tue Mar 21 11:39:28 2006 4> rmdir A:/foo 5> rm A:abc abc: no such file. 6> cp demo1.txt A:demo.txt 7> append demo2.txt A:demo.txt 8> cp A:demo.txt demo.txt 9> rm A:demo.txt
The file 'demo.txt' in your local directory should now have the content of 'demo1.txt' and 'demo2.txt', assuming you created these before you started the shell.
You can earn extra credit (5%) for this assignment by implementing a current working directory pointer for each volume and additional commands to set and print the current working directory of a volume:
Here is an example:
1> cd A:/foo 2> pwd A: /foo 3> pwd B: / 3> cp A:bar B:bar
This copies A:/foo/bar to B:/bar.
- End -