================================ Utopia: A Filesystem Simulator ================================ Developed by: Ken Eimer, Brandon Schory, and Brian Tobia With Code from: Donghui Zhang Assistant Professor College of Computer Science Northeastern University ==================== Table of Contents: ==================== 1. Setup 2. Running the Simulator 3. Using Utopia 4. Resetting the Simulator =========== 1. Setup: =========== Windows: The code contained in this package can be compiled using any Integrated Development Environment of your choice. Another useful alternative is Cygwin, an open-source Linux-like environment for Windows. Information on Cygwin can be found at: http://www.cygwin.com/ Cygwin will allow you to generally follow the directions is the "Mac OS X, Unix, and Linux" sections of this file, with some slight changes. Mac OS X, Unix, and Linux: cd to the directory containing the included files type "make" to build a working copy of the application Example: This is an example of these commands being run on Mac OS X. The computer name here is Duchamp, the user's name is Username, and the absolute path to the directory containing the files is /Users/Username/Documents/Eimer_Schory_Tobia_Filesystem (~ represents /Users/Username below) The terminal output would be as follows: Duchamp:~/ Username$ cd /Users/Username/Documents/Eimer_Schory_Tobia_Filesystem Duchamp:~/Documents/Eimer_Schory_Tobia_Filesystem Username$ make g++ -g -Wall -c disk.cc g++ -g -Wall -c main.cc g++ -g -Wall -c filesystem.cc g++ -g -Wall -o filesystem disk.o main.o filesystem.o =========================== 2. Running the Simulator: =========================== Mac OS X, Unix, and Linux: type "./filesystem" to run Utopia Example: This is an example of these commands being run on Mac OS X. The computer name here is Duchamp, the user's name is Username, and the absolute path to the directory containing the files is /Users/Username/Documents/Eimer_Schory_Tobia_Filesystem (~ represents /Users/Username below) The terminal output would be as follows: Duchamp:~/Documents/Eimer_Schory_Tobia_Filesystem Username$ ./filesystem You have logged into Utopia, a file-system simulator. Type "help" to see a list of commands and their functions. Utopia:~/$ ================== 3. Using Utopia: ================== Utopia is a basic filesystem simulator designed to simulate functions common to those in the major operating systems. For simplicity and ease of use, the concept of Directories (aka. Folders) was omitted. The following commands are provided to the user to create, manipulate, and delete files from the file system: ----------- Commands: ----------- help This command can be entered at any time as a reminder of the other commands available to the user. quit Exit Utopia. ls List the names of all existing files. create Creates a new file with the given filename. If the length of the given name exceeds the allowable name size, it will be shortened appropriately. No two files may have the same name, and no file may start with a space. rm Deletes the file specified by the given filename. open Opens the file specified by the given filename. Enables the seek, read, write, size, and close commands. seek Moves the file pointer to byte specified by the provided offset. The offset is absolute relative to the beginning of the file (i.e. "seek 50" moves the pointer to byte 50, and "seek 50" immediately followed by "seek 30" moves the pointer to byte 30.) A file must be open to use this command. read Reads the specified number of bytes from the file, beginning at the file pointer. If the number of requested bytes exceeds the length of the file, it read to the end of the file then stops. The file pointer is repositioned to the end of the read. A file must be open to use this command. write Writes the given content to the file beginning at the location of the file pointer. If the amount of content to be written exceeds the maximum file size, it will write the content up to that limit then stop. The file pointer is repositioned to the end of the write. A file must be open to use this command. size Prints the size of the open file. A file must be open to use this command. close Closes the open file, so another file may be opened and manipulated. A file must be open to use this command. ============================= 4. Resetting the Simulator: ============================= Mac OS X, Unix, and Linux: type "make clean" to remove all previously compiled files type "make" to build a working copy of the application type "./filesystem" to run Utopia Example: This is an example of these commands being run on Mac OS X. The computer name here is Duchamp, the user's name is Username, and the absolute path to the directory containing the files is /Users/Username/Documents/Eimer_Schory_Tobia_Filesystem (~ represents /Users/Username below) The terminal output would be as follows: Duchamp:~/Documents/Eimer_Schory_Tobia_Filesystem Username$ make clean rm *.o TESTFILESYSTEM *~ rm: *~: No such file or directory make: *** [clean] Error 1 Duchamp:~/Documents/Eimer_Schory_Tobia_Filesystem Username$ make g++ -g -Wall -c disk.cc g++ -g -Wall -c main.cc g++ -g -Wall -c filesystem.cc g++ -g -Wall -o filesystem disk.o main.o filesystem.o