Assignment 2: Filesystem

CS23000/33000 - Operating Systems (Winter 2004).

MWF 10:30pm    Ry251

Due : Friday, January 23, 11:59 p.m.


Now that you've got disk devices working, your next challenge is to implement a simple file system. A file system merely organizes the disk in way that allows us to deal with files and directories instead of low-level disk blocks.

There are two parts to this assignment. First, you're going to implement the file system interface. That is, you're going to write a collection of generic functions that will be used to interact with the filesystem. Next, you are going to implement a simple file system.

Most of this assignment involves reading source code and implementing code of your own. The instructions will be brief. All of this work must be done in the yfs directory you already created for assignment 1.

Implement the file interface

In the file /yfs/include/yfile.h, you will find the interface that is required to be supported by open files. That is, if you open a file, there are all sorts of things you can do to it---reading, writing, etc. Create a file 'yfile.c' in your directory that implements all of the functions in yfile.h. Note: this file will be almost identical to the ydisk.c file from earlier.

Note: Your implementation should not use any Unix system calls or have any code that pertains to specific devices. The code is meant to be generic.

Implement the file system interface

In the file /yfs/include/yfs.h, you will find the interface that is supported by all file systems. Create a file 'yfs.c' that implements all of the functions in yfs.h. Note: This file will be almost identical to yfile.c.

Implement a file system

In the file /yfs/include/minifs.h, you will find a description of a very simple file system. Create a file minifs.c and implement this file system. To do this, you'll need to implement about 10 functions---corresponding to all of the methods in yfile.h and yfs.h. Follow the instructions contained in the minifs.h for more information.

Note: The implementation will almost be identical (in technique) to what you did in the ramdisk and diskimage devices.

Building and Testing

Copy the file /yfs/Makefile to your own directory. Modify it so that it includes your files (if necessary).

This updated Makefile creates a program called 'ydisk' that can be used to perform various operations on the disk.

Handin Procedure

The filsystem project will be automatically collected from CVS at 11:59 p.m. on the due date. Your project must be checked into a CVS project named 'yfs'.

Your final solution to the first assignment should be a directory of files that look like this:

To grade your solution, we will run various tests on your program using a testing program that we will supply.

Make sure you verify your handin:

unix % cvs checkout yfs
unix % cd yfs
unix % make
If your solution fails to check out of CVS, does not build using make, or fails to run, you will receive no credit!

Make sure you test your solution by typing the above commands in some kind of junk directory---do not assume that your solution works until you have tested it yourself!


Your code will primarily be graded for correctness and style. Your solution should not deviate from the specifications described in this handout (i.e., don't change the name of the files, add additional files, or change the specification of the assignment).

Your grade will consist of the following:

No late handins are accepted!