All of lore.kernel.org
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.vnet.ibm.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Amit Shah <amit.shah@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Halil Pasic <pasic@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 11/12] vhost-vsock: convert to VIRTIO_DEF_DEVICE_VMSD
Date: Fri, 30 Sep 2016 16:20:02 +0200	[thread overview]
Message-ID: <20160930142003.53232-12-pasic@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160930142003.53232-1-pasic@linux.vnet.ibm.com>

Refactor so the previously introduced VIRTIO_DEF_DEVICE_VMSD
replaces VMSTATE_VIRTIO_DEVICE.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
---
 hw/virtio/vhost-vsock.c | 33 ++++++++++++---------------------
 1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index bde2456..3c2763e 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -236,17 +236,6 @@ out:
     g_free(elem);
 }
 
-static void vhost_vsock_save(QEMUFile *f, void *opaque, size_t size)
-{
-    VHostVSock *vsock = opaque;
-    VirtIODevice *vdev = VIRTIO_DEVICE(vsock);
-
-    /* At this point, backend must be stopped, otherwise
-     * it might keep writing to memory. */
-    assert(!vsock->vhost_dev.started);
-    virtio_save(vdev, f);
-}
-
 static void vhost_vsock_post_load_timer_cleanup(VHostVSock *vsock)
 {
     if (!vsock->post_load_timer) {
@@ -266,16 +255,19 @@ static void vhost_vsock_post_load_timer_cb(void *opaque)
     vhost_vsock_send_transport_reset(vsock);
 }
 
-static int vhost_vsock_load(QEMUFile *f, void *opaque, size_t size)
+static void vhost_vsock_pre_save(void *opaque)
+{
+    VHostVSock *vsock = opaque;
+
+    /* At this point, backend must be stopped, otherwise
+     * it might keep writing to memory. */
+    assert(!vsock->vhost_dev.started);
+}
+
+static int vhost_vsock_post_load(void *opaque, int version_id)
 {
     VHostVSock *vsock = opaque;
     VirtIODevice *vdev = VIRTIO_DEVICE(vsock);
-    int ret;
-
-    ret = virtio_load(vdev, f, VHOST_VSOCK_SAVEVM_VERSION);
-    if (ret) {
-        return ret;
-    }
 
     if (virtio_queue_get_addr(vdev, 2)) {
         /* Defer transport reset event to a vm clock timer so that virtqueue
@@ -288,12 +280,11 @@ static int vhost_vsock_load(QEMUFile *f, void *opaque, size_t size)
                          vsock);
         timer_mod(vsock->post_load_timer, 1);
     }
-
     return 0;
 }
 
-VMSTATE_VIRTIO_DEVICE(vhost_vsock, VHOST_VSOCK_SAVEVM_VERSION,
-                      vhost_vsock_load, vhost_vsock_save);
+VIRTIO_DEF_DEVICE_VMSD(vhost_vsock, VHOST_VSOCK_SAVEVM_VERSION,
+    .pre_save = vhost_vsock_pre_save, .post_load = vhost_vsock_post_load)
 
 static void vhost_vsock_device_realize(DeviceState *dev, Error **errp)
 {
-- 
2.8.4

  parent reply	other threads:[~2016-09-30 14:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30 14:19 [Qemu-devel] [PATCH 00/11] virtio migration: simplify vmstate helper Halil Pasic
2016-09-30 14:19 ` [Qemu-devel] [PATCH 01/12] virtio: add VIRTIO_DEF_DEVICE_VMSD macro Halil Pasic
2016-09-30 14:50   ` Paolo Bonzini
2016-10-03 10:36     ` Halil Pasic
2016-10-03 11:29       ` Paolo Bonzini
2016-10-03 13:34         ` Halil Pasic
2016-10-03 15:24           ` Paolo Bonzini
2016-10-04  8:00             ` Halil Pasic
2016-10-05 14:29             ` Dr. David Alan Gilbert
2016-10-05 15:52               ` Paolo Bonzini
2016-10-05 19:00                 ` Dr. David Alan Gilbert
2016-10-06  9:43                   ` Paolo Bonzini
2016-10-06 11:08                   ` Halil Pasic
2016-10-06 10:54                 ` Halil Pasic
2016-09-30 14:19 ` [Qemu-devel] [PATCH 02/12] virtio-blk: convert to VIRTIO_DEF_DEVICE_VMSD Halil Pasic
2016-09-30 14:19 ` [Qemu-devel] [PATCH 03/12] virtio-net: " Halil Pasic
2016-09-30 14:19 ` [Qemu-devel] [PATCH 04/12] virtio-9p: " Halil Pasic
2016-09-30 14:19 ` [Qemu-devel] [PATCH 05/12] virtio-serial: " Halil Pasic
2016-09-30 14:19 ` [Qemu-devel] [PATCH 06/12] virtio-gpu: do not use VMSTATE_VIRTIO_DEVICE Halil Pasic
2016-09-30 14:19 ` [Qemu-devel] [PATCH 07/12] virtio-input: convert to VIRTIO_DEF_DEVICE_VMSD Halil Pasic
2016-09-30 14:19 ` [Qemu-devel] [PATCH 08/12] virtio-scsi: " Halil Pasic
2016-09-30 14:20 ` [Qemu-devel] [PATCH 09/12] virtio-balloon: " Halil Pasic
2016-09-30 14:20 ` [Qemu-devel] [PATCH 10/12] virtio-rng: " Halil Pasic
2016-09-30 14:20 ` Halil Pasic [this message]
2016-09-30 14:20 ` [Qemu-devel] [PATCH 12/12] virtio: remove unused VMSTATE_VIRTIO_DEVICE Halil Pasic
2016-09-30 15:02 ` [Qemu-devel] [PATCH 00/11] virtio migration: simplify vmstate helper Paolo Bonzini
2016-09-30 15:51   ` Dr. David Alan Gilbert
2016-10-03 10:04   ` Halil Pasic
2016-10-03 10:06     ` Paolo Bonzini

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=20160930142003.53232-12-pasic@linux.vnet.ibm.com \
    --to=pasic@linux.vnet.ibm.com \
    --cc=amit.shah@redhat.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=dgilbert@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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.