[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 15/18] qom: optimize qdev_get_canonical_path usi

From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 15/18] qom: optimize qdev_get_canonical_path using a parent link
Date: Thu, 1 Dec 2011 11:21:39 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Nov 30, 2011 at 03:03:45PM -0600, Anthony Liguori wrote:
> @@ -1210,6 +1210,9 @@ void qdev_property_add_child(DeviceState *dev, const 
> char *name,
>      qdev_property_add(dev, name, type, qdev_get_child_property,
>                        NULL, NULL, child, errp);
> +    g_assert(child->parent == NULL);
> +    child->parent = dev;

The implications are:

1. A DeviceState must be a child or the root.  It is not okay to create
   a DeviceState and inquire its canonical path before making it a child in
   the graph.

2. A DeviceState can only be the child of one parent.  Since
   user-created devices are added to /peripheral or /peripheral-anon this
   means that the /i440fx only has links to them, never a parent-child

Is this right?

> +    /* Do not, under any circumstance, use this parent link below anywhere
> +     * outside of qdev.c.  You have been warned. */
> +    DeviceState *parent;

It would be nice to explain why parent is private to qdev.c.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]