From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsGCg-0002cb-5B for qemu-devel@nongnu.org; Tue, 31 Jan 2012 11:05:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RsGCW-0001YC-Ii for qemu-devel@nongnu.org; Tue, 31 Jan 2012 11:05:06 -0500 Received: from goliath.siemens.de ([192.35.17.28]:23699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsGCW-0001Y7-5F for qemu-devel@nongnu.org; Tue, 31 Jan 2012 11:04:56 -0500 Message-ID: <4F281123.8060206@siemens.com> Date: Tue, 31 Jan 2012 17:04:51 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1327604460-31142-1-git-send-email-aliguori@us.ibm.com> <1327604460-31142-7-git-send-email-aliguori@us.ibm.com> <4F27FBE6.7040800@siemens.com> <4F27FEFD.5070507@codemonkey.ws> <4F28000B.5060406@siemens.com> <4F280184.3080607@redhat.com> In-Reply-To: <4F280184.3080607@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 06/15] piix: create i8254 through composition List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Peter Maydell , Anthony Liguori , Markus Armbruster , "qemu-devel@nongnu.org" , Avi Kivity On 2012-01-31 15:58, 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) }, > { } > } and .links = ... Yep, such a thing looks better. I suppose that also opens the door for (runtime) type checking, right? > } > > QOM's object_init would allocate a single malloced block for all of > them, carve out space for the parent and all children, and add the > properties. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux