L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
virtio_block.h
1/*
2 * (c) 2014 Sarah Hoffmann <sarah.hoffmann@kernkonzept.com>
3 *
4 * This file is part of TUD:OS and distributed under the terms of the
5 * GNU General Public License 2.
6 * Please see the COPYING-GPL-2 file for details.
7 *
8 * As a special exception, you may use this file as part of a free software
9 * library without restriction. Specifically, if other files instantiate
10 * templates or use macros or inline functions from this file, or you compile
11 * this file and link it with other files to produce an executable, this
12 * file does not by itself cause the resulting executable to be covered by
13 * the GNU General Public License. This exception does not however
14 * invalidate any other reasons why the executable file might be covered by
15 * the GNU General Public License.
16 */
17
18#pragma once
19
26#include <l4/sys/types.h>
27
40
50
60
61enum L4virtio_block_discard_flags_t
62{
63 L4VIRTIO_BLOCK_DISCARD_F_UNMAP = 0x00000001UL,
64 L4VIRTIO_BLOCK_DISCARD_F_RESERVED = 0xFFFFFFFEUL,
65};
66
71{
72 l4_uint64_t sector;
73 l4_uint32_t num_sectors;
74 l4_uint32_t flags;
76
81{
85 struct l4virtio_block_config_geometry_t
86 {
87 l4_uint16_t cylinders;
88 l4_uint8_t heads;
89 l4_uint8_t sectors;
90 } geometry;
92 struct l4virtio_block_config_topology_t
93 {
95 l4_uint8_t physical_block_exp;
97 l4_uint8_t alignment_offset;
99 l4_uint16_t min_io_size;
101 l4_uint32_t opt_io_size;
102 } topology;
103 l4_uint8_t writeback;
104 l4_uint8_t unused0[3];
105 l4_uint32_t max_discard_sectors;
106 l4_uint32_t max_discard_seg;
107 l4_uint32_t discard_sector_alignment;
108 l4_uint32_t max_write_zeroes_sectors;
109 l4_uint32_t max_write_zeroes_seg;
110 l4_uint8_t write_zeroes_may_unmap;
111 l4_uint8_t unused1[3];
113
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition l4int.h:36
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:40
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition l4int.h:38
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:42
L4virtio_block_operations
Kinds of operation over a block device.
L4virtio_block_status
Status of a finished block request.
@ L4VIRTIO_BLOCK_T_DISCARD
Discard a range of sectors.
@ L4VIRTIO_BLOCK_T_GET_ID
Get device ID.
@ L4VIRTIO_BLOCK_T_FLUSH
Flush data to disk.
@ L4VIRTIO_BLOCK_T_IN
Read from device.
@ L4VIRTIO_BLOCK_T_OUT
Write to device.
@ L4VIRTIO_BLOCK_T_WRITE_ZEROES
Write zeroes to a range of sectors.
@ L4VIRTIO_BLOCK_S_IOERR
IO error on device.
@ L4VIRTIO_BLOCK_S_UNSUPP
Operation is not supported.
@ L4VIRTIO_BLOCK_S_OK
Request finished successfully.
Common L4 ABI Data Types.
Device configuration for block devices.
l4_uint32_t seg_max
Maximum number of segments per request.
l4_uint32_t blk_size
Block size of underlying disk.
l4_uint32_t size_max
Maximum size of a single segment.
l4_uint64_t capacity
Capacity of device in 512-byte sectors.
Structure used for the write zeroes and discard commands.
Header structure of a request for a block device.
l4_uint32_t type
Kind of request, see L4virtio_block_operations.
l4_uint32_t ioprio
Priority (unused)
l4_uint64_t sector
First sector to read/write.