From 871da2aa80687142bec00ef7c1112253c76c32bb Mon Sep 17 00:00:00 2001 From: Ot ten Thije Date: Mon, 20 Sep 2010 10:29:22 +0100 Subject: Added state snapshot support for QemuD. With this patch, both modem and sensor functionality are correctly restored when a state snapshot is loaded. This was not the case previously because communication with either of these services is done using the qemud daemon, which did not support snapshots. The boot-properties and charpipe services have no specific save/load functionality yet, since the framework itself should be reviewed first. Adding support for bootproperties should not be difficult though, and charpipe may not need it. For a description of the high-level process for saving and loading, consult section IV "State snapshots" in docs/ANDROID-QEMUD.TXT. Change-Id: I5b06d88b911ca096e78060163174904c48a01c66 --- android/hw-qemud.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'android/hw-qemud.h') diff --git a/android/hw-qemud.h b/android/hw-qemud.h index 8aae74d..18eec6f 100644 --- a/android/hw-qemud.h +++ b/android/hw-qemud.h @@ -72,6 +72,16 @@ typedef void (*QemudClientClose)( void* opaque ); */ typedef void (*QemudClientRecv) ( void* opaque, uint8_t* msg, int msglen, QemudClient* client ); +/* A function that will be called when the state of the client should be + * saved to a snapshot. + */ +typedef void (*QemudClientSave) ( QEMUFile* f, QemudClient* client, void* opaque ); + +/* A function that will be called when the state of the client should be + * restored from a snapshot. + */ +typedef int (*QemudClientLoad) ( QEMUFile* f, QemudClient* client, void* opaque ); + /* Register a new client for a given service. * 'clie_opaque' will be sent as the first argument to 'clie_recv' and 'clie_close' * 'clie_recv' and 'clie_close' are both optional and may be NULL. @@ -83,7 +93,9 @@ extern QemudClient* qemud_client_new( QemudService* service, int channel_id, void* clie_opaque, QemudClientRecv clie_recv, - QemudClientClose clie_close ); + QemudClientClose clie_close, + QemudClientSave clie_save, + QemudClientLoad clie_load ); /* Enable framing on a given client channel. */ @@ -104,13 +116,25 @@ extern void qemud_client_close( QemudClient* client ); */ typedef QemudClient* (*QemudServiceConnect)( void* opaque, QemudService* service, int channel ); +/* A function that will be called when the state of the service should be + * saved to a snapshot. + */ +typedef void (*QemudServiceSave) ( QEMUFile* f, QemudService* service, void* opaque ); + +/* A function that will be called when the state of the service should be + * restored from a snapshot. + */ +typedef int (*QemudServiceLoad) ( QEMUFile* f, QemudService* service, void* opaque ); + /* Register a new qemud service. * 'serv_opaque' is the first parameter to 'serv_connect' */ extern QemudService* qemud_service_register( const char* serviceName, int max_clients, void* serv_opaque, - QemudServiceConnect serv_connect ); + QemudServiceConnect serv_connect, + QemudServiceSave serv_save, + QemudServiceLoad serv_load); /* Sends a message to all clients of a given service. */ -- cgit v1.1