|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [RFC v0 5/8] object: make interfaces concrete |
Date: | Wed, 13 Jun 2012 08:30:44 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 |
On 06/13/2012 08:02 AM, Paolo Bonzini wrote:
Il 13/06/2012 14:59, Andreas Färber ha scritto:Ouch! One can argue that's still not recursive, but what matters more this borks Anthony's in-place object_initialize() concept. Two solutions come to mind: * allocate the interfaces as part of object_new() beyond instance_sizeThat won't work if you initialize in place, because you cannot allocate the room for the interface. It is possible to put Interface objects explicitly in the class, and pass an offset when registering the type so that they can be initialized in place. But I still think we're fighting windmills...
There's no problem in my mind with allocating interfaces on the heap. in-place initialization is a readability thing, it's not a memory management thing. It's so you can see that:
struct PIIX3 { ... RTCState rtc; APICState *apic; }; 'rtc' is a child and 'apic' is a link.Anyway, I don't like the idea of making interfaces concrete. That means that a user could directly instantiate an interface which doesn't make a lot of sense.
Here's a different solution. This has not been even compile tested but I think the concept is sound.
Regards, Anthony Liguori
Paolo
0001-qom-allow-interfaces-to-be-created-while-abstract-du.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |