Programming Assignment 4: FAT32 File System
This assignment will familiarize you with the FAT32 file system. You will become familiar with
file allocation tables, endieness, as well as file access. You will implement a user space shell
application that is capable of interpreting a FAT32 file system image. The utility must not corrupt
the file system image and should be robust. No existing kernel code or any other FAT 32 utility
code may be used in your program.
You may complete this assignment in groups of two or by yourself. If you wish to be in a group
of two the group leader must email me your group member’s names by November 27, 2017.
The code you submit for this assignment will be verified against a database consisting of kernel
source, github code, stackoverflow and other internet resources. Code that is not 100% your own
code will result in a grade of 0 and referral to the Office of Student Conduct.
You can find a FAT32 file image, fat32.img, on blackboard under Assignment 4. Also under
Assignment 4 you can find the fat 32 specification, fatspec.pdf. You will need this specification
to interpret the file system image correctly.
Program Requirements
Your program shall be named mfs.c and shall be implemented in C or C++. You shall not use the
system calls system() or any of the exec family of system calls.
Your program shall print out a prompt of mfs> when it is ready to accept input.
The following commands shall be supported:
open
This command shall open a fat32 image. Filenames of fat32 images shall not contain spaces.
If the file is not found your program shall output: “Error: File system image not found.”. If a file
system is already opened then your program shall output: “Error: File system image already
open.”.
close
This command shall close the fat32 image. If the file system is not currently open your program
shall output: “Error: File system not open.” Any command issued after a close, except for
open, shall result in “Error: File system image must be opened first.”
info
This command shall print out information about the file system in both hexadecimal and base 10:
•
BPB_BytesPerSec
•
BPB_SecPerClus
•
BPB_RsvdSecCnt
•
BPB_NumFATS
•
BPB_FATSz32
stat or
This command shall print the attributes and starting cluster number of the file or directory name.
If the parameter is a directory name then the size shall be 0. If the file or directory does not exist
then your program shall output “Error: File not found”.
get
This command shall retrieve the file from the FAT 32 image and place it in your current working
directory. If the file or directory does not exist then your program shall output “Error: File not
found”.
cd
This command shall change the current working directory to the given directory. Your program
shall support relative paths, e.g cd ../name and absolute paths.
ls
Lists the directory contents. Your program shall support listing “.” and “..” . Your program shall
not list deleted files or system volume names.
read
Reads from the given file at the position, in bytes, specified by the position parameter and output
the number of bytes specified.
volume
Prints the volume name of the file system image. If there is a volume name, it will be found in
the root directory. If there is no volume name, your program shall output “Error: volume name
not found.”
Grading
The assignment will be graded out of 100 points. Compiler warnings are there to tell you
something is not correct. Pay attention to them and you will save yourself a lot of late nights
debugging code. Code that does not compile will earn 0.
Your code will be compiled and graded on omega.uta.edu . Your code must compile as:
g++ mfs.c -o mfs
How to submit homework
1. Submit your file mfs.c on blackboard.