vmstate: Add pre_load() hook
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
752ff2fa31
commit
fd4d52deab
1
hw/hw.h
1
hw/hw.h
@ -306,6 +306,7 @@ struct VMStateDescription {
|
||||
int minimum_version_id;
|
||||
int minimum_version_id_old;
|
||||
LoadStateHandler *load_state_old;
|
||||
int (*pre_load)(void *opaque);
|
||||
int (*post_load)(void *opaque);
|
||||
VMStateField *fields;
|
||||
};
|
||||
|
5
savevm.c
5
savevm.c
@ -1028,6 +1028,11 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
|
||||
if (version_id < vmsd->minimum_version_id) {
|
||||
return vmsd->load_state_old(f, opaque, version_id);
|
||||
}
|
||||
if (vmsd->pre_load) {
|
||||
int ret = vmsd->pre_load(opaque);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
while(field->name) {
|
||||
if (field->version_id <= version_id) {
|
||||
void *base_addr = opaque + field->offset;
|
||||
|
Loading…
Reference in New Issue
Block a user