From: Luiz Capitulino Date: Thu, 10 Dec 2009 19:16:00 +0000 (-0200) Subject: monitor: Convert do_info_kvm() to QObject X-Git-Tag: TizenStudio_2.0_p2.3~6298 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ecde8f1b5341fe0350e8b308ab3cbef50d8d48a;p=sdk%2Femulator%2Fqemu.git monitor: Convert do_info_kvm() to QObject Signed-off-by: Luiz Capitulino Signed-off-by: Anthony Liguori --- diff --git a/monitor.c b/monitor.c index 3d37548..18c4612 100644 --- a/monitor.c +++ b/monitor.c @@ -1806,16 +1806,40 @@ static void tlb_info(Monitor *mon) #endif -static void do_info_kvm(Monitor *mon) +static void do_info_kvm_print(Monitor *mon, const QObject *data) { -#ifdef CONFIG_KVM + QDict *qdict; + + qdict = qobject_to_qdict(data); + monitor_printf(mon, "kvm support: "); - if (kvm_enabled()) - monitor_printf(mon, "enabled\n"); - else - monitor_printf(mon, "disabled\n"); + if (qdict_get_bool(qdict, "present")) { + monitor_printf(mon, "%s\n", qdict_get_bool(qdict, "enabled") ? + "enabled" : "disabled"); + } else { + monitor_printf(mon, "not compiled\n"); + } +} + +/** + * do_info_kvm(): Show KVM information + * + * Return a QDict with the following information: + * + * - "enabled": true if KVM support is enabled, false otherwise + * - "present": true if QEMU has KVM support, false otherwise + * + * Example: + * + * { "enabled": true, "present": true } + */ +static void do_info_kvm(Monitor *mon, QObject **ret_data) +{ +#ifdef CONFIG_KVM + *ret_data = qobject_from_jsonf("{ 'enabled': %i, 'present': true }", + kvm_enabled()); #else - monitor_printf(mon, "kvm support: not compiled\n"); + *ret_data = qobject_from_jsonf("{ 'enabled': false, 'present': false }"); #endif } @@ -2369,7 +2393,8 @@ static const mon_cmd_t info_cmds[] = { .args_type = "", .params = "", .help = "show KVM information", - .mhandler.info = do_info_kvm, + .user_print = do_info_kvm_print, + .mhandler.info_new = do_info_kvm, }, { .name = "numa",