提交 8fb0791d 编写于 作者: J Juan Quintela 提交者: Anthony Liguori

vmstate: Add pre/post_save() hooks

Signed-off-by: NJuan Quintela <quintela@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 fd4d52de
......@@ -308,6 +308,8 @@ struct VMStateDescription {
LoadStateHandler *load_state_old;
int (*pre_load)(void *opaque);
int (*post_load)(void *opaque);
void (*pre_save)(const void *opaque);
void (*post_save)(const void *opaque);
VMStateField *fields;
};
......
......@@ -1073,6 +1073,9 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
{
VMStateField *field = vmsd->fields;
if (vmsd->pre_save) {
vmsd->pre_save(opaque);
}
while(field->name) {
const void *base_addr = opaque + field->offset;
int i, n_elems = 1;
......@@ -1096,6 +1099,9 @@ 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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册