diff options
author | Greg Bellows <greg.bellows@linaro.org> | 2014-11-19 13:32:52 -0600 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2015-01-07 11:36:06 +0000 |
commit | c41beafed8b0b2dd50915f9cd8ef3467297183ee (patch) | |
tree | d5b7e56b3760c1f61584f21b93ede508b9f13180 | |
parent | 06e3ac43c0681f0830ec79b761026947efa04f50 (diff) | |
download | qemu-android-c41beafed8b0b2dd50915f9cd8ef3467297183ee.tar.gz |
android-console: Add avd snapshot command stubsqemu-android-2.2.0
Add stub functionality to support the Android emulator console "avd snapshot"
sub-commands. Specifically, stub functions and entries for the "list", "save",
"load", and "del" sub-commands were added along with their proper help
messages. Currently, all of the sub-commands return "unsupported" if executed.
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
[AJB: fix up header]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
-rw-r--r-- | android-commands.h | 44 | ||||
-rw-r--r-- | android-console.c | 70 | ||||
-rw-r--r-- | android-console.h | 5 |
3 files changed, 119 insertions, 0 deletions
diff --git a/android-commands.h b/android-commands.h index 9b0f5a91c7..a7b24740c8 100644 --- a/android-commands.h +++ b/android-commands.h @@ -103,6 +103,42 @@ static mon_cmd_t android_event_cmds[] = { { NULL, NULL, }, }; +static mon_cmd_t android_avd_snapshot_cmds[] = { + { + .name = "list", + .args_type = "", + .params = "", + .help = "'avd snapshot list' will show a list of all state snapshots " + "that can be loaded", + .mhandler.cmd = android_console_avd_snapshot_list, + }, + { + .name = "save", + .args_type = "arg:s?", + .params = "", + .help = "'avd snapshot save <name>' will save the current (run-time) " + "state to a snapshot with the given name", + .mhandler.cmd = android_console_avd_snapshot_save, + }, + { + .name = "load", + .args_type = "arg:s?", + .params = "", + .help = "'avd snapshot load <name>' will load the state snapshot of " + "the given name", + .mhandler.cmd = android_console_avd_snapshot_load, + }, + { + .name = "del", + .args_type = "arg:s?", + .params = "", + .help = "'avd snapshot del <name>' will delete the state snapshot with " + "the given name", + .mhandler.cmd = android_console_avd_snapshot_del, + }, + { NULL, NULL, }, +}; + static mon_cmd_t android_avd_cmds[] = { { .name = "stop", @@ -132,6 +168,14 @@ static mon_cmd_t android_avd_cmds[] = { .help = "query virtual device name", .mhandler.cmd = android_console_avd_name, }, + { + .name = "snapshot", + .args_type = "item:s", + .params = "", + .help = "state snapshot commands", + .mhandler.cmd = android_console_avd_snapshot, + .sub_cmds.static_table = android_avd_snapshot_cmds, + }, { NULL, NULL, }, }; diff --git a/android-console.c b/android-console.c index 595df065e0..84bce39ba6 100644 --- a/android-console.c +++ b/android-console.c @@ -735,6 +735,11 @@ enum { CMD_AVD_START, CMD_AVD_STATUS, CMD_AVD_NAME, + CMD_AVD_SNAPSHOT, + CMD_AVD_SNAPSHOT_LIST, + CMD_AVD_SNAPSHOT_SAVE, + CMD_AVD_SNAPSHOT_LOAD, + CMD_AVD_SNAPSHOT_DEL, }; static const char *avd_help[] = { @@ -758,6 +763,26 @@ static const char *avd_help[] = { "'avd status' will indicate whether the virtual device is running or not", /* CMD_AVD_NAME */ "'avd name' will return the name of this virtual device", + /* CMD_AVD_SNAPSHOT */ + "allows you to save and restore the virtual device state in snapshots\n" + "\n" + "available sub-commands:\n" + " avd snapshot list list available state snapshots\n" + " avd snapshot save save state snapshot\n" + " avd snapshot load load state snapshot\n" + " avd snapshot del delete state snapshot\n", + /* CMD_AVD_SNAPSHOT_LIST */ + "'avd snapshot list' will show a list of all state snapshots that can be " + "loaded", + /* CMD_AVD_SNAPSHOT_SAVE */ + "'avd snapshot save <name>' will save the current (run-time) state to a " + "snapshot with the given name", + /* CMD_AVD_SNAPSHOT_LOAD */ + "'avd snapshot load <name>' will load the state snapshot of the given " + "name", + /* CMD_AVD_SNAPSHOT_DEL */ + "'avd snapshot del <name>' will delete the state snapshot with the given " + "name", }; void android_console_avd_stop(Monitor *mon, const QDict *qdict) @@ -797,6 +822,51 @@ void android_console_avd_name(Monitor *mon, const QDict *qdict) monitor_printf(mon, "KO: 'avd name' is currently unsupported\n"); } +void android_console_avd_snapshot(Monitor *mon, const QDict *qdict) +{ + /* This only gets called for bad subcommands and help requests */ + const char *helptext = qdict_get_try_str(qdict, "helptext"); + + /* Default to the first entry which is the snapshot help message */ + int cmd = CMD_AVD_SNAPSHOT; + + if (helptext) { + if (strstr(helptext, "list")) { + cmd = CMD_AVD_SNAPSHOT_LIST; + } else if (strstr(helptext, "save")) { + cmd = CMD_AVD_SNAPSHOT_SAVE; + } else if (strstr(helptext, "load")) { + cmd = CMD_AVD_SNAPSHOT_LOAD; + } else if (strstr(helptext, "del")) { + cmd = CMD_AVD_SNAPSHOT_DEL; + } + } + + /* If this is not a help request then we are here with a bad sub-command */ + monitor_printf(mon, "%s\n%s\n", avd_help[cmd], + helptext ? "OK" : "KO: missing sub-command"); +} + +void android_console_avd_snapshot_list(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "KO: 'avd snapshot list' is currently unsupported\n"); +} + +void android_console_avd_snapshot_save(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "KO: 'avd snapshot save' is currently unsupported\n"); +} + +void android_console_avd_snapshot_load(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "KO: 'avd snapshot load' is currently unsupported\n"); +} + +void android_console_avd_snapshot_del(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "KO: 'avd snapshot del' is currently unsupported\n"); +} + void android_console_avd(Monitor *mon, const QDict *qdict) { /* This only gets called for bad subcommands and help requests */ diff --git a/android-console.h b/android-console.h index c92045747a..65f4e1c84e 100644 --- a/android-console.h +++ b/android-console.h @@ -46,6 +46,11 @@ void android_console_avd_stop(Monitor *mon, const QDict *qdict); void android_console_avd_start(Monitor *mon, const QDict *qdict); void android_console_avd_status(Monitor *mon, const QDict *qdict); void android_console_avd_name(Monitor *mon, const QDict *qdict); +void android_console_avd_snapshot(Monitor *mon, const QDict *qdict); +void android_console_avd_snapshot_list(Monitor *mon, const QDict *qdict); +void android_console_avd_snapshot_save(Monitor *mon, const QDict *qdict); +void android_console_avd_snapshot_load(Monitor *mon, const QDict *qdict); +void android_console_avd_snapshot_del(Monitor *mon, const QDict *qdict); void android_console_avd(Monitor *mon, const QDict *qdict); void android_monitor_print_error(Monitor *mon, const char *fmt, ...); |