qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC 0/2] Allow QOM struct fields to be marked as private
@ 2013-07-25 16:42 Peter Maydell
  2013-07-25 16:42 ` [Qemu-devel] [RFC 1/2] Provide infrastructure for marking private QOM struct fields Peter Maydell
  2013-07-25 16:42 ` [Qemu-devel] [RFC 2/2] arm_gic: Use new __private macro to mark private fields Peter Maydell
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Maydell @ 2013-07-25 16:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf, Anthony Liguori, Andreas Färber, patches

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-26  4:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-25 16:42 [Qemu-devel] [RFC 0/2] Allow QOM struct fields to be marked as private Peter Maydell
2013-07-25 16:42 ` [Qemu-devel] [RFC 1/2] Provide infrastructure for marking private QOM struct fields Peter Maydell
2013-07-26  4:39   ` Edgar E. Iglesias
2013-07-25 16:42 ` [Qemu-devel] [RFC 2/2] arm_gic: Use new __private macro to mark private fields Peter Maydell
2013-07-25 19:04   ` Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).