Received: from eggs.gnu.org ([208.118.235.92]:47963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXbHo-0006YE-D8 for qemu-devel@nongnu.org; Thu, 24 May 2012 12:53:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXb22-0006yU-0C for qemu-devel@nongnu.org; Thu, 24 May 2012 12:37:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXb21-0006x3-P5 for qemu-devel@nongnu.org; Thu, 24 May 2012 12:36:57 -0400 From: Markus Armbruster References: <1336749740-18474-1-git-send-email-armbru@redhat.com> <1336749740-18474-3-git-send-email-armbru@redhat.com> <4FB10BC2.6080306@us.ibm.com> Date: Thu, 24 May 2012 18:36:53 +0200 In-Reply-To: (Markus Armbruster's message of "Wed, 16 May 2012 22:30:51 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [RFC PATCH 2/2] Split fdd devices off the floppy controller List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: kwolf@redhat.com, hpoussin@reactos.org, qemu-devel@nongnu.org Markus Armbruster writes: > Anthony Liguori writes: > >> On 05/11/2012 10:22 AM, Markus Armbruster wrote: [...] >>> diff --git a/hw/fdc.c b/hw/fdc.c >>> index d9c4fbf..98ff87a 100644 >>> --- a/hw/fdc.c >>> +++ b/hw/fdc.c >>> @@ -54,6 +54,33 @@ >>> /********************************************************/ >>> /* Floppy drive emulation */ >>> >>> +typedef struct FDD { >>> + Object obj; >>> + BlockDriverState *bs; >>> +} FDD; >>> + >>> +#define TYPE_FDD "fdd" >>> + >>> +static TypeInfo fdd_info = { >>> + .name = TYPE_FDD, >>> + .parent = TYPE_OBJECT, >>> + .instance_size = sizeof(FDD), >>> +}; >>> + >>> +static void fdd_create(Object *fdc, const char *link_name, >>> + BlockDriverState *bs) >>> +{ >>> + Object *obj = object_new(TYPE_FDD); >>> + FDD *fdd = OBJECT_CHECK(FDD, obj, TYPE_FDD); >>> + >>> + fdd->bs = bs; >>> + object_property_add_child(qdev_get_machine(), "fdd", obj, NULL); >>> + object_property_set_link(fdc, obj, link_name, NULL); >>> +} >> >> This is not quite right. You want to do the actual initialization in >> instance_init as a method. > > Will do, thanks. > >> You should make the BlockDriverState a >> property too. The fdd_create() call then because object_new() + >> setting properties only. > > Last sentence no verb? I'm guessing s/because/becomes/ I'm afraid adding a drive property would require way too much surgery right now. The existing drive property code is encapsulated in qdev-properties.c, and works only for subtypes of TYPE_DEVICE. I guess I have to shelve this work until I can make TYPE_FDD one.