aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-04-05 21:27:53 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-04-15 08:26:18 +0200
commitcf8074b3825f7229a20c60e679511592bde41340 (patch)
tree0d44731c8ec33903dd131295f76c8cd6da9b9c7a /block.c
parente2ec3f976803b360c70d9ae2ba13852fa5d11665 (diff)
block: Introduce bdrv_writev_vmstate
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/block.c b/block.c
index 602d8a443e..175497e678 100644
--- a/block.c
+++ b/block.c
@@ -3184,13 +3184,28 @@ int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
int64_t pos, int size)
{
+ QEMUIOVector qiov;
+ struct iovec iov = {
+ .iov_base = (void *) buf,
+ .iov_len = size,
+ };
+
+ qemu_iovec_init_external(&qiov, &iov, 1);
+ return bdrv_writev_vmstate(bs, &qiov, pos);
+}
+
+int bdrv_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)
+{
BlockDriver *drv = bs->drv;
- if (!drv)
+
+ if (!drv) {
return -ENOMEDIUM;
- if (drv->bdrv_save_vmstate)
- return drv->bdrv_save_vmstate(bs, buf, pos, size);
- if (bs->file)
- return bdrv_save_vmstate(bs->file, buf, pos, size);
+ } else if (drv->bdrv_save_vmstate) {
+ return drv->bdrv_save_vmstate(bs, qiov, pos);
+ } else if (bs->file) {
+ return bdrv_writev_vmstate(bs->file, qiov, pos);
+ }
+
return -ENOTSUP;
}