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 Knuth or Wilkes and that supports Fuse, 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.
#defined
constant, of course. Remember to
watch out for the working directory
gotcha.
SIGKILL
. O_DSYNC
isn't
necessary, because the operating system will make sure your
data gets to stable storage unless it crashes—which
isn't part of the testing plan!)
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 (it was a while ago), had six fields in the superblock (including a magic number), and had four fields in the directory entry. To make 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 should be 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.
Note: You are supposed to be writing a real filesystem. The only differences from a true implementation of FAT should be:
In particular, this means not taking easy shortcuts. Like any filesystem, your implementation must satisfy the following criteria:
You may also find it wise to review the requirements of Part 2 of this assignment to make sure you don't make a design decision that will back you into a corner.
Submit your code (it should be a single file) as assignment 2 with
cs137submit
. If you implement any additional features,
describe them prominently in comments at the top of the file.
© 2016, Geoff Kuenning
This page is maintained by Geoff Kuenning.