summaryrefslogtreecommitdiff
path: root/savevm.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-05-16 15:28:50 +0300
committerAvi Kivity <avi@redhat.com>2010-05-16 15:28:50 +0300
commit9fa1d2158218fe0e3b7982faa244d0d0e9790c14 (patch)
treee07201083647ddde8dc12f9e4f4db371106997e7 /savevm.c
parentb6533d4e041a52276900ee45ba82803abb52eda0 (diff)
parentfc0bdd995ca36a34cc576ee706df239dd5ff79a9 (diff)
Merge commit 'fc0bdd995ca36a34cc576ee706df239dd5ff79a9' into upstream-merge
* commit 'fc0bdd995ca36a34cc576ee706df239dd5ff79a9': acpi: split out piix4 smbus routines from acpi.c into pm_smbus.c mc146818rtc: Register vmstate via qdev fdc: Register vmstate via qdev serial: Register vmstate via qdev vmstate: Add support for alias ID vmstate: Drop unused post_save handler sh: sm501: add 2D engine support tmp105: update the register in post_load where it needs updating. cpus: add one 'const' e1000: make some tables 'const' ide: make a table 'const' vga: make some tables 'const' Compile virtio-9p-debug and virtio-9p-local once Update SeaBIOS pckbd: don't use any static state apb: don't use any static state target-sparc: Fix wrong printf argument Update OpenBIOS images to r771 kvm: fix 80000001.EDX supported bit filtering Conflicts: Makefile.target Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'savevm.c')
-rw-r--r--savevm.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/savevm.c b/savevm.c
index af377be05..017695bf0 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1014,6 +1014,7 @@ typedef struct SaveStateEntry {
QTAILQ_ENTRY(SaveStateEntry) entry;
char idstr[256];
int instance_id;
+ int alias_id;
int version_id;
int section_id;
SaveSetParamsHandler *set_params;
@@ -1102,11 +1103,16 @@ void unregister_savevm(const char *idstr, void *opaque)
}
}
-int vmstate_register(int instance_id, const VMStateDescription *vmsd,
- void *opaque)
+int vmstate_register_with_alias_id(int instance_id,
+ const VMStateDescription *vmsd,
+ void *opaque, int alias_id,
+ int required_for_version)
{
SaveStateEntry *se;
+ /* If this triggers, alias support can be dropped for the vmsd. */
+ assert(alias_id == -1 || required_for_version >= vmsd->minimum_version_id);
+
se = qemu_mallocz(sizeof(SaveStateEntry));
pstrcpy(se->idstr, sizeof(se->idstr), vmsd->name);
se->version_id = vmsd->version_id;
@@ -1116,6 +1122,7 @@ int vmstate_register(int instance_id, const VMStateDescription *vmsd,
se->load_state = NULL;
se->opaque = opaque;
se->vmsd = vmsd;
+ se->alias_id = alias_id;
if (instance_id == -1) {
se->instance_id = calculate_new_instance_id(vmsd->name);
@@ -1127,6 +1134,12 @@ int vmstate_register(int instance_id, const VMStateDescription *vmsd,
return 0;
}
+int vmstate_register(int instance_id, const VMStateDescription *vmsd,
+ void *opaque)
+{
+ return vmstate_register_with_alias_id(instance_id, vmsd, opaque, -1, 0);
+}
+
void vmstate_unregister(const VMStateDescription *vmsd, void *opaque)
{
SaveStateEntry *se, *new_se;
@@ -1254,9 +1267,6 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
}
field++;
}
- if (vmsd->post_save) {
- vmsd->post_save(opaque);
- }
}
static int vmstate_load(QEMUFile *f, SaveStateEntry *se, int version_id)
@@ -1459,7 +1469,8 @@ static SaveStateEntry *find_se(const char *idstr, int instance_id)
QTAILQ_FOREACH(se, &savevm_handlers, entry) {
if (!strcmp(se->idstr, idstr) &&
- instance_id == se->instance_id)
+ (instance_id == se->instance_id ||
+ instance_id == se->alias_id))
return se;
}
return NULL;