diff mbox

[12/21] savevm: qemu_pending_size() to return pending buffered size

Message ID 24f4911a409525b9353e82f6e7190f90955a3154.1325055139.git.yamahata@valinux.co.jp
State New
Headers show

Commit Message

Isaku Yamahata Dec. 29, 2011, 1:25 a.m. UTC
This will be used later by postcopy migration.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/hw.h  |    1 +
 savevm.c |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/hw/hw.h b/hw/hw.h
index 0b481ba..d508b4e 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -80,6 +80,7 @@  int qemu_get_byte(QEMUFile *f);
 int qemu_peek_byte(QEMUFile *f, int offset);
 int qemu_peek_buffer(QEMUFile *f, uint8_t *buf, int size, size_t offset);
 void qemu_file_skip(QEMUFile *f, int size);
+int qemu_pending_size(const QEMUFile *f);
 
 static inline unsigned int qemu_get_ubyte(QEMUFile *f)
 {
diff --git a/savevm.c b/savevm.c
index ff77846..1d9e218 100644
--- a/savevm.c
+++ b/savevm.c
@@ -593,6 +593,11 @@  void qemu_file_skip(QEMUFile *f, int size)
     }
 }
 
+int qemu_pending_size(const QEMUFile *f)
+{
+    return f->buf_size - f->buf_index;
+}
+
 int qemu_peek_buffer(QEMUFile *f, uint8_t *buf, int size, size_t offset)
 {
     int pending;