# block_request Struct Reference

A block device request. More...

`#include <device.h>`

Collaboration diagram for block_request:

[legend]

## Data Fields
struct slist | buf_list
void(* | req_done )(struct block_device *bdev, struct block_request *req)
void * | context
int | status
struct block_device * | bdev

## Detailed Description

A block device request.

This structure represents an asynchronous request to a block device. It is allocated by calling block_device::prepare_req(). After initializing all the necessary fields, call block_request::req_submit() to submit it for I/O. When it is done, block_request::req_done() will be called by the driver.

Definition at line 69 of file device.h.

## Field Documentation

struct block_device* block_request::bdev`[read]`

The block request to which this request belongs

Definition at line 108 of file device.h.

Referenced by aesblk_prepare_req(), blk_req_get_blocks_xfered(), blk_req_get_bytes_xfered(), block_alloc_request(), block_free_request(), block_prepare_req(), block_submit_buf_list(), and block_submit_req().

struct slist block_request::buf_list`[read]`

List of buffers associated with this request

Definition at line 71 of file device.h.

Referenced by blk_req_add_buffer(), and blk_req_add_buffer_list().

void* block_request::context

Arbitrary data pointer associated with this request, for use by the submitter.

Definition at line 94 of file device.h.

Referenced by aesblk_prepare_req(), block_copy_set_dest(), block_copy_set_source(), and msc_do_read().

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

Function provided by the client to be called when this request is completed.

Parameters:

  | bdev | The Block Device that handled the request
  | req | The request that was completed.

Referenced by aesblk_prepare_req(), block_copy_set_dest(), block_copy_set_source(), and msc_do_read().

int block_request::status

Status code set by the block device driver upon completion of this request.

This field is always updated before req_done() is called, and before buf_list_done() if an error occurred during transfer of that particular buffer list. While the transfer is still in progress, including during the last buf_list_done() callback, it contains the value -STATUS_IN_PROGRESS.

Definition at line 105 of file device.h.

Referenced by aesblk_prepare_req(), msc_read_worker(), and msc_write_worker().

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

- include/block/device.h