readme.txt vFileSystem 1.0 =========================== I. Overview vFileSystem is a UNIX-like file system with a hierarchical directory structure. Users can browse the directory structure, create and delete new files as well as directory. II. System Required The current version is developed and validated on Linux operating system, specifically Ubuntu 9.04. You may use similar operating system to run it. Make sure "make" and "g++" are installed on your machine. We DO NOT provide such packages, if you are working on Ubuntu 9.04, try the following command: ~$ sudo apt-get install build-essentials Pay Attention: Windows with Cygwin is NOT compatible for this version!!! III. Usage 1. Package Structure The vFileSystem package contains the basic tools for file system operations and source codes. 1) vhdd: A fixed size large file representing virtual hard disk drive. Initialized content is '~' in vhdd. So '~' is not allowed to use as the content in vFileSystem. 2) Source code for the vFilesystem implementations: Blocks : Blocks functions implementation Filesystem : File functions implementation Types : Directory, Inode and Blocks definition Interpreter : Shell-like interpreter Makefile : Makefiles for vFileSystem test.c : vShell entry point 3) Testing files: Input : Reading commands from Out : Write output into input.txt : Sample import file 2. Build vFileSystem To compile the programs of vFileSystem, simply use Makefile to compile all the programs. Command in Linux Shell: make clean; make 3. Run vShell After building, type command: ./vShell in Linux Shell to run vFileSystem. "</root>%" indicates you have entered vFileSystem. 4. Supported Shell Commands 1)mkfs: Make a new file system, i.e., format the disk so that it is ready for other file system operations. Example: </root>% mkfs 2)open <filename> <flag>: Open a file with the given <flag>, return a file descriptor <fd> associated with this file. <flag>: 1: READ ONLY; 2: WRITE ONLY, 3: READ_WRITE. Example: </root>% open a.txt r/w/rw/1/2/3 3)read <fd> <size>: Read <size> bytes from the file associated with <fd>, from current file offset. The current file offset will move forward <size> bytes after read. Example: </root>% read 1024 10 Page 1 readme.txt 4)write <fd> <string>: Write <string> into file associated with <fd>, from current file offset. The current file offset will move forward the size of the string after write. Here <string> must be formatted as a string. If the end of the file is reached, the size of the file will be increased. Example: </root>% write 1024 "abcdefg" 5)seek <fd> <offset>: Move the current file offset associated with <fd> to a new file offset at <offset>. The <offset> means the number of bytes from the beginning of the file. Example: </root>% seek 1024 100 6)close <fd>: Close the file associated with <fd>. Example: </root>% close 1024 7)mkdir <dirname>: Create a sub-directory <dirname> under the current directory. Example: </root>% mkdir test 8)rmdir <dirname>: Remove the sub-directory <dirname>. This directory has to be empty when it is removed. Example: </root>% rmdir test 9)cd <dirname>: Change the current directory to <dirname>. Example: </root>% cd test 10)link <src> <dest>: Create a link named <dest> to an existing file or directory named <src>. Note that <dest> and <src> may not be in the same directory. Both <src> and <dest> are files, not directories. Example: </root>% link a.txt b.txt 11)unlink <name>: Remove a link to the name. (When link count drop to 0, delete the file). Example: </root>% unlink a.txt 12)stat <name>: Show the status of the file or directory with name <name>. It displays its inode information; whether it is a file or directory; its link count; size of the file/directory; number of blocks allocated; date modified; items it contains. Example: </root>% stat a.txt 13)ls: Show the content of the current directory. No parameters need to be supported. Example: </root>% ls 14)cat <filename>: Show the content of the file. Example: </root>% cat a.txt 15)cp <src> <dest>: Copy the file from a source location to the destination location. Note that <src> and <dest> may not be in the same directory. If the <dest> already exists, the program should report an error. Example: </root>% cp a.txt c.txt 16)tree: List the contents of the current directory in a tree-format. For each file listed, its date file size should be included. Example: </root>% tree It returns: root-> | test-> | | cs560-> | | | a.txt | mouse-> | | b.txt | home-> | | c.txt 17)import <srcname> <destname>: Import a file from the host machine file system to the current directory. Page 2 readme.txt Example: </root>% import /home/test/input.txt a.txt 18)export <srcname> <destname>: Export a file from the current directory to the host machine file system. Example: </root>% export a.txt /home/test/output.txt 19)q / e / quit / exit: Quit the vFileSystem. Example: </root>% q 20)redirection: sh < <input file> > <output file> Example: </root>% sh < input.txt > output.txt 21)pwd: Check the current working directory Example: </root>% pwd 5. File Operation Attention User operates file MUST follow the flow: open file -> operate file -> close file, in case of error. 6. Cache This function enables caching data blocks of files in memory. is invoked, such as read or write, the system call will go to data blocks first and handles cache miss with LRU replacement is also maintained. A simple LRU 4 frame paging out algorithm page out. IV. Contact Jilong Liao: jliao2@utk.edu Chi Zhang: czhang24@utk.edu V. Download Source Code http://web.eecs.utk.edu/~czhang24/projects/vShell.tar.gz Page 3 While a file access cache to look for policy. Consistence is used in cache to