pintos/src/filesys/directory.c File Reference

#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 dirdir_open (struct inode *inode)
struct dirdir_open_root (void)
struct dirdir_reopen (struct dir *dir)
void dir_close (struct dir *dir)
struct inodedir_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])


Function Documentation

bool dir_add ( struct dir dir,
const char *  name,
block_sector_t  inode_sector 
)

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 28 of file directory.c.

References inode_create().

Referenced by do_format().

struct inode* dir_get_inode ( struct dir dir  )  [read]

Definition at line 82 of file directory.c.

References dir::inode.

bool dir_lookup ( const struct dir dir,
const char *  name,
struct inode **  inode 
)

Definition at line 120 of file directory.c.

References ASSERT, inode_open(), dir_entry::inode_sector, lookup(), and NULL.

Referenced by filesys_open().

struct dir* dir_open ( struct inode inode  )  [read]

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 
)

struct dir* dir_reopen ( struct dir dir  )  [read]

Definition at line 64 of file directory.c.

References dir_open(), dir::inode, and inode_reopen().

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().


Generated on Mon Jan 10 16:43:58 2011 for Pintos by  doxygen 1.5.6