Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

implement a simple file system

I am doing an assignment about implementing a simple file system, for which I need to complete open(), read(), and write() functions via the superblock, inodes, dir_mapping, and a virtual HardDisk file which is provided. But I don't know how to start it.

Here are some code variables:

    int open(char* path, int flag){
      int inodeNumber;
      return inodeNumber;
    }

    int read(int inodeNumber, int offset, void* buff, int count) {
      int readbytes; 
      return readbytes;
    }

    int write(int inodeNumber, int offset, void* buff, int count) {
      int writebytes; 
      return writebytes;
    }

and the struct of superblock, inode, and dir_mapping:

    typedef struct _super_block_ {
      int inode_offset;
      int data_offset;
      int max_inode;
      int max_data_blk;
      int next_available_inode;
      int next_available_blk;
      int blk_size;
    } superblock;

    typedef struct _inode_ {
      int i_number;
      time_t i_mtime;
      int  i_type;
      int i_size;
      int i_blocks;
      int direct_blk[2];
      int indirect_blk;
      int file_num;
    } inode;

    typedef struct dir_mapping {
      char dir[20];
      int inode_number;
    } DIR_NODE;

Comments