11#define BLOCK_SECTOR_SIZE 512
struct block * block_register(const char *name, enum block_type, const char *extra_info, block_sector_t size, const struct block_operations *, void *aux)
devices/block.h
struct block * block_first(void)
Returns the first block device in kernel probe order, or a null pointer if no block devices are regis...
struct block * block_get_by_name(const char *name)
Returns the block device with the given NAME, or a null pointer if no block device has that name.
const char * block_type_name(enum block_type)
Returns a human-readable name for the given block device TYPE.
block_sector_t block_size(struct block *)
Block device operations.
uint32_t block_sector_t
Index of a block device sector.
struct block * block_get_role(enum block_type)
Finding block devices.
const char * block_name(struct block *)
Returns BLOCK's name (e.g.
void block_set_role(enum block_type, struct block *)
Assigns BLOCK the given ROLE.
void block_read(struct block *, block_sector_t, void *)
Reads sector SECTOR from BLOCK into BUFFER, which must have room for BLOCK_SECTOR_SIZE bytes.
block_type
Type of a block device.
@ BLOCK_RAW
"Raw" device with unidentified contents.
@ BLOCK_KERNEL
Pintos OS kernel.
@ BLOCK_FILESYS
File system.
@ BLOCK_CNT
Number of Pintos block types.
@ BLOCK_FOREIGN
Owned by non-Pintos operating system.
void block_write(struct block *, block_sector_t, const void *)
Write sector SECTOR to BLOCK from BUFFER, which must contain BLOCK_SECTOR_SIZE bytes.
struct block * block_next(struct block *)
Returns the block device following BLOCK in kernel probe order, or a null pointer if BLOCK is the las...
void block_print_stats(void)
Statistics.
Lower-level interface to block device drivers.
void(* write)(void *aux, block_sector_t, const void *buffer)
void(* read)(void *aux, block_sector_t, void *buffer)
void * aux
Extra data owned by driver.
block_sector_t size
Size in sectors.