ShubhamRasal / 10-Virtual_file_system-c

When user enters ‘truncate’ command, the data which is stored in the file which contains the text will gets erased or gets deleted.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Virtual_file_system-c

Name of the project : VFS (Virtual File System)

Technology : Core C-Programming

User Interface : CUI (character User Interface)

Platform : Windows NT / Linux

Hardware Requirements: 20 MB HDD and Processor(any one)

Description of the project:

In this project, we are creating a file system which runs on the primary memory (i.e. RAM). This project is CLI (i.e. Command Line Interface) based. The user interface is Command User Interface.

Data structures used in the project:

The type of data structure used in this project is Linked List. We have use Singly Linear Linked List here.

Flow of the project:

Most UNIX filesystem types have a similar general structure, although the exact details vary quite a bit. The central concepts are superblock, inode , data block, directory block , and indirection block. The superblock contains information about the filesystem as a whole, such as its size (the exact information here depends on the filesystem). An inode contains all information about a file, except its name(in our case we store name also). The name is stored in the directory, together with the number of the inode. A directory entry consists of a filename and the number of the inode which represents the file. The inode contains the numbers of several data blocks, which are used to store the data in the file. There is space only for a few data block numbers in the inode, however, and if more are needed, more space for pointers to the data blocks is allocated dynamically. These dynamically allocated blocks are indirect blocks; the name indicates that in order to find the data block, one has to find its number in the indirect block first. As this project fully functions on the primary memory, we are creating the data structure as linked list (Singly Linear). So we are creating the Superblock

which contains the information of the inodes that i.e. total number of inodes and number of free inodes. These inodes are created in the DILB block i.e. Data Inode List Block. We created the singly linear linked list of fifty inodes in which each inode has a unique inode number and these inode contains the information of the files which are stored in the data block. The information of each file gets stored in the separate inode that means for number of inodes we can create number of files (i.e. for fifty inodes, we can create fifty files). When the command prompt opens, user will have to enter the username and password for the valid authentication. When user will enter the command, that command will be searched in the program then the further operations will happen. When the user creates the file , firstly, the filename is get searched in the DILB block for duplication, means, for the existence of same file name. If file name is not exists then the separate inode gets allocated for that file. Firstly, the memory gets allocated for that file then the inode in the DILB block will be initialise for that file. That inode contains the file information like, name of the file, file permission, link count, reference count, etc. When user will enter some data or text in the file, for that data, the memory gets allocated in the file Buffer and all the text or data will be put in that buffer. When user will read the data giving the size of the bytes, how many data user wants to read. Then that bytes of data (if exists that number of bytes) will be shown to the user. User can write that data upto 1024 bytes (as our file size is 1024 bytes) and can also read the 1024 bytes of data. When user enters ‘truncate’ command, the data which is stored in the file which contains the text will gets erased or gets deleted.

About

When user enters ‘truncate’ command, the data which is stored in the file which contains the text will gets erased or gets deleted.


Languages

Language:C++ 95.8%Language:C 4.2%