From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URMYb-0002rm-Kz for qemu-devel@nongnu.org; Sun, 14 Apr 2013 09:01:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1URMYa-0001K9-FG for qemu-devel@nongnu.org; Sun, 14 Apr 2013 09:01:21 -0400 Received: from greensocs.com ([87.106.252.221]:34273 helo=s15328186.onlinehome-server.info) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1URMYa-0001Jv-9v for qemu-devel@nongnu.org; Sun, 14 Apr 2013 09:01:20 -0400 From: fred.konrad@greensocs.com Date: Sun, 14 Apr 2013 15:01:03 +0200 Message-Id: <1365944470-13837-2-git-send-email-fred.konrad@greensocs.com> In-Reply-To: <1365944470-13837-1-git-send-email-fred.konrad@greensocs.com> References: <1365944470-13837-1-git-send-email-fred.konrad@greensocs.com> Subject: [Qemu-devel] [PATCH v3 1/8] virtio-rng: don't use pointer for configuration. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, aliguori@us.ibm.com, amit.shah@redhat.com Cc: cornelia.huck@de.ibm.com, peter.maydell@linaro.org, mark.burton@greensocs.com, fred.konrad@greensocs.com From: KONRAD Frederic The configuration field must not be a pointer as it will be used for virtio-rng properties. So *conf is replaced by conf. Signed-off-by: KONRAD Frederic --- hw/virtio/virtio-rng.c | 12 ++++++------ include/hw/virtio/virtio-rng.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 6079b2a..5a5e049 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -124,10 +124,10 @@ static void check_rate_limit(void *opaque) { VirtIORNG *s = opaque; - s->quota_remaining = s->conf->max_bytes; + s->quota_remaining = s->conf.max_bytes; virtio_rng_process(s); qemu_mod_timer(s->rate_limit_timer, - qemu_get_clock_ms(vm_clock) + s->conf->period_ms); + qemu_get_clock_ms(vm_clock) + s->conf.period_ms); } @@ -159,16 +159,16 @@ VirtIODevice *virtio_rng_init(DeviceState *dev, VirtIORNGConf *conf) vrng->vdev.get_features = get_features; vrng->qdev = dev; - vrng->conf = conf; + memcpy(&(vrng->conf), conf, sizeof(struct VirtIORNGConf)); - assert(vrng->conf->max_bytes <= INT64_MAX); - vrng->quota_remaining = vrng->conf->max_bytes; + assert(vrng->conf.max_bytes <= INT64_MAX); + vrng->quota_remaining = vrng->conf.max_bytes; vrng->rate_limit_timer = qemu_new_timer_ms(vm_clock, check_rate_limit, vrng); qemu_mod_timer(vrng->rate_limit_timer, - qemu_get_clock_ms(vm_clock) + vrng->conf->period_ms); + qemu_get_clock_ms(vm_clock) + vrng->conf.period_ms); register_savevm(dev, "virtio-rng", -1, 1, virtio_rng_save, virtio_rng_load, vrng); diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h index 3711c97..3deb283 100644 --- a/include/hw/virtio/virtio-rng.h +++ b/include/hw/virtio/virtio-rng.h @@ -33,7 +33,7 @@ typedef struct VirtIORNG { /* Only one vq - guest puts buffer(s) on it when it needs entropy */ VirtQueue *vq; - VirtIORNGConf *conf; + VirtIORNGConf conf; RngBackend *rng; -- 1.7.11.7