[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 05/22] virtio-blk: implement per-device migration
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH v9 05/22] virtio-blk: implement per-device migration calls |
Date: |
Tue, 24 Jun 2014 19:19:23 +0200 |
User-agent: |
StGit/0.17-dirty |
Signed-off-by: Greg Kurz <address@hidden>
Reviewed-by: Alexander Graf <address@hidden>
---
hw/block/virtio-blk.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 3b34ce9..fd32a6a 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -601,12 +601,16 @@ static void virtio_blk_set_status(VirtIODevice *vdev,
uint8_t status)
static void virtio_blk_save(QEMUFile *f, void *opaque)
{
- VirtIOBlock *s = opaque;
- VirtIODevice *vdev = VIRTIO_DEVICE(s);
- VirtIOBlockReq *req = s->rq;
+ VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
virtio_save(vdev, f);
+}
+static void virtio_blk_save_device(VirtIODevice *vdev, QEMUFile *f)
+{
+ VirtIOBlock *s = VIRTIO_BLK(vdev);
+ VirtIOBlockReq *req = s->rq;
+
while (req) {
qemu_put_sbyte(f, 1);
qemu_put_buffer(f, (unsigned char*)&req->elem, sizeof(req->elem));
@@ -619,15 +623,17 @@ static int virtio_blk_load(QEMUFile *f, void *opaque, int
version_id)
{
VirtIOBlock *s = opaque;
VirtIODevice *vdev = VIRTIO_DEVICE(s);
- int ret;
if (version_id != 2)
return -EINVAL;
- ret = virtio_load(vdev, f, version_id);
- if (ret) {
- return ret;
- }
+ return virtio_load(vdev, f, version_id);
+}
+
+static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f,
+ int version_id)
+{
+ VirtIOBlock *s = VIRTIO_BLK(vdev);
while (qemu_get_sbyte(f)) {
VirtIOBlockReq *req = virtio_blk_alloc_request(s);
@@ -786,6 +792,8 @@ static void virtio_blk_class_init(ObjectClass *klass, void
*data)
vdc->get_features = virtio_blk_get_features;
vdc->set_status = virtio_blk_set_status;
vdc->reset = virtio_blk_reset;
+ vdc->save = virtio_blk_save_device;
+ vdc->load = virtio_blk_load_device;
}
static const TypeInfo virtio_device_info = {
- [Qemu-devel] [PATCH v9 00/22] legacy virtio support for cross-endian targets, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 01/22] virtio-net: byteswap virtio-net header, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 02/22] virtio-serial: don't migrate the config space, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 03/22] virtio: introduce device specific migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 04/22] virtio-net: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 05/22] virtio-blk: implement per-device migration calls,
Greg Kurz <=
- [Qemu-devel] [PATCH v9 06/22] virtio-serial: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 07/22] virtio-balloon: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 08/22] virtio-rng: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 09/22] virtio: add subsections to the migration stream, Greg Kurz, 2014/06/24
- Re: [Qemu-devel] [PATCH v9 00/22] legacy virtio support for cross-endian targets, Michael S. Tsirkin, 2014/06/24
- [Qemu-devel] [PATCH v9 10/22] exec: introduce target_words_bigendian() helper, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 11/22] cpu: introduce CPUClass::virtio_is_big_endian(), Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 12/22] virtio: add endian-ambivalent support to VirtIODevice, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 13/22] virtio: memory accessors for endian-ambivalent targets, Greg Kurz, 2014/06/24