• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This header was generated from the Linux kernel headers by update_headers.py,
3  * to provide necessary information from kernel to userspace, such as constants,
4  * structures, and macros, and thus, contains no copyrightable information.
5  */
6 #ifndef _LINUX_VIRTIO_BLK_H
7 #define _LINUX_VIRTIO_BLK_H
8 #include <linux/types.h>
9 #include <linux/virtio_ids.h>
10 #include <linux/virtio_config.h>
11 #include <linux/virtio_types.h>
12 #define VIRTIO_BLK_F_SIZE_MAX	1
13 #define VIRTIO_BLK_F_SEG_MAX	2
14 #define VIRTIO_BLK_F_GEOMETRY	4
15 #define VIRTIO_BLK_F_RO		5
16 #define VIRTIO_BLK_F_BLK_SIZE	6
17 #define VIRTIO_BLK_F_TOPOLOGY	10
18 #define VIRTIO_BLK_F_MQ		12
19 #ifndef VIRTIO_BLK_NO_LEGACY
20 #define VIRTIO_BLK_F_BARRIER	0
21 #define VIRTIO_BLK_F_SCSI	7
22 #define VIRTIO_BLK_F_FLUSH	9
23 #define VIRTIO_BLK_F_CONFIG_WCE	11
24 #ifndef __KERNEL__
25 #define VIRTIO_BLK_F_WCE VIRTIO_BLK_F_FLUSH
26 #endif
27 #endif
28 #define VIRTIO_BLK_ID_BYTES	20
29 struct virtio_blk_config {
30 
31 	__u64 capacity;
32 
33 	__u32 size_max;
34 
35 	__u32 seg_max;
36 
37 	struct virtio_blk_geometry {
38 		__u16 cylinders;
39 		__u8 heads;
40 		__u8 sectors;
41 	} geometry;
42 
43 	__u32 blk_size;
44 
45 
46 	__u8 physical_block_exp;
47 
48 	__u8 alignment_offset;
49 
50 	__u16 min_io_size;
51 
52 	__u32 opt_io_size;
53 
54 	__u8 wce;
55 	__u8 unused;
56 
57 	__u16 num_queues;
58 } __attribute__((packed));
59 #define VIRTIO_BLK_T_IN		0
60 #define VIRTIO_BLK_T_OUT	1
61 #ifndef VIRTIO_BLK_NO_LEGACY
62 #define VIRTIO_BLK_T_SCSI_CMD	2
63 #endif
64 #define VIRTIO_BLK_T_FLUSH	4
65 #define VIRTIO_BLK_T_GET_ID    8
66 #ifndef VIRTIO_BLK_NO_LEGACY
67 #define VIRTIO_BLK_T_BARRIER	0x80000000
68 #endif
69 struct virtio_blk_outhdr {
70 
71 	__virtio32 type;
72 
73 	__virtio32 ioprio;
74 
75 	__virtio64 sector;
76 };
77 #ifndef VIRTIO_BLK_NO_LEGACY
78 struct virtio_scsi_inhdr {
79 	__virtio32 errors;
80 	__virtio32 data_len;
81 	__virtio32 sense_len;
82 	__virtio32 residual;
83 };
84 #endif
85 #define VIRTIO_BLK_S_OK		0
86 #define VIRTIO_BLK_S_IOERR	1
87 #define VIRTIO_BLK_S_UNSUPP	2
88 #endif
89