On 06/01/2012 12:48 AM, Markus Armbruster wrote:
Anthony Liguori<anth...@codemonkey.ws>  writes:
[On how to model virtio devices in QOM:]
Basically, it should look like:

VirtioPCIDevice is-a PCIDevice

VirtioPCIDevice has-a link<VirtioDevice>
Could you explain why this is link<>  and not child<>?
So you can do:

qemu -device virtio-pci,id=foo,vdev=bar -device virtio-blk,id=bar,bus=foo

The alternative would be:

qemu -device virtio-pci,id=foo,child_type=virtio-blk

But that feels ugly to me. If you want to have a variable type of device, a link is the right tool.
BTW, I make no mention of BusState here.  That's intentional.  There's no need 
to involve buses IMHO.
Regards,

Anthony Liguori

VirtioDevice is-a DeviceState

VirtioBlk is-a VirtioDevice
VirtioNet is-a VirtioDevice
...

VirtioPCIBlk is-a VirtioPCIDevice
VirtioPCIBlk has-a child<VirtioBlk>

This gives us backwards compat while also providing a cleaner
model. VirtioPCIBlk et al would be deprecated eventually (but not any
time soon).

Reply via email to