University of Texas at Dallas--Computer Science Department
CS 4348 Operating Systems Concepts Spring 2021
Project 2
V6 file system is highly restrictive. A modification has been done: Block size is 2048 Bytes, i-node size is 64 Bytes and i-node’s structure and directory entry struct have been modified as well and given below:
typedef struct {
int isize;
int fsize;
int nfree;
unsigned int free[250];
unsigned int ninode;
unsigned int inode[250];
int flock;
int ilock;
unsigned int fmod;
unsigned int time;
} superblock_type; // Blocksie is 2048 Bytes superblock_type superBlock;
// i-Node Structure
typedef struct {
unsigned short flags;
unsigned int nlinks;
unsigned int uid;
unsigned int gid;
unsigned int size;
unsigned int addr[9];
unsigned short actime[2];
unsigned short modtime[2];
unsigned short dummy; //not used
} inode_type; //64 Bytes in size
typedef struct {
unsigned int inode;
unsigned char filename[28];
} dir_type;//32 Bytes long
You need to develop a program called mod-v6.c (or mod-v6.cc) that implements the following three commands in C/C++:
1. openfs file_name
In this case, file_name is the name of the file in the native unix machine (where you are running your program) that represents the disk drive.
2. initfs n1 n2
where n1 is the file system size in number of blocks and n2 is the number of blocks devoted to the i-nodes. In this case, set all data blocks free (except for one data block for storing the contents of i-node number 1, representing the root, which has the two entries . and .. All i-nodes except i-node number 1 are (unallocated) set to free. Make sure that all free blocks are accessible from free[] array of the super block.
3. count-free
in this case, report the number of free data blocks and number of free i-nodes available in the system.
Some useful Unix system calls: lseek(), read(), write(), open() This project must be done in C/C++ only.
Due date: May 1, 2021, 11:55 pm.