From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWUVy-0002sA-Jd for qemu-devel@nongnu.org; Fri, 02 Dec 2011 09:55:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWUVs-0004aB-D3 for qemu-devel@nongnu.org; Fri, 02 Dec 2011 09:55:02 -0500 Received: from mail-gy0-f173.google.com ([209.85.160.173]:61257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWUVs-0004a6-6a for qemu-devel@nongnu.org; Fri, 02 Dec 2011 09:54:56 -0500 Received: by ghbg19 with SMTP id g19so3768208ghb.4 for ; Fri, 02 Dec 2011 06:54:55 -0800 (PST) Message-ID: <4ED8E6BB.5020202@codemonkey.ws> Date: Fri, 02 Dec 2011 08:54:51 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1322687028-29714-1-git-send-email-aliguori@us.ibm.com> <1322687028-29714-7-git-send-email-aliguori@us.ibm.com> <4ED8BC6E.9090904@redhat.com> In-Reply-To: <4ED8BC6E.9090904@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 06/18] qom: add child properties (composition) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Peter Maydell , Anthony Liguori , Stefan Hajnoczi , Jan Kiszka , qemu-devel@nongnu.org, Markus Armbruster , Luiz Capitulino On 12/02/2011 05:54 AM, Kevin Wolf wrote: > Am 30.11.2011 22:03, schrieb Anthony Liguori: >> Child properties express a relationship of composition. >> >> Signed-off-by: Anthony Liguori > > Do we have a flag or something that makes sure that a child is never > removed without its parent? The code assumes that child stays valid as > long as the parent lives. Good question. This is an interesting issue with qdev. The child property is not writable so you cannot detach a child. That's because the child's life cycle is supposed to be tied to the parents. qdev doesn't have the right bits to handle this right now. I think that's fixable by just adding a new flag to DeviceState. > >> @@ -499,4 +499,24 @@ gchar *qdev_get_canonical_path(DeviceState *dev); >> */ >> DeviceState *qdev_resolve_path(const char *path, bool *ambiguous); >> >> +/** >> + * @qdev_property_add_child - Add a child property to a device >> + * >> + * Child properties form the composition tree. All devices need to be a child >> + * of another device. Devices can only be a child of one device. >> + * >> + * There is no way for a child to determine what it's parent is. It is not > > s/it's/its/ Ack. Regards, Anthony Liguori > Kevin >