Patchwork [RFC,05/12] Add block_writev_buffer function

login
register
mail settings
Submitter Orit Wasserman
Date March 21, 2013, 9:09 a.m.
Message ID <1363856971-4601-6-git-send-email-owasserm@redhat.com>
Download mbox | patch
Permalink /patch/229611/
State New
Headers show

Comments

Orit Wasserman - March 21, 2013, 9:09 a.m.
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
---
 savevm.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Patch

diff --git a/savevm.c b/savevm.c
index fa07a86..2c8fb03 100644
--- a/savevm.c
+++ b/savevm.c
@@ -459,6 +459,18 @@  fail:
     return NULL;
 }
 
+static int block_writev_buffer(void *opaque, struct iovec *iov, int iovcnt)
+{
+    int i;
+    int size = 0;
+
+    for (i = 0; i < iovcnt; i++) {
+        bdrv_save_vmstate(opaque, iov[i].iov_base, 0, iov[i].iov_len);
+        size += iov[i].iov_len;
+    }
+    return size;
+}
+
 static int block_put_buffer(void *opaque, const uint8_t *buf,
                            int64_t pos, int size)
 {
@@ -483,6 +495,7 @@  static const QEMUFileOps bdrv_read_ops = {
 
 static const QEMUFileOps bdrv_write_ops = {
     .put_buffer = block_put_buffer,
+    .writev_buffer = block_writev_buffer,
     .close =      bdrv_fclose
 };