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-blk-x.
Signed-off-by: KONRAD Frederic <fred.kon...@greensocs.com> --- hw/virtio-blk.c | 16 ---------------- hw/virtio-blk.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index df57b35..38a53e9 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -25,22 +25,6 @@ # include <scsi/sg.h> #endif -typedef struct VirtIOBlock -{ - VirtIODevice vdev; - BlockDriverState *bs; - VirtQueue *vq; - void *rq; - QEMUBH *bh; - BlockConf *conf; - VirtIOBlkConf *blk; - unsigned short sector_mask; - DeviceState *qdev; -#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE - VirtIOBlockDataPlane *dataplane; -#endif -} VirtIOBlock; - static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev) { return (VirtIOBlock *)vdev; diff --git a/hw/virtio-blk.h b/hw/virtio-blk.h index 43ca492..2a7aef2 100644 --- a/hw/virtio-blk.h +++ b/hw/virtio-blk.h @@ -108,6 +108,21 @@ struct VirtIOBlkConf uint32_t data_plane; }; +typedef struct VirtIOBlock { + VirtIODevice vdev; + BlockDriverState *bs; + VirtQueue *vq; + void *rq; + QEMUBH *bh; + BlockConf *conf; + VirtIOBlkConf *blk; + unsigned short sector_mask; + DeviceState *qdev; +#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE + VirtIOBlockDataPlane *dataplane; +#endif +} VirtIOBlock; + #define DEFINE_VIRTIO_BLK_FEATURES(_state, _field) \ DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) -- 1.7.11.7