pintos/src/devices/block.c File Reference

#include "devices/block.h"
#include <list.h>
#include <string.h>
#include <stdio.h>
#include "devices/ide.h"
#include "threads/malloc.h"
#include "threads/synch.h"

Go to the source code of this file.

Data Structures

struct  block

Functions

static struct blocklist_elem_to_block (struct list_elem *)
const char * block_type_name (enum block_type type)
struct blockblock_get_role (enum block_type role)
void block_set_role (enum block_type role, struct block *block)
struct blockblock_first (void)
struct blockblock_next (struct block *block)
struct blockblock_get_by_name (const char *name)
static void check_sector (struct block *block, block_sector_t sector)
void block_read (struct block *block, block_sector_t sector, void *buffer)
void block_write (struct block *block, block_sector_t sector, const void *buffer)
block_sector_t block_size (struct block *block)
const char * block_name (struct block *block)
enum block_type block_type (struct block *block)
void block_print_stats (void)
struct blockblock_register (const char *name, enum block_type type, const char *extra_info, block_sector_t size, const struct block_operations *ops, void *aux)

Variables

static struct list all_blocks = LIST_INITIALIZER (all_blocks)
static struct blockblock_by_role [BLOCK_ROLE_CNT]


Function Documentation

struct block* block_first ( void   )  [read]

Definition at line 74 of file block.c.

References list_begin(), and list_elem_to_block().

struct block* block_get_by_name ( const char *  name  )  [read]

Definition at line 90 of file block.c.

References list_begin(), list_end(), list_entry, list_next(), block::name, NULL, and strcmp().

struct block* block_get_role ( enum block_type  role  )  [read]

Definition at line 57 of file block.c.

References ASSERT, and BLOCK_ROLE_CNT.

Referenced by filesys_init(), fsutil_append(), and fsutil_extract().

const char* block_name ( struct block block  ) 

Definition at line 158 of file block.c.

References block::name.

Referenced by check_sector(), found_partition(), fsutil_extract(), partition_scan(), and read_partition_table().

struct block* block_next ( struct block block  )  [read]

Definition at line 82 of file block.c.

References block::list_elem, list_elem_to_block(), and list_next().

void block_print_stats ( void   ) 

void block_read ( struct block block,
block_sector_t  sector,
void *  buffer 
)

struct block* block_register ( const char *  name,
enum block_type  type,
const char *  extra_info,
block_sector_t  size,
const struct block_operations ops,
void *  aux 
) [read]

void block_set_role ( enum block_type  role,
struct block block 
)

Definition at line 65 of file block.c.

References ASSERT, and BLOCK_ROLE_CNT.

block_sector_t block_size ( struct block block  ) 

enum block_type block_type ( struct block block  ) 

Definition at line 165 of file block.c.

References block::type.

const char* block_type_name ( enum block_type  type  ) 

Definition at line 38 of file block.c.

References ASSERT, and BLOCK_CNT.

Referenced by block_print_stats().

void block_write ( struct block block,
block_sector_t  sector,
const void *  buffer 
)

static void check_sector ( struct block block,
block_sector_t  sector 
) [static]

Definition at line 108 of file block.c.

References block_name(), PANIC, PRDSNu, and block::size.

Referenced by block_read(), and block_write().

static struct block * list_elem_to_block ( struct list_elem list_elem  )  [static, read]

Definition at line 227 of file block.c.

References list_end(), list_entry, and NULL.

Referenced by block_first(), and block_next().


Variable Documentation

struct list all_blocks = LIST_INITIALIZER (all_blocks) [static]

Definition at line 28 of file block.c.

struct block* block_by_role[BLOCK_ROLE_CNT] [static]

Definition at line 31 of file block.c.


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