qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 0/9] qdev deconstruction, command-line episode


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 0/9] qdev deconstruction, command-line episode
Date: Thu, 9 Feb 2012 15:31:49 +0100

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




reply via email to

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