qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCHv4 1/2] qdev: add bit property type


From: Gerd Hoffmann
Subject: [Qemu-devel] Re: [PATCHv4 1/2] qdev: add bit property type
Date: Mon, 04 Jan 2010 15:22:36 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-3.9.b4.fc12 Lightning/1.0pre Thunderbird/3.0b4

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]