From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SaMyE-0006gR-W7 for qemu-devel@nongnu.org; Fri, 01 Jun 2012 04:12:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SaMy8-0007VC-FE for qemu-devel@nongnu.org; Fri, 01 Jun 2012 04:12:30 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:56084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SaMy8-0007UK-8N for qemu-devel@nongnu.org; Fri, 01 Jun 2012 04:12:24 -0400 Received: by pbbro12 with SMTP id ro12so2859404pbb.4 for ; Fri, 01 Jun 2012 01:12:21 -0700 (PDT) Message-ID: <4FC87960.2090206@codemonkey.ws> Date: Fri, 01 Jun 2012 16:12:16 +0800 From: Anthony Liguori MIME-Version: 1.0 References: <4FC6A71A.90303@codemonkey.ws> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Can we improve virtio data structures with QOM? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Stefan Hajnoczi , =?ISO-8859-1?Q?Andreas_F=E4rber?= , qemu-devel@nongnu.org, Evgeny Voevodin , Paolo Bonzini On 06/01/2012 12:48 AM, Markus Armbruster wrote: > Anthony Liguori writes: > > [On how to model virtio devices in QOM:] >> Basically, it should look like: >> >> VirtioPCIDevice is-a PCIDevice >> >> VirtioPCIDevice has-a link > > 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 >> >> This gives us backwards compat while also providing a cleaner >> model. VirtioPCIBlk et al would be deprecated eventually (but not any >> time soon).