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
31#include <linux/virtio_types.h>31#include <linux/virtio_types.h>
32 32
33/* Feature bits */33/* Feature bits */
34#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
35#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */34#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
36#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */35#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
37#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */36#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
38#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */37#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
39#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/38#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 */
42#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */39#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
43#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */
44#define VIRTIO_BLK_F_MQ 12 /* support more than one vq */40#define VIRTIO_BLK_F_MQ 12 /* support more than one vq */
45 41
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 */
46#ifndef __KERNEL__48#ifndef __KERNEL__
47/* Old (deprecated) name for VIRTIO_BLK_F_WCE. */49/* Old (deprecated) name for VIRTIO_BLK_F_WCE. */
48#define VIRTIO_BLK_F_FLUSH VIRTIO_BLK_F_WCE50#define VIRTIO_BLK_F_FLUSH VIRTIO_BLK_F_WCE
49#endif51#endif
52#endif /* !VIRTIO_BLK_NO_LEGACY */
50 53
51#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */54#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */
52 55
@@ -100,8 +103,10 @@ struct virtio_blk_config { · 47 unmodified lines
100#define VIRTIO_BLK_T_IN 0103#define VIRTIO_BLK_T_IN 0
101#define VIRTIO_BLK_T_OUT 1104#define VIRTIO_BLK_T_OUT 1
102 105
106#ifndef VIRTIO_BLK_NO_LEGACY
103/* This bit says it's a scsi command, not an actual read or write. */107/* This bit says it's a scsi command, not an actual read or write. */
104#define VIRTIO_BLK_T_SCSI_CMD 2108#define VIRTIO_BLK_T_SCSI_CMD 2
109#endif /* VIRTIO_BLK_NO_LEGACY */
105 110
106/* Cache flush command */111/* Cache flush command */
107#define VIRTIO_BLK_T_FLUSH 4112#define VIRTIO_BLK_T_FLUSH 4
@@ -109,8 +114,10 @@ struct virtio_blk_config { · 1 unmodified line
109/* Get device ID command */114/* Get device ID command */
110#define VIRTIO_BLK_T_GET_ID 8115#define VIRTIO_BLK_T_GET_ID 8
111 116
117#ifndef VIRTIO_BLK_NO_LEGACY
112/* Barrier before this op. */118/* Barrier before this op. */
113#define VIRTIO_BLK_T_BARRIER 0x80000000119#define VIRTIO_BLK_T_BARRIER 0x80000000
120#endif /* !VIRTIO_BLK_NO_LEGACY */
114 121
115/* This is the first element of the read scatter-gather list. */122/* This is the first element of the read scatter-gather list. */
116struct virtio_blk_outhdr {123struct virtio_blk_outhdr {
@@ -122,12 +129,14 @@ struct virtio_blk_outhdr { · 5 unmodified lines
122 __virtio64 sector;129 __virtio64 sector;
123};130};
124 131
132#ifndef VIRTIO_BLK_NO_LEGACY
125struct virtio_scsi_inhdr {133struct virtio_scsi_inhdr {
126 __virtio32 errors;134 __virtio32 errors;
127 __virtio32 data_len;135 __virtio32 data_len;
128 __virtio32 sense_len;136 __virtio32 sense_len;
129 __virtio32 residual;137 __virtio32 residual;
130};138};
139#endif /* !VIRTIO_BLK_NO_LEGACY */
131 140
132/* And this is the final byte of the write scatter-gather list. */141/* And this is the final byte of the write scatter-gather list. */
133#define VIRTIO_BLK_S_OK 0142#define VIRTIO_BLK_S_OK 0