History

virtio: Don't expose legacy block features when VIRTIO_BLK_NO_LEGACY defined.

This allows modern implementations to ensure they don't use legacy feature bits or SCSI commands (which are not used in v1.0 non-legacy).

Rusty Russell committed 11 years ago

Commit 527100a1 parent e6a02741 file · +13 −4Browse files

Showing the changes to include/uapi/linux (1 of 1 file). Show all

Unified · Split

include/uapi/linux/virtio_blk.h+13−4
@@ -31,22 +31,25 @@ · 30 unmodified lines
3131 #include <linux/virtio_types.h>
3232
3333 /* Feature bits */
34−#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
3534 #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
3635 #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
3736 #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
3837 #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
3938 #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
40−#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
41−#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */
4239 #define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
43−#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */
4440 #define VIRTIO_BLK_F_MQ 12 /* support more than one vq */
4541
42+/* Legacy feature bits */
43+#ifndef VIRTIO_BLK_NO_LEGACY
44+#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
45+#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
46+#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */
47+#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */
4648 #ifndef __KERNEL__
4749 /* Old (deprecated) name for VIRTIO_BLK_F_WCE. */
4850 #define VIRTIO_BLK_F_FLUSH VIRTIO_BLK_F_WCE
4951 #endif
52+#endif /* !VIRTIO_BLK_NO_LEGACY */
5053
5154 #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */
5255
@@ -100,8 +103,10 @@ struct virtio_blk_config { · 47 unmodified lines
100103 #define VIRTIO_BLK_T_IN 0
101104 #define VIRTIO_BLK_T_OUT 1
102105
106+#ifndef VIRTIO_BLK_NO_LEGACY
103107 /* This bit says it's a scsi command, not an actual read or write. */
104108 #define VIRTIO_BLK_T_SCSI_CMD 2
109+#endif /* VIRTIO_BLK_NO_LEGACY */
105110
106111 /* Cache flush command */
107112 #define VIRTIO_BLK_T_FLUSH 4
@@ -109,8 +114,10 @@ struct virtio_blk_config { · 1 unmodified line
109114 /* Get device ID command */
110115 #define VIRTIO_BLK_T_GET_ID 8
111116
117+#ifndef VIRTIO_BLK_NO_LEGACY
112118 /* Barrier before this op. */
113119 #define VIRTIO_BLK_T_BARRIER 0x80000000
120+#endif /* !VIRTIO_BLK_NO_LEGACY */
114121
115122 /* This is the first element of the read scatter-gather list. */
116123 struct virtio_blk_outhdr {
@@ -122,12 +129,14 @@ struct virtio_blk_outhdr { · 5 unmodified lines
122129 __virtio64 sector;
123130 };
124131
132+#ifndef VIRTIO_BLK_NO_LEGACY
125133 struct virtio_scsi_inhdr {
126134 __virtio32 errors;
127135 __virtio32 data_len;
128136 __virtio32 sense_len;
129137 __virtio32 residual;
130138 };
139+#endif /* !VIRTIO_BLK_NO_LEGACY */
131140
132141 /* And this is the final byte of the write scatter-gather list. */
133142 #define VIRTIO_BLK_S_OK 0