qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 06/15] piix: create i8254 through composition


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH 06/15] piix: create i8254 through composition
Date: Tue, 31 Jan 2012 17:19:36 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2012-01-31 17:12, Anthony Liguori wrote:
> On 01/31/2012 08:58 AM, Paolo Bonzini wrote:
>> On 01/31/2012 03:51 PM, Jan Kiszka wrote:
>>>>>
>>>>> BTW, this is yet another benefit of making structures public. You can 
>>>>> take the
>>>>> address of a child and set link fields directly without accessors.
>>> Well, that has two sides. We introduced properties to avoid this direct
>>> messing.
>>>
>>> Does linking also work without exposing internals?
>>
>> Perhaps it doesn't need to expose internals. Just like we create interfaces
>> automatically when creating a parent object, perhaps we can create children 
>> as
>> well, like
>>
>> TypeInfo type_piix3 = {
>> ...
>> .children = {
>> { "pic[0]", TYPE_I8259, offsetof(PIIX3, pic[0]) },
>> { "pic[1]", TYPE_I8259, offsetof(PIIX3, pic[1]) },
>> { "pit, TYPE_I8254, offsetof(PIIX3, pit) },
>> { "rtc", TYPE_RTC, offsetof(PIIX3, rtc) },
> 
> 
> Eeek.  I absolutely want to avoid any offset based interfaces.

Why?

> 
> You can just as well do:
> 
> void object_property_add_child(Object *obj, const char *name,
>                                 const char *type, Object **child);
> 
> It could then do:
> 
> *child = object_new(type);

How does this resolve where the link is stored in the opaque state
structure?

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux



reply via email to

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