In this project, you will design and implement a simplified UNIX System 7 like file system in C or C++ as described in S
Posted: Tue May 24, 2022 8:05 am
Part 3 You will write a program that performs file system operation on the file system. The program will work like following fileSystemOper fileSystem.data operation parameters where fileSystemOper is your program, filesystem.data is the file system data file that you have created in Part 2. You will keep modifying the same fileSystem.data file for all your operations. Allowable operations and parameters for these operations are given below in the following table. Operation Parameters Explanation Example dir Path fileSystemOper fileSystem.data dir "\" Lists the contents of the directory shown by path on the screen. lists the contents of the root directory. The output will be similar to dir command of DOS I
mkdir rmdir dumpe2fs write read del Path and dir name None Path and file name Path and file name Path and file name Makes or removes a directory Gives information about the file system. Creates and writes data to the file Reads data from the file Deletes file from the path fileSystemOper filesystem.data mkdir "\ysa\fname" makes a new directory under the directory "ysa" if possible. These two works exactly like mkdir and rmdir commands of DOS shell fileSystemOper fileSystem.data dumpe2fs works like simplified and modified Linux dumpe2fs command. It will list block count, free blocks, number of files and directories, and block size. Different from regular dumpe2fs, this command lists all the occupied blocks and the file names for each of them. fileSystemOper filesystem.data write "\ysa\file" linuxFile Creates a file named file under "\usr\ysa" in your file system, then copies the contents of the Linux file into the new file. fileSystemOper fileSystem.data read "\ysa\file" linuxFile Reads the file named file under "/usr/ysa" in your file system, then writes this data to the Linux file. This again works very similar to Linux copy command. fileSystemOper fileSystem.data del "\ysa\file" Deletes the file named file under "\ysa\file" in your file system. This again works very similar to Linux del command.
Here is a sequence file system operation commands that you can use to test your file system. Suppose you have a file named linuxFile.data in your Linux current directory. makeFileSystem 4 mySystem.data ; you may change 4 to a reasonable value fileSystemOper fileSystem.data mkdir "usr" fileSystemOper fileSystem.data mkdir "\usr\ysa" ; Should print error! fileSystemOper fileSystem.data mkdir "\bin\ysa" fileSystemOper filesystem.data write "\usr\ysa\filel" linuxFile.data fileSystemOper fileSystem.data write "\usr\file2" linuxFile.data fileSystemOper fileSystem.data write "\file3" linuxFile.data fileSystemOper fileSystem.data dir "\" ; Should list 1 dir, 1 file fileSystemOper filesystem. data del "\usr\ysa\filel" fileSystemOper fileSystem.data dumpe2fs fileSystemOper fileSystem.data read "\usr\file2" linuxFile2.data cmp linuxFile2.data linuxFile.data ; Should not print any difference Notes 1. Always be careful about the errors, such as bad block sizes, bad file names, non-existent files or directories, etc. 2. Run experiments that uses up all of your data blocks. 3. Try to get fragmentation and show your fragmented file system using the dumpe2fs command. 4. Do not use any code from any other source even a single line! General Homework Guidelines II