From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4C6s-00006x-UH for qemu-devel@nongnu.org; Thu, 15 Sep 2011 09:36:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4C6n-0001Tt-8S for qemu-devel@nongnu.org; Thu, 15 Sep 2011 09:36:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4C6m-0001Tn-VQ for qemu-devel@nongnu.org; Thu, 15 Sep 2011 09:36:05 -0400 Message-ID: <4E71FF3E.9040008@redhat.com> Date: Thu, 15 Sep 2011 15:35:58 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <4E70EC90.8000904@us.ibm.com> <4E719F7C.10700@redhat.com> <4E71FD19.6050606@codemonkey.ws> In-Reply-To: <4E71FD19.6050606@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 , Jan Kiszka , qemu-devel , Markus Armbruster , Gerd Hoffmann , "Edgar E. Iglesias" On 09/15/2011 03:26 PM, Anthony Liguori wrote: > class PciConnector : public PciDevice > { > // provides interfaces to register closures which implement > // PCI abstract functions > }; or actually even class PciConnector : Plug { PciBus *bus; uint8_t config_space[4096]; ... } > The properties thing is definitely an interesting point, but I'm not > sure how far you can push it. If you start out with a NE2000 device that > is ISA and you decide to abstract it to a shared model, all you need to > do is keep the ISA NE2000 device named NE2000 and call the common chip > and PCI bridge something else. It still holds, for two reasons. 1) The properties will be named differently for ISA and PCI versions, which is at the very least ugly; 2) if you want to save the property names for the ISA version, you need to duplicate the logic in NE2000 and PCI_NE2000. If we had C++ and templates, the problem would be much less pressing: just use inheritance for PCI and template for ISA vs. PCI. The code duplication at least is invisible to the programmer, it's only in the object files. > I really think it's important to keep the simple cases simple. I think > any model where you don't do: > > class E1000 : public PciDevice > { > }; > > Is unnecessarily complicated. I don't think it's any more complicated. It _is_ different from what is done now, which may indeed make conversions slower. That's the main disadvantage of the connector model indeed. Paolo