From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RW4i4-0002Gb-Ao for qemu-devel@nongnu.org; Thu, 01 Dec 2011 06:21:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RW4i0-0004AW-8T for qemu-devel@nongnu.org; Thu, 01 Dec 2011 06:21:48 -0500 Received: from mail-bw0-f45.google.com ([209.85.214.45]:49356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RW4i0-0004AS-0g for qemu-devel@nongnu.org; Thu, 01 Dec 2011 06:21:44 -0500 Received: by bkar19 with SMTP id r19so2653886bka.4 for ; Thu, 01 Dec 2011 03:21:43 -0800 (PST) Date: Thu, 1 Dec 2011 11:21:39 +0000 From: Stefan Hajnoczi Message-ID: <20111201112139.GE31730@stefanha-thinkpad.localdomain> References: <1322687028-29714-1-git-send-email-aliguori@us.ibm.com> <1322687028-29714-16-git-send-email-aliguori@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1322687028-29714-16-git-send-email-aliguori@us.ibm.com> Subject: Re: [Qemu-devel] [PATCH 15/18] qom: optimize qdev_get_canonical_path using a parent link List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Kevin Wolf , Peter Maydell , Stefan Hajnoczi , Jan Kiszka , qemu-devel@nongnu.org, Markus Armbruster , Luiz Capitulino 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.