diff options
author | Juan Quintela <quintela@redhat.com> | 2012-06-26 18:46:10 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2012-07-20 08:19:27 +0200 |
commit | 7908c78d3e1a117ae6b9545e601409eee3d33863 (patch) | |
tree | 6b58bdcf72b13c958459ae6df46427c1a14c66d1 /savevm.c | |
parent | 22ea40f4ff072a113fdf96bff10bc81ee063da32 (diff) | |
download | hqemu-7908c78d3e1a117ae6b9545e601409eee3d33863.zip hqemu-7908c78d3e1a117ae6b9545e601409eee3d33863.tar.gz |
savevm: Live migration handlers register the struct directly
Notice that the live migration users never unregister, so no problem
about freeing the ops structure.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'savevm.c')
-rw-r--r-- | savevm.c | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -1223,10 +1223,7 @@ int register_savevm_live(DeviceState *dev, const char *idstr, int instance_id, int version_id, - SaveSetParamsHandler *set_params, - SaveLiveStateHandler *save_live_state, - SaveStateHandler *save_state, - LoadStateHandler *load_state, + SaveVMHandlers *ops, void *opaque) { SaveStateEntry *se; @@ -1234,16 +1231,12 @@ int register_savevm_live(DeviceState *dev, se = g_malloc0(sizeof(SaveStateEntry)); se->version_id = version_id; se->section_id = global_section_id++; - se->ops = g_malloc0(sizeof(SaveVMHandlers)); - se->ops->set_params = set_params; - se->ops->save_live_state = save_live_state; - se->ops->save_state = save_state; - se->ops->load_state = load_state; + se->ops = ops; se->opaque = opaque; se->vmsd = NULL; se->no_migrate = 0; /* if this is a live_savem then set is_ram */ - if (save_live_state != NULL) { + if (ops->save_live_state != NULL) { se->is_ram = 1; } @@ -1282,8 +1275,11 @@ int register_savevm(DeviceState *dev, LoadStateHandler *load_state, void *opaque) { + SaveVMHandlers *ops = g_malloc0(sizeof(SaveVMHandlers)); + ops->save_state = save_state; + ops->load_state = load_state; return register_savevm_live(dev, idstr, instance_id, version_id, - NULL, NULL, save_state, load_state, opaque); + ops, opaque); } void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque) |