#include "filesys/directory.h"
#include <stdio.h>
#include <string.h>
#include <list.h>
#include "filesys/filesys.h"
#include "filesys/inode.h"
#include "threads/malloc.h"
Go to the source code of this file.
Data Structures | |
struct | dir |
struct | dir_entry |
Functions | |
bool | dir_create (block_sector_t sector, size_t entry_cnt) |
struct dir * | dir_open (struct inode *inode) |
struct dir * | dir_open_root (void) |
struct dir * | dir_reopen (struct dir *dir) |
void | dir_close (struct dir *dir) |
struct inode * | dir_get_inode (struct dir *dir) |
static bool | lookup (const struct dir *dir, const char *name, struct dir_entry *ep, off_t *ofsp) |
bool | dir_lookup (const struct dir *dir, const char *name, struct inode **inode) |
bool | dir_add (struct dir *dir, const char *name, block_sector_t inode_sector) |
bool | dir_remove (struct dir *dir, const char *name) |
bool | dir_readdir (struct dir *dir, char name[NAME_MAX+1]) |
bool dir_add | ( | struct dir * | dir, | |
const char * | name, | |||
block_sector_t | inode_sector | |||
) |
Definition at line 143 of file directory.c.
References ASSERT, dir_entry::in_use, dir::inode, inode_read_at(), dir_entry::inode_sector, inode_write_at(), lookup(), dir_entry::name, NAME_MAX, NULL, strlcpy(), and strlen().
Referenced by filesys_create().
void dir_close | ( | struct dir * | dir | ) |
Definition at line 71 of file directory.c.
References free(), dir::inode, inode_close(), and NULL.
Referenced by filesys_create(), filesys_open(), and filesys_remove().
bool dir_create | ( | block_sector_t | sector, | |
size_t | entry_cnt | |||
) |
Definition at line 120 of file directory.c.
References ASSERT, inode_open(), dir_entry::inode_sector, lookup(), and NULL.
Referenced by filesys_open().
Definition at line 36 of file directory.c.
References calloc(), free(), dir::inode, inode_close(), NULL, and dir::pos.
Referenced by dir_open_root(), and dir_reopen().
struct dir* dir_open_root | ( | void | ) | [read] |
Definition at line 56 of file directory.c.
References dir_open(), inode_open(), and ROOT_DIR_SECTOR.
Referenced by filesys_create(), filesys_open(), filesys_remove(), and fsutil_ls().
bool dir_readdir | ( | struct dir * | dir, | |
char | name[NAME_MAX+1] | |||
) |
Definition at line 223 of file directory.c.
References dir_entry::in_use, dir::inode, inode_read_at(), dir_entry::name, name, NAME_MAX, dir::pos, and strlcpy().
Referenced by fsutil_ls().
bool dir_remove | ( | struct dir * | dir, | |
const char * | name | |||
) |
Definition at line 186 of file directory.c.
References ASSERT, dir_entry::in_use, dir::inode, inode_close(), inode_open(), inode_remove(), dir_entry::inode_sector, inode_write_at(), lookup(), and NULL.
Referenced by filesys_remove().
static bool lookup | ( | const struct dir * | dir, | |
const char * | name, | |||
struct dir_entry * | ep, | |||
off_t * | ofsp | |||
) | [static] |
Definition at line 93 of file directory.c.
References ASSERT, dir_entry::in_use, dir::inode, inode_read_at(), dir_entry::name, NULL, and strcmp().
Referenced by dir_add(), dir_lookup(), and dir_remove().