|
From: | Paolo Bonzini |
Subject: | Re: [Qemu-devel] [RFC] Plan for moving forward with QOM |
Date: | Thu, 15 Sep 2011 16:14:45 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |