From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WinMi-0002cJ-Eq for qemu-devel@nongnu.org; Fri, 09 May 2014 12:09:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WinMh-0003N8-K1 for qemu-devel@nongnu.org; Fri, 09 May 2014 12:09:40 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48110) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WinMh-0003N0-Do for qemu-devel@nongnu.org; Fri, 09 May 2014 12:09:39 -0400 From: Peter Maydell Date: Fri, 9 May 2014 16:56:00 +0100 Message-Id: <1399650964-21067-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] =?utf-8?q?=5BPATCH_v2_0/4=5D_Allow_QOM_struct_fields?= =?utf-8?q?_to_be_marked_as_private?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori , patches@linaro.org This patch series provides infrastructure and documentation for marking QOM struct fields as private to the class implementation. Patch 1 is the implementation (which is a trivial five lines!) and documentation of the code pattern that it's intended to be used with. Patches 2, 3 and 4 are examples of its use: patch 2 deals with the ARM GIC classes, as an example of a largish class with some subclasses. Patches 3 and 4 are conversions of much simpler and smaller devices, so might be easier to look at first. A .h file which uses this pattern ends up with half a dozen extra lines of boilerplate, which is slightly sad but not too awful. It would be pretty easy to autogenerate (along with the type macros themselves) if we decided to do that in future, though. Example of the compiler message if you try to touch a field which is private: arm_gic_kvm.c:559:5: error: ‘iomem’ is deprecated (declared at /root/qemu/include/hw/intc/arm_gic_common.h:105): this field is private [-Werror=deprecated-declarations] Changes since the RFC back in July last year: * name the macro 'qom_private' rather than '__private' * redid patch 2 as the GIC code has been rearranged somewhat * patches 3 and 4 are new Peter Maydell (4): Provide infrastructure for marking private QOM struct fields arm_gic: Use new qom_private macro to mark private fields a9scu: Use qom_private to mark private fields arm11scu: Use qom_private to mark private fields hw/intc/arm_gic.c | 3 ++ hw/intc/arm_gic_common.c | 2 ++ hw/intc/arm_gic_kvm.c | 2 ++ hw/intc/armv7m_nvic.c | 2 ++ hw/misc/a9scu.c | 2 ++ hw/misc/arm11scu.c | 2 ++ include/hw/intc/arm_gic.h | 12 ++++++-- include/hw/intc/arm_gic_common.h | 62 +++++++++++++++++++++++----------------- include/hw/misc/a9scu.h | 16 +++++++---- include/hw/misc/arm11scu.h | 14 ++++++--- include/qemu/compiler.h | 10 +++++++ include/qom/object.h | 47 ++++++++++++++++++++++++++++++ 12 files changed, 136 insertions(+), 38 deletions(-) -- 1.9.2