Issued | 3/20/14 |
Due Date | |
homework/homework5
).
Use EXACTLY the requested file and directory names, including case!
Please commit the following files:
mkfs.c
, yourfs.c
, yourfs.h
and any other files required to build the test program and the mkfs program. FILES SHOULD COMPILE WITHOUT WARNINGS!
Makefile
DESCRIPTION
containing a description of what your code does, how you achieved it, clearly listing which tasks (see above) you completed.
Makefile
is provided. Feel free to enhance this makefile (for example to automate invoking your mkfs
program or to automate testing.
device.h
header. This header contains functions to obtain the blocksize of the device, the number of blocks and to read or write a block on the device.
Please see device.h
for a detailed description of the functions and their parameters.
You should not modify device.h
or device.c
.
mkfs.c
file in the shared repository.
This program takes a number of options:
-v
and -d
: these options set the opt_verbose
and opt_debug
variables. You can use these in your code to enable extra debug output if you want.
-i
filename: this option specifies an existing file in which the tool will write the file system image. You can use make image1.img
and make image2.img
to create empty image files which you can use for this.
-c
number: This sets the opt_clear
variable; If this variable is not equal to 0, your mkfs
programs needs to fill every unused disk block (i.e. every block not storing file data or data structures for you file system) with this byte.
test
containing the following files:
a b cand an image file
image1.img
, calling your mkfs
program as:
./mkfs -i image1.img testshould create a file system containing 3 files,
a
, b
and c
, where each file contains the contents of the equally named file in the test
directory.
You can make the following assumptions:
yourfs.h
and yourfs.c
files provide the read access to the file system that was created by the mkfs
tool.
The test program uses these two files to access the file system created by mkfs
, and to validate that each file was correctly stored on your file system.
See the yourfs.h
file for a list of functions to implement and how these functions should behave.
There is no need to modify =yourfs.h=
An example implementation of yourfs.c
, which calls the existing POSIX I/O functions is provided.
This is just an example. You should replace yourfs.c
with your own version which provides the same functions
and functionality, but uses device.h
to obtain the file data and directory listings instead.
mkfs
program
yourfs.h
and yourfs.c
mkfs
program should still function correctly.
readdir
functionality does not need to be completed.
yourfs.h
and yourfs.c
.
yourfs_dir_open yourfs_dir_close yourfs_dir_getentrySee
yourfs.h
for more information.
The special files .
and=..= should not be returned by your yourfs_dir_getentry
function.
testfs
is provided.
The idea is that given a directory containing files (and possibly other subdirectories), and an image file (created by mkfs
) which contains the same files and directories, testfs
will use your yourfs.c
file to verify that all the files are present in the image and that the contents of the files etc. is correct (when accessed through your yourfs.c
functions).
By default, the program only tests the minimal functionality (no subdirectories, no readdir). If you also want to test the optional functionality, pass -1
or -2
to the test program.
To grade the homework, the same testfs
program will be used.
mkfs
tool and yourfs.c
and yourfs.h
files is provided.
valgrind
tool can help you find bugs in your program. http://valgrind.org/
apt-get
under ubuntu.
yourfs_xxx_open
functions, you can malloc
a yourfs_xxx_handle_t
structure, and return it. Store enough information to identify the file or directory, so when later your yourfs_xxx_read
function is called, you can retrieve the information from the structure.yourfs_xxx_close
function, you can free()
the structure again.
yourfs_dir_handle_t
parameter as it will always be equal to YOURFS_ROOT_DIRECTORY
.
Copyright 2016 The Board of Trustees of the University of Illinois.webmaster@cs.uic.edu |
WISEST Helping Women Faculty Advance Funded by NSF | ![]() | ![]() |