[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 2/2] Split fdd devices off the floppy contro
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [RFC PATCH 2/2] Split fdd devices off the floppy controller |
Date: |
Thu, 24 May 2012 18:36:53 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Markus Armbruster <address@hidden> writes:
> Anthony Liguori <address@hidden> 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.
Re: [Qemu-devel] [RFC PATCH 0/2] Split fdd devices off the floppy controller, Markus Armbruster, 2012/05/11