3.9 Extra Credit: McDOS
In C, implement a mock OS with a terminal interface.
Your program should accept a path as a command-line argument. If the path exists, then run in execute mode. If it does not, then run in create mode.
In create mode, the program should run with a little interactive prompt which should ask for (a) the size of the disk and (b) the number of users to create, then their usernames and passwords. It should create the disk file, initialize it, and then exit. This should create a format the disk. You can use any format you want for the disk, but you must keep track of the users as well as file contents. The filesystem must store files and directories. Every file should have metadata for an owner, permissions, a create time, a modify time, and a name.
In execute mode, you should display a login prompt, and once logged in, you should get a basic shell that supports the following commands:
cd - change the directory (including ..)
ls - displays directory contents, including file names, sizes, and all metadata.
diskinfo - display information about the internal disk (free, used, etc)
cat - displays a file named on command-line
rm - remove file
rmdir - remove directory
mkdir - create directory
cp - copy file
mv - move file
chmod - change permissions
chown - change owner
exit - log out
ed - edit a file.
Here is a suggested interface: Start a new prompt with commands for each of the things an editor can do. Model after the unix ed command. Allow the user to seek to a line, then display it or enter a new version of the line. Allow the user to add new lines to the file. Allow the user to quit. Don’t bother with saving, but feel free to have the changes reflected on disk instantly.
This assignment may look complicated, but there’s a very easy way to do all of it. If you need to make it simpler to do it, I’ll give you less extra credit. If you want to make it more complicated, I’ll give you more extra credit.
The assignment is deliberately vague, so that you can flesh it out for yourself.
A README file that contains a short write-up of your project. It should discuss the approach you took to solving the problem, it should discuss any problems or issues that still remain, it should discuss any interesting things that you learned in the course of the project. Finally, it should provide the grade you believe the project deserves with a detailed explanation of why. This explanation should almost certainly focus on why you believe the program is correct.
This file must be in plain-text. If you need formatting, use Markdown. It must be limited to 80 characters wide, unless you are quoting program output.
Your source code, named mcdos.c.
A Makefile that first builds the program and then tests it by running it in a way that demonstrates each mode, all the features, and the persistence of the data.
This assignment will be graded based on its correctness and your ability to articulate why it is correct.