[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 12/17] char: Convert qemu_chr_info() to QObject
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 12/17] char: Convert qemu_chr_info() to QObject |
Date: |
Fri, 20 Nov 2009 15:10:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Luiz Capitulino <address@hidden> writes:
> Each device is represented by a QDict. The returned QObject is a QList
> of all devices.
>
> This commit should not change user output.
>
> Signed-off-by: Luiz Capitulino <address@hidden>
> ---
> monitor.c | 3 ++-
> qemu-char.c | 43 +++++++++++++++++++++++++++++++++++++++++--
> qemu-char.h | 4 +++-
> 3 files changed, 46 insertions(+), 4 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index e4fed10..a0a9281 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2040,7 +2040,8 @@ static const mon_cmd_t info_cmds[] = {
> .args_type = "",
> .params = "",
> .help = "show the character devices",
> - .mhandler.info = qemu_chr_info,
> + .user_print = qemu_chr_info_print,
> + .mhandler.info_new = qemu_chr_info,
> },
> {
> .name = "block",
> diff --git a/qemu-char.c b/qemu-char.c
> index 5a81e8f..7fcde98 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -32,6 +32,7 @@
> #include "hw/usb.h"
> #include "hw/baum.h"
> #include "hw/msmouse.h"
> +#include "qemu-objects.h"
>
> #include <unistd.h>
> #include <fcntl.h>
> @@ -2465,13 +2466,51 @@ void qemu_chr_close(CharDriverState *chr)
> qemu_free(chr);
> }
>
> -void qemu_chr_info(Monitor *mon)
> +static void qemu_chr_print_qlist(QObject *obj, void *opaque)
Why *_qlist? It prints a qdict, which happens to be a list element, but
this function doesn't know that.
> {
> + QDict *chr_dict;
> + Monitor *mon = opaque;
> +
> + chr_dict = qobject_to_qdict(obj);
> + monitor_printf(mon, "%s: filename=%s\n", qdict_get_str(chr_dict,
> "label"),
> + qdict_get_str(chr_dict,
> "filename"));
> +}
> +
> +void qemu_chr_info_print(Monitor *mon, const QObject *ret_data)
> +{
> + qlist_iter(qobject_to_qlist(ret_data), qemu_chr_print_qlist, mon);
> +}
[...]
[Qemu-devel] [PATCH 15/17] VNC: Convert do_info_vnc() to QObject, Luiz Capitulino, 2009/11/17
[Qemu-devel] [PATCH 13/17] PCI: Convert pci_device_hot_add() to QObject, Luiz Capitulino, 2009/11/17
[Qemu-devel] [PATCH 14/17] block: Convert bdrv_info_stats() to QObject, Luiz Capitulino, 2009/11/17
[Qemu-devel] [PATCH 16/17] net: Convert do_info_network() to QObject, Luiz Capitulino, 2009/11/17