Requirements
1. Simulate a Unix file system on your Windows Platform
2. Understand the file system on Unix system, and the usage of i-nodes
3. Implement the function of sub-directory
4. The task needs to be completed using C++ or C
5.
Tasks/Functionalities
The following functions are required in your file system:
1. Allocate 16MB space in memory as the storage for your file system. The space is divided as
blocks with block size 1KB
Assume block address length is 32-bit;
Design the information contained in i-node
The i-node should support up to 10 direct block addresses
The i-node should support at least one indirect block address
2. The fist block is used for storing the i-node for the root directory(/). While your program is
lunched, two directories (/dir1 and / dir1/dir2) should be created, and also two files need to be
written as /dir1/file1 and /dir1/dir2/file2 (5 marks)
3. File 1 and 2 contain the message of “This is file 1.” and “This is file2”.
4. Following commands should be supported in your system:
a) Create a file:createFile fileName fileSize (10 marks)
i.e.:createFile /dir1/myFile 1024 (in bytes)
if fileSiz > max file size, print out an error message.
The file content is filled up with filename + repeated digits from 0 - 9
i.e.: “myFile012345678901234567890123….”
b) Delete a file:deleteFile filename (10 marks)
i.e.:deleteFile /dir1/myFile
c) Create a directory:createDir (5 marks)
i.e.:createDir /dir1/sub1
d) Delete a directory:deleteDir (5 marks)
i.e.: deleteDir /dir1/sub1 (The current working directory is not allowed to be
deleted)
e) Change current working direcotry:changeDir (5 marks)
i.e.: changeDir /dir2
f) List all the files and sub-directories under current working directory:dir (5 marks)
You also need to list at least two file attributes. (i.e. file size, time created, etc.)
g) Copy a file : cp (5 marks)
i.e.: file1 file2
h) Display the usage of storage space:sum (10 marks)
Display the usage of the 16MB
2019-12-21 20:28:55
1.27MB
文件系统
1