qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] Clean up upcast from PCIDevice to I6300Stat


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 2/3] Clean up upcast from PCIDevice to I6300State
Date: Mon, 24 Aug 2009 17:07:25 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2

  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





reply via email to

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