Hide minor edits - Show changes to markup
char name[8]; //file name
int size; // file size (in number of blocks)
int blockPointers[8]; // direct block pointers
int used; // 0 => inode is free; 1 => in use
char name[8]; //file name int size; // file size (in number of blocks) int blockPointers[8]; // direct block pointers int used; // 0 => inode is free; 1 => in use
For more related information, please refer to Lab details.
For more related information, please refer to Lab details.
The goal of this lab is to write a simple UNIX-like file system. The file system you will write make the following simplifying assumptions:
The layout of your 128 KB disk is as follows
char name[8]; //file name
int size; // file size (in number of blocks)
int blockPointers[8]; // direct block pointers
int used; // 0 => inode is free; 1 => in use
Note that each inode is 48 bytes in size; Since you have 16 of these, the total size of occupied by the inodes is 768 bytes. The free/used block information (mentioned above) is 128 byes. So the total space used in the super block is 896 bytes. The remaining bytes are unused.
For more related information, please refer to Lab details.
You need to implement the following operations for your file system.
create(char name[8], int size): create a new file with this name and with these many blocks. (We shall assume that the file size is specified at file creation time and the file does not grow or shrink from this point on)
delete(char name[8]): delete the file with this name
read(char name[8], int blockNum, char buf[1024]): read the specified block from this file into the specified buffer; blockNum can range from 0 to 7.
write(char name[8], int blockNum, char buf[1024]): write the data in the buffer to the specified block in this file.
ls(void): list the names of all files in the file system and their sizes.
An example to mount BFS file system
To enable bfs filesystem in UML, you should create a second ubd block device and mount it under UML. For example, the following steps tell you how to mount a bfs filesystem.
Virtual Filesystem (VFS)
Please submit the following items to lab7 dir on elgate:
Thank you and have fun!