In C language.
Develop and implement a small Unix-CP/M-like file system (“FS”).
This file system will not be part of an operating system, but similar to mode file systems, it will run on several different operating systems to provide
a portable file system. The file system will use file (for example “disk01”), rather than a physical flash or disk, to store data. You may have several disk-like files (for example: disk01, disk 02), used to store data. The data store in disk 01 will be a user’s programs, text files, other data files, or any type of binary information. In addition to the data stored, you FS will need to store other, meta information, such as free space (blocks), directory details, and possibly other information. The FS directory is flat (one level) fixed sized. Has a user name associated with each file, and has fixed sized “blocks” (entries).
You should use fixed size block (similar to disk blocks) of size 128 bytes to store files and all meta-data in your disk.
(Your disk (for example “disk01”) is logically divided into a number of “sectors” which are fixed size blocks. Everything that is stored (persistently is in these blocks)
The program (the File system executable) should provide the following operations:
Createfs #of blocks –create a filesystem (disk) with #ofblocks size, each 128 butes
Formatfs #filenames #DABPTentries
- Savefs name- save the “disk” image in a file “name”
- Openfs name- use an existing disk image
- List- list files(and other meta-information is a file “name”) in a FS
- Remove name –remove named file from fs
- Rename oldname newname –rename a file stored in the FS
- Put ExternalFile –put (store host OS file into the disk)
- Get ExternalFile –get disk file, copy from “disk” to host OS file system
- User name – this user owns this user’s files
- Link/Unlink – Unix style file linking
- Set/Use file permessions for r/w/x, implement subdirectories, “check disk”
FS should have 4 or more sections.
A FileNameTable(FNT), an directory and attribute/block pointer table (DASPT). and the data blocks.
The FNT should be of size allocated, each entry should contain 54 char(maximum) file name and an inode pointer (index to DABPT) (blocks are 128 bytes).
The DABPT should be allocated from disk blocks, one entry per block, where each entry should contain a file meta-information (FileSize, last time+date (sec), pointers to data blocks) , user name
The Block Pointer Table has direct pointers to data blocks, and one additional pointer to another entry in the table. If needed (for big files). These many be chained for very large files. (Similar to CP/M extents)
Since disks (and some meta-information) are fixed size, many small or one large file might not fit on the “disk”. File names, file attributes and other file information stored in FS are restrictive(for example file creation time).