qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hani Benhabiles <kroosec@gmail.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH qom-next 1/4] qom: Implement info qom-composition HMP command
Date: Sun, 11 May 2014 14:26:47 +0100	[thread overview]
Message-ID: <20140511132647.GD4487@Inspiron-3521> (raw)
In-Reply-To: <1399558877-4915-2-git-send-email-afaerber@suse.de>

On Thu, May 08, 2014 at 04:21:14PM +0200, Andreas Färber wrote:
> To complement qdev's bus-oriented info qtree, info qom-composition
> prints a hierarchical view of the machine composition tree.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  include/monitor/qdev.h |  1 +
>  monitor.c              |  7 +++++++
>  qdev-monitor.c         | 35 +++++++++++++++++++++++++++++++++++
>  3 files changed, 43 insertions(+)
> 
> diff --git a/include/monitor/qdev.h b/include/monitor/qdev.h
> index 8d16e11..cb5c8ee 100644
> --- a/include/monitor/qdev.h
> +++ b/include/monitor/qdev.h
> @@ -8,6 +8,7 @@
>  
>  void do_info_qtree(Monitor *mon, const QDict *qdict);
>  void do_info_qdm(Monitor *mon, const QDict *qdict);
> +void do_info_qom_composition(Monitor *mon, const QDict *dict);
>  int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data);
>  int qdev_device_help(QemuOpts *opts);
>  DeviceState *qdev_device_add(QemuOpts *opts);
> diff --git a/monitor.c b/monitor.c
> index 1266ba0..c2b9315 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2920,6 +2920,13 @@ static mon_cmd_t info_cmds[] = {
>          .mhandler.cmd = do_info_qdm,
>      },
>      {
> +        .name       = "qom-composition",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show QOM machine composition tree",
> +        .mhandler.cmd = do_info_qom_composition,
> +    },
> +    {
>          .name       = "roms",
>          .args_type  = "",
>          .params     = "",
> diff --git a/qdev-monitor.c b/qdev-monitor.c
> index 02cbe43..744144a 100644
> --- a/qdev-monitor.c
> +++ b/qdev-monitor.c
> @@ -658,6 +658,41 @@ void do_info_qdm(Monitor *mon, const QDict *qdict)
>      qdev_print_devinfos(true);
>  }
>  
> +typedef struct QOMCompositionState {
> +    Monitor *mon;
> +    int indent;
> +} QOMCompositionState;
> +
> +static void print_qom_composition(Monitor *mon, Object *obj, int indent);
> +
> +static int print_qom_composition_child(Object *obj, void *opaque)
> +{
> +    QOMCompositionState *s = opaque;
> +
> +    print_qom_composition(s->mon, obj, s->indent);
> +
> +    return 0;
> +}
> +
> +static void print_qom_composition(Monitor *mon, Object *obj, int indent)
> +{
> +    QOMCompositionState s = {
> +        .mon = mon,
> +        .indent = indent + 2,
> +    };
> +    char *name = object_get_canonical_path_component(obj);
> +
> +    monitor_printf(mon, "%*s/%s (%s)\n", indent, "", name,
> +                   object_get_typename(obj));
> +    g_free(name);
> +    object_child_foreach(obj, print_qom_composition_child, &s);
> +}
> +
> +void do_info_qom_composition(Monitor *mon, const QDict *dict)
> +{
> +    print_qom_composition(mon, qdev_get_machine(), 0);
> +}
> +
>  int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
>  {
>      Error *local_err = NULL;

Reviewed-by: Hani Benhabiles <hani@linux.com>

  reply	other threads:[~2014-05-11 13:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 14:21 [Qemu-devel] [PATCH qom-next 0/4] qom: HMP commands to replace info qtree Andreas Färber
2014-05-08 14:21 ` [Qemu-devel] [PATCH qom-next 1/4] qom: Implement info qom-composition HMP command Andreas Färber
2014-05-11 13:26   ` Hani Benhabiles [this message]
2014-05-08 14:21 ` [Qemu-devel] [PATCH qom-next 2/4] qom: Implement qom-list " Andreas Färber
2014-05-11 13:45   ` Hani Benhabiles
2014-05-08 14:21 ` [Qemu-devel] [PATCH qom-next 3/4] qom: Implement qom-get " Andreas Färber
2014-05-11 14:49   ` Hani Benhabiles
2014-05-08 14:21 ` [Qemu-devel] [PATCH qom-next 4/4] qom: Implement qom-set " Andreas Färber
2014-05-11 14:58   ` Hani Benhabiles
2014-05-18  0:38 ` [Qemu-devel] [PATCH qom-next 0/4] qom: HMP commands to replace info qtree Peter Crosthwaite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140511132647.GD4487@Inspiron-3521 \
    --to=kroosec@gmail.com \
    --cc=afaerber@suse.de \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).