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 relationship. 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.