#include "directory.h"
#include "file.h"
+#include "fsutil.h"
#include "lib.h"
#include "malloc.h"
return false;
}
-void dir_list (const struct dir *);
-void dir_print (const struct dir *);
+void
+dir_list (const struct dir *d)
+{
+ struct dir_entry *e;
+
+ for (e = d->entries; e < d->entries + d->entry_cnt; e++)
+ if (e->in_use)
+ printk ("%s\n", e->name);
+}
+
+void
+dir_dump (const struct dir *d)
+{
+ struct dir_entry *e;
+
+ for (e = d->entries; e < d->entries + d->entry_cnt; e++)
+ if (e->in_use)
+ {
+ printk ("Contents of %s:\n", e->name);
+ fsutil_print (e->name);
+ printk ("\n");
+ }
+}
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;
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 *);
bool dir_add (struct dir *, const char *name, disk_sector_no);
bool dir_remove (struct dir *, const char *name);
void dir_list (const struct dir *);
-void dir_print (const struct dir *);
+void dir_dump (const struct dir *);
#endif /* directory.h */