From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mfb8y-0002Gq-1I for qemu-devel@nongnu.org; Mon, 24 Aug 2009 11:07:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mfb8s-0002Ab-HM for qemu-devel@nongnu.org; Mon, 24 Aug 2009 11:07:35 -0400 Received: from [199.232.76.173] (port=41370 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mfb8s-0002A0-9I for qemu-devel@nongnu.org; Mon, 24 Aug 2009 11:07:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38388) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mfb8r-0000O3-L3 for qemu-devel@nongnu.org; Mon, 24 Aug 2009 11:07:29 -0400 Received: from int-mx06.intmail.prod.int.phx2.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.19]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7OF7Sgn001416 for ; Mon, 24 Aug 2009 11:07:28 -0400 Message-ID: <4A92ACAD.8040202@redhat.com> Date: Mon, 24 Aug 2009 17:07:25 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 2/3] Clean up upcast from PCIDevice to I6300State References: <1250843494-28326-1-git-send-email-armbru@redhat.com> <1250843494-28326-3-git-send-email-armbru@redhat.com> <200908241259.06409.paul@codesourcery.com> <8763cdpbqd.fsf@pike.pond.sub.org> In-Reply-To: <8763cdpbqd.fsf@pike.pond.sub.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org Hi, > play. However, the *next* commit (conversion to qdev) is wrong if qdev > requires the PCIDevice at offset zero (not obvious to me, document it?). qdev_create() allocates DeviceInfo->size bytes for you and assumes DeviceState starts at offset zero of your FooDeviceState. I think that is the only place though. Could probably be relaxed by adding a offset field to DeviceInfo, but I don't think that buys us much, so unless there is some real need I'd just go with the "DeviceState must be first" convention. It also could be that there is some old code which does casts instead of using DO_UPCAST, especially for PCI because PCIDevice predates qdev. That I'd consider a bug though. cheers, Gerd