[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] container_of() vs DO_UPCAST() (was: [PATCH 2/3] Clean up up
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] container_of() vs DO_UPCAST() (was: [PATCH 2/3] Clean up upcast from PCIDevice to I6300State) |
Date: |
Mon, 24 Aug 2009 10:49:20 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) |
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()?
[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