Due Date: June 14th
questions: besmith@cs.ucsb.edu
Currently, the Nachos File System is primitive and is limited in many ways. In this project, you will remedy some of these limitations.
filesys
directory. Modify your system calls to use Nachos file-system stubs (if they don't already)
Understand how Nachos emulates a disk: Take a look at
disk.cc in the machine directory. This file contains code
used to emulate an actual disk. You won't want to modify these files,
but it is useful for understanding the other parts of the
file-system. On a real machine (not emulated), a disk driver would
provide an interface similar to that provided by the Disk
class.
Examine the "-f" and "-cp" commmand line switches for Nachos to see what they do and how you'll want to use them.
Understand how Nachos implements files: Take a look at
openfile.cc. You should use the routines in this file for
your system calls. If you implemented your system calls using the
Nachos file-system, you should (hopefully :)) understand how the
OpenFile class works. The OpenFile class
uses the FileHeader class. Examine the
FileHeader class and see why the file size is limited.
Look at the implementation of FileHeader and see what
each part is doing. Also, look through the code in the
filesys directory to figure out why files cannot
currently be resized.
Understand how Nachos implements a directory: Examine the
directory implementation in directory.cc. Make sure you
understand what is contained in a directory entry, and how an entry
is created and modified.
Modify Nachos so that you can create large (up to 64KB) files:
This will probably (but not necessarily) require you to implement
doubly indirect blocks. The use of (indirect and) doubly indirect
blocks to keep track of sectors used for large files was described in
class. It is also described in OSC, Chapter 21.7.2 as a part
of the inode description. For this, you will need to modify the
FileHeader class. You should not have to modify anything
else.
Allow the write() syscall to extend the size of a file: Currently, if the user tries to write beyond the end of the file, Nachos returns an error. Modify the current implementation so that a write beyond the end of the file extends the size of the file. Gracefully handle the case the disk is full - the user process should not crash. Instead an error should be returned.
Implement a hierarchical directory structure: This part of the
project will require the most work. You will probably want to modify
the DirectoryEntry class to include a flag that
identifies an entry as a directory instead of a file. You will need to
modify the Directory class, as well as the OpenFile class to implement
the hierarchical directory structure. You will also need to implement
a procedure that resolves file-names to the corresponding file-headers
(or inodes). Every directory should include the "." and ".."
entries. Use "/" as the delimiting character. You will also need to
add two new system calls - for creating and deleting directories.
Implement a few simple UNIX file utilites to test your system:
Implement a few programs to help you test your file-system
implementation. Include them in the code handed in. Suggestions
include ls, cat, touch and rm. Nothing fancy; just the basic
functions. Use the shell to run these programs.
filesys directory. Investing an hour or two (or a
few:)) in this will make the rest of the project much easier. userprog/Makefile to add files -- you must
add those files to Makefile.common.