From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL v2 0/9] qdev deconstruction, command-line episode
Date: Tue, 21 Feb 2012 18:13:11 +0100 [thread overview]
Message-ID: <1329844391-25016-1-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1328797918-1316-1-git-send-email-pbonzini@redhat.com>
Anthony,
I'm sending a pull request since you informally said on IRC that you're
okay with the patches.
The following changes since commit 99c7f87826337fa81f2f0f9baa9ca0a44faf90e9:
input: send kbd+mouse events only to running guests. (2012-02-17 11:02:55 -0600)
are available in the git repository at:
git://github.com/bonzini/qemu.git qdev-props-for-anthony
v1->v2:
Fix bug in parsing booleans and strengthen test suite.
The interdiff is attached.
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 | 51 +++++++++++
qapi/qapi-visit-impl.h | 23 +++++
qapi/qmp-input-visitor.c | 39 +--------
qapi/qmp-output-visitor.c | 22 +-----
qapi/string-input-visitor.c | 138 +++++++++++++++++++++++++++++
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 | 195 ++++++++++++++++++++++++++++++++++++++++++
test-string-output-visitor.c | 188 ++++++++++++++++++++++++++++++++++++++++
tests/Makefile | 12 ++-
16 files changed, 841 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
diff --git a/include/qemu/object.h b/include/qemu/object.h
index 2081ca0..ff6be14 100644
--- a/include/qemu/object.h
+++ b/include/qemu/object.h
@@ -742,7 +742,7 @@ void object_property_parse(Object *obj, const char *string,
const char *name, struct Error **errp);
/**
- * object_property_set:
+ * object_property_print:
* @obj: the object
* @name: the name of the property
* @errp: returns an error if this function fails
diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c
index ceee699..497eb9a 100644
--- a/qapi/string-input-visitor.c
+++ b/qapi/string-input-visitor.c
@@ -47,13 +47,15 @@ static void parse_type_bool(Visitor *v, bool *obj, const char *name,
StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v);
if (siv->string) {
- if (strcasecmp(siv->string, "on") || strcasecmp(siv->string, "yes") ||
- strcasecmp(siv->string, "true")) {
+ if (!strcasecmp(siv->string, "on") ||
+ !strcasecmp(siv->string, "yes") ||
+ !strcasecmp(siv->string, "true")) {
*obj = true;
return;
}
- if (strcasecmp(siv->string, "off") || strcasecmp(siv->string, "no") ||
- strcasecmp(siv->string, "false")) {
+ if (!strcasecmp(siv->string, "off") ||
+ !strcasecmp(siv->string, "no") ||
+ !strcasecmp(siv->string, "false")) {
*obj = false;
return;
}
diff --git a/test-string-input-visitor.c b/test-string-input-visitor.c
index ba2cc40..5370e32 100644
--- a/test-string-input-visitor.c
+++ b/test-string-input-visitor.c
@@ -75,6 +75,41 @@ static void test_visitor_in_bool(TestInputVisitorData *data,
visit_type_bool(v, &res, NULL, &errp);
g_assert(!error_is_set(&errp));
g_assert_cmpint(res, ==, true);
+ visitor_input_teardown(data, unused);
+
+ v = visitor_input_test_init(data, "yes");
+
+ visit_type_bool(v, &res, NULL, &errp);
+ g_assert(!error_is_set(&errp));
+ g_assert_cmpint(res, ==, true);
+ visitor_input_teardown(data, unused);
+
+ v = visitor_input_test_init(data, "on");
+
+ visit_type_bool(v, &res, NULL, &errp);
+ g_assert(!error_is_set(&errp));
+ g_assert_cmpint(res, ==, true);
+ visitor_input_teardown(data, unused);
+
+ v = visitor_input_test_init(data, "false");
+
+ visit_type_bool(v, &res, NULL, &errp);
+ g_assert(!error_is_set(&errp));
+ g_assert_cmpint(res, ==, false);
+ visitor_input_teardown(data, unused);
+
+ v = visitor_input_test_init(data, "no");
+
+ visit_type_bool(v, &res, NULL, &errp);
+ g_assert(!error_is_set(&errp));
+ g_assert_cmpint(res, ==, false);
+ visitor_input_teardown(data, unused);
+
+ v = visitor_input_test_init(data, "off");
+
+ visit_type_bool(v, &res, NULL, &errp);
+ g_assert(!error_is_set(&errp));
+ g_assert_cmpint(res, ==, false);
}
static void test_visitor_in_number(TestInputVisitorData *data,
--
1.7.7.6
next prev parent reply other threads:[~2012-02-21 17:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Paolo Bonzini [this message]
2012-02-22 14:44 ` [Qemu-devel] [PULL v2 0/9] qdev deconstruction, command-line episode 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=1329844391-25016-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.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).