PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
Go to the source code of this file.
Macros | |
#define | FREE_MAP_SECTOR 0 |
Sectors of system file inodes. More... | |
#define | ROOT_DIR_SECTOR 1 |
Root directory file inode sector. More... | |
Functions | |
void | filesys_init (bool format) |
Initializes the file system module. More... | |
void | filesys_done (void) |
Shuts down the file system module, writing any unwritten data to disk. More... | |
bool | filesys_create (const char *name, off_t initial_size) |
Creates a file named NAME with the given INITIAL_SIZE. More... | |
struct file * | filesys_open (const char *name) |
Opens the file with the given NAME. More... | |
bool | filesys_remove (const char *name) |
filesys/filesys.h More... | |
Variables | |
struct block * | fs_device |
Block device that contains the file system. More... | |
#define FREE_MAP_SECTOR 0 |
Creates a file named NAME with the given INITIAL_SIZE.
Returns true if successful, false otherwise. Fails if a file named NAME already exists, or if internal memory allocation fails.
Definition at line 46 of file filesys.c.
References dir_add(), dir_close(), dir_open_root(), free_map_allocate(), free_map_release(), inode_create(), name, and NULL.
Referenced by fsutil_extract().
void filesys_done | ( | void | ) |
Shuts down the file system module, writing any unwritten data to disk.
Definition at line 36 of file filesys.c.
References free_map_close().
Referenced by shutdown_power_off().
void filesys_init | ( | bool | format | ) |
Initializes the file system module.
If FORMAT is true, reformats the file system.
Definition at line 18 of file filesys.c.
References BLOCK_FILESYS, block_get_role(), do_format(), free_map_init(), free_map_open(), fs_device, inode_init(), NULL, and PANIC.
Referenced by pintos_init().
struct file * filesys_open | ( | const char * | name | ) |
Opens the file with the given NAME.
Returns the new file if successful or a null pointer otherwise. Fails if no file named NAME exists, or if an internal memory allocation fails.
Definition at line 67 of file filesys.c.
References dir_close(), dir_lookup(), dir_open_root(), file_open(), name, and NULL.
Referenced by fsutil_append(), fsutil_cat(), fsutil_extract(), and load().
bool filesys_remove | ( | const char * | name | ) |
Returns true if successful, false on failure. Fails if no file named NAME exists, or if an internal memory allocation fails.
Definition at line 84 of file filesys.c.
References dir_close(), dir_open_root(), dir_remove(), name, and NULL.
Referenced by fsutil_rm().