133 const static uint32_t MAGIC_NUMBER = 0xf0f03410;
134 const static uint32_t INODES_PER_BLOCK = 128;
135 const static uint32_t POINTERS_PER_INODE = 5;
136 const static uint32_t POINTERS_PER_BLOCK = 1024;
137 const static uint32_t NAMESIZE = 16;
138 const static uint32_t ENTRIES_PER_DIR = 7;
139 const static uint32_t DIR_PER_BLOCK = 8;
149 uint32_t MagicNumber;
155 char PasswordHash[257];
193 uint32_t Direct[FileSystem::POINTERS_PER_INODE];
205 uint32_t Pointers[FileSystem::POINTERS_PER_BLOCK];
206 char Data[Disk::BLOCK_SIZE];
207 struct
Directory Directories[FileSystem::DIR_PER_BLOCK];
212 vector<bool> free_blocks;
213 vector<int> inode_counter;
214 vector<uint32_t> dir_counter;
230 bool remove(size_t inumber);
237 ssize_t stat(size_t inumber);
247 ssize_t read(size_t inumber, char *data, int length, size_t offset);
257 ssize_t write(size_t inumber, char *data, int length, size_t offset);
266 bool load_inode(size_t inumber, Inode *node);
272 ssize_t allocate_free_block();
283 void read_helper(uint32_t blocknum, int offset, int *length, char **data, char **ptr);
292 ssize_t write_ret(size_t inumber, Inode* node, int ret);
303 void read_buffer(int offset, int *read, int length, char *data, uint32_t blocknum);
315 bool check_allocation(Inode *node, int read, int orig_offset, uint32_t &blocknum, bool write_indirect, Block indirect);
321 uint32_t allocate_block();
336 Directory add_dir_entry(Directory dir, uint32_t inum, uint32_t type, char name[]);
343 void write_dir_back(struct Directory dir);
352 int dir_lookup(Directory dir, char name[]);
360 Directory read_dir_from_offset(uint32_t offset);
369 Directory rmdir_helper(Directory parent, char name[]);
378 Directory rm_helper(Directory parent, char name[]);
387 static void debug(Disk *disk);
394 static bool format(Disk *disk);
402 bool mount(Disk *disk);
423 bool change_password();
431 bool remove_password();
445 bool touch(char name[]);
455 bool mkdir(char name[]);
465 bool rmdir(char name[]);
474 bool cd(char name[]);
491 bool rm(char name[]);
502 bool copyout(char name[],const char *path);
515 bool copyin(const char *path, char name[]);
526 bool ls_dir(char name[]);