aboutsummaryrefslogtreecommitdiff
path: root/savevm.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-08-20 19:42:29 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-08-27 20:30:21 -0500
commitec245e2111ec59cd04e2510a183e43dee3fb85ce (patch)
tree7ee9a56dd6f0d3a80b480ecfd07750fd0236d741 /savevm.c
parent695dcf71eb463c93c9b3418cffdf3be437dee14a (diff)
Add VMState support for structs
This patch adds support for saving one VMStateDescription from other VMStateDescription. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'savevm.c')
-rw-r--r--savevm.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/savevm.c b/savevm.c
index 7bcb783f96..71ec4ca84c 100644
--- a/savevm.c
+++ b/savevm.c
@@ -983,7 +983,13 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
}
for (i = 0; i < n_elems; i++) {
void *addr = base_addr + field->size * i;
- ret = field->info->get(f, addr, field->size);
+
+ if (field->flags & VMS_STRUCT) {
+ ret = vmstate_load_state(f, field->vmsd, addr, version_id);
+ } else {
+ ret = field->info->get(f, addr, field->size);
+
+ }
if (ret < 0) {
return ret;
}
@@ -1011,7 +1017,12 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
}
for (i = 0; i < n_elems; i++) {
const void *addr = base_addr + field->size * i;
- field->info->put(f, addr, field->size);
+
+ if (field->flags & VMS_STRUCT) {
+ vmstate_save_state(f, field->vmsd, addr);
+ } else {
+ field->info->put(f, addr, field->size);
+ }
}
field++;
}