qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.9 v2] qom: Make all interface types abstra


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH for-2.9 v2] qom: Make all interface types abstract
Date: Thu, 15 Dec 2016 14:45:34 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1


On 14/12/2016 18:47, Markus Armbruster wrote:
> Paolo Bonzini <address@hidden> writes:
> 
>> On 14/12/2016 14:48, Eduardo Habkost wrote:
>>>> How do you find all abstract TypeInfo in the source?  The uninitiated
>>>> might grep for .abstract = true, and be misled.  The initiated will be
>>>> annoyed instead, because grepping for *absence* of .instance_size = is
>>>> bothersome.
>>>>
>>>> I suspect life could be easier going forward if we instead required
>>>> .abstract = true for interfaces, and enforced it with
>>>> assert(ti->instance_size || ti->abstract) here.
>>> I was doing that before deciding to change type_initialize(). I
>>> think I still have the commit in my git reflog, I will recover it
>>> and submit it as v3.
>>
>> I think it's worse.
>>
>> Interfaces are abstract by definition.  Requiring ".abstract = true"
>> makes things less intuitive.  v2 seems good.
> 
> What makes a TypeInfo declaration an interface?  Whatever it is, it
> better be *locally* obvious.

The fact that the superclass is an interface:

1) most interface names are (or should be) "interfacey".  Compare
device, memory backend, console (all classes) with user-creatable, fw
path provider, hotplug handler.  A few others simply end with "_IF".  Of
course naming is the hardest problem in computer science so there are
some interfaces whose name might apply just as well to a class (stream
slave, ISA DMA).  However...

2) ... currently we don't have a single case of an interface that
doesn't inherit from TYPE_INTERFACE, so all interfaces are declared with
".parent = TYPE_INTERFACE".  That does make a TypeInfo obviously an
interface.

If we ever have a case of interface inheritance, the supertype had
better have a good name.

Paolo



reply via email to

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