From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MfVF2-00023R-R5 for qemu-devel@nongnu.org; Mon, 24 Aug 2009 04:49:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MfVEx-00022O-S6 for qemu-devel@nongnu.org; Mon, 24 Aug 2009 04:49:27 -0400 Received: from [199.232.76.173] (port=50122 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfVEx-00022L-Os for qemu-devel@nongnu.org; Mon, 24 Aug 2009 04:49:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16629) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MfVEx-0000mD-7Y for qemu-devel@nongnu.org; Mon, 24 Aug 2009 04:49:23 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7O8nLhx005250 for ; Mon, 24 Aug 2009 04:49:21 -0400 Received: from pike.pond.sub.org (vpn-10-25.str.redhat.com [10.32.10.25]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7O8nKrP018128 for ; Mon, 24 Aug 2009 04:49:21 -0400 References: <1250843494-28326-1-git-send-email-armbru@redhat.com> <1250843494-28326-3-git-send-email-armbru@redhat.com> From: Markus Armbruster Date: Mon, 24 Aug 2009 10:49:20 +0200 In-Reply-To: (Juan Quintela's message of "Fri\, 21 Aug 2009 19\:06\:06 +0200") Message-ID: <87ab1pvbov.fsf_-_@pike.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] container_of() vs DO_UPCAST() (was: [PATCH 2/3] Clean up upcast from PCIDevice to I6300State) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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()?