qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Andrzej Zaborowski <balrogg@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Add tab-completion for device_add.
Date: Thu, 12 Jan 2012 11:01:43 -0600	[thread overview]
Message-ID: <4F0F11F7.9080202@codemonkey.ws> (raw)
In-Reply-To: <1326036534-18029-1-git-send-email-balrogg@gmail.com>

On 01/08/2012 09:28 AM, Andrzej Zaborowski wrote:
> Signed-off-by: Andrzej Zaborowski<andrew.zaborowski@intel.com>
> ---
> There are other ways to do this, but adding an API for querying
> available qdev drivers was the one that made most sense to me.
> ---
>   hw/qdev.c |   38 ++++++++++++++++++++++++++++++++++++++
>   hw/qdev.h |    7 +++++++
>   monitor.c |   41 +++++++++++++++++++++++++++++++++++++++++
>   3 files changed, 86 insertions(+), 0 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index d0cf66d..ba97312 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -1535,3 +1535,41 @@ void qdev_machine_init(void)
>       qdev_get_peripheral_anon();
>       qdev_get_peripheral();
>   }
> +
> +int qdev_driver_foreach(qdev_driver_foreach_func func, void *opaque)
> +{
> +    DeviceInfo *info;
> +    int ret = 0;
> +
> +    for (info = device_info_list; info != NULL; info = info->next) {
> +        ret |= (*func)(info, opaque);
> +    }
> +
> +    return ret;
> +}
> +
> +int qdev_driver_prop_foreach(qdev_driver_prop_foreach_func func,
> +                const char *driver, void *opaque)
> +{
> +    DeviceInfo *info;
> +    Property *prop;
> +    int ret = 0;
> +
> +    info = qdev_find_info(NULL, driver);
> +    if (!info) {
> +        return -1;
> +    }
> +
> +    for (prop = info->props; prop&&  prop->name; prop++) {
> +        /*
> +         * TODO Properties without a parser are just for dirty hacks.
> +         * See comment in qdev_device_help.
> +         */
> +        if (!prop->info->parse) {
> +            continue;           /* no way to set it, don't show */
> +        }
> +        ret |= (*func)(prop, opaque);

Would be better to pass prop->name here as Property is going to go away soon.

Regards,

Anthony Liguori

  reply	other threads:[~2012-01-12 17:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <yes>
2012-01-08 15:28 ` [Qemu-devel] [PATCH] Add tab-completion for device_add Andrzej Zaborowski
2012-01-12 17:01   ` Anthony Liguori [this message]
2019-12-04  9:36 ` [PATCH] i386: pass CLZERO to guests with EPYC CPU model on AMD ZEN platform Ani Sinha
2019-12-16  9:31   ` Ani Sinha
2012-01-08 15:14 [Qemu-devel] [PATCH] Add tab-completion for device_add Andrzej Zaborowski
2012-01-09  2:19 ` andrzej zaborowski

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=4F0F11F7.9080202@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=balrogg@gmail.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).