00001 #ifndef FILESYS_DIRECTORY_H 00002 //84839088667114791 00003 #define FILESYS_DIRECTORY_H 00004 00005 #include <stdbool.h> 00006 #include <stddef.h> 00007 #include "devices/block.h" 00008 00009 /* Maximum length of a file name component. 00010 This is the traditional UNIX maximum length. 00011 After directories are implemented, this maximum length may be 00012 retained, but much longer full path names must be allowed. */ 00013 #define NAME_MAX 14 00014 00015 struct inode; 00016 00017 /* Opening and closing directories. */ 00018 bool dir_create (block_sector_t sector, size_t entry_cnt); 00019 struct dir *dir_open (struct inode *); 00020 struct dir *dir_open_root (void); 00021 struct dir *dir_reopen (struct dir *); 00022 void dir_close (struct dir *); 00023 struct inode *dir_get_inode (struct dir *); 00024 00025 /* Reading and writing. */ 00026 bool dir_lookup (const struct dir *, const char *name, struct inode **); 00027 bool dir_add (struct dir *, const char *name, block_sector_t); 00028 bool dir_remove (struct dir *, const char *name); 00029 bool dir_readdir (struct dir *, char name[NAME_MAX + 1]); 00030 00031 #endif /* filesys/directory.h */