pintos/src/filesys/inode.c File Reference

#include "filesys/inode.h"
#include <list.h>
#include <debug.h>
#include <round.h>
#include <string.h>
#include "filesys/filesys.h"
#include "filesys/free-map.h"
#include "threads/malloc.h"

Go to the source code of this file.

Data Structures

struct  inode_disk
struct  inode

Defines

#define INODE_MAGIC   0x494e4f44

Functions

static size_t bytes_to_sectors (off_t size)
static block_sector_t byte_to_sector (const struct inode *inode, off_t pos)
void inode_init (void)
bool inode_create (block_sector_t sector, off_t length)
struct inodeinode_open (block_sector_t sector)
struct inodeinode_reopen (struct inode *inode)
block_sector_t inode_get_inumber (const struct inode *inode)
void inode_close (struct inode *inode)
void inode_remove (struct inode *inode)
off_t inode_read_at (struct inode *inode, void *buffer_, off_t size, off_t offset)
off_t inode_write_at (struct inode *inode, const void *buffer_, off_t size, off_t offset)
void inode_deny_write (struct inode *inode)
void inode_allow_write (struct inode *inode)
off_t inode_length (const struct inode *inode)

Variables

static struct list open_inodes


Define Documentation

#define INODE_MAGIC   0x494e4f44

Definition at line 12 of file inode.c.

Referenced by inode_create().


Function Documentation

static block_sector_t byte_to_sector ( const struct inode inode,
off_t  pos 
) [static]

Definition at line 48 of file inode.c.

References ASSERT, BLOCK_SECTOR_SIZE, inode::data, NULL, and inode_disk::start.

Referenced by inode_read_at(), and inode_write_at().

static size_t bytes_to_sectors ( off_t  size  )  [inline, static]

Definition at line 27 of file inode.c.

References BLOCK_SECTOR_SIZE, and DIV_ROUND_UP.

Referenced by inode_close(), and inode_create().

void inode_allow_write ( struct inode inode  ) 

Definition at line 334 of file inode.c.

References ASSERT, inode::deny_write_cnt, and inode::open_cnt.

Referenced by file_allow_write().

void inode_close ( struct inode inode  ) 

bool inode_create ( block_sector_t  sector,
off_t  length 
)

void inode_deny_write ( struct inode inode  ) 

Definition at line 324 of file inode.c.

References ASSERT, inode::deny_write_cnt, and inode::open_cnt.

Referenced by file_deny_write().

block_sector_t inode_get_inumber ( const struct inode inode  ) 

Definition at line 156 of file inode.c.

References inode::sector.

void inode_init ( void   ) 

Definition at line 63 of file inode.c.

References list_init(), and open_inodes.

Referenced by filesys_init().

off_t inode_length ( const struct inode inode  ) 

Definition at line 343 of file inode.c.

References inode::data, and inode_disk::length.

Referenced by file_length(), inode_read_at(), and inode_write_at().

struct inode* inode_open ( block_sector_t  sector  )  [read]

off_t inode_read_at ( struct inode inode,
void *  buffer_,
off_t  size,
off_t  offset 
)

void inode_remove ( struct inode inode  ) 

Definition at line 192 of file inode.c.

References ASSERT, NULL, and inode::removed.

Referenced by dir_remove().

struct inode* inode_reopen ( struct inode inode  )  [read]

Definition at line 147 of file inode.c.

References NULL, and inode::open_cnt.

Referenced by dir_reopen(), file_reopen(), and inode_open().

off_t inode_write_at ( struct inode inode,
const void *  buffer_,
off_t  size,
off_t  offset 
)


Variable Documentation

struct list open_inodes [static]

Definition at line 59 of file inode.c.

Referenced by inode_init(), and inode_open().


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