qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 39/61] virtio-rng : don't use pointer for configurat


From: fred . konrad
Subject: [Qemu-devel] [PATCH 39/61] virtio-rng : don't use pointer for configuration.
Date: Mon, 7 Jan 2013 19:40:52 +0100

From: KONRAD Frederic <address@hidden>

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 <address@hidden>
---
 hw/virtio-rng.c | 12 ++++++------
 hw/virtio-rng.h |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/virtio-rng.c b/hw/virtio-rng.c
index d79aa46..e672c40 100644
--- a/hw/virtio-rng.c
+++ b/hw/virtio-rng.c
@@ -123,10 +123,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);
 }
 
 
@@ -158,16 +158,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/hw/virtio-rng.h b/hw/virtio-rng.h
index 3711c97..3deb283 100644
--- a/hw/virtio-rng.h
+++ b/hw/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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]