qemu-devel
[Top][All Lists]
Advanced

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

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


From: Paolo Bonzini
Subject: [Qemu-devel] [PULL v2 0/9] qdev deconstruction, command-line episode
Date: Tue, 21 Feb 2012 18:13:11 +0100

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



reply via email to

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