From: KONRAD Frederic <fred.kon...@greensocs.com> As we discuss with anthony and andreas, this structure must be showed to avoid two memory allocations for virtio-scsi-x.
Signed-off-by: KONRAD Frederic <fred.kon...@greensocs.com> --- hw/virtio-scsi.c | 15 --------------- hw/virtio-scsi.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c index bfe1860..4e2d884 100644 --- a/hw/virtio-scsi.c +++ b/hw/virtio-scsi.c @@ -129,21 +129,6 @@ typedef struct { uint32_t max_lun; } QEMU_PACKED VirtIOSCSIConfig; -typedef struct { - VirtIODevice vdev; - DeviceState *qdev; - VirtIOSCSIConf *conf; - - SCSIBus bus; - uint32_t sense_size; - uint32_t cdb_size; - int resetting; - bool events_dropped; - VirtQueue *ctrl_vq; - VirtQueue *event_vq; - VirtQueue *cmd_vqs[0]; -} VirtIOSCSI; - typedef struct VirtIOSCSIReq { VirtIOSCSI *dev; VirtQueue *vq; diff --git a/hw/virtio-scsi.h b/hw/virtio-scsi.h index 8d9d15f..38b9c0f 100644 --- a/hw/virtio-scsi.h +++ b/hw/virtio-scsi.h @@ -16,6 +16,7 @@ #include "virtio.h" #include "pci/pci.h" +#include <hw/scsi.h> /* The ID for virtio_scsi */ #define VIRTIO_ID_SCSI 8 @@ -31,6 +32,21 @@ struct VirtIOSCSIConf { uint32_t cmd_per_lun; }; +typedef struct { + VirtIODevice vdev; + DeviceState *qdev; + VirtIOSCSIConf *conf; + + SCSIBus bus; + uint32_t sense_size; + uint32_t cdb_size; + int resetting; + bool events_dropped; + VirtQueue *ctrl_vq; + VirtQueue *event_vq; + VirtQueue *cmd_vqs[0]; +} VirtIOSCSI; + #define DEFINE_VIRTIO_SCSI_PROPERTIES(_state, _features_field, _conf_field) \ DEFINE_VIRTIO_COMMON_FEATURES(_state, _features_field), \ DEFINE_PROP_UINT32("num_queues", _state, _conf_field.num_queues, 1), \ -- 1.7.11.7