qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC 0/2] Allow QOM struct fields to be marked as private


From: Peter Maydell
Subject: [Qemu-devel] [RFC 0/2] Allow QOM struct fields to be marked as private
Date: Thu, 25 Jul 2013 17:42:01 +0100

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.

Patch 2 is an example of its use in the ARM GIC classes. This
patch depends on Andreas' "A9MPCore+A15MPCore QOM'ification" v2
patchset, really just because there aren't any examples in the
tree at the moment of devices which I understand and which use the
"include file with device struct which is included by both
implementation and object users" pattern.

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.

I'm not hugely attached to either the "__private" or IMPLEMENTING_FOO
naming conventions, so feel free to bikeshed them. (I am aware that
the former is treading on the implementation reserved namespace...)

Incidentally, I think I would be in favour of (as a coding style
issue) having exactly one class per .h file, which the gic doesn't
currently do (it puts both TYPE_ARM_GIC_COMMON and TYPE_ARM_GIC in
one file).


Peter Maydell (2):
  Provide infrastructure for marking private QOM struct fields
  arm_gic: Use new __private macro 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 ++
 include/hw/intc/arm_gic.h |   64 ++++++++++++++++++++++++++++-----------------
 include/qemu/compiler.h   |   10 +++++++
 include/qom/object.h      |   47 +++++++++++++++++++++++++++++++++
 7 files changed, 106 insertions(+), 24 deletions(-)

-- 
1.7.9.5




reply via email to

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