-
Notifications
You must be signed in to change notification settings - Fork 0
/
directory.h
executable file
·30 lines (24 loc) · 975 Bytes
/
directory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef FILESYS_DIRECTORY_H
#define FILESYS_DIRECTORY_H
#include <stdbool.h>
#include <stddef.h>
#include "devices/block.h"
/* 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 inode;
/* Opening and closing directories. */
bool dir_create (block_sector_t sector, size_t entry_cnt);
struct dir *dir_open (struct inode *);
struct dir *dir_open_root (void);
struct dir *dir_reopen (struct dir *);
void dir_close (struct dir *);
struct inode *dir_get_inode (struct dir *);
/* Reading and writing. */
bool dir_lookup (const struct dir *, const char *name, struct inode **);
bool dir_add (struct dir *, const char *name, block_sector_t);
bool dir_remove (struct dir *, const char *name);
bool dir_readdir (struct dir *, char name[NAME_MAX + 1]);
#endif /* filesys/directory.h */