-#ifndef HEADER_DIRECTORY_H
-#define HEADER_DIRECTORY_H 1
+#ifndef FILESYS_DIRECTORY_H
+#define FILESYS_DIRECTORY_H
#include <stdbool.h>
#include <stddef.h>
-#include "disk.h"
+#include "devices/disk.h"
-/* Maximum length of a filename.
- This is the traditional UNIX maximum. */
-#define FILENAME_LEN_MAX 14
-
-struct dir
- {
- size_t entry_cnt;
- struct dir_entry *entries;
- };
-
-struct dir_entry
- {
- bool in_use;
- char name[FILENAME_LEN_MAX + 1];
- disk_sector_t filehdr_sector;
- };
+/* 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 file;
-bool dir_init (struct dir *, size_t entry_cnt);
+struct dir *dir_create (size_t entry_cnt);
+size_t dir_size (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_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_dump (const struct dir *);
-#endif /* directory.h */
+#endif /* filesys/directory.h */