savevm.c: Getting closer to upstream.
This patch refactors savevm.c considerably to get much closer
to upstream. The main benefit is the introduction of savevm_register()
and savevm_unregister() functions, which allow the client to provide
a description of the state through a VMStateDescription structure.
The 'legacy' register_savevm() and unregister_savevm() are still
provided (just like upstream does). Future patches will 'upgrade'
our virtual devices to the new interface.
NOTE: Since DeviceState is not implemented properly yet, qdev_get_path()
is stubbed to always return NULL.
Change-Id: I7bfa201da40a0e470fafde6ccc002a4216ecd9c1
diff --git a/vl-android.c b/vl-android.c
index 4493597..9c5b4d9 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -3861,8 +3861,18 @@
if (qemu_opts_foreach(qemu_find_opts("drive"), drive_init_func, &machine->use_scsi, 1) != 0)
exit(1);
- //register_savevm("timer", 0, 2, timer_save, timer_load, &timers_state);
- register_savevm_live("ram", 0, 3, ram_save_live, NULL, ram_load, NULL);
+ //register_savevm(NULL, "timer", 0, 2, timer_save, timer_load, &timers_state);
+
+ SaveVMHandlers* ops = g_malloc0(sizeof(*ops));
+ ops->save_live_state = ram_save_live;
+ ops->load_state = ram_load;
+
+ register_savevm_live(NULL,
+ "ram",
+ 0,
+ 3,
+ ops,
+ NULL);
/* must be after terminal init, SDL library changes signal handlers */
os_setup_signal_handling();