From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH 0/9] qdev deconstruction, command-line episode
Date: Thu, 9 Feb 2012 15:31:49 +0100 [thread overview]
Message-ID: <1328797918-1316-1-git-send-email-pbonzini@redhat.com> (raw)
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
next reply other threads:[~2012-02-09 14:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 14:31 Paolo Bonzini [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1328797918-1316-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).