aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-08-20 19:42:24 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:30:21 -0500
commit4082be4df4cf1ad53e15a1f0876cd2f04d6d2593 (patch)
tree8fd76fe20936ea203f5bb154721eeeb0ff9b87a1
parentb5a22e4a0aaead2ceeb5af445c9d460d910601cf (diff)
Add vmstate_load() and vmstate_save() functions
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--savevm.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/savevm.c b/savevm.c
index ab7c0d328a..ec37f6dcbe 100644
--- a/savevm.c
+++ b/savevm.c
@@ -719,6 +719,17 @@ void unregister_savevm(const char *idstr, void *opaque)
}
}
+static int vmstate_load(QEMUFile *f, SaveStateEntry *se, int version_id)
+{
+ return se->load_state(f, se->opaque, version_id);
+}
+
+static void vmstate_save(QEMUFile *f, SaveStateEntry *se)
+{
+ se->save_state(f, se->opaque);
+}
+
+
#define QEMU_VM_FILE_MAGIC 0x5145564d
#define QEMU_VM_FILE_VERSION_COMPAT 0x00000002
#define QEMU_VM_FILE_VERSION 0x00000003
@@ -821,7 +832,7 @@ int qemu_savevm_state_complete(QEMUFile *f)
qemu_put_be32(f, se->instance_id);
qemu_put_be32(f, se->version_id);
- se->save_state(f, se->opaque);
+ vmstate_save(f, se);
}
qemu_put_byte(f, QEMU_VM_EOF);
@@ -907,7 +918,7 @@ static int qemu_loadvm_state_v2(QEMUFile *f)
fprintf(stderr, "qemu: warning: instance 0x%x of device '%s' not present in current VM\n",
instance_id, idstr);
} else {
- ret = se->load_state(f, se->opaque, version_id);
+ ret = vmstate_load(f, se, version_id);
if (ret < 0) {
fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n",
instance_id, idstr);
@@ -984,7 +995,7 @@ int qemu_loadvm_state(QEMUFile *f)
le->next = first_le;
first_le = le;
- ret = le->se->load_state(f, le->se->opaque, le->version_id);
+ ret = vmstate_load(f, le->se, le->version_id);
if (ret < 0) {
fprintf(stderr, "qemu: warning: error while loading state for instance 0x%x of device '%s'\n",
instance_id, idstr);
@@ -1002,7 +1013,7 @@ int qemu_loadvm_state(QEMUFile *f)
goto out;
}
- ret = le->se->load_state(f, le->se->opaque, le->version_id);
+ ret = vmstate_load(f, le->se, le->version_id);
if (ret < 0) {
fprintf(stderr, "qemu: warning: error while loading state section id %d\n",
section_id);