qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/9] qdev deconstruction, command-line episode
@ 2012-02-09 14:31 Paolo Bonzini
  2012-02-09 14:31 ` [Qemu-devel] [PATCH 1/9] qapi: allow sharing enum implementation across visitors Paolo Bonzini
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Paolo Bonzini @ 2012-02-09 14:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

This patch substitutes more qdev code with shared infrastructure.  The
code is now ripe enough that we can attack command-line parsing.

Parsing to a string is replaced with a StringInputVisitor (there is also
a StringOutputVisitor, but it's not used yet).  This lets us remove most
integer parsing/printing code; command-line parsing accesses the integer
properties with object_property_parse rather than object_property_set_int,
and that's enough in almost all cases.

Similar "type-casting visitors" could be created also for integer and
boolean and could replace the use of QObject in qom/object.c.

In addition, the limited polymorphism allowed by visitors is exploited
for PCI devfn properties.  These will always read as an integer (the
8-bit DDDDDFFF), but they can be set both as strings and integers.

While there are still a few legacy getters for "info qtree", the only
remaining legacy setters are for hex properties.  But even here we can
lay down the foundations for future simplification.  In general, they
are rarely used and their printed form is more interesting than the
parsing.  For example you'd usually set isa-serial.index instead of
isa-serial.iobase.  Plus (luckily) our main client, libvirt, only cares
about few of these, and always sets them with a 0x prefix.  So the series
stops accepting bare hexadecimal numbers, preparing for making legacy
properties read-only in 1.3 or so.

Patches 1 to 4 refactor some QAPI code and introduce the string visitors.
Patches 5 uses them in new generic property accessors.  Patches 6 to 9
put the shiny new accessors to use in qdev.

Paolo Bonzini (9):
  qapi: allow sharing enum implementation across visitors
  qapi: drop qmp_input_end_optional
  qapi: add string-based visitors
  qapi: add tests for string-based visitors
  qom: add generic string parsing/printing
  qdev: accept both strings and integers for PCI addresses
  qdev: accept hex properties only if prefixed by 0x
  qdev: use built-in QOM string parser
  qdev: drop unnecessary parse/print methods

 .gitignore                   |    2 +
 Makefile.objs                |    5 +-
 hw/qdev-properties.c         |  186 +++++++++---------------------------------
 include/qemu/object.h        |   24 ++++++
 qapi/qapi-visit-core.c       |   52 ++++++++++++
 qapi/qapi-visit-impl.h       |   23 +++++
 qapi/qmp-input-visitor.c     |   39 +--------
 qapi/qmp-output-visitor.c    |   22 +-----
 qapi/string-input-visitor.c  |  136 ++++++++++++++++++++++++++++++
 qapi/string-input-visitor.h  |   25 ++++++
 qapi/string-output-visitor.c |   89 ++++++++++++++++++++
 qapi/string-output-visitor.h |   26 ++++++
 qom/object.c                 |   24 ++++++
 test-string-input-visitor.c  |  160 +++++++++++++++++++++++++++++++++++
 test-string-output-visitor.c |  188 ++++++++++++++++++++++++++++++++++++++++++
 tests/Makefile               |   12 ++-
 16 files changed, 805 insertions(+), 208 deletions(-)
 create mode 100644 qapi/qapi-visit-impl.h
 create mode 100644 qapi/string-input-visitor.c
 create mode 100644 qapi/string-input-visitor.h
 create mode 100644 qapi/string-output-visitor.c
 create mode 100644 qapi/string-output-visitor.h
 create mode 100644 test-string-input-visitor.c
 create mode 100644 test-string-output-visitor.c

-- 
1.7.7.6

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

end of thread, other threads:[~2012-02-22 14:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-09 14:31 [Qemu-devel] [PATCH 0/9] qdev deconstruction, command-line episode Paolo Bonzini
2012-02-09 14:31 ` [Qemu-devel] [PATCH 1/9] qapi: allow sharing enum implementation across visitors Paolo Bonzini
2012-02-21 20:31   ` Andreas Färber
2012-02-22  7:30     ` Paolo Bonzini
2012-02-09 14:31 ` [Qemu-devel] [PATCH 2/9] qapi: drop qmp_input_end_optional Paolo Bonzini
2012-02-09 14:31 ` [Qemu-devel] [PATCH 3/9] qapi: add string-based visitors Paolo Bonzini
2012-02-09 14:31 ` [Qemu-devel] [PATCH 4/9] qapi: add tests for " Paolo Bonzini
2012-02-09 14:31 ` [Qemu-devel] [PATCH 5/9] qom: add generic string parsing/printing Paolo Bonzini
2012-02-21 20:47   ` Andreas Färber
2012-02-22  7:31     ` Paolo Bonzini
2012-02-09 14:31 ` [Qemu-devel] [PATCH 6/9] qdev: accept both strings and integers for PCI addresses Paolo Bonzini
2012-02-09 14:31 ` [Qemu-devel] [PATCH 7/9] qdev: accept hex properties only if prefixed by 0x Paolo Bonzini
2012-02-09 14:31 ` [Qemu-devel] [PATCH 8/9] qdev: use built-in QOM string parser Paolo Bonzini
2012-02-09 14:31 ` [Qemu-devel] [PATCH 9/9] qdev: drop unnecessary parse/print methods Paolo Bonzini
2012-02-21 17:13 ` [Qemu-devel] [PULL v2 0/9] qdev deconstruction, command-line episode Paolo Bonzini
2012-02-22 14:44   ` Anthony Liguori

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).