From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4CiH-0006im-HB for qemu-devel@nongnu.org; Thu, 15 Sep 2011 10:14:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4CiG-0000zA-KS for qemu-devel@nongnu.org; Thu, 15 Sep 2011 10:14:49 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:43490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4CiG-0000z6-EX for qemu-devel@nongnu.org; Thu, 15 Sep 2011 10:14:48 -0400 Received: by wyf22 with SMTP id 22so2840124wyf.4 for ; Thu, 15 Sep 2011 07:14:47 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E720855.1090501@redhat.com> Date: Thu, 15 Sep 2011 16:14:45 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <4E70EC90.8000904@us.ibm.com> <20110915063121.GW21417@redhat.com> <4E720435.3060509@codemonkey.ws> In-Reply-To: <4E720435.3060509@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] Plan for moving forward with QOM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Peter Maydell , Anthony Liguori , Gleb Natapov , Jan Kiszka , Markus Armbruster , qemu-devel , Gerd Hoffmann , "Edgar E. Iglesias" On 09/15/2011 03:57 PM, Anthony Liguori wrote: > > void generate_tree(Device *node) > { > if (IS_PCI_BUS(node)) { > for (i = 0; i < 32; i++) { > generate_tree(lookup_device(get_property(node, "slot[%d]", i))); > } > } else if (IS_ISA_BUS(node)) { > .... > } else { > // leaf node, generate path segment > } > } > > There are certainly ways to walk the graph generically (by coloring or > following the composition paths) but that won't give you the desired > ordering. It seems easier to go backwards from the target device. Each device most likely will have a canonical parent link, and together they will give the OF path. Paolo