Skip to content

SahilThorat11/Customized-Virtual-File-System-CVFS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

A Linux-inspired Virtual File System written in C that simulates inode-based file management similar to Unix file systems.

πŸ“‚ Custom Virtual File System (CVFS)

A Custom Virtual File System (CVFS) implemented in C Programming that simulates the internal working of a Linux file system.
This project demonstrates how operating systems manage files using inodes, file descriptors, and memory management.


πŸ“Œ Project Overview

The CVFS project is a command-line based system programming project that replicates file system behavior such as:

  • File Creation
  • File Opening
  • File Reading
  • File Writing
  • File Deletion
  • File Information Display
  • Command Manual System

The entire system runs in RAM using dynamic memory allocation.


🎯 Objectives

  • Understand Linux File System Architecture
  • Implement inode-based file management
  • Simulate file operations
  • Learn System Programming Concepts
  • Strengthen Data Structures knowledge

βš™οΈ Technology Used

Technology Purpose
C Programming Core implementation
Data Structures Inode and file management
Dynamic Memory Allocation File storage
GCC Compiler Compilation
CLI (Command Line Interface) User interaction

πŸ–₯️ User Interface

The system uses Command Line Interface (CLI).

Example commands:

create file1 3
open file1 3
write file1
read file1 10
ls
unlink file1

🧱 System Architecture

The CVFS system is composed of the following components:

User Commands
      |
      v
+-------------------+
|   Command Parser  |
+-------------------+
          |
          v
+-------------------+
|       UFDT        |
| (File Descriptor) |
+-------------------+
          |
          v
+-------------------+
|     File Table    |
+-------------------+
          |
          v
+-------------------+
|       Inode       |
+-------------------+
          |
          v
+-------------------+
|    Data Blocks    |
+-------------------+

πŸ—‚ Data Structures Used

Superblock

Tracks total and free inodes.

struct SUPERBLOCK
{
    int TotalInodes;
    int FreeInodes;
};

Inode

Represents file metadata.

struct inode
{
    char FileName[50];
    int InodeNumber;
    int FileSize;
    int FileActualSize;
    int FileType;
    char *Buffer;
    int LinkCount;
    int ReferenceCount;
    int Permission;
    struct inode *next;
};

File Table

Stores information of opened files.

struct filetable
{
    int ReadOffset;
    int WriteOffset;
    int Count;
    int Mode;
    struct inode *ptrinode;
};

UFDT (User File Descriptor Table)

Maps file descriptors to file tables.

struct ufdt
{
    struct filetable *ptrfiletable;
};

πŸ“œ Supported Commands

Command Description
create <name> <permission> Create new file
open <name> <mode> Open file
read <name> <size> Read file
write <name> Write into file
close <name> Close file
ls List all files
unlink <name> Delete file
man <command> Display command manual
help Display all commands
exit Exit CVFS

πŸ”„ Project Flow

Start Program
      |
Initialize Superblock
      |
Create Inode Linked List
      |
Accept User Command
      |
Parse Command
      |
Execute Function
      |
Display Output
      |
Repeat Until Exit

▢️ How to Run the Project

Step 1: Compile

gcc cvfs.c -o cvfs

Step 2: Run

./cvfs

πŸ’» Example Output

CVFS : > create file1 3
File created successfully with file descriptor : 0

CVFS : > write file1
Enter data : Hello World

CVFS : > read file1 11
Hello World

CVFS : > ls
file1

CVFS : > unlink file1
File deleted successfully

πŸ“Έ Output Screenshots

File Creation

CVFS > create file1 3
File created successfully

File Reading

CVFS > read file1 11
Hello World

Listing Files

CVFS > ls
file1

File Deletion

CVFS > unlink file1
File deleted successfully

⚠️ Limitations

  • Data stored only in RAM
  • No directory structure
  • Limited inode count
  • No multi-user support

πŸš€ Future Enhancements

  • Persistent storage
  • Directory support
  • Multi-user system
  • File encryption
  • GUI interface

πŸ“š Learning Outcomes

This project helps understand:

  • File System Architecture
  • Inode-based File Management
  • File Descriptors
  • Memory Management
  • System Programming

πŸ‘¨β€πŸ’» Author

Sahil Rajaram Thorat


⭐ If you like this project, give it a star on GitHub!

About

A Linux-inspired Virtual File System implemented in C demonstrating inode-based architecture and file descriptor management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors