X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffilesys%2Fdirectory.h;h=abc3029f9e86cea3c861a9ca711956a6d77efc1f;hb=f5a8a96c77a329a6fe175e62c6ed3c149fc3937d;hp=fe7f333adbe076279fe8f14f7702eac0ccdf8f89;hpb=621963e2a383d53b2c5eca627102625421b46545;p=pintos-anon diff --git a/src/filesys/directory.h b/src/filesys/directory.h index fe7f333..abc3029 100644 --- a/src/filesys/directory.h +++ b/src/filesys/directory.h @@ -1,36 +1,25 @@ -#ifndef HEADER_DIRECTORY_H -#define HEADER_DIRECTORY_H 1 +#ifndef FILESYS_DIRECTORY_H +#define FILESYS_DIRECTORY_H #include #include -#include "disk.h" +#include "devices/disk.h" -/* Maximum length of a filename. - This is the traditional UNIX maximum. */ -#define FILENAME_LEN_MAX 14 +/* Maximum length of a file name component. + This is the traditional UNIX maximum length. + After directories are implemented, this maximum length may be + retained, but much longer full path names must be allowed. */ +#define NAME_MAX 14 -struct dir_entry - { - bool in_use; - char name[FILENAME_LEN_MAX + 1]; - disk_sector_no filehdr_sector; - }; - -struct dir - { - size_t entry_cnt; - struct dir_entry *entries; - }; - -struct file; -bool dir_init (struct dir *, size_t entry_cnt); -void dir_destroy (struct dir *); -void dir_read (struct dir *, struct file *); -void dir_write (struct dir *, struct file *); -bool dir_lookup (const struct dir *, const char *name, disk_sector_no *); -bool dir_add (struct dir *, const char *name, disk_sector_no); +struct inode; +struct dir; +bool dir_create (disk_sector_t sector, size_t entry_cnt); +bool dir_open (struct inode *, struct dir **); +bool dir_open_root (struct dir **); +void dir_close (struct dir *); +bool dir_lookup (const struct dir *, const char *name, struct inode **); +bool dir_add (struct dir *, const char *name, disk_sector_t); bool dir_remove (struct dir *, const char *name); void dir_list (const struct dir *); -void dir_print (const struct dir *); -#endif /* directory.h */ +#endif /* filesys/directory.h */