All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, mst@redhat.com, amit.shah@redhat.com,
	quintela@redhat.com
Cc: cornelia.huck@de.ibm.com, kraxel@redhat.com
Subject: [Qemu-devel] [PATCH v3 11/14] virtio-input: Wrap in vmstate
Date: Thu, 14 Jul 2016 18:22:53 +0100	[thread overview]
Message-ID: <1468516976-20140-12-git-send-email-dgilbert@redhat.com> (raw)
In-Reply-To: <1468516976-20140-1-git-send-email-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Forcibly convert it to a vmstate wrapper;  proper conversion
comes later.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/input/virtio-input.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c
index edf6990..a87fd68 100644
--- a/hw/input/virtio-input.c
+++ b/hw/input/virtio-input.c
@@ -217,26 +217,14 @@ static void virtio_input_reset(VirtIODevice *vdev)
     }
 }
 
-static void virtio_input_save(QEMUFile *f, void *opaque)
-{
-    VirtIOInput *vinput = opaque;
-    VirtIODevice *vdev = VIRTIO_DEVICE(vinput);
-
-    virtio_save(vdev, f);
-}
-
-static int virtio_input_load(QEMUFile *f, void *opaque, int version_id)
+static int virtio_input_load(QEMUFile *f, void *opaque, size_t size)
 {
     VirtIOInput *vinput = opaque;
     VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(vinput);
     VirtIODevice *vdev = VIRTIO_DEVICE(vinput);
     int ret;
 
-    if (version_id != VIRTIO_INPUT_VM_VERSION) {
-        return -EINVAL;
-    }
-
-    ret = virtio_load(vdev, f, version_id);
+    ret = virtio_load(vdev, f, VIRTIO_INPUT_VM_VERSION);
     if (ret) {
         return ret;
     }
@@ -280,20 +268,14 @@ static void virtio_input_device_realize(DeviceState *dev, Error **errp)
                 vinput->cfg_size);
     vinput->evt = virtio_add_queue(vdev, 64, virtio_input_handle_evt);
     vinput->sts = virtio_add_queue(vdev, 64, virtio_input_handle_sts);
-
-    register_savevm(dev, "virtio-input", -1, VIRTIO_INPUT_VM_VERSION,
-                    virtio_input_save, virtio_input_load, vinput);
 }
 
 static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
 {
     VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(dev);
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
-    VirtIOInput *vinput = VIRTIO_INPUT(dev);
     Error *local_err = NULL;
 
-    unregister_savevm(dev, "virtio-input", vinput);
-
     if (vic->unrealize) {
         vic->unrealize(dev, &local_err);
         if (local_err) {
@@ -304,6 +286,9 @@ static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
     virtio_cleanup(vdev);
 }
 
+VMSTATE_VIRTIO_DEVICE(input, VIRTIO_INPUT_VM_VERSION, virtio_input_load,
+                      virtio_vmstate_save);
+
 static Property virtio_input_properties[] = {
     DEFINE_PROP_STRING("serial", VirtIOInput, serial),
     DEFINE_PROP_END_OF_LIST(),
@@ -315,6 +300,7 @@ static void virtio_input_class_init(ObjectClass *klass, void *data)
     VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
 
     dc->props          = virtio_input_properties;
+    dc->vmsd           = &vmstate_virtio_input;
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
     vdc->realize      = virtio_input_device_realize;
     vdc->unrealize    = virtio_input_device_unrealize;
-- 
2.7.4

  parent reply	other threads:[~2016-07-14 17:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-14 17:22 [Qemu-devel] [PATCH v3 00/14] virtio migration: Flip outer layer to vmstate Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 01/14] virtio-net: Remove old migration version support Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 02/14] virtio-serial: " Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 03/14] virtio: Migration helper function and macro Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 04/14] virtio-scsi: Wrap in vmstate Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 05/14] virtio-blk: " Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 06/14] virtio-rng: " Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 07/14] virtio-balloon: " Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 08/14] virtio-net: " Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 09/14] virtio-serial: " Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 10/14] 9pfs: " Dr. David Alan Gilbert (git)
2016-07-14 17:22 ` Dr. David Alan Gilbert (git) [this message]
2016-07-15  9:56   ` [Qemu-devel] [PATCH v3 11/14] virtio-input: " Gerd Hoffmann
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 12/14] virtio-gpu: Use migrate_add_blocker for virgl migration blocking Dr. David Alan Gilbert (git)
2016-07-15  8:21   ` Cornelia Huck
2016-07-15  9:57   ` Gerd Hoffmann
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 13/14] virtio-gpu: Wrap in vmstate Dr. David Alan Gilbert (git)
2016-07-15  9:56   ` Gerd Hoffmann
2016-07-14 17:22 ` [Qemu-devel] [PATCH v3 14/14] virtio: Update migration docs Dr. David Alan Gilbert (git)
2016-07-15  8:23 ` [Qemu-devel] [PATCH v3 00/14] virtio migration: Flip outer layer to vmstate Cornelia Huck
2016-07-15 12:43   ` 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=1468516976-20140-12-git-send-email-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.