qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: aliguori@linux.vnet.ibm.com, andreas.faerber@web.de,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/4] qdev: give all devices a canonical path
Date: Tue, 27 Mar 2012 16:12:07 -0500	[thread overview]
Message-ID: <4F722D27.40909@us.ibm.com> (raw)
In-Reply-To: <1332866328-25443-4-git-send-email-pbonzini@redhat.com>

On 03/27/2012 11:38 AM, Paolo Bonzini wrote:
> A strong limitation of QOM right now is that unconverted ports
> (e.g. all...) do not give a canonical path to devices that are
> part of the board.  This in turn makes it impossible to replace
> PROP_PTR with a QOM link for example.
>
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>   hw/qdev.c |   16 +++++++++++++---
>   1 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index ee21d90..f5c716e 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -113,14 +113,14 @@ DeviceState *qdev_create(BusState *bus, const char *name)
>       return dev;
>   }
>
> -DeviceState *qdev_try_create(BusState *bus, const char *name)
> +DeviceState *qdev_try_create(BusState *bus, const char *type)
>   {
>       DeviceState *dev;
>
> -    if (object_class_by_name(name) == NULL) {
> +    if (object_class_by_name(type) == NULL) {
>           return NULL;
>       }
> -    dev = DEVICE(object_new(name));
> +    dev = DEVICE(object_new(type));
>       if (!dev) {
>           return NULL;
>       }
> @@ -152,6 +152,16 @@ int qdev_init(DeviceState *dev)
>           qdev_free(dev);
>           return rc;
>       }
> +
> +    if (!OBJECT(dev)->parent) {
> +        static int unattached_count = 0;
> +        gchar *name = g_strdup_printf("device[%d]", unattached_count++);
> +
> +        object_property_add_child(container_get("/unattached"), name,
> +                                  OBJECT(dev), NULL);
> +        g_free(name);
> +    }
> +
>       if (qdev_get_vmsd(dev)) {
>           vmstate_register_with_alias_id(dev, -1, qdev_get_vmsd(dev), dev,
>                                          dev->instance_id_alias,

  reply	other threads:[~2012-03-27 21:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 16:38 [Qemu-devel] [PATCH 0/4] qdev: give all devices a canonical QOM path Paolo Bonzini
2012-03-27 16:38 ` [Qemu-devel] [PATCH 1/4] qom: add container_get Paolo Bonzini
2012-03-27 21:07   ` Anthony Liguori
2012-03-27 16:38 ` [Qemu-devel] [PATCH 2/4] qdev: add children before qdev_init Paolo Bonzini
2012-03-27 21:08   ` Anthony Liguori
2012-03-27 16:38 ` [Qemu-devel] [PATCH 3/4] qdev: give all devices a canonical path Paolo Bonzini
2012-03-27 21:12   ` Anthony Liguori [this message]
2012-03-27 16:38 ` [Qemu-devel] [PATCH 4/4] qdev: put all devices under /machine Paolo Bonzini
2012-03-27 21:11   ` Anthony Liguori
2012-03-28 14:01     ` Andreas Färber
2012-03-28 14:34       ` [Qemu-devel] [PATCH v2 " Paolo Bonzini
2012-03-28 15:10         ` Andreas Färber
2012-03-28 15:19           ` Paolo Bonzini
2012-04-05 11:21             ` [Qemu-devel] [PATCH] qom: Refine container_get() to allow using a custom root Andreas Färber
2012-04-05 11:30               ` Paolo Bonzini
2012-03-27 16:42 ` [Qemu-devel] [PATCH 0/4] qdev: give all devices a canonical QOM path Anthony Liguori
2012-04-02 21:21 ` Anthony Liguori

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=4F722D27.40909@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=andreas.faerber@web.de \
    --cc=pbonzini@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).