diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2011-08-26 17:38:13 -0300 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2011-10-04 11:01:30 -0300 |
commit | b9c15f16d702306aeb984f30490cddb8b418a231 (patch) | |
tree | 6952fefe9fb9e4470556c8788032ff53bd0a8572 /monitor.c | |
parent | 48a32bedfed0ea5b30bdbb470c0520acdadc3bf2 (diff) |
qapi: Convert query-version
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 46 |
1 files changed, 3 insertions, 43 deletions
@@ -731,37 +731,6 @@ help: help_cmd(mon, "info"); } -static void do_info_version_print(Monitor *mon, const QObject *data) -{ - QDict *qdict; - QDict *qemu; - - qdict = qobject_to_qdict(data); - qemu = qdict_get_qdict(qdict, "qemu"); - - monitor_printf(mon, "%" PRId64 ".%" PRId64 ".%" PRId64 "%s\n", - qdict_get_int(qemu, "major"), - qdict_get_int(qemu, "minor"), - qdict_get_int(qemu, "micro"), - qdict_get_str(qdict, "package")); -} - -static void do_info_version(Monitor *mon, QObject **ret_data) -{ - const char *version = QEMU_VERSION; - int major = 0, minor = 0, micro = 0; - char *tmp; - - major = strtol(version, &tmp, 10); - tmp++; - minor = strtol(tmp, &tmp, 10); - tmp++; - micro = strtol(tmp, &tmp, 10); - - *ret_data = qobject_from_jsonf("{ 'qemu': { 'major': %d, 'minor': %d, \ - 'micro': %d }, 'package': %s }", major, minor, micro, QEMU_PKGVERSION); -} - static QObject *get_cmd_dict(const char *name) { const char *p; @@ -2872,8 +2841,7 @@ static const mon_cmd_t info_cmds[] = { .args_type = "", .params = "", .help = "show the version of QEMU", - .user_print = do_info_version_print, - .mhandler.info_new = do_info_version, + .mhandler.info = hmp_info_version, }, { .name = "network", @@ -3172,14 +3140,6 @@ static const mon_cmd_t qmp_cmds[] = { static const mon_cmd_t qmp_query_cmds[] = { { - .name = "version", - .args_type = "", - .params = "", - .help = "show the version of QEMU", - .user_print = do_info_version_print, - .mhandler.info_new = do_info_version, - }, - { .name = "commands", .args_type = "", .params = "", @@ -5185,9 +5145,9 @@ void monitor_resume(Monitor *mon) static QObject *get_qmp_greeting(void) { - QObject *ver; + QObject *ver = NULL; - do_info_version(NULL, &ver); + qmp_marshal_input_query_version(NULL, NULL, &ver); return qobject_from_jsonf("{'QMP':{'version': %p,'capabilities': []}}",ver); } |