#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 block * | list_elem_to_block (struct list_elem *) |
const char * | block_type_name (enum block_type type) |
struct block * | block_get_role (enum block_type role) |
void | block_set_role (enum block_type role, struct block *block) |
struct block * | block_first (void) |
struct block * | block_next (struct block *block) |
struct block * | block_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 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) |
Variables | |
static struct list | all_blocks = LIST_INITIALIZER (all_blocks) |
static struct block * | block_by_role [BLOCK_ROLE_CNT] |
struct block* block_first | ( | void | ) | [read] |
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().
Definition at line 82 of file block.c.
References block::list_elem, list_elem_to_block(), and list_next().
void block_print_stats | ( | void | ) |
Definition at line 172 of file block.c.
References BLOCK_CNT, block_type_name(), block::lock, lock_acquire(), lock_release(), block::name, NULL, printf(), block::read_cnt, block::type, and block::write_cnt.
Referenced by print_stats().
void block_read | ( | struct block * | block, | |
block_sector_t | sector, | |||
void * | buffer | |||
) |
Definition at line 124 of file block.c.
References block::aux, check_sector(), block::lock, lock_acquire(), lock_release(), block::ops, block_operations::read, and block::read_cnt.
Referenced by fsutil_extract(), inode_open(), inode_read_at(), inode_write_at(), partition_read(), and read_partition_table().
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] |
Definition at line 196 of file block.c.
References block::aux, BLOCK_SECTOR_SIZE, block::list_elem, list_push_back(), block::lock, lock_init(), malloc(), block::name, NULL, block::ops, PANIC, PRDSNu, print_human_readable_size(), printf(), block::read_cnt, block::size, strlcpy(), block::type, and block::write_cnt.
Referenced by found_partition(), identify_ata_device(), and msc_attached().
void block_set_role | ( | enum block_type | role, | |
struct block * | block | |||
) |
block_sector_t block_size | ( | struct block * | block | ) |
Definition at line 151 of file block.c.
References block::size.
Referenced by bitmap_create_in_buf(), check_file_handle(), found_partition(), free_map_init(), fsutil_append(), malloc_init(), read_partition_table(), realloc(), seq_test(), and write_some_bytes().
enum block_type block_type | ( | struct block * | block | ) |
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 | |||
) |
Definition at line 139 of file block.c.
References ASSERT, block::aux, BLOCK_FOREIGN, check_sector(), block::lock, lock_acquire(), lock_release(), block::ops, block::type, block_operations::write, and block::write_cnt.
Referenced by fsutil_append(), fsutil_extract(), inode_create(), inode_write_at(), and partition_write().
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().
Definition at line 227 of file block.c.
References list_end(), list_entry, and NULL.
Referenced by block_first(), and block_next().
struct list all_blocks = LIST_INITIALIZER (all_blocks) [static] |
struct block* block_by_role[BLOCK_ROLE_CNT] [static] |