[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Can we improve virtio data structures with QOM?

From: Anthony Liguori
Subject: Re: [Qemu-devel] Can we improve virtio data structures with QOM?
Date: Fri, 01 Jun 2012 16:12:16 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 06/01/2012 12:48 AM, Markus Armbruster wrote:
Anthony Liguori<address@hidden>  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.


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

[Prev in Thread] Current Thread [Next in Thread]