qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 34/41] virtio-console: port to vmstate


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 34/41] virtio-console: port to vmstate
Date: Wed, 2 Dec 2009 13:04:32 +0100

Signed-off-by: Juan Quintela <address@hidden>
---
 hw/virtio-console.c |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 57f5e9d..1ebb3dd 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -100,23 +100,16 @@ static void vcon_event(void *opaque, int event)
     /* we will ignore any event for the time being */
 }

-static void virtio_console_save(QEMUFile *f, void *opaque)
-{
-    VirtIOConsole *s = opaque;
-
-    virtio_save(&s->vdev, f);
-}
-
-static int virtio_console_load(QEMUFile *f, void *opaque, int version_id)
-{
-    VirtIOConsole *s = opaque;
-
-    if (version_id != 1)
-        return -EINVAL;
-
-    virtio_load(&s->vdev, f);
-    return 0;
-}
+static const VMStateDescription vmstate_virtio_console = {
+    .name = "virtio-console",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_VIRTIO(vdev, VirtIOConsole),
+        VMSTATE_END_OF_LIST()
+    }
+};

 VirtIODevice *virtio_console_init(DeviceState *dev)
 {
@@ -133,7 +126,7 @@ VirtIODevice *virtio_console_init(DeviceState *dev)
     s->chr = qdev_init_chardev(dev);
     qemu_chr_add_handlers(s->chr, vcon_can_read, vcon_read, vcon_event, s);

-    register_savevm("virtio-console", -1, 1, virtio_console_save, 
virtio_console_load, s);
+    vmstate_register(-1, &vmstate_virtio_console, s);

     return &s->vdev;
 }
-- 
1.6.5.2





reply via email to

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