Skip to content

mbinary-course-labs/userspace-file-system

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Filesystem

A simple file system running on user space

Function

  • read file
  • write file
  • truncate file
  • ls: view attrs
  • chown, chmod
  • directory operations ( to do )

Design

metadata of fs

  • TOTAL SIZE: 4G
  • BLOCKSIZE: 4KB
  • BLOCKNR : 4G/4KB
  • NAME_LENGTH: 256
  • block_no_t: int (the type of block_no)
  • Each block has a block_no at the begining

super block

struct super_node
{
    block_no_t block_no;
    block_no_t used_block;
    block_no_t last_block;
    block_no_t blocknr;
    unsigned  namelen;
    unsigned  blocksize;
    struct entry_node * next;
};

block 0( aka mem[0]) is the super block.

It stores the num of used_blocks and the num of the latest used block.

The latest used block is exactly the head block of the node-chain

entry_node

metadata of each entry( dir or file) stored in mem blocks including :

  • int block_no : num of mem block
  • int content : is the value of the first mem block_no of the files's content( for dir, it's -1)
  • stat st : st of each entry
  • filenode* next: next node
  • char name[256]: entry name

data_node

At the begining, this node stores block_no The following are file data content

Free space allocation algorithm

next fit

Resource

Vision

Licence

MIT

About

📁A simple file system in userspace

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 94.8%
  • Shell 5.2%