]> git.ipfire.org Git - thirdparty/qemu.git/commit
vhost: Add high-level state save/load functions
authorHanna Czenczek <hreitz@redhat.com>
Mon, 16 Oct 2023 13:42:42 +0000 (15:42 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 7 Nov 2023 08:39:10 +0000 (03:39 -0500)
commit4a00d5d7f4b65ba99b33d5a0d6f8c563895839ea
tree19b78cd1a6bfcbf60a1b216241699229abccecb2
parentcda83adc62b6108afc8a82d0f54d9a9a861e7aa8
vhost: Add high-level state save/load functions

vhost_save_backend_state() and vhost_load_backend_state() can be used by
vhost front-ends to easily save and load the back-end's state to/from
the migration stream.

Because we do not know the full state size ahead of time,
vhost_save_backend_state() simply reads the data in 1 MB chunks, and
writes each chunk consecutively into the migration stream, prefixed by
its length.  EOF is indicated by a 0-length chunk.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-Id: <20231016134243.68248-7-hreitz@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/vhost.c
include/hw/virtio/vhost.h