From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRnpY-0006nC-0n for qemu-devel@nongnu.org; Mon, 04 Jan 2010 09:22:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRnpT-0006eq-Go for qemu-devel@nongnu.org; Mon, 04 Jan 2010 09:22:47 -0500 Received: from [199.232.76.173] (port=56630 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRnpT-0006el-A0 for qemu-devel@nongnu.org; Mon, 04 Jan 2010 09:22:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55161) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NRnpS-00076h-Gf for qemu-devel@nongnu.org; Mon, 04 Jan 2010 09:22:42 -0500 Message-ID: <4B41F9AC.9010104@redhat.com> Date: Mon, 04 Jan 2010 15:22:36 +0100 From: Gerd Hoffmann MIME-Version: 1.0 References: <20091224124358.GB31553@redhat.com> In-Reply-To: <20091224124358.GB31553@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCHv4 1/2] qdev: add bit property type List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org 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