The purpose of this assignment is to begin developing a real filesystem. Because of the complexity of writing a working filesystem, the assignment is divided into two parts. In this first part, you will develop a lot of scaffolding and enough code for your filesystem to do something testable. In the second part, you will complete the filesystem.
You may write in any language that is supported on Wilkes, but as mentioned in class, I strongly recommend C or C++.
Your assignment is to develop a FAT-like filesystem that supports the following features:
getattr
, access
,
readdir
, and mkdir
. (Note that at
this point it is not necessary to support
file I/O, or even files.)
mkdir
operation must allocate space from
the free list.
ls -la
returning reasonable results including "." and ".."), and
cd
into them.
rmdir
, etc. in the
next assignment, so you are welcome to implement those
things. However, they will not be tested in the current
assignment.
Why this particular set of features? It's the minimum necessary to have a filesystem where you can do something visible: create and list directories. You'll find that you need to create quite a bit of scaffolding to get that far (in particular, the code that creates an initialized FAT filesystem from scratch).
When I refer to a "FAT-like" filesystem, I mean the following:
For reference, my minimal implementation used a block size of 512 bytes, had six fields in the superblock (including a magic number), and had four fields in the directory entry. To it easy to store the superblock in a filesystem block, I used the following union:
union { struct fat_superblock s; char pad[512]; } superblock;(Note that the superblock is only 512 bytes, even if you use a different block size for your filesystem. That design makes it possible to read the superblock without knowing the block size, which is a useful feature. If the filesystem uses blocks larger than 512 bytes, the remaining space in the larger "block" is simply wasted.)
I also found it useful to create a few macros to do things like seeking to a particular block, converting back and forth between byte offsets and block numbers, etc.
Submit your code (it should be a single file) as assignment 2 with
cs135submit
. If you implement any additional features,
describe them prominently in comments at the top of the file.
© 2010, Geoff Kuenning
This page is maintained by Geoff Kuenning.