[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCHv4 1/2] qdev: add bit property type
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] Re: [PATCHv4 1/2] qdev: add bit property type |
Date: |
Mon, 4 Jan 2010 17:38:39 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On Mon, Jan 04, 2010 at 03:22:36PM +0100, Gerd Hoffmann wrote:
> On 12/24/09 13:43, Michael S. Tsirkin wrote:
>> This adds "bit" property type, which is a boolean stored in a 32 bit
>> integer field, with legal values on and off. Will be used by virtio for
>> feature bits.
>
>> +static void *qdev_bit_prop_ptr(DeviceState *dev, Property *prop)
>> +{
>> + void *ptr = dev;
>> + assert(prop->info->type == PROP_TYPE_BIT);
>> + ptr += prop->offset / 32;
>> + return ptr;
>> +}
>
> I don't like that idea. IMHO prop->offset should be specified in bytes
> no matter what the property is. Better add a new prop->bitnr field to
> specify which bit of the 32bit word should be toggled. Then you don't
> need this function in the first place.
>
> cheers,
> Gerd
OK, I reworked the patches in this way.