From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEnEg-0007cR-Ub for qemu-devel@nongnu.org; Mon, 02 Apr 2012 15:48:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SEnEf-0007qE-A0 for qemu-devel@nongnu.org; Mon, 02 Apr 2012 15:48:18 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:48079) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEnEe-0007q0-W5 for qemu-devel@nongnu.org; Mon, 02 Apr 2012 15:48:17 -0400 Received: by werp12 with SMTP id p12so2103550wer.4 for ; Mon, 02 Apr 2012 12:48:14 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4F7A027B.9050500@redhat.com> Date: Mon, 02 Apr 2012 21:48:11 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1333376921-13834-1-git-send-email-i.mitsyanko@samsung.com> <1333376921-13834-7-git-send-email-i.mitsyanko@samsung.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 6/6] hw/sd.c: convert to QOM object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Anthony Liguori , Igor Mitsyanko , quintela@redhat.com, qemu-devel@nongnu.org, kyungmin.park@samsung.com, michael@walle.cc, afaerber@suse.de, paul@codesourcery.com Il 02/04/2012 18:48, Peter Maydell ha scritto: > Ideally rather than having a class specific init function we > should make the 'is_spi' and 'bdrv' be object properties, and > then you do something like (syntax probably wrong but): > s->card = SD_CARD(object_new(TYPE_SD_CARD)); > if (dinfo) { > object_property_set_bdrv(s->card, dinfo->bdrv, "bdrv", errp); Long term, this would be a link property. Short term it can be object_property_set_str(s->card, bdrv_get_device_name(dinfo->bdrv), "bdrv", errp); > } > realize(s->card); No need to realize explicitly if you instead call object_property_add_child to add s->card as a child of s. > (where the default for bdrv is NULL and the default for is_spi is false > so we don't need to set that). > > This needs realize support for QOM objects, though. And support for properties in non-device objects. Both coming tomorrow. :) Paolo