1 #ifndef _LINUX_VIRTIO_BLK_H
2 #define _LINUX_VIRTIO_BLK_H
3 /* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */
5 #include <linux/virtio_config.h>
7 /* The ID for virtio_block */
8 #define VIRTIO_ID_BLOCK 2
11 #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
12 #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
13 #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
14 #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
15 #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
17 struct virtio_blk_config
19 /* The capacity (in 512-byte sectors). */
21 /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */
23 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
25 /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */
26 struct virtio_blk_geometry {
31 } __attribute__((packed));
33 /* These two define direction. */
34 #define VIRTIO_BLK_T_IN 0
35 #define VIRTIO_BLK_T_OUT 1
37 /* This bit says it's a scsi command, not an actual read or write. */
38 #define VIRTIO_BLK_T_SCSI_CMD 2
40 /* Barrier before this op. */
41 #define VIRTIO_BLK_T_BARRIER 0x80000000
43 /* This is the first element of the read scatter-gather list. */
44 struct virtio_blk_outhdr
50 /* Sector (ie. 512 byte offset) */
54 /* And this is the final byte of the write scatter-gather list. */
55 #define VIRTIO_BLK_S_OK 0
56 #define VIRTIO_BLK_S_IOERR 1
57 #define VIRTIO_BLK_S_UNSUPP 2
58 #endif /* _LINUX_VIRTIO_BLK_H */