diff mbox

[v11,3/6] qapi: rename QmpInputVisitor to QObjectInputVisitor

Message ID 1473088600-17930-4-git-send-email-berrange@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel P. Berrangé Sept. 5, 2016, 3:16 p.m. UTC
The QmpInputVisitor has no direct dependancy on QMP. It is
valid to use it anywhere that one has a QObject. Rename it
to better reflect its functionality as a generic QObject
to QAPI convertor.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 docs/qapi-code-gen.txt                             |   2 +-
 ...qmp-input-visitor.h => qobject-input-visitor.h} |  10 +-
 monitor.c                                          |   2 +-
 qapi/Makefile.objs                                 |   2 +-
 ...qmp-input-visitor.c => qobject-input-visitor.c} | 171 +++++++++++----------
 qmp.c                                              |   4 +-
 qom/qom-qobject.c                                  |   4 +-
 scripts/qapi-commands.py                           |   4 +-
 tests/.gitignore                                   |   4 +-
 tests/Makefile.include                             |  12 +-
 tests/check-qnull.c                                |   4 +-
 tests/test-qmp-commands.c                          |   4 +-
 ...-input-strict.c => test-qobject-input-strict.c} |   4 +-
 ...nput-visitor.c => test-qobject-input-visitor.c} |   4 +-
 tests/test-string-input-visitor.c                  |   2 +-
 tests/test-visitor-serialization.c                 |   4 +-
 util/qemu-sockets.c                                |   2 +-
 17 files changed, 121 insertions(+), 118 deletions(-)
 rename include/qapi/{qmp-input-visitor.h => qobject-input-visitor.h} (63%)
 rename qapi/{qmp-input-visitor.c => qobject-input-visitor.c} (56%)
 rename tests/{test-qmp-input-strict.c => test-qobject-input-strict.c} (99%)
 rename tests/{test-qmp-input-visitor.c => test-qobject-input-visitor.c} (99%)

Comments

Markus Armbruster Sept. 12, 2016, 4:19 p.m. UTC | #1
"Daniel P. Berrange" <berrange@redhat.com> writes:

> The QmpInputVisitor has no direct dependancy on QMP. It is
> valid to use it anywhere that one has a QObject. Rename it
> to better reflect its functionality as a generic QObject
> to QAPI convertor.
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  docs/qapi-code-gen.txt                             |   2 +-
>  ...qmp-input-visitor.h => qobject-input-visitor.h} |  10 +-
>  monitor.c                                          |   2 +-
>  qapi/Makefile.objs                                 |   2 +-
>  ...qmp-input-visitor.c => qobject-input-visitor.c} | 171 +++++++++++----------
>  qmp.c                                              |   4 +-
>  qom/qom-qobject.c                                  |   4 +-
>  scripts/qapi-commands.py                           |   4 +-
>  tests/.gitignore                                   |   4 +-
>  tests/Makefile.include                             |  12 +-
>  tests/check-qnull.c                                |   4 +-
>  tests/test-qmp-commands.c                          |   4 +-
>  ...-input-strict.c => test-qobject-input-strict.c} |   4 +-
>  ...nput-visitor.c => test-qobject-input-visitor.c} |   4 +-
>  tests/test-string-input-visitor.c                  |   2 +-
>  tests/test-visitor-serialization.c                 |   4 +-
>  util/qemu-sockets.c                                |   2 +-
>  17 files changed, 121 insertions(+), 118 deletions(-)
>  rename include/qapi/{qmp-input-visitor.h => qobject-input-visitor.h} (63%)
>  rename qapi/{qmp-input-visitor.c => qobject-input-visitor.c} (56%)
>  rename tests/{test-qmp-input-strict.c => test-qobject-input-strict.c} (99%)
>  rename tests/{test-qmp-input-visitor.c => test-qobject-input-visitor.c} (99%)

$ git-grep -Ei 'qmp.?input.*?vis'
include/qapi/visitor.h: * the dealloc and QMP input/output visitors are general, the string,
target-s390x/cpu_models.c:#include "qapi/qmp-input-visitor.h"
target-s390x/cpu_models.c:        visitor = qmp_input_visitor_new(info->props, true);
tests/test-qobject-input-strict.c: * QMP Input Visitor unit-tests (strict mode).
tests/test-qobject-input-visitor.c: * QMP Input Visitor unit-tests.

>
> diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt
> index de298dc..a011872 100644
> --- a/docs/qapi-code-gen.txt
> +++ b/docs/qapi-code-gen.txt
> @@ -1024,7 +1024,7 @@ Example:
>          Visitor *v;
>          UserDefOneList *arg1 = NULL;
>  
> -        v = qmp_input_visitor_new(QOBJECT(args), true);
> +        v = qobject_input_visitor_new(QOBJECT(args), true);
>          visit_start_struct(v, NULL, NULL, 0, &err);
>          if (err) {
>              goto out;
> diff --git a/include/qapi/qmp-input-visitor.h b/include/qapi/qobject-input-visitor.h
> similarity index 63%
> rename from include/qapi/qmp-input-visitor.h
> rename to include/qapi/qobject-input-visitor.h
> index f3ff5f3..cde328d 100644
> --- a/include/qapi/qmp-input-visitor.h
> +++ b/include/qapi/qobject-input-visitor.h
> @@ -11,20 +11,20 @@
>   *
>   */
>  
> -#ifndef QMP_INPUT_VISITOR_H
> -#define QMP_INPUT_VISITOR_H
> +#ifndef QOBJECT_INPUT_VISITOR_H
> +#define QOBJECT_INPUT_VISITOR_H
>  
>  #include "qapi/visitor.h"
>  #include "qapi/qmp/qobject.h"
>  
> -typedef struct QmpInputVisitor QmpInputVisitor;
> +typedef struct QObjectInputVisitor QObjectInputVisitor;
>  
>  /*
> - * Return a new input visitor that converts QMP to QAPI.
> + * Return a new input visitor that converts a QObject to a QAPI object.
>   *
>   * Set @strict to reject a parse that doesn't consume all keys of a
>   * dictionary; otherwise excess input is ignored.
>   */
> -Visitor *qmp_input_visitor_new(QObject *obj, bool strict);
> +Visitor *qobject_input_visitor_new(QObject *obj, bool strict);
>  
>  #endif
> diff --git a/monitor.c b/monitor.c
> index 5c00373..b151934 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -998,7 +998,7 @@ EventInfoList *qmp_query_events(Error **errp)
>   * directly into QObject instead of first parsing it with
>   * visit_type_SchemaInfoList() into a SchemaInfoList, then marshal it
>   * to QObject with generated output marshallers, every time.  Instead,
> - * we do it in test-qmp-input-visitor.c, just to make sure
> + * we do it in test-qobject-input-visitor.c, just to make sure
>   * qapi-introspect.py's output actually conforms to the schema.
>   */
>  static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data,
> diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
> index 7ea4aeb..6ec7bdc 100644
> --- a/qapi/Makefile.objs
> +++ b/qapi/Makefile.objs
> @@ -1,4 +1,4 @@
> -util-obj-y = qapi-visit-core.o qapi-dealloc-visitor.o qmp-input-visitor.o
> +util-obj-y = qapi-visit-core.o qapi-dealloc-visitor.o qobject-input-visitor.o
>  util-obj-y += qmp-output-visitor.o qmp-registry.o qmp-dispatch.o
>  util-obj-y += string-input-visitor.o string-output-visitor.o
>  util-obj-y += opts-visitor.o qapi-clone-visitor.o
> diff --git a/qapi/qmp-input-visitor.c b/qapi/qobject-input-visitor.c
> similarity index 56%
> rename from qapi/qmp-input-visitor.c
> rename to qapi/qobject-input-visitor.c
> index 64dd392..5ff3db3 100644
> --- a/qapi/qmp-input-visitor.c
> +++ b/qapi/qobject-input-visitor.c
> @@ -14,7 +14,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "qapi/visitor-impl.h"
>  #include "qemu/queue.h"
>  #include "qemu-common.h"
> @@ -34,7 +34,7 @@ typedef struct StackObject
>      QSLIST_ENTRY(StackObject) node;
>  } StackObject;
>  
> -struct QmpInputVisitor
> +struct QObjectInputVisitor
>  {
>      Visitor visitor;
>  
> @@ -49,14 +49,14 @@ struct QmpInputVisitor
>      bool strict;
>  };
>  
> -static QmpInputVisitor *to_qiv(Visitor *v)
> +static QObjectInputVisitor *to_qiv(Visitor *v)
>  {
> -    return container_of(v, QmpInputVisitor, visitor);
> +    return container_of(v, QObjectInputVisitor, visitor);
>  }
>  
> -static QObject *qmp_input_get_object(QmpInputVisitor *qiv,
> -                                     const char *name,
> -                                     bool consume)
> +static QObject *qobject_input_get_object(QObjectInputVisitor *qiv,
> +                                         const char *name,
> +                                         bool consume)

The replacement of qmp_input by qobject_input makes our long function
names even longer.  Oh well.

>  {
>      StackObject *tos;
>      QObject *qobj;
> @@ -97,8 +97,9 @@ static void qdict_add_key(const char *key, QObject *obj, void *opaque)
>      g_hash_table_insert(h, (gpointer) key, NULL);
>  }
>  
> -static const QListEntry *qmp_input_push(QmpInputVisitor *qiv, QObject *obj,
> -                                        void *qapi, Error **errp)
> +static const QListEntry *qobject_input_push(QObjectInputVisitor *qiv,
> +                                            QObject *obj, void *qapi,
> +                                            Error **errp)
>  {
>      GHashTable *h;
>      StackObject *tos = g_new0(StackObject, 1);
> @@ -120,9 +121,9 @@ static const QListEntry *qmp_input_push(QmpInputVisitor *qiv, QObject *obj,
>  }
>  
>  
> -static void qmp_input_check_struct(Visitor *v, Error **errp)
> +static void qobject_input_check_struct(Visitor *v, Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> +    QObjectInputVisitor *qiv = to_qiv(v);
>      StackObject *tos = QSLIST_FIRST(&qiv->stack);
>  
>      assert(tos && !tos->entry);
> @@ -140,7 +141,7 @@ static void qmp_input_check_struct(Visitor *v, Error **errp)
>      }
>  }
>  
> -static void qmp_input_stack_object_free(StackObject *tos)
> +static void qobject_input_stack_object_free(StackObject *tos)
>  {
>      if (tos->h) {
>          g_hash_table_unref(tos->h);
> @@ -149,21 +150,21 @@ static void qmp_input_stack_object_free(StackObject *tos)
>      g_free(tos);
>  }
>  
> -static void qmp_input_pop(Visitor *v, void **obj)
> +static void qobject_input_pop(Visitor *v, void **obj)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> +    QObjectInputVisitor *qiv = to_qiv(v);
>      StackObject *tos = QSLIST_FIRST(&qiv->stack);
>  
>      assert(tos && tos->qapi == obj);
>      QSLIST_REMOVE_HEAD(&qiv->stack, node);
> -    qmp_input_stack_object_free(tos);
> +    qobject_input_stack_object_free(tos);
>  }
>  
> -static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
> -                                   size_t size, Error **errp)
> +static void qobject_input_start_struct(Visitor *v, const char *name, void **obj,
> +                                       size_t size, Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QObject *qobj = qmp_input_get_object(qiv, name, true);
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QObject *qobj = qobject_input_get_object(qiv, name, true);
>      Error *err = NULL;
>  
>      if (obj) {
> @@ -175,7 +176,7 @@ static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
>          return;
>      }
>  
> -    qmp_input_push(qiv, qobj, obj, &err);
> +    qobject_input_push(qiv, qobj, obj, &err);
>      if (err) {
>          error_propagate(errp, err);
>          return;
> @@ -187,11 +188,12 @@ static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
>  }
>  
>  
> -static void qmp_input_start_list(Visitor *v, const char *name,
> -                                 GenericList **list, size_t size, Error **errp)
> +static void qobject_input_start_list(Visitor *v, const char *name,
> +                                     GenericList **list, size_t size,
> +                                     Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QObject *qobj = qmp_input_get_object(qiv, name, true);
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QObject *qobj = qobject_input_get_object(qiv, name, true);
>      const QListEntry *entry;
>  
>      if (!qobj || qobject_type(qobj) != QTYPE_QLIST) {
> @@ -203,7 +205,7 @@ static void qmp_input_start_list(Visitor *v, const char *name,
>          return;
>      }
>  
> -    entry = qmp_input_push(qiv, qobj, list, errp);
> +    entry = qobject_input_push(qiv, qobj, list, errp);
>      if (list) {
>          if (entry) {
>              *list = g_malloc0(size);
> @@ -213,10 +215,10 @@ static void qmp_input_start_list(Visitor *v, const char *name,
>      }
>  }
>  
> -static GenericList *qmp_input_next_list(Visitor *v, GenericList *tail,
> -                                        size_t size)
> +static GenericList *qobject_input_next_list(Visitor *v, GenericList *tail,
> +                                            size_t size)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> +    QObjectInputVisitor *qiv = to_qiv(v);
>      StackObject *so = QSLIST_FIRST(&qiv->stack);
>  
>      if (!so->entry) {
> @@ -227,12 +229,12 @@ static GenericList *qmp_input_next_list(Visitor *v, GenericList *tail,
>  }
>  
>  
> -static void qmp_input_start_alternate(Visitor *v, const char *name,
> -                                      GenericAlternate **obj, size_t size,
> -                                      bool promote_int, Error **errp)
> +static void qobject_input_start_alternate(Visitor *v, const char *name,
> +                                          GenericAlternate **obj, size_t size,
> +                                          bool promote_int, Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QObject *qobj = qmp_input_get_object(qiv, name, false);
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QObject *qobj = qobject_input_get_object(qiv, name, false);
>  
>      if (!qobj) {
>          *obj = NULL;
> @@ -246,11 +248,11 @@ static void qmp_input_start_alternate(Visitor *v, const char *name,
>      }
>  }
>  
> -static void qmp_input_type_int64(Visitor *v, const char *name, int64_t *obj,
> -                                 Error **errp)
> +static void qobject_input_type_int64(Visitor *v, const char *name, int64_t *obj,
> +                                     Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QInt *qint = qobject_to_qint(qmp_input_get_object(qiv, name, true));
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QInt *qint = qobject_to_qint(qobject_input_get_object(qiv, name, true));
>  
>      if (!qint) {
>          error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
> @@ -261,12 +263,12 @@ static void qmp_input_type_int64(Visitor *v, const char *name, int64_t *obj,
>      *obj = qint_get_int(qint);
>  }
>  
> -static void qmp_input_type_uint64(Visitor *v, const char *name, uint64_t *obj,
> -                                  Error **errp)
> +static void qobject_input_type_uint64(Visitor *v, const char *name,
> +                                      uint64_t *obj, Error **errp)
>  {
>      /* FIXME: qobject_to_qint mishandles values over INT64_MAX */
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QInt *qint = qobject_to_qint(qmp_input_get_object(qiv, name, true));
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QInt *qint = qobject_to_qint(qobject_input_get_object(qiv, name, true));
>  
>      if (!qint) {
>          error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
> @@ -277,11 +279,11 @@ static void qmp_input_type_uint64(Visitor *v, const char *name, uint64_t *obj,
>      *obj = qint_get_int(qint);
>  }
>  
> -static void qmp_input_type_bool(Visitor *v, const char *name, bool *obj,
> -                                Error **errp)
> +static void qobject_input_type_bool(Visitor *v, const char *name, bool *obj,
> +                                    Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QBool *qbool = qobject_to_qbool(qmp_input_get_object(qiv, name, true));
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QBool *qbool = qobject_to_qbool(qobject_input_get_object(qiv, name, true));
>  
>      if (!qbool) {
>          error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
> @@ -292,11 +294,12 @@ static void qmp_input_type_bool(Visitor *v, const char *name, bool *obj,
>      *obj = qbool_get_bool(qbool);
>  }
>  
> -static void qmp_input_type_str(Visitor *v, const char *name, char **obj,
> -                               Error **errp)
> +static void qobject_input_type_str(Visitor *v, const char *name, char **obj,
> +                                   Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QString *qstr = qobject_to_qstring(qmp_input_get_object(qiv, name, true));
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QString *qstr = qobject_to_qstring(qobject_input_get_object(qiv, name,
> +                                                                true));
>  
>      if (!qstr) {
>          *obj = NULL;
> @@ -308,11 +311,11 @@ static void qmp_input_type_str(Visitor *v, const char *name, char **obj,
>      *obj = g_strdup(qstring_get_str(qstr));
>  }
>  
> -static void qmp_input_type_number(Visitor *v, const char *name, double *obj,
> -                                  Error **errp)
> +static void qobject_input_type_number(Visitor *v, const char *name, double *obj,
> +                                      Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QObject *qobj = qmp_input_get_object(qiv, name, true);
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QObject *qobj = qobject_input_get_object(qiv, name, true);
>      QInt *qint;
>      QFloat *qfloat;
>  
> @@ -332,20 +335,20 @@ static void qmp_input_type_number(Visitor *v, const char *name, double *obj,
>                 "number");
>  }
>  
> -static void qmp_input_type_any(Visitor *v, const char *name, QObject **obj,
> -                               Error **errp)
> +static void qobject_input_type_any(Visitor *v, const char *name, QObject **obj,
> +                                   Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QObject *qobj = qmp_input_get_object(qiv, name, true);
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QObject *qobj = qobject_input_get_object(qiv, name, true);
>  
>      qobject_incref(qobj);
>      *obj = qobj;
>  }
>  
> -static void qmp_input_type_null(Visitor *v, const char *name, Error **errp)
> +static void qobject_input_type_null(Visitor *v, const char *name, Error **errp)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QObject *qobj = qmp_input_get_object(qiv, name, true);
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QObject *qobj = qobject_input_get_object(qiv, name, true);
>  
>      if (qobject_type(qobj) != QTYPE_QNULL) {
>          error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
> @@ -353,10 +356,10 @@ static void qmp_input_type_null(Visitor *v, const char *name, Error **errp)
>      }
>  }
>  
> -static void qmp_input_optional(Visitor *v, const char *name, bool *present)
> +static void qobject_input_optional(Visitor *v, const char *name, bool *present)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> -    QObject *qobj = qmp_input_get_object(qiv, name, false);
> +    QObjectInputVisitor *qiv = to_qiv(v);
> +    QObject *qobj = qobject_input_get_object(qiv, name, false);
>  
>      if (!qobj) {
>          *present = false;
> @@ -366,43 +369,43 @@ static void qmp_input_optional(Visitor *v, const char *name, bool *present)
>      *present = true;
>  }
>  
> -static void qmp_input_free(Visitor *v)
> +static void qobject_input_free(Visitor *v)
>  {
> -    QmpInputVisitor *qiv = to_qiv(v);
> +    QObjectInputVisitor *qiv = to_qiv(v);
>      while (!QSLIST_EMPTY(&qiv->stack)) {
>          StackObject *tos = QSLIST_FIRST(&qiv->stack);
>  
>          QSLIST_REMOVE_HEAD(&qiv->stack, node);
> -        qmp_input_stack_object_free(tos);
> +        qobject_input_stack_object_free(tos);
>      }
>  
>      qobject_decref(qiv->root);
>      g_free(qiv);
>  }
>  
> -Visitor *qmp_input_visitor_new(QObject *obj, bool strict)
> +Visitor *qobject_input_visitor_new(QObject *obj, bool strict)
>  {
> -    QmpInputVisitor *v;
> +    QObjectInputVisitor *v;
>  
>      v = g_malloc0(sizeof(*v));
>  
>      v->visitor.type = VISITOR_INPUT;
> -    v->visitor.start_struct = qmp_input_start_struct;
> -    v->visitor.check_struct = qmp_input_check_struct;
> -    v->visitor.end_struct = qmp_input_pop;
> -    v->visitor.start_list = qmp_input_start_list;
> -    v->visitor.next_list = qmp_input_next_list;
> -    v->visitor.end_list = qmp_input_pop;
> -    v->visitor.start_alternate = qmp_input_start_alternate;
> -    v->visitor.type_int64 = qmp_input_type_int64;
> -    v->visitor.type_uint64 = qmp_input_type_uint64;
> -    v->visitor.type_bool = qmp_input_type_bool;
> -    v->visitor.type_str = qmp_input_type_str;
> -    v->visitor.type_number = qmp_input_type_number;
> -    v->visitor.type_any = qmp_input_type_any;
> -    v->visitor.type_null = qmp_input_type_null;
> -    v->visitor.optional = qmp_input_optional;
> -    v->visitor.free = qmp_input_free;
> +    v->visitor.start_struct = qobject_input_start_struct;
> +    v->visitor.check_struct = qobject_input_check_struct;
> +    v->visitor.end_struct = qobject_input_pop;
> +    v->visitor.start_list = qobject_input_start_list;
> +    v->visitor.next_list = qobject_input_next_list;
> +    v->visitor.end_list = qobject_input_pop;
> +    v->visitor.start_alternate = qobject_input_start_alternate;
> +    v->visitor.type_int64 = qobject_input_type_int64;
> +    v->visitor.type_uint64 = qobject_input_type_uint64;
> +    v->visitor.type_bool = qobject_input_type_bool;
> +    v->visitor.type_str = qobject_input_type_str;
> +    v->visitor.type_number = qobject_input_type_number;
> +    v->visitor.type_any = qobject_input_type_any;
> +    v->visitor.type_null = qobject_input_type_null;
> +    v->visitor.optional = qobject_input_optional;
> +    v->visitor.free = qobject_input_free;
>      v->strict = strict;
>  
>      v->root = obj;
> diff --git a/qmp.c b/qmp.c
> index b6d531e..ffc8828 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -30,7 +30,7 @@
>  #include "qom/qom-qobject.h"
>  #include "qapi/qmp/qerror.h"
>  #include "qapi/qmp/qobject.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "hw/boards.h"
>  #include "qom/object_interfaces.h"
>  #include "hw/mem/pc-dimm.h"
> @@ -666,7 +666,7 @@ void qmp_object_add(const char *type, const char *id,
>          }
>      }
>  
> -    v = qmp_input_visitor_new(props, true);
> +    v = qobject_input_visitor_new(props, true);
>      obj = user_creatable_add_type(type, id, pdict, v, errp);
>      visit_free(v);
>      if (obj) {
> diff --git a/qom/qom-qobject.c b/qom/qom-qobject.c
> index c225abc..81959e0 100644
> --- a/qom/qom-qobject.c
> +++ b/qom/qom-qobject.c
> @@ -15,7 +15,7 @@
>  #include "qom/object.h"
>  #include "qom/qom-qobject.h"
>  #include "qapi/visitor.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "qapi/qmp-output-visitor.h"
>  
>  void object_property_set_qobject(Object *obj, QObject *value,
> @@ -23,7 +23,7 @@ void object_property_set_qobject(Object *obj, QObject *value,
>  {
>      Visitor *v;
>      /* TODO: Should we reject, rather than ignore, excess input? */
> -    v = qmp_input_visitor_new(value, false);
> +    v = qobject_input_visitor_new(value, false);
>      object_property_set(obj, v, name, errp);
>      visit_free(v);
>  }
> diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
> index a06a2c4..3010163 100644
> --- a/scripts/qapi-commands.py
> +++ b/scripts/qapi-commands.py
> @@ -117,7 +117,7 @@ def gen_marshal(name, arg_type, boxed, ret_type):
>      Visitor *v;
>      %(c_name)s arg = {0};
>  
> -    v = qmp_input_visitor_new(QOBJECT(args), true);
> +    v = qobject_input_visitor_new(QOBJECT(args), true);
>      visit_start_struct(v, NULL, NULL, 0, &err);
>      if (err) {
>          goto out;
> @@ -279,7 +279,7 @@ fdef.write(mcgen('''
>  #include "qapi/qmp/dispatch.h"
>  #include "qapi/visitor.h"
>  #include "qapi/qmp-output-visitor.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "qapi/dealloc-visitor.h"
>  #include "%(prefix)sqapi-types.h"
>  #include "%(prefix)sqapi-visit.h"
> diff --git a/tests/.gitignore b/tests/.gitignore
> index dbb5263..4ec0a1a 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -57,8 +57,8 @@ test-qht-par
>  test-qmp-commands
>  test-qmp-commands.h
>  test-qmp-event
> -test-qmp-input-strict
> -test-qmp-input-visitor
> +test-qobject-input-strict
> +test-qobject-input-visitor
>  test-qmp-introspect.[ch]
>  test-qmp-marshal.c
>  test-qmp-output-visitor
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 14be491..5ac61b7 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -24,9 +24,9 @@ check-unit-y += tests/test-qmp-output-visitor$(EXESUF)
>  gcov-files-test-qmp-output-visitor-y = qapi/qmp-output-visitor.c
>  check-unit-y += tests/test-clone-visitor$(EXESUF)
>  gcov-files-test-clone-visitor-y = qapi/qapi-clone-visitor.c
> -check-unit-y += tests/test-qmp-input-visitor$(EXESUF)
> -gcov-files-test-qmp-input-visitor-y = qapi/qmp-input-visitor.c
> -check-unit-y += tests/test-qmp-input-strict$(EXESUF)
> +check-unit-y += tests/test-qobject-input-visitor$(EXESUF)
> +gcov-files-test-qobject-input-visitor-y = qapi/qobject-input-visitor.c
> +check-unit-y += tests/test-qobject-input-strict$(EXESUF)
>  check-unit-y += tests/test-qmp-commands$(EXESUF)
>  gcov-files-test-qmp-commands-y = qapi/qmp-dispatch.c
>  check-unit-y += tests/test-string-input-visitor$(EXESUF)
> @@ -415,7 +415,7 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
>  	tests/test-coroutine.o tests/test-string-output-visitor.o \
>  	tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
>  	tests/test-clone-visitor.o \
> -	tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
> +	tests/test-qobject-input-visitor.o tests/test-qobject-input-strict.o \
>  	tests/test-qmp-commands.o tests/test-visitor-serialization.o \
>  	tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \
>  	tests/test-opts-visitor.o tests/test-qmp-event.o \
> @@ -514,8 +514,8 @@ tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(te
>  tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y)
>  tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y)
>  tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
> -tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y)
> -tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y)
> +tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
> +tests/test-qobject-input-strict$(EXESUF): tests/test-qobject-input-strict.o $(test-qapi-obj-y)
>  tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y)
>  tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
>  tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
> diff --git a/tests/check-qnull.c b/tests/check-qnull.c
> index dc906b1..eeb803a 100644
> --- a/tests/check-qnull.c
> +++ b/tests/check-qnull.c
> @@ -10,7 +10,7 @@
>  
>  #include "qapi/qmp/qobject.h"
>  #include "qemu-common.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "qapi/qmp-output-visitor.h"
>  #include "qapi/error.h"
>  
> @@ -47,7 +47,7 @@ static void qnull_visit_test(void)
>  
>      g_assert(qnull_.refcnt == 1);
>      obj = qnull();
> -    v = qmp_input_visitor_new(obj, true);
> +    v = qobject_input_visitor_new(obj, true);
>      qobject_decref(obj);
>      visit_type_null(v, NULL, &error_abort);
>      visit_free(v);
> diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
> index 261fd9e..ffb145f 100644
> --- a/tests/test-qmp-commands.c
> +++ b/tests/test-qmp-commands.c
> @@ -4,7 +4,7 @@
>  #include "test-qmp-commands.h"
>  #include "qapi/qmp/dispatch.h"
>  #include "qemu/module.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "tests/test-qapi-types.h"
>  #include "tests/test-qapi-visit.h"
>  
> @@ -229,7 +229,7 @@ static void test_dealloc_partial(void)
>          ud2_dict = qdict_new();
>          qdict_put_obj(ud2_dict, "string0", QOBJECT(qstring_from_str(text)));
>  
> -        v = qmp_input_visitor_new(QOBJECT(ud2_dict), true);
> +        v = qobject_input_visitor_new(QOBJECT(ud2_dict), true);
>          visit_type_UserDefTwo(v, NULL, &ud2, &err);
>          visit_free(v);
>          QDECREF(ud2_dict);
> diff --git a/tests/test-qmp-input-strict.c b/tests/test-qobject-input-strict.c
> similarity index 99%
> rename from tests/test-qmp-input-strict.c
> rename to tests/test-qobject-input-strict.c
> index 814550a..546f8af 100644
> --- a/tests/test-qmp-input-strict.c
> +++ b/tests/test-qobject-input-strict.c
> @@ -15,7 +15,7 @@
>  
>  #include "qemu-common.h"
>  #include "qapi/error.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "test-qapi-types.h"
>  #include "test-qapi-visit.h"
>  #include "qapi/qmp/types.h"
> @@ -53,7 +53,7 @@ static Visitor *validate_test_init_internal(TestInputVisitorData *data,
>      data->obj = qobject_from_jsonv(json_string, ap);
>      g_assert(data->obj);
>  
> -    data->qiv = qmp_input_visitor_new(data->obj, true);
> +    data->qiv = qobject_input_visitor_new(data->obj, true);
>      g_assert(data->qiv);
>      return data->qiv;
>  }
> diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qobject-input-visitor.c
> similarity index 99%
> rename from tests/test-qmp-input-visitor.c
> rename to tests/test-qobject-input-visitor.c
> index f583dce..02895f0 100644
> --- a/tests/test-qmp-input-visitor.c
> +++ b/tests/test-qobject-input-visitor.c
> @@ -14,7 +14,7 @@
>  
>  #include "qemu-common.h"
>  #include "qapi/error.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "test-qapi-types.h"
>  #include "test-qapi-visit.h"
>  #include "qapi/qmp/types.h"
> @@ -49,7 +49,7 @@ static Visitor *visitor_input_test_init_internal(TestInputVisitorData *data,
>      data->obj = qobject_from_jsonv(json_string, ap);
>      g_assert(data->obj);
>  
> -    data->qiv = qmp_input_visitor_new(data->obj, false);
> +    data->qiv = qobject_input_visitor_new(data->obj, false);
>      g_assert(data->qiv);
>      return data->qiv;
>  }
> diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
> index d837ebe..9bdcd74 100644
> --- a/tests/test-string-input-visitor.c
> +++ b/tests/test-string-input-visitor.c
> @@ -4,7 +4,7 @@
>   * Copyright (C) 2012 Red Hat Inc.
>   *
>   * Authors:
> - *  Paolo Bonzini <pbonzini@redhat.com> (based on test-qmp-input-visitor)
> + *  Paolo Bonzini <pbonzini@redhat.com> (based on test-qobject-input-visitor)
>   *
>   * This work is licensed under the terms of the GNU GPL, version 2 or later.
>   * See the COPYING file in the top-level directory.
> diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
> index dba4670..51df428 100644
> --- a/tests/test-visitor-serialization.c
> +++ b/tests/test-visitor-serialization.c
> @@ -20,7 +20,7 @@
>  #include "qapi/error.h"
>  #include "qapi/qmp/types.h"
>  #include "qapi/qmp/qjson.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "qapi/qmp-output-visitor.h"
>  #include "qapi/string-input-visitor.h"
>  #include "qapi/string-output-visitor.h"
> @@ -1040,7 +1040,7 @@ static void qmp_deserialize(void **native_out, void *datap,
>      obj = qobject_from_json(qstring_get_str(output_json));
>  
>      QDECREF(output_json);
> -    d->qiv = qmp_input_visitor_new(obj, true);
> +    d->qiv = qobject_input_visitor_new(obj, true);
>      qobject_decref(obj_orig);
>      qobject_decref(obj);
>      visit(d->qiv, native_out, errp);
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index 2aed799..dd9ad44 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -21,7 +21,7 @@
>  #include "qapi/error.h"
>  #include "qemu/sockets.h"
>  #include "qemu/main-loop.h"
> -#include "qapi/qmp-input-visitor.h"
> +#include "qapi/qobject-input-visitor.h"
>  #include "qapi/qmp-output-visitor.h"
>  #include "qapi-visit.h"
>  #include "qemu/cutils.h"

I guess we could simply live with the badly chosen name (and avoid the
churn), but since you did the work already...
Daniel P. Berrangé Sept. 13, 2016, 10:25 a.m. UTC | #2
On Mon, Sep 12, 2016 at 06:19:08PM +0200, Markus Armbruster wrote:
> "Daniel P. Berrange" <berrange@redhat.com> writes:
> 
> > The QmpInputVisitor has no direct dependancy on QMP. It is
> > valid to use it anywhere that one has a QObject. Rename it
> > to better reflect its functionality as a generic QObject
> > to QAPI convertor.
> >
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  docs/qapi-code-gen.txt                             |   2 +-
> >  ...qmp-input-visitor.h => qobject-input-visitor.h} |  10 +-
> >  monitor.c                                          |   2 +-
> >  qapi/Makefile.objs                                 |   2 +-
> >  ...qmp-input-visitor.c => qobject-input-visitor.c} | 171 +++++++++++----------
> >  qmp.c                                              |   4 +-
> >  qom/qom-qobject.c                                  |   4 +-
> >  scripts/qapi-commands.py                           |   4 +-
> >  tests/.gitignore                                   |   4 +-
> >  tests/Makefile.include                             |  12 +-
> >  tests/check-qnull.c                                |   4 +-
> >  tests/test-qmp-commands.c                          |   4 +-
> >  ...-input-strict.c => test-qobject-input-strict.c} |   4 +-
> >  ...nput-visitor.c => test-qobject-input-visitor.c} |   4 +-
> >  tests/test-string-input-visitor.c                  |   2 +-
> >  tests/test-visitor-serialization.c                 |   4 +-
> >  util/qemu-sockets.c                                |   2 +-
> >  17 files changed, 121 insertions(+), 118 deletions(-)
> >  rename include/qapi/{qmp-input-visitor.h => qobject-input-visitor.h} (63%)
> >  rename qapi/{qmp-input-visitor.c => qobject-input-visitor.c} (56%)
> >  rename tests/{test-qmp-input-strict.c => test-qobject-input-strict.c} (99%)
> >  rename tests/{test-qmp-input-visitor.c => test-qobject-input-visitor.c} (99%)
> 
> $ git-grep -Ei 'qmp.?input.*?vis'
> include/qapi/visitor.h: * the dealloc and QMP input/output visitors are general, the string,
> target-s390x/cpu_models.c:#include "qapi/qmp-input-visitor.h"
> target-s390x/cpu_models.c:        visitor = qmp_input_visitor_new(info->props, true);
> tests/test-qobject-input-strict.c: * QMP Input Visitor unit-tests (strict mode).
> tests/test-qobject-input-visitor.c: * QMP Input Visitor unit-tests.

Opps, yes will fix those.


Regards,
Daniel
diff mbox

Patch

diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt
index de298dc..a011872 100644
--- a/docs/qapi-code-gen.txt
+++ b/docs/qapi-code-gen.txt
@@ -1024,7 +1024,7 @@  Example:
         Visitor *v;
         UserDefOneList *arg1 = NULL;
 
-        v = qmp_input_visitor_new(QOBJECT(args), true);
+        v = qobject_input_visitor_new(QOBJECT(args), true);
         visit_start_struct(v, NULL, NULL, 0, &err);
         if (err) {
             goto out;
diff --git a/include/qapi/qmp-input-visitor.h b/include/qapi/qobject-input-visitor.h
similarity index 63%
rename from include/qapi/qmp-input-visitor.h
rename to include/qapi/qobject-input-visitor.h
index f3ff5f3..cde328d 100644
--- a/include/qapi/qmp-input-visitor.h
+++ b/include/qapi/qobject-input-visitor.h
@@ -11,20 +11,20 @@ 
  *
  */
 
-#ifndef QMP_INPUT_VISITOR_H
-#define QMP_INPUT_VISITOR_H
+#ifndef QOBJECT_INPUT_VISITOR_H
+#define QOBJECT_INPUT_VISITOR_H
 
 #include "qapi/visitor.h"
 #include "qapi/qmp/qobject.h"
 
-typedef struct QmpInputVisitor QmpInputVisitor;
+typedef struct QObjectInputVisitor QObjectInputVisitor;
 
 /*
- * Return a new input visitor that converts QMP to QAPI.
+ * Return a new input visitor that converts a QObject to a QAPI object.
  *
  * Set @strict to reject a parse that doesn't consume all keys of a
  * dictionary; otherwise excess input is ignored.
  */
-Visitor *qmp_input_visitor_new(QObject *obj, bool strict);
+Visitor *qobject_input_visitor_new(QObject *obj, bool strict);
 
 #endif
diff --git a/monitor.c b/monitor.c
index 5c00373..b151934 100644
--- a/monitor.c
+++ b/monitor.c
@@ -998,7 +998,7 @@  EventInfoList *qmp_query_events(Error **errp)
  * directly into QObject instead of first parsing it with
  * visit_type_SchemaInfoList() into a SchemaInfoList, then marshal it
  * to QObject with generated output marshallers, every time.  Instead,
- * we do it in test-qmp-input-visitor.c, just to make sure
+ * we do it in test-qobject-input-visitor.c, just to make sure
  * qapi-introspect.py's output actually conforms to the schema.
  */
 static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data,
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index 7ea4aeb..6ec7bdc 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -1,4 +1,4 @@ 
-util-obj-y = qapi-visit-core.o qapi-dealloc-visitor.o qmp-input-visitor.o
+util-obj-y = qapi-visit-core.o qapi-dealloc-visitor.o qobject-input-visitor.o
 util-obj-y += qmp-output-visitor.o qmp-registry.o qmp-dispatch.o
 util-obj-y += string-input-visitor.o string-output-visitor.o
 util-obj-y += opts-visitor.o qapi-clone-visitor.o
diff --git a/qapi/qmp-input-visitor.c b/qapi/qobject-input-visitor.c
similarity index 56%
rename from qapi/qmp-input-visitor.c
rename to qapi/qobject-input-visitor.c
index 64dd392..5ff3db3 100644
--- a/qapi/qmp-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -14,7 +14,7 @@ 
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "qapi/visitor-impl.h"
 #include "qemu/queue.h"
 #include "qemu-common.h"
@@ -34,7 +34,7 @@  typedef struct StackObject
     QSLIST_ENTRY(StackObject) node;
 } StackObject;
 
-struct QmpInputVisitor
+struct QObjectInputVisitor
 {
     Visitor visitor;
 
@@ -49,14 +49,14 @@  struct QmpInputVisitor
     bool strict;
 };
 
-static QmpInputVisitor *to_qiv(Visitor *v)
+static QObjectInputVisitor *to_qiv(Visitor *v)
 {
-    return container_of(v, QmpInputVisitor, visitor);
+    return container_of(v, QObjectInputVisitor, visitor);
 }
 
-static QObject *qmp_input_get_object(QmpInputVisitor *qiv,
-                                     const char *name,
-                                     bool consume)
+static QObject *qobject_input_get_object(QObjectInputVisitor *qiv,
+                                         const char *name,
+                                         bool consume)
 {
     StackObject *tos;
     QObject *qobj;
@@ -97,8 +97,9 @@  static void qdict_add_key(const char *key, QObject *obj, void *opaque)
     g_hash_table_insert(h, (gpointer) key, NULL);
 }
 
-static const QListEntry *qmp_input_push(QmpInputVisitor *qiv, QObject *obj,
-                                        void *qapi, Error **errp)
+static const QListEntry *qobject_input_push(QObjectInputVisitor *qiv,
+                                            QObject *obj, void *qapi,
+                                            Error **errp)
 {
     GHashTable *h;
     StackObject *tos = g_new0(StackObject, 1);
@@ -120,9 +121,9 @@  static const QListEntry *qmp_input_push(QmpInputVisitor *qiv, QObject *obj,
 }
 
 
-static void qmp_input_check_struct(Visitor *v, Error **errp)
+static void qobject_input_check_struct(Visitor *v, Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
+    QObjectInputVisitor *qiv = to_qiv(v);
     StackObject *tos = QSLIST_FIRST(&qiv->stack);
 
     assert(tos && !tos->entry);
@@ -140,7 +141,7 @@  static void qmp_input_check_struct(Visitor *v, Error **errp)
     }
 }
 
-static void qmp_input_stack_object_free(StackObject *tos)
+static void qobject_input_stack_object_free(StackObject *tos)
 {
     if (tos->h) {
         g_hash_table_unref(tos->h);
@@ -149,21 +150,21 @@  static void qmp_input_stack_object_free(StackObject *tos)
     g_free(tos);
 }
 
-static void qmp_input_pop(Visitor *v, void **obj)
+static void qobject_input_pop(Visitor *v, void **obj)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
+    QObjectInputVisitor *qiv = to_qiv(v);
     StackObject *tos = QSLIST_FIRST(&qiv->stack);
 
     assert(tos && tos->qapi == obj);
     QSLIST_REMOVE_HEAD(&qiv->stack, node);
-    qmp_input_stack_object_free(tos);
+    qobject_input_stack_object_free(tos);
 }
 
-static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
-                                   size_t size, Error **errp)
+static void qobject_input_start_struct(Visitor *v, const char *name, void **obj,
+                                       size_t size, Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QObject *qobj = qmp_input_get_object(qiv, name, true);
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QObject *qobj = qobject_input_get_object(qiv, name, true);
     Error *err = NULL;
 
     if (obj) {
@@ -175,7 +176,7 @@  static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
         return;
     }
 
-    qmp_input_push(qiv, qobj, obj, &err);
+    qobject_input_push(qiv, qobj, obj, &err);
     if (err) {
         error_propagate(errp, err);
         return;
@@ -187,11 +188,12 @@  static void qmp_input_start_struct(Visitor *v, const char *name, void **obj,
 }
 
 
-static void qmp_input_start_list(Visitor *v, const char *name,
-                                 GenericList **list, size_t size, Error **errp)
+static void qobject_input_start_list(Visitor *v, const char *name,
+                                     GenericList **list, size_t size,
+                                     Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QObject *qobj = qmp_input_get_object(qiv, name, true);
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QObject *qobj = qobject_input_get_object(qiv, name, true);
     const QListEntry *entry;
 
     if (!qobj || qobject_type(qobj) != QTYPE_QLIST) {
@@ -203,7 +205,7 @@  static void qmp_input_start_list(Visitor *v, const char *name,
         return;
     }
 
-    entry = qmp_input_push(qiv, qobj, list, errp);
+    entry = qobject_input_push(qiv, qobj, list, errp);
     if (list) {
         if (entry) {
             *list = g_malloc0(size);
@@ -213,10 +215,10 @@  static void qmp_input_start_list(Visitor *v, const char *name,
     }
 }
 
-static GenericList *qmp_input_next_list(Visitor *v, GenericList *tail,
-                                        size_t size)
+static GenericList *qobject_input_next_list(Visitor *v, GenericList *tail,
+                                            size_t size)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
+    QObjectInputVisitor *qiv = to_qiv(v);
     StackObject *so = QSLIST_FIRST(&qiv->stack);
 
     if (!so->entry) {
@@ -227,12 +229,12 @@  static GenericList *qmp_input_next_list(Visitor *v, GenericList *tail,
 }
 
 
-static void qmp_input_start_alternate(Visitor *v, const char *name,
-                                      GenericAlternate **obj, size_t size,
-                                      bool promote_int, Error **errp)
+static void qobject_input_start_alternate(Visitor *v, const char *name,
+                                          GenericAlternate **obj, size_t size,
+                                          bool promote_int, Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QObject *qobj = qmp_input_get_object(qiv, name, false);
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QObject *qobj = qobject_input_get_object(qiv, name, false);
 
     if (!qobj) {
         *obj = NULL;
@@ -246,11 +248,11 @@  static void qmp_input_start_alternate(Visitor *v, const char *name,
     }
 }
 
-static void qmp_input_type_int64(Visitor *v, const char *name, int64_t *obj,
-                                 Error **errp)
+static void qobject_input_type_int64(Visitor *v, const char *name, int64_t *obj,
+                                     Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QInt *qint = qobject_to_qint(qmp_input_get_object(qiv, name, true));
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QInt *qint = qobject_to_qint(qobject_input_get_object(qiv, name, true));
 
     if (!qint) {
         error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
@@ -261,12 +263,12 @@  static void qmp_input_type_int64(Visitor *v, const char *name, int64_t *obj,
     *obj = qint_get_int(qint);
 }
 
-static void qmp_input_type_uint64(Visitor *v, const char *name, uint64_t *obj,
-                                  Error **errp)
+static void qobject_input_type_uint64(Visitor *v, const char *name,
+                                      uint64_t *obj, Error **errp)
 {
     /* FIXME: qobject_to_qint mishandles values over INT64_MAX */
-    QmpInputVisitor *qiv = to_qiv(v);
-    QInt *qint = qobject_to_qint(qmp_input_get_object(qiv, name, true));
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QInt *qint = qobject_to_qint(qobject_input_get_object(qiv, name, true));
 
     if (!qint) {
         error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
@@ -277,11 +279,11 @@  static void qmp_input_type_uint64(Visitor *v, const char *name, uint64_t *obj,
     *obj = qint_get_int(qint);
 }
 
-static void qmp_input_type_bool(Visitor *v, const char *name, bool *obj,
-                                Error **errp)
+static void qobject_input_type_bool(Visitor *v, const char *name, bool *obj,
+                                    Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QBool *qbool = qobject_to_qbool(qmp_input_get_object(qiv, name, true));
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QBool *qbool = qobject_to_qbool(qobject_input_get_object(qiv, name, true));
 
     if (!qbool) {
         error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
@@ -292,11 +294,12 @@  static void qmp_input_type_bool(Visitor *v, const char *name, bool *obj,
     *obj = qbool_get_bool(qbool);
 }
 
-static void qmp_input_type_str(Visitor *v, const char *name, char **obj,
-                               Error **errp)
+static void qobject_input_type_str(Visitor *v, const char *name, char **obj,
+                                   Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QString *qstr = qobject_to_qstring(qmp_input_get_object(qiv, name, true));
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QString *qstr = qobject_to_qstring(qobject_input_get_object(qiv, name,
+                                                                true));
 
     if (!qstr) {
         *obj = NULL;
@@ -308,11 +311,11 @@  static void qmp_input_type_str(Visitor *v, const char *name, char **obj,
     *obj = g_strdup(qstring_get_str(qstr));
 }
 
-static void qmp_input_type_number(Visitor *v, const char *name, double *obj,
-                                  Error **errp)
+static void qobject_input_type_number(Visitor *v, const char *name, double *obj,
+                                      Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QObject *qobj = qmp_input_get_object(qiv, name, true);
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QObject *qobj = qobject_input_get_object(qiv, name, true);
     QInt *qint;
     QFloat *qfloat;
 
@@ -332,20 +335,20 @@  static void qmp_input_type_number(Visitor *v, const char *name, double *obj,
                "number");
 }
 
-static void qmp_input_type_any(Visitor *v, const char *name, QObject **obj,
-                               Error **errp)
+static void qobject_input_type_any(Visitor *v, const char *name, QObject **obj,
+                                   Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QObject *qobj = qmp_input_get_object(qiv, name, true);
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QObject *qobj = qobject_input_get_object(qiv, name, true);
 
     qobject_incref(qobj);
     *obj = qobj;
 }
 
-static void qmp_input_type_null(Visitor *v, const char *name, Error **errp)
+static void qobject_input_type_null(Visitor *v, const char *name, Error **errp)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QObject *qobj = qmp_input_get_object(qiv, name, true);
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QObject *qobj = qobject_input_get_object(qiv, name, true);
 
     if (qobject_type(qobj) != QTYPE_QNULL) {
         error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
@@ -353,10 +356,10 @@  static void qmp_input_type_null(Visitor *v, const char *name, Error **errp)
     }
 }
 
-static void qmp_input_optional(Visitor *v, const char *name, bool *present)
+static void qobject_input_optional(Visitor *v, const char *name, bool *present)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
-    QObject *qobj = qmp_input_get_object(qiv, name, false);
+    QObjectInputVisitor *qiv = to_qiv(v);
+    QObject *qobj = qobject_input_get_object(qiv, name, false);
 
     if (!qobj) {
         *present = false;
@@ -366,43 +369,43 @@  static void qmp_input_optional(Visitor *v, const char *name, bool *present)
     *present = true;
 }
 
-static void qmp_input_free(Visitor *v)
+static void qobject_input_free(Visitor *v)
 {
-    QmpInputVisitor *qiv = to_qiv(v);
+    QObjectInputVisitor *qiv = to_qiv(v);
     while (!QSLIST_EMPTY(&qiv->stack)) {
         StackObject *tos = QSLIST_FIRST(&qiv->stack);
 
         QSLIST_REMOVE_HEAD(&qiv->stack, node);
-        qmp_input_stack_object_free(tos);
+        qobject_input_stack_object_free(tos);
     }
 
     qobject_decref(qiv->root);
     g_free(qiv);
 }
 
-Visitor *qmp_input_visitor_new(QObject *obj, bool strict)
+Visitor *qobject_input_visitor_new(QObject *obj, bool strict)
 {
-    QmpInputVisitor *v;
+    QObjectInputVisitor *v;
 
     v = g_malloc0(sizeof(*v));
 
     v->visitor.type = VISITOR_INPUT;
-    v->visitor.start_struct = qmp_input_start_struct;
-    v->visitor.check_struct = qmp_input_check_struct;
-    v->visitor.end_struct = qmp_input_pop;
-    v->visitor.start_list = qmp_input_start_list;
-    v->visitor.next_list = qmp_input_next_list;
-    v->visitor.end_list = qmp_input_pop;
-    v->visitor.start_alternate = qmp_input_start_alternate;
-    v->visitor.type_int64 = qmp_input_type_int64;
-    v->visitor.type_uint64 = qmp_input_type_uint64;
-    v->visitor.type_bool = qmp_input_type_bool;
-    v->visitor.type_str = qmp_input_type_str;
-    v->visitor.type_number = qmp_input_type_number;
-    v->visitor.type_any = qmp_input_type_any;
-    v->visitor.type_null = qmp_input_type_null;
-    v->visitor.optional = qmp_input_optional;
-    v->visitor.free = qmp_input_free;
+    v->visitor.start_struct = qobject_input_start_struct;
+    v->visitor.check_struct = qobject_input_check_struct;
+    v->visitor.end_struct = qobject_input_pop;
+    v->visitor.start_list = qobject_input_start_list;
+    v->visitor.next_list = qobject_input_next_list;
+    v->visitor.end_list = qobject_input_pop;
+    v->visitor.start_alternate = qobject_input_start_alternate;
+    v->visitor.type_int64 = qobject_input_type_int64;
+    v->visitor.type_uint64 = qobject_input_type_uint64;
+    v->visitor.type_bool = qobject_input_type_bool;
+    v->visitor.type_str = qobject_input_type_str;
+    v->visitor.type_number = qobject_input_type_number;
+    v->visitor.type_any = qobject_input_type_any;
+    v->visitor.type_null = qobject_input_type_null;
+    v->visitor.optional = qobject_input_optional;
+    v->visitor.free = qobject_input_free;
     v->strict = strict;
 
     v->root = obj;
diff --git a/qmp.c b/qmp.c
index b6d531e..ffc8828 100644
--- a/qmp.c
+++ b/qmp.c
@@ -30,7 +30,7 @@ 
 #include "qom/qom-qobject.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/qmp/qobject.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "hw/boards.h"
 #include "qom/object_interfaces.h"
 #include "hw/mem/pc-dimm.h"
@@ -666,7 +666,7 @@  void qmp_object_add(const char *type, const char *id,
         }
     }
 
-    v = qmp_input_visitor_new(props, true);
+    v = qobject_input_visitor_new(props, true);
     obj = user_creatable_add_type(type, id, pdict, v, errp);
     visit_free(v);
     if (obj) {
diff --git a/qom/qom-qobject.c b/qom/qom-qobject.c
index c225abc..81959e0 100644
--- a/qom/qom-qobject.c
+++ b/qom/qom-qobject.c
@@ -15,7 +15,7 @@ 
 #include "qom/object.h"
 #include "qom/qom-qobject.h"
 #include "qapi/visitor.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "qapi/qmp-output-visitor.h"
 
 void object_property_set_qobject(Object *obj, QObject *value,
@@ -23,7 +23,7 @@  void object_property_set_qobject(Object *obj, QObject *value,
 {
     Visitor *v;
     /* TODO: Should we reject, rather than ignore, excess input? */
-    v = qmp_input_visitor_new(value, false);
+    v = qobject_input_visitor_new(value, false);
     object_property_set(obj, v, name, errp);
     visit_free(v);
 }
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index a06a2c4..3010163 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -117,7 +117,7 @@  def gen_marshal(name, arg_type, boxed, ret_type):
     Visitor *v;
     %(c_name)s arg = {0};
 
-    v = qmp_input_visitor_new(QOBJECT(args), true);
+    v = qobject_input_visitor_new(QOBJECT(args), true);
     visit_start_struct(v, NULL, NULL, 0, &err);
     if (err) {
         goto out;
@@ -279,7 +279,7 @@  fdef.write(mcgen('''
 #include "qapi/qmp/dispatch.h"
 #include "qapi/visitor.h"
 #include "qapi/qmp-output-visitor.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "qapi/dealloc-visitor.h"
 #include "%(prefix)sqapi-types.h"
 #include "%(prefix)sqapi-visit.h"
diff --git a/tests/.gitignore b/tests/.gitignore
index dbb5263..4ec0a1a 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -57,8 +57,8 @@  test-qht-par
 test-qmp-commands
 test-qmp-commands.h
 test-qmp-event
-test-qmp-input-strict
-test-qmp-input-visitor
+test-qobject-input-strict
+test-qobject-input-visitor
 test-qmp-introspect.[ch]
 test-qmp-marshal.c
 test-qmp-output-visitor
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 14be491..5ac61b7 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -24,9 +24,9 @@  check-unit-y += tests/test-qmp-output-visitor$(EXESUF)
 gcov-files-test-qmp-output-visitor-y = qapi/qmp-output-visitor.c
 check-unit-y += tests/test-clone-visitor$(EXESUF)
 gcov-files-test-clone-visitor-y = qapi/qapi-clone-visitor.c
-check-unit-y += tests/test-qmp-input-visitor$(EXESUF)
-gcov-files-test-qmp-input-visitor-y = qapi/qmp-input-visitor.c
-check-unit-y += tests/test-qmp-input-strict$(EXESUF)
+check-unit-y += tests/test-qobject-input-visitor$(EXESUF)
+gcov-files-test-qobject-input-visitor-y = qapi/qobject-input-visitor.c
+check-unit-y += tests/test-qobject-input-strict$(EXESUF)
 check-unit-y += tests/test-qmp-commands$(EXESUF)
 gcov-files-test-qmp-commands-y = qapi/qmp-dispatch.c
 check-unit-y += tests/test-string-input-visitor$(EXESUF)
@@ -415,7 +415,7 @@  test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \
 	tests/test-coroutine.o tests/test-string-output-visitor.o \
 	tests/test-string-input-visitor.o tests/test-qmp-output-visitor.o \
 	tests/test-clone-visitor.o \
-	tests/test-qmp-input-visitor.o tests/test-qmp-input-strict.o \
+	tests/test-qobject-input-visitor.o tests/test-qobject-input-strict.o \
 	tests/test-qmp-commands.o tests/test-visitor-serialization.o \
 	tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \
 	tests/test-opts-visitor.o tests/test-qmp-event.o \
@@ -514,8 +514,8 @@  tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(te
 tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y)
 tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y)
 tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
-tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y)
-tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y)
+tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
+tests/test-qobject-input-strict$(EXESUF): tests/test-qobject-input-strict.o $(test-qapi-obj-y)
 tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y)
 tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
 tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
diff --git a/tests/check-qnull.c b/tests/check-qnull.c
index dc906b1..eeb803a 100644
--- a/tests/check-qnull.c
+++ b/tests/check-qnull.c
@@ -10,7 +10,7 @@ 
 
 #include "qapi/qmp/qobject.h"
 #include "qemu-common.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "qapi/qmp-output-visitor.h"
 #include "qapi/error.h"
 
@@ -47,7 +47,7 @@  static void qnull_visit_test(void)
 
     g_assert(qnull_.refcnt == 1);
     obj = qnull();
-    v = qmp_input_visitor_new(obj, true);
+    v = qobject_input_visitor_new(obj, true);
     qobject_decref(obj);
     visit_type_null(v, NULL, &error_abort);
     visit_free(v);
diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
index 261fd9e..ffb145f 100644
--- a/tests/test-qmp-commands.c
+++ b/tests/test-qmp-commands.c
@@ -4,7 +4,7 @@ 
 #include "test-qmp-commands.h"
 #include "qapi/qmp/dispatch.h"
 #include "qemu/module.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "tests/test-qapi-types.h"
 #include "tests/test-qapi-visit.h"
 
@@ -229,7 +229,7 @@  static void test_dealloc_partial(void)
         ud2_dict = qdict_new();
         qdict_put_obj(ud2_dict, "string0", QOBJECT(qstring_from_str(text)));
 
-        v = qmp_input_visitor_new(QOBJECT(ud2_dict), true);
+        v = qobject_input_visitor_new(QOBJECT(ud2_dict), true);
         visit_type_UserDefTwo(v, NULL, &ud2, &err);
         visit_free(v);
         QDECREF(ud2_dict);
diff --git a/tests/test-qmp-input-strict.c b/tests/test-qobject-input-strict.c
similarity index 99%
rename from tests/test-qmp-input-strict.c
rename to tests/test-qobject-input-strict.c
index 814550a..546f8af 100644
--- a/tests/test-qmp-input-strict.c
+++ b/tests/test-qobject-input-strict.c
@@ -15,7 +15,7 @@ 
 
 #include "qemu-common.h"
 #include "qapi/error.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "test-qapi-types.h"
 #include "test-qapi-visit.h"
 #include "qapi/qmp/types.h"
@@ -53,7 +53,7 @@  static Visitor *validate_test_init_internal(TestInputVisitorData *data,
     data->obj = qobject_from_jsonv(json_string, ap);
     g_assert(data->obj);
 
-    data->qiv = qmp_input_visitor_new(data->obj, true);
+    data->qiv = qobject_input_visitor_new(data->obj, true);
     g_assert(data->qiv);
     return data->qiv;
 }
diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qobject-input-visitor.c
similarity index 99%
rename from tests/test-qmp-input-visitor.c
rename to tests/test-qobject-input-visitor.c
index f583dce..02895f0 100644
--- a/tests/test-qmp-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -14,7 +14,7 @@ 
 
 #include "qemu-common.h"
 #include "qapi/error.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "test-qapi-types.h"
 #include "test-qapi-visit.h"
 #include "qapi/qmp/types.h"
@@ -49,7 +49,7 @@  static Visitor *visitor_input_test_init_internal(TestInputVisitorData *data,
     data->obj = qobject_from_jsonv(json_string, ap);
     g_assert(data->obj);
 
-    data->qiv = qmp_input_visitor_new(data->obj, false);
+    data->qiv = qobject_input_visitor_new(data->obj, false);
     g_assert(data->qiv);
     return data->qiv;
 }
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index d837ebe..9bdcd74 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -4,7 +4,7 @@ 
  * Copyright (C) 2012 Red Hat Inc.
  *
  * Authors:
- *  Paolo Bonzini <pbonzini@redhat.com> (based on test-qmp-input-visitor)
+ *  Paolo Bonzini <pbonzini@redhat.com> (based on test-qobject-input-visitor)
  *
  * This work is licensed under the terms of the GNU GPL, version 2 or later.
  * See the COPYING file in the top-level directory.
diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
index dba4670..51df428 100644
--- a/tests/test-visitor-serialization.c
+++ b/tests/test-visitor-serialization.c
@@ -20,7 +20,7 @@ 
 #include "qapi/error.h"
 #include "qapi/qmp/types.h"
 #include "qapi/qmp/qjson.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "qapi/qmp-output-visitor.h"
 #include "qapi/string-input-visitor.h"
 #include "qapi/string-output-visitor.h"
@@ -1040,7 +1040,7 @@  static void qmp_deserialize(void **native_out, void *datap,
     obj = qobject_from_json(qstring_get_str(output_json));
 
     QDECREF(output_json);
-    d->qiv = qmp_input_visitor_new(obj, true);
+    d->qiv = qobject_input_visitor_new(obj, true);
     qobject_decref(obj_orig);
     qobject_decref(obj);
     visit(d->qiv, native_out, errp);
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 2aed799..dd9ad44 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -21,7 +21,7 @@ 
 #include "qapi/error.h"
 #include "qemu/sockets.h"
 #include "qemu/main-loop.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
 #include "qapi/qmp-output-visitor.h"
 #include "qapi-visit.h"
 #include "qemu/cutils.h"