[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 03/21] Introduce skip_header parameter to qemu_loadv
From: |
Yoshiaki Tamura |
Subject: |
[Qemu-devel] [PATCH 03/21] Introduce skip_header parameter to qemu_loadvm_state(). |
Date: |
Thu, 25 Nov 2010 15:06:42 +0900 |
Introduce skip_header parameter to qemu_loadvm_state() so that it can
be called iteratively without reading the header.
Signed-off-by: Yoshiaki Tamura <address@hidden>
---
migration.c | 2 +-
savevm.c | 24 +++++++++++++-----------
sysemu.h | 2 +-
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/migration.c b/migration.c
index 6500714..8f4ffcb 100644
--- a/migration.c
+++ b/migration.c
@@ -60,7 +60,7 @@ int qemu_start_incoming_migration(const char *uri)
void process_incoming_migration(QEMUFile *f)
{
- if (qemu_loadvm_state(f) < 0) {
+ if (qemu_loadvm_state(f, 0) < 0) {
fprintf(stderr, "load of migration failed\n");
exit(0);
}
diff --git a/savevm.c b/savevm.c
index 6f651b3..8917416 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1704,7 +1704,7 @@ typedef struct LoadStateEntry {
int version_id;
} LoadStateEntry;
-int qemu_loadvm_state(QEMUFile *f)
+int qemu_loadvm_state(QEMUFile *f, int skip_header)
{
QLIST_HEAD(, LoadStateEntry) loadvm_handlers =
QLIST_HEAD_INITIALIZER(loadvm_handlers);
@@ -1713,17 +1713,19 @@ int qemu_loadvm_state(QEMUFile *f)
unsigned int v;
int ret;
- v = qemu_get_be32(f);
- if (v != QEMU_VM_FILE_MAGIC)
- return -EINVAL;
+ if (!skip_header) {
+ v = qemu_get_be32(f);
+ if (v != QEMU_VM_FILE_MAGIC)
+ return -EINVAL;
- v = qemu_get_be32(f);
- if (v == QEMU_VM_FILE_VERSION_COMPAT) {
- fprintf(stderr, "SaveVM v2 format is obsolete and don't work
anymore\n");
- return -ENOTSUP;
+ v = qemu_get_be32(f);
+ if (v == QEMU_VM_FILE_VERSION_COMPAT) {
+ fprintf(stderr, "SaveVM v2 format is obsolete and don't work
anymore\n");
+ return -ENOTSUP;
+ }
+ if (v != QEMU_VM_FILE_VERSION)
+ return -ENOTSUP;
}
- if (v != QEMU_VM_FILE_VERSION)
- return -ENOTSUP;
while ((section_type = qemu_get_byte(f)) != QEMU_VM_EOF) {
uint32_t instance_id, version_id, section_id;
@@ -2048,7 +2050,7 @@ int load_vmstate(const char *name)
return -EINVAL;
}
- ret = qemu_loadvm_state(f);
+ ret = qemu_loadvm_state(f, 0);
qemu_fclose(f);
if (ret < 0) {
diff --git a/sysemu.h b/sysemu.h
index b81a70e..588548a 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -78,7 +78,7 @@ int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int
blk_enable,
int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
-int qemu_loadvm_state(QEMUFile *f);
+int qemu_loadvm_state(QEMUFile *f, int skip_header);
/* SLIRP */
void do_info_slirp(Monitor *mon);
--
1.7.1.2
- [Qemu-devel] [PATCH 00/21] Kemari for KVM 0.2, Yoshiaki Tamura, 2010/11/25
- [Qemu-devel] [PATCH 15/21] virtio-net: replace qemu_sendv_packet_async() with qemu_sendv_packet_async_proxy()., Yoshiaki Tamura, 2010/11/25
- [Qemu-devel] [PATCH 14/21] virtio-blk: replace bdrv_aio_multiwrite() with bdrv_aio_multiwrite_proxy()., Yoshiaki Tamura, 2010/11/25
- [Qemu-devel] [PATCH 03/21] Introduce skip_header parameter to qemu_loadvm_state().,
Yoshiaki Tamura <=
- [Qemu-devel] [PATCH 10/21] Call init handler of event-tap at main() in vl.c., Yoshiaki Tamura, 2010/11/25
- [Qemu-devel] [PATCH 17/21] savevm: introduce qemu_savevm_trans_{begin, commit}., Yoshiaki Tamura, 2010/11/25
- [Qemu-devel] [PATCH 11/21] ioport: insert event_tap_ioport() to ioport_write()., Yoshiaki Tamura, 2010/11/25
- [Qemu-devel] [PATCH 21/21] migration: add a parser to accept FT migration incoming mode., Yoshiaki Tamura, 2010/11/25
- [Qemu-devel] [PATCH 06/21] vl: add a tmp pointer so that a handler can delete the entry to which it belongs., Yoshiaki Tamura, 2010/11/25
- [Qemu-devel] [PATCH 20/21] Introduce -k option to enable FT migration mode (Kemari)., Yoshiaki Tamura, 2010/11/25
- [Qemu-devel] [PATCH 13/21] dma-helpers: replace bdrv_aio_writev() with bdrv_aio_writev_proxy()., Yoshiaki Tamura, 2010/11/25