qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: fred.konrad@greensocs.com
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
Subject: [Qemu-devel] [PATCH v3 1/8] virtio-rng: don't use pointer for configuration.
Date: Sun, 14 Apr 2013 15:01:03 +0200	[thread overview]
Message-ID: <1365944470-13837-2-git-send-email-fred.konrad@greensocs.com> (raw)
In-Reply-To: <1365944470-13837-1-git-send-email-fred.konrad@greensocs.com>

From: KONRAD Frederic <fred.konrad@greensocs.com>

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 <fred.konrad@greensocs.com>
---
 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

  reply	other threads:[~2013-04-14 13:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14 13:01 [Qemu-devel] [PATCH v3 0/8] virtio-rng refactoring fred.konrad
2013-04-14 13:01 ` fred.konrad [this message]
2013-04-14 13:01 ` [Qemu-devel] [PATCH v3 2/8] virtio-rng: add virtio-rng device fred.konrad
2013-04-14 13:01 ` [Qemu-devel] [PATCH v3 3/8] virtio-rng-pci: switch to the new API fred.konrad
2013-04-14 13:01 ` [Qemu-devel] [PATCH v3 4/8] virtio-rng-s390: " fred.konrad
2013-04-14 13:01 ` [Qemu-devel] [PATCH v3 5/8] virtio-rng-ccw: " fred.konrad
2013-04-14 13:01 ` [Qemu-devel] [PATCH v3 6/8] virtio-rng: cleanup: init and exit functions fred.konrad
2013-04-14 13:01 ` [Qemu-devel] [PATCH v3 7/8] virtio-rng: cleanup: remove qdev field fred.konrad
2013-04-14 13:01 ` [Qemu-devel] [PATCH v3 8/8] virtio-rng: cleanup: use QOM casts fred.konrad
2013-04-15 13:34   ` Andreas Färber
2013-04-15 14:33     ` KONRAD Frédéric
2013-04-15 17:06       ` Andreas Färber
2013-04-15 13:12 ` [Qemu-devel] [PATCH v3 0/8] virtio-rng refactoring Cornelia Huck
2013-04-16  9:51 ` Amit Shah

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1365944470-13837-2-git-send-email-fred.konrad@greensocs.com \
    --to=fred.konrad@greensocs.com \
    --cc=aliguori@us.ibm.com \
    --cc=amit.shah@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=mark.burton@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).