[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] container_of() vs DO_UPCAST() (was: [PATCH 2/3] Clean u
Re: [Qemu-devel] container_of() vs DO_UPCAST() (was: [PATCH 2/3] Clean up upcast from PCIDevice to I6300State)
Mon, 24 Aug 2009 12:55:13 +0100
KMail/1.12.0 (Linux/2.6.30-1-amd64; KDE/4.3.0; x86_64; ; )
On Monday 24 August 2009, Markus Armbruster wrote:
> We got container_of() in osdep.h.
> We also got DO_UPCAST() in qdev.h. Odd place, as it's not really
> specific to qdev (except for the naming of the last parameter). It
> takes the same parameters as container_of(), but in a different order,
> which I find needlessly confusing. The last parameter is insufficiently
> parenthesized in the macro expansion. Finally, I don't really like the
> name --- I find container_of() much clearer --- but that's just me.
> Why do we have two macros to do essentially the same thing?
> When should container_of() be used, and when DO_UPCAST()?
DO_UPCAST requires that the child object be at offset zero.
[Qemu-devel] [PATCH 1/3] Move watchdog, watchdog_action, give them internal linkage, Markus Armbruster, 2009/08/21
[Qemu-devel] [PATCH 2/3] Clean up upcast from PCIDevice to I6300State, Markus Armbruster, 2009/08/21
Re: [Qemu-devel] [PATCH 2/3] Clean up upcast from PCIDevice to I6300State, Paul Brook, 2009/08/24