aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--savevm.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/savevm.c b/savevm.c
index d6da050f36..55a2763f0f 100644
--- a/savevm.c
+++ b/savevm.c
@@ -959,13 +959,27 @@ const VMStateInfo vmstate_info_buffer = {
static int get_unused_buffer(QEMUFile *f, void *pv, size_t size)
{
- qemu_fseek(f, size, SEEK_CUR);
- return 0;
+ uint8_t buf[1024];
+ int block_len;
+
+ while (size > 0) {
+ block_len = MIN(sizeof(buf), size);
+ size -= block_len;
+ qemu_get_buffer(f, buf, block_len);
+ }
+ return 0;
}
static void put_unused_buffer(QEMUFile *f, void *pv, size_t size)
{
- qemu_fseek(f, size, SEEK_CUR);
+ static const uint8_t buf[1024];
+ int block_len;
+
+ while (size > 0) {
+ block_len = MIN(sizeof(buf), size);
+ size -= block_len;
+ qemu_put_buffer(f, buf, block_len);
+ }
}
const VMStateInfo vmstate_info_unused_buffer = {