Capabilities: move cap_file_mmap to commoncap.c
[linux-2.6/mini2440.git] / include / linux / virtio_blk.h
blob8dab9f2b8832db74569f668a70edfd853274414c
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/types.h>
6 #include <linux/virtio_config.h>
8 /* The ID for virtio_block */
9 #define VIRTIO_ID_BLOCK 2
11 /* Feature bits */
12 #define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
13 #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
14 #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
15 #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
16 #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
17 #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
18 #define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
19 #define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */
21 #define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */
23 struct virtio_blk_config {
24 /* The capacity (in 512-byte sectors). */
25 __u64 capacity;
26 /* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */
27 __u32 size_max;
28 /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
29 __u32 seg_max;
30 /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */
31 struct virtio_blk_geometry {
32 __u16 cylinders;
33 __u8 heads;
34 __u8 sectors;
35 } geometry;
36 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
37 __u32 blk_size;
38 __u8 identify[VIRTIO_BLK_ID_BYTES];
39 } __attribute__((packed));
41 /* These two define direction. */
42 #define VIRTIO_BLK_T_IN 0
43 #define VIRTIO_BLK_T_OUT 1
45 /* This bit says it's a scsi command, not an actual read or write. */
46 #define VIRTIO_BLK_T_SCSI_CMD 2
48 /* Barrier before this op. */
49 #define VIRTIO_BLK_T_BARRIER 0x80000000
51 /* This is the first element of the read scatter-gather list. */
52 struct virtio_blk_outhdr {
53 /* VIRTIO_BLK_T* */
54 __u32 type;
55 /* io priority. */
56 __u32 ioprio;
57 /* Sector (ie. 512 byte offset) */
58 __u64 sector;
61 struct virtio_scsi_inhdr {
62 __u32 errors;
63 __u32 data_len;
64 __u32 sense_len;
65 __u32 residual;
68 /* And this is the final byte of the write scatter-gather list. */
69 #define VIRTIO_BLK_S_OK 0
70 #define VIRTIO_BLK_S_IOERR 1
71 #define VIRTIO_BLK_S_UNSUPP 2
72 #endif /* _LINUX_VIRTIO_BLK_H */