From 394e2e4c59294f2c5da58d2970693667218c7cf3 Mon Sep 17 00:00:00 2001 From: KONRAD Frederic Date: Thu, 21 Mar 2013 15:15:11 +0100 Subject: [PATCH] virtio-scsi: don't use pointer for configuration. The configuration field must not be a pointer as it will be used for virtio-scsi properties. So *conf is replaced by conf. Signed-off-by: KONRAD Frederic Reviewed-by: Cornelia Huck Reviewed-by: Peter Maydell Tested-by: Cornelia Huck Message-id: 1363875320-7985-2-git-send-email-fred.konrad@greensocs.com Signed-off-by: Anthony Liguori --- hw/virtio-scsi.c | 14 +++++++------- hw/virtio-scsi.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/virtio-scsi.c b/hw/virtio-scsi.c index 86207124a2..55191c566c 100644 --- a/hw/virtio-scsi.c +++ b/hw/virtio-scsi.c @@ -237,7 +237,7 @@ static void virtio_scsi_save_request(QEMUFile *f, SCSIRequest *sreq) VirtIOSCSIReq *req = sreq->hba_private; uint32_t n = virtio_queue_get_id(req->vq) - 2; - assert(n < req->dev->conf->num_queues); + assert(n < req->dev->conf.num_queues); qemu_put_be32s(f, &n); qemu_put_buffer(f, (unsigned char *)&req->elem, sizeof(req->elem)); } @@ -251,7 +251,7 @@ static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq) req = g_malloc(sizeof(*req)); qemu_get_be32s(f, &n); - assert(n < s->conf->num_queues); + assert(n < s->conf.num_queues); qemu_get_buffer(f, (unsigned char *)&req->elem, sizeof(req->elem)); virtio_scsi_parse_req(s, s->cmd_vqs[n], req); @@ -513,10 +513,10 @@ static void virtio_scsi_get_config(VirtIODevice *vdev, VirtIOSCSIConfig *scsiconf = (VirtIOSCSIConfig *)config; VirtIOSCSI *s = (VirtIOSCSI *)vdev; - stl_raw(&scsiconf->num_queues, s->conf->num_queues); + stl_raw(&scsiconf->num_queues, s->conf.num_queues); stl_raw(&scsiconf->seg_max, 128 - 2); - stl_raw(&scsiconf->max_sectors, s->conf->max_sectors); - stl_raw(&scsiconf->cmd_per_lun, s->conf->cmd_per_lun); + stl_raw(&scsiconf->max_sectors, s->conf.max_sectors); + stl_raw(&scsiconf->cmd_per_lun, s->conf.cmd_per_lun); stl_raw(&scsiconf->event_info_size, sizeof(VirtIOSCSIEvent)); stl_raw(&scsiconf->sense_size, s->sense_size); stl_raw(&scsiconf->cdb_size, s->cdb_size); @@ -698,7 +698,7 @@ VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf) sizeof(VirtIOSCSIConfig), sz); s->qdev = dev; - s->conf = proxyconf; + s->conf = *proxyconf; /* TODO set up vdev function pointers */ s->vdev.get_config = virtio_scsi_get_config; @@ -710,7 +710,7 @@ VirtIODevice *virtio_scsi_init(DeviceState *dev, VirtIOSCSIConf *proxyconf) virtio_scsi_handle_ctrl); s->event_vq = virtio_add_queue(&s->vdev, VIRTIO_SCSI_VQ_SIZE, virtio_scsi_handle_event); - for (i = 0; i < s->conf->num_queues; i++) { + for (i = 0; i < s->conf.num_queues; i++) { s->cmd_vqs[i] = virtio_add_queue(&s->vdev, VIRTIO_SCSI_VQ_SIZE, virtio_scsi_handle_cmd); } diff --git a/hw/virtio-scsi.h b/hw/virtio-scsi.h index ccf1e4207c..6a0a95e07b 100644 --- a/hw/virtio-scsi.h +++ b/hw/virtio-scsi.h @@ -35,7 +35,7 @@ struct VirtIOSCSIConf { typedef struct VirtIOSCSI { VirtIODevice vdev; DeviceState *qdev; - VirtIOSCSIConf *conf; + VirtIOSCSIConf conf; SCSIBus bus; uint32_t sense_size;