# block_device Struct Reference

A block device. More...

`#include <device.h>`

Collaboration diagram for block_device:

[legend]

## Data Fields
uint16_t | block_size
uint32_t | nr_blocks
unsigned long | flags
void(* | prepare_req )(struct block_device *bdev, struct block_request *req, block_addr_t lba, uint32_t nr_blocks, enum block_operation operation)
struct block_request *(* | alloc_req )(struct block_device *bdev)
void(* | free_req )(struct block_device *bdev, struct block_request *req)
uint32_t(* | get_dev_id )(struct block_device *bdev)

## Detailed Description

A block device.

A block device can handle block-oriented requests like read and write. Each request operates on one or more blocks.

Definition at line 134 of file device.h.

## Field Documentation

struct block_request*(* block_device::alloc_req)(struct block_device *bdev)`[read]`

For internal use only.

Referenced by aesblk_init(), block_alloc_request(), and dummy_blkdev_init().

uint16_t block_device::block_size

The size of each block.

Definition at line 136 of file device.h.

Referenced by aesblk_update(), blk_req_get_blocks_xfered(), block_copy_set_dest(), block_copy_set_source(), dummy_blkdev_init(), msc_do_read(), msc_submit_read_buffers(), and msc_submit_write_data_req().

unsigned long block_device::flags

Flags indicating the state of the device

Definition at line 140 of file device.h.

Referenced by aesblk_update(), and dummy_blkdev_init().

void(* block_device::free_req)(struct block_device *bdev, struct block_request *req)

For internal use only.

Referenced by aesblk_init(), block_free_request(), and dummy_blkdev_init().

uint32_t(* block_device::get_dev_id)(struct block_device *bdev)

For internal use only.

Referenced by aesblk_update(), and dummy_blkdev_init().

uint32_t block_device::nr_blocks

The total number of blocks the device can hold

Definition at line 138 of file device.h.

Referenced by aesblk_update(), and dummy_blkdev_init().

void(* block_device::prepare_req)(struct block_device *bdev, struct block_request *req, block_addr_t lba, uint32_t nr_blocks, enum block_operation operation)

For internal use only.

Referenced by aesblk_init(), block_prepare_req(), and dummy_blkdev_init().

The documentation for this struct was generated from the following file:

- include/block/device.h