All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string
@ 2017-08-24  8:45 Markus Armbruster
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code Markus Armbruster
                   ` (17 more replies)
  0 siblings, 18 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

The purpose of this work is to make holes in QAPI enumerations
possible.

Why holes?  Because we want to be able to suppress enumeration
constants with #if.  Holes could be avoided, e.g. by letting the
compiler assign the values.  Falls apart when the conditions are
target-specific, because then target-specific code would get different
values.

Why are holes a problem?  The tables mapping enumeration constants to
strings use a NULL sentinel.

This is PATCH 06-13 of "[PATCH v2 00/54] qapi: add #if pre-processor
conditions to generated code" reworked for reviewability.  Took a bit
of time, but it was probably less work and certainly more fun than
reviewing the old PATCH 06 and 12 (almost 300 hunks!) in sufficient
depth would have been.

* PATCH 01: New, included only so I can update qapi-code-gen.txt
  sanely in PATCH 12
* PATCH 02: New, factored out of old PATCH 12 (sort of)
* PATCH 03: Old PATCH 07 rebased, superfluous initializer dropped,
  commit message rewritten
* PATCH 04: New, to finish PATCH 03's cleanup job
* PATCH 05: Old PATCH 08 rebased, commit message rewritten
* PATCH 06: Old PATCH 09 rebased, assertion added, commit message
  rewritten
* PATCH 07: Old PATCH 10 rebased, commit message rewritten
* PATCH 08: Old PATCH 11 rebased, qemu_opt_get() factored out, commit
  message tweaked
* PATCH 09: New, factored out of old PATCH 12
* PATCH 10: New, to complete PATCH 03-09
* PATCH 11: New, to make these loops cope with holes
* PATCH 12: New, split off old PATCH 06, with macros spliced in
* PATCH 13: New, replacing parts of old PATCH 06
* PATCH 14: New, replacing parts of old PATCH 06
* PATCH 15: Old PATCH 12 basically redone
* PATCH 16: Old PATCH 13 rebased, superfluous local variable dropped,
  missing check-qom-proplist.c update added

Not included: old PATCH 12's change to make output_type_enum() fail on
"hole".  I think this is best done together with the patches that
punch holes, so it can be tested.

Old diffstat:
 68 files changed, 425 insertions(+), 396 deletions(-)
New diffstat:
 71 files changed, 410 insertions(+), 463 deletions(-)

Marc-André Lureau (7):
  tpm: Clean up driver registration & lookup
  hmp: Use qapi_enum_parse() in hmp_migrate_set_capability()
  hmp: Use qapi_enum_parse() in hmp_migrate_set_parameter()
  block: Use qemu_enum_parse() in blkdebug_debug_breakpoint()
  quorum: Use qapi_enum_parse() in quorum_open()
  qapi: Change data type of the FOO_lookup generated for enum FOO
  qapi: drop the sentinel in enum array

Markus Armbruster (9):
  qapi: Update qapi-code-gen.txt examples to match current code
  qapi: Drop superfluous qapi_enum_parse() parameter max
  tpm: Clean up model registration & lookup
  crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup()
  qapi: Use qapi_enum_parse() in input_type_enum()
  qapi: Avoid unnecessary use of enum lookup table's sentinel
  qapi: Generate FOO_str() macro for QAPI enum FOO
  qapi: Mechanically convert FOO_lookup[...] to FOO_str(...)
  qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup()

 backends/hostmem.c                  |   4 +-
 block.c                             |   4 +-
 block/backup.c                      |   2 +-
 block/blkdebug.c                    |  27 ++---
 block/file-posix.c                  |  20 ++--
 block/file-win32.c                  |   5 +-
 block/gluster.c                     |  11 +-
 block/iscsi.c                       |   2 +-
 block/nfs.c                         |   2 +-
 block/parallels.c                   |  17 +--
 block/qcow2.c                       |  15 +--
 block/qed.c                         |   2 +-
 block/quorum.c                      |  27 ++---
 block/rbd.c                         |   2 +-
 block/sheepdog.c                    |   2 +-
 blockdev.c                          |   8 +-
 blockjob.c                          |   6 +-
 chardev/char.c                      |   4 +-
 crypto/block-luks.c                 |  38 +++----
 crypto/block.c                      |   4 +-
 crypto/cipher-afalg.c               |   2 +-
 crypto/cipher-builtin.c             |   8 +-
 crypto/cipher-gcrypt.c              |   4 +-
 crypto/cipher-nettle.c              |   8 +-
 crypto/hmac-gcrypt.c                |   2 +-
 crypto/hmac-glib.c                  |   2 +-
 crypto/hmac-nettle.c                |   2 +-
 crypto/pbkdf-gcrypt.c               |   2 +-
 crypto/pbkdf-nettle.c               |   2 +-
 crypto/secret.c                     |   2 +-
 crypto/tlscreds.c                   |   2 +-
 docs/devel/qapi-code-gen.txt        |  50 ++++++--
 hmp.c                               | 220 ++++++++++++++++++------------------
 hw/block/fdc.c                      |   6 +-
 hw/char/escc.c                      |   2 +-
 hw/core/qdev-properties.c           |  17 +--
 hw/input/virtio-input-hid.c         |   4 +-
 include/hw/qdev-core.h              |   2 +-
 include/qapi/util.h                 |  10 +-
 include/qapi/visitor.h              |   2 +-
 include/qom/object.h                |   4 +-
 include/sysemu/tpm_backend.h        |   4 +-
 migration/colo-failover.c           |   4 +-
 migration/colo.c                    |  14 +--
 migration/global_state.c            |   6 +-
 migration/migration.c               |   1 -
 monitor.c                           |  20 ++--
 net/filter.c                        |   2 +-
 net/net.c                           |   4 +-
 qapi/qapi-util.c                    |  16 ++-
 qapi/qapi-visit-core.c              |  34 +++---
 qapi/qmp-dispatch.c                 |   2 +-
 qemu-img.c                          |   6 +-
 qemu-nbd.c                          |   4 +-
 qom/object.c                        |  16 +--
 scripts/qapi-event.py               |   1 +
 scripts/qapi-types.py               |   4 +
 scripts/qapi-visit.py               |   2 +-
 scripts/qapi.py                     |  16 ++-
 tests/check-qom-proplist.c          |  14 ++-
 tests/test-qapi-util.c              |  18 +--
 tests/test-qobject-input-visitor.c  |   8 +-
 tests/test-qobject-output-visitor.c |   2 +-
 tests/test-string-input-visitor.c   |   4 +-
 tests/test-string-output-visitor.c  |   4 +-
 tpm.c                               |  81 +++----------
 ui/input-legacy.c                   |   6 +-
 ui/input.c                          |  12 +-
 ui/vnc.c                            |   6 +-
 util/keyval.c                       |   1 -
 vl.c                                |   6 +-
 71 files changed, 410 insertions(+), 463 deletions(-)

-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
@ 2017-08-24  8:45 ` Markus Armbruster
  2017-08-24 10:43   ` Marc-André Lureau
  2017-08-24 16:32   ` Eric Blake
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max Markus Armbruster
                   ` (16 subsequent siblings)
  17 siblings, 2 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 docs/devel/qapi-code-gen.txt | 47 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 9 deletions(-)

diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
index 9903ac4..ae05327 100644
--- a/docs/devel/qapi-code-gen.txt
+++ b/docs/devel/qapi-code-gen.txt
@@ -957,6 +957,8 @@ Example:
 
     typedef struct UserDefOneList UserDefOneList;
 
+    typedef struct q_obj_my_command_arg q_obj_my_command_arg;
+
     struct UserDefOne {
         int64_t integer;
         bool has_string;
@@ -972,6 +974,10 @@ Example:
 
     void qapi_free_UserDefOneList(UserDefOneList *obj);
 
+    struct q_obj_my_command_arg {
+        UserDefOneList *arg1;
+    };
+
     #endif
     $ cat qapi-generated/example-qapi-types.c
 [Uninteresting stuff omitted...]
@@ -1036,6 +1042,8 @@ Example:
     void visit_type_UserDefOne(Visitor *v, const char *name, UserDefOne **obj, Error **errp);
     void visit_type_UserDefOneList(Visitor *v, const char *name, UserDefOneList **obj, Error **errp);
 
+    void visit_type_q_obj_my_command_arg_members(Visitor *v, q_obj_my_command_arg *obj, Error **errp);
+
     #endif
     $ cat qapi-generated/example-qapi-visit.c
 [Uninteresting stuff omitted...]
@@ -1104,6 +1112,9 @@ Example:
             }
         }
 
+        if (!err) {
+            visit_check_list(v, &err);
+        }
         visit_end_list(v, (void **)obj);
         if (err && visit_is_input(v)) {
             qapi_free_UserDefOneList(*obj);
@@ -1113,6 +1124,19 @@ Example:
         error_propagate(errp, err);
     }
 
+    void visit_type_q_obj_my_command_arg_members(Visitor *v, q_obj_my_command_arg *obj, Error **errp)
+    {
+        Error *err = NULL;
+
+        visit_type_UserDefOneList(v, "arg1", &obj->arg1, &err);
+        if (err) {
+            goto out;
+        }
+
+    out:
+        error_propagate(errp, err);
+    }
+
 === scripts/qapi-commands.py ===
 
 Used to generate the marshaling/dispatch functions for the commands
@@ -1145,9 +1169,12 @@ Example:
 
     #include "example-qapi-types.h"
     #include "qapi/qmp/qdict.h"
+    #include "qapi/qmp/dispatch.h"
     #include "qapi/error.h"
 
+    void example_qmp_init_marshal(QmpCommandList *cmds);
     UserDefOne *qmp_my_command(UserDefOneList *arg1, Error **errp);
+    void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp);
 
     #endif
     $ cat qapi-generated/example-qmp-marshal.c
@@ -1170,19 +1197,19 @@ Example:
         visit_free(v);
     }
 
-    static void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp)
+    void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp)
     {
         Error *err = NULL;
         UserDefOne *retval;
         Visitor *v;
-        UserDefOneList *arg1 = NULL;
+        q_obj_my_command_arg arg = {0};
 
         v = qobject_input_visitor_new(QOBJECT(args));
         visit_start_struct(v, NULL, NULL, 0, &err);
         if (err) {
             goto out;
         }
-        visit_type_UserDefOneList(v, "arg1", &arg1, &err);
+        visit_type_q_obj_my_command_arg_members(v, &arg, &err);
         if (!err) {
             visit_check_struct(v, &err);
         }
@@ -1191,7 +1218,7 @@ Example:
             goto out;
         }
 
-        retval = qmp_my_command(arg1, &err);
+        retval = qmp_my_command(arg.arg1, &err);
         if (err) {
             goto out;
         }
@@ -1203,17 +1230,18 @@ Example:
         visit_free(v);
         v = qapi_dealloc_visitor_new();
         visit_start_struct(v, NULL, NULL, 0, NULL);
-        visit_type_UserDefOneList(v, "arg1", &arg1, NULL);
+        visit_type_q_obj_my_command_arg_members(v, &arg, NULL);
         visit_end_struct(v, NULL);
         visit_free(v);
     }
 
-    static void qmp_init_marshal(void)
+    void example_qmp_init_marshal(QmpCommandList *cmds)
     {
-        qmp_register_command("my-command", qmp_marshal_my_command, QCO_NO_OPTIONS);
-    }
+        QTAILQ_INIT(cmds);
 
-    qapi_init(qmp_init_marshal);
+        qmp_register_command(cmds, "my-command",
+                             qmp_marshal_my_command, QCO_NO_OPTIONS);
+    }
 
 === scripts/qapi-event.py ===
 
@@ -1258,6 +1286,7 @@ Example:
         QDict *qmp;
         Error *err = NULL;
         QMPEventFuncEmit emit;
+
         emit = qmp_event_get_func_emit();
         if (!emit) {
             return;
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code Markus Armbruster
@ 2017-08-24  8:45 ` Markus Armbruster
  2017-08-24 10:45   ` Marc-André Lureau
  2017-08-24 16:38   ` Eric Blake
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 03/16] tpm: Clean up driver registration & lookup Markus Armbruster
                   ` (15 subsequent siblings)
  17 siblings, 2 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

The lookup tables have a sentinel, no need to make callers pass their
size.

Fun: the header has it in the wrong position.  Good riddance.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block.c                  |  1 -
 block/file-posix.c       |  7 +++----
 block/file-win32.c       |  2 +-
 block/gluster.c          |  6 ++----
 block/parallels.c        |  3 ++-
 block/qcow2.c            |  6 ++----
 blockdev.c               |  1 -
 hmp.c                    |  2 +-
 include/qapi/util.h      |  2 +-
 migration/global_state.c |  3 +--
 qapi/qapi-util.c         |  4 ++--
 qemu-img.c               |  3 +--
 qemu-nbd.c               |  1 -
 tests/test-qapi-util.c   | 15 +++++----------
 14 files changed, 21 insertions(+), 35 deletions(-)

diff --git a/block.c b/block.c
index 3615a68..dd0efa2 100644
--- a/block.c
+++ b/block.c
@@ -1335,7 +1335,6 @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file,
         BlockdevDetectZeroesOptions value =
             qapi_enum_parse(BlockdevDetectZeroesOptions_lookup,
                             detect_zeroes,
-                            BLOCKDEV_DETECT_ZEROES_OPTIONS__MAX,
                             BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF,
                             &local_err);
         if (local_err) {
diff --git a/block/file-posix.c b/block/file-posix.c
index cb3bfce..97e8a92 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -439,7 +439,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
                   ? BLOCKDEV_AIO_OPTIONS_NATIVE
                   : BLOCKDEV_AIO_OPTIONS_THREADS;
     aio = qapi_enum_parse(BlockdevAioOptions_lookup, qemu_opt_get(opts, "aio"),
-                          BLOCKDEV_AIO_OPTIONS__MAX, aio_default, &local_err);
+                          aio_default, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         ret = -EINVAL;
@@ -448,7 +448,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
     s->use_linux_aio = (aio == BLOCKDEV_AIO_OPTIONS_NATIVE);
 
     locking = qapi_enum_parse(OnOffAuto_lookup, qemu_opt_get(opts, "locking"),
-                              ON_OFF_AUTO__MAX, ON_OFF_AUTO_AUTO, &local_err);
+                              ON_OFF_AUTO_AUTO, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         ret = -EINVAL;
@@ -1975,8 +1975,7 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
     nocow = qemu_opt_get_bool(opts, BLOCK_OPT_NOCOW, false);
     buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
     prealloc = qapi_enum_parse(PreallocMode_lookup, buf,
-                               PREALLOC_MODE__MAX, PREALLOC_MODE_OFF,
-                               &local_err);
+                               PREALLOC_MODE_OFF, &local_err);
     g_free(buf);
     if (local_err) {
         error_propagate(errp, local_err);
diff --git a/block/file-win32.c b/block/file-win32.c
index 4706335..978d805 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -304,7 +304,7 @@ static bool get_aio_option(QemuOpts *opts, int flags, Error **errp)
     aio_default = (flags & BDRV_O_NATIVE_AIO) ? BLOCKDEV_AIO_OPTIONS_NATIVE
                                               : BLOCKDEV_AIO_OPTIONS_THREADS;
     aio = qapi_enum_parse(BlockdevAioOptions_lookup, qemu_opt_get(opts, "aio"),
-                          BLOCKDEV_AIO_OPTIONS__MAX, aio_default, errp);
+                          aio_default, errp);
 
     switch (aio) {
     case BLOCKDEV_AIO_OPTIONS_NATIVE:
diff --git a/block/gluster.c b/block/gluster.c
index 3064a45..8367e80 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -544,8 +544,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
         if (!strcmp(ptr, "tcp")) {
             ptr = "inet";       /* accept legacy "tcp" */
         }
-        type = qapi_enum_parse(SocketAddressType_lookup, ptr,
-                               SOCKET_ADDRESS_TYPE__MAX, -1, NULL);
+        type = qapi_enum_parse(SocketAddressType_lookup, ptr, -1, NULL);
         if (type != SOCKET_ADDRESS_TYPE_INET
             && type != SOCKET_ADDRESS_TYPE_UNIX) {
             error_setg(&local_err,
@@ -1002,8 +1001,7 @@ static int qemu_gluster_create(const char *filename,
                           BDRV_SECTOR_SIZE);
 
     tmp = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
-    prealloc = qapi_enum_parse(PreallocMode_lookup, tmp,
-                               PREALLOC_MODE__MAX, PREALLOC_MODE_OFF,
+    prealloc = qapi_enum_parse(PreallocMode_lookup, tmp, PREALLOC_MODE_OFF,
                                &local_err);
     g_free(tmp);
     if (local_err) {
diff --git a/block/parallels.c b/block/parallels.c
index e1e06d2..eb92366 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -697,7 +697,8 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
     s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS);
     buf = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE);
     s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, buf,
-            PRL_PREALLOC_MODE__MAX, PRL_PREALLOC_MODE_FALLOCATE, &local_err);
+                                       PRL_PREALLOC_MODE_FALLOCATE,
+                                       &local_err);
     g_free(buf);
     if (local_err != NULL) {
         goto fail_options;
diff --git a/block/qcow2.c b/block/qcow2.c
index 40ba26c..7aaf248 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2933,8 +2933,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)
     }
     buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
     prealloc = qapi_enum_parse(PreallocMode_lookup, buf,
-                               PREALLOC_MODE__MAX, PREALLOC_MODE_OFF,
-                               &local_err);
+                               PREALLOC_MODE_OFF, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         ret = -EINVAL;
@@ -3624,8 +3623,7 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
 
     optstr = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
     prealloc = qapi_enum_parse(PreallocMode_lookup, optstr,
-                               PREALLOC_MODE__MAX, PREALLOC_MODE_OFF,
-                               &local_err);
+                               PREALLOC_MODE_OFF, &local_err);
     g_free(optstr);
     if (local_err) {
         goto err;
diff --git a/blockdev.c b/blockdev.c
index 02cd69b..722a61e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -440,7 +440,6 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
         *detect_zeroes =
             qapi_enum_parse(BlockdevDetectZeroesOptions_lookup,
                             qemu_opt_get(opts, "detect-zeroes"),
-                            BLOCKDEV_DETECT_ZEROES_OPTIONS__MAX,
                             BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF,
                             &local_error);
         if (local_error) {
diff --git a/hmp.c b/hmp.c
index fd80dce..03c1a78 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1742,7 +1742,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
         if (read_only) {
             read_only_mode =
                 qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup,
-                                read_only, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX,
+                                read_only,
                                 BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err);
             if (err) {
                 hmp_handle_error(mon, &err);
diff --git a/include/qapi/util.h b/include/qapi/util.h
index 7436ed8..4eb8a3f 100644
--- a/include/qapi/util.h
+++ b/include/qapi/util.h
@@ -12,7 +12,7 @@
 #define QAPI_UTIL_H
 
 int qapi_enum_parse(const char * const lookup[], const char *buf,
-                    int max, int def, Error **errp);
+                    int def, Error **errp);
 
 int parse_qapi_name(const char *name, bool complete);
 
diff --git a/migration/global_state.c b/migration/global_state.c
index dcbbcb2..88c55f8 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -89,8 +89,7 @@ static int global_state_post_load(void *opaque, int version_id)
     s->received = true;
     trace_migrate_global_state_post_load(runstate);
 
-    r = qapi_enum_parse(RunState_lookup, runstate, RUN_STATE__MAX,
-                                -1, &local_err);
+    r = qapi_enum_parse(RunState_lookup, runstate, -1, &local_err);
 
     if (r == -1) {
         if (local_err) {
diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
index 46eda7d..ee7594f 100644
--- a/qapi/qapi-util.c
+++ b/qapi/qapi-util.c
@@ -16,7 +16,7 @@
 #include "qapi/util.h"
 
 int qapi_enum_parse(const char * const lookup[], const char *buf,
-                    int max, int def, Error **errp)
+                    int def, Error **errp)
 {
     int i;
 
@@ -24,7 +24,7 @@ int qapi_enum_parse(const char * const lookup[], const char *buf,
         return def;
     }
 
-    for (i = 0; i < max; i++) {
+    for (i = 0; lookup[i]; i++) {
         if (!strcmp(buf, lookup[i])) {
             return i;
         }
diff --git a/qemu-img.c b/qemu-img.c
index 56ef49e..611ab7d 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3491,8 +3491,7 @@ static int img_resize(int argc, char **argv)
             break;
         case OPTION_PREALLOCATION:
             prealloc = qapi_enum_parse(PreallocMode_lookup, optarg,
-                                       PREALLOC_MODE__MAX, PREALLOC_MODE__MAX,
-                                       NULL);
+                                       PREALLOC_MODE__MAX, NULL);
             if (prealloc == PREALLOC_MODE__MAX) {
                 error_report("Invalid preallocation mode '%s'", optarg);
                 return 1;
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 27164b8..96e10d6 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -641,7 +641,6 @@ int main(int argc, char **argv)
             detect_zeroes =
                 qapi_enum_parse(BlockdevDetectZeroesOptions_lookup,
                                 optarg,
-                                BLOCKDEV_DETECT_ZEROES_OPTIONS__MAX,
                                 BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF,
                                 &local_err);
             if (local_err) {
diff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c
index e869757..d72ee8c 100644
--- a/tests/test-qapi-util.c
+++ b/tests/test-qapi-util.c
@@ -20,25 +20,20 @@ static void test_qapi_enum_parse(void)
     Error *err = NULL;
     int ret;
 
-    ret = qapi_enum_parse(QType_lookup, NULL, QTYPE__MAX, QTYPE_NONE,
-                          &error_abort);
+    ret = qapi_enum_parse(QType_lookup, NULL, QTYPE_NONE, &error_abort);
     g_assert_cmpint(ret, ==, QTYPE_NONE);
 
-    ret = qapi_enum_parse(QType_lookup, "junk", QTYPE__MAX, -1,
-                          NULL);
+    ret = qapi_enum_parse(QType_lookup, "junk", -1, NULL);
     g_assert_cmpint(ret, ==, -1);
 
-    ret = qapi_enum_parse(QType_lookup, "junk", QTYPE__MAX, -1,
-                          &err);
+    ret = qapi_enum_parse(QType_lookup, "junk", -1, &err);
     error_free_or_abort(&err);
 
-    ret = qapi_enum_parse(QType_lookup, "none", QTYPE__MAX, -1,
-                          &error_abort);
+    ret = qapi_enum_parse(QType_lookup, "none", -1, &error_abort);
     g_assert_cmpint(ret, ==, QTYPE_NONE);
 
     ret = qapi_enum_parse(QType_lookup, QType_lookup[QTYPE__MAX - 1],
-                          QTYPE__MAX, QTYPE__MAX - 1,
-                          &error_abort);
+                          QTYPE__MAX - 1, &error_abort);
     g_assert_cmpint(ret, ==, QTYPE__MAX - 1);
 }
 
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 03/16] tpm: Clean up driver registration & lookup
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code Markus Armbruster
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max Markus Armbruster
@ 2017-08-24  8:45 ` Markus Armbruster
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 04/16] tpm: Clean up model " Markus Armbruster
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth, Stefan Berger

From: Marc-André Lureau <marcandre.lureau@redhat.com>

We have a strict separation between enum TpmType and be_drivers[]:

* TpmType may have any number of members.  It just happens to have one.

* tpm_register_driver() uses the first empty slot in be_drivers[].

  If you register more than tpm_models[] has space,
  tpm_register_driver() fails.  Its caller silently ignores the
  failure.

  If you register more than one with a given TpmType,
  tpm_display_backend_drivers() will shows all of them, but
  tpm_driver_find_by_type() and tpm_get_backend_driver() will find
  only the one one that registered first.

Since we only ever register one driver, and be_drivers[] has space for
just that one, this contraption even works.

Turn be_drivers[] into a straight map from enum TpmType to driver.
Much simpler, and has a decent chance to actually work should we ever
acquire additional drivers.

While there, use qapi_enum_parse() in tpm_get_backend_driver().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170822132255.23945-8-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Rebased, superfluous initializer dropped, commit message rewritten]
Cc: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 include/sysemu/tpm_backend.h |  2 +-
 tpm.c                        | 45 +++++++++++++-------------------------------
 2 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
index b58f52d..1d21c6b 100644
--- a/include/sysemu/tpm_backend.h
+++ b/include/sysemu/tpm_backend.h
@@ -227,6 +227,6 @@ TPMBackend *qemu_find_tpm(const char *id);
 
 const TPMDriverOps *tpm_get_backend_driver(const char *type);
 int tpm_register_model(enum TpmModel model);
-int tpm_register_driver(const TPMDriverOps *tdo);
+void tpm_register_driver(const TPMDriverOps *tdo);
 
 #endif
diff --git a/tpm.c b/tpm.c
index 9a7c711..6f39ec9 100644
--- a/tpm.c
+++ b/tpm.c
@@ -14,6 +14,7 @@
 #include "qemu/osdep.h"
 
 #include "qapi/qmp/qerror.h"
+#include "qapi/util.h"
 #include "sysemu/tpm_backend.h"
 #include "sysemu/tpm.h"
 #include "qemu/config-file.h"
@@ -25,11 +26,8 @@ static QLIST_HEAD(, TPMBackend) tpm_backends =
 
 
 #define TPM_MAX_MODELS      1
-#define TPM_MAX_DRIVERS     1
 
-static TPMDriverOps const *be_drivers[TPM_MAX_DRIVERS] = {
-    NULL,
-};
+static TPMDriverOps const *be_drivers[TPM_TYPE__MAX];
 
 static enum TpmModel tpm_models[TPM_MAX_MODELS] = {
     TPM_MODEL__MAX,
@@ -63,31 +61,18 @@ static bool tpm_model_is_registered(enum TpmModel model)
 
 const TPMDriverOps *tpm_get_backend_driver(const char *type)
 {
-    int i;
+    int i = qapi_enum_parse(TpmType_lookup, type, -1, NULL);
 
-    for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {
-        if (!strcmp(TpmType_lookup[be_drivers[i]->type], type)) {
-            return be_drivers[i];
-        }
-    }
-
-    return NULL;
+    return i >= 0 ? be_drivers[i] : NULL;
 }
 
 #ifdef CONFIG_TPM
 
-int tpm_register_driver(const TPMDriverOps *tdo)
+void tpm_register_driver(const TPMDriverOps *tdo)
 {
-    int i;
+    assert(!be_drivers[tdo->type]);
 
-    for (i = 0; i < TPM_MAX_DRIVERS; i++) {
-        if (!be_drivers[i]) {
-            be_drivers[i] = tdo;
-            return 0;
-        }
-    }
-    error_report("Could not register TPM driver");
-    return 1;
+    be_drivers[tdo->type] = tdo;
 }
 
 /*
@@ -100,9 +85,12 @@ static void tpm_display_backend_drivers(void)
 
     fprintf(stderr, "Supported TPM types (choose only one):\n");
 
-    for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {
+    for (i = 0; i < TPM_TYPE__MAX; i++) {
+        if (be_drivers[i] == NULL) {
+            continue;
+        }
         fprintf(stderr, "%12s   %s\n",
-                TpmType_lookup[be_drivers[i]->type], be_drivers[i]->desc());
+                TpmType_lookup[i], be_drivers[i]->desc());
     }
     fprintf(stderr, "\n");
 }
@@ -239,14 +227,7 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)
 
 static const TPMDriverOps *tpm_driver_find_by_type(enum TpmType type)
 {
-    int i;
-
-    for (i = 0; i < TPM_MAX_DRIVERS && be_drivers[i] != NULL; i++) {
-        if (be_drivers[i]->type == type) {
-            return be_drivers[i];
-        }
-    }
-    return NULL;
+    return be_drivers[type];
 }
 
 static TPMInfo *qmp_query_tpm_inst(TPMBackend *drv)
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 04/16] tpm: Clean up model registration & lookup
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (2 preceding siblings ...)
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 03/16] tpm: Clean up driver registration & lookup Markus Armbruster
@ 2017-08-24  8:45 ` Markus Armbruster
  2017-08-24 10:50   ` Marc-André Lureau
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 05/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_capability() Markus Armbruster
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth, Stefan Berger

We have a strict separation between enum TpmModel and tpm_models[]:

* TpmModel may have any number of members.  It just happens to have one.

* tpm_register_model() uses the first empty slot in tmp_models[].

  If you register more than tpm_models[] has space,
  tpn_register_model() fails.  Its caller silently ignores the
  failure.

  Register the same TpmModel more than once has no effect other than
  wasting tpm_models[] slots: tpm_model_is_registered() is happy with
  the first one it finds.

Since we only ever register one model, and tpm_models[] has space for
just that one, this contraption even works.

Turn tpm_models[] into a straight map from enum TpmType to bool.  Much
simpler.

Cc: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 include/sysemu/tpm_backend.h |  2 +-
 tpm.c                        | 37 +++++--------------------------------
 2 files changed, 6 insertions(+), 33 deletions(-)

diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
index 1d21c6b..b0a9731 100644
--- a/include/sysemu/tpm_backend.h
+++ b/include/sysemu/tpm_backend.h
@@ -226,7 +226,7 @@ TPMVersion tpm_backend_get_tpm_version(TPMBackend *s);
 TPMBackend *qemu_find_tpm(const char *id);
 
 const TPMDriverOps *tpm_get_backend_driver(const char *type);
-int tpm_register_model(enum TpmModel model);
+void tpm_register_model(enum TpmModel model);
 void tpm_register_driver(const TPMDriverOps *tdo);
 
 #endif
diff --git a/tpm.c b/tpm.c
index 6f39ec9..7635fc7 100644
--- a/tpm.c
+++ b/tpm.c
@@ -24,39 +24,12 @@
 static QLIST_HEAD(, TPMBackend) tpm_backends =
     QLIST_HEAD_INITIALIZER(tpm_backends);
 
-
-#define TPM_MAX_MODELS      1
-
 static TPMDriverOps const *be_drivers[TPM_TYPE__MAX];
+static bool tpm_models[TPM_MODEL__MAX];
 
-static enum TpmModel tpm_models[TPM_MAX_MODELS] = {
-    TPM_MODEL__MAX,
-};
-
-int tpm_register_model(enum TpmModel model)
+void tpm_register_model(enum TpmModel model)
 {
-    int i;
-
-    for (i = 0; i < TPM_MAX_MODELS; i++) {
-        if (tpm_models[i] == TPM_MODEL__MAX) {
-            tpm_models[i] = model;
-            return 0;
-        }
-    }
-    error_report("Could not register TPM model");
-    return 1;
-}
-
-static bool tpm_model_is_registered(enum TpmModel model)
-{
-    int i;
-
-    for (i = 0; i < TPM_MAX_MODELS; i++) {
-        if (tpm_models[i] == model) {
-            return true;
-        }
-    }
-    return false;
+    tpm_models[model] = true;
 }
 
 const TPMDriverOps *tpm_get_backend_driver(const char *type)
@@ -270,7 +243,7 @@ TPMInfoList *qmp_query_tpm(Error **errp)
     TPMInfoList *info, *head = NULL, *cur_item = NULL;
 
     QLIST_FOREACH(drv, &tpm_backends, list) {
-        if (!tpm_model_is_registered(drv->fe_model)) {
+        if (!tpm_models[drv->fe_model]) {
             continue;
         }
         info = g_new0(TPMInfoList, 1);
@@ -317,7 +290,7 @@ TpmModelList *qmp_query_tpm_models(Error **errp)
     TpmModelList *head = NULL, *prev = NULL, *cur_item;
 
     for (i = 0; i < TPM_MODEL__MAX; i++) {
-        if (!tpm_model_is_registered(i)) {
+        if (!tpm_models[i]) {
             continue;
         }
         cur_item = g_new0(TpmModelList, 1);
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 05/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_capability()
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (3 preceding siblings ...)
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 04/16] tpm: Clean up model " Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 06/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_parameter() Markus Armbruster
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth, Dr. David Alan Gilbert

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The error message on invalid capability name changes from

    Invalid parameter "NAME"

to

    invalid parameter value: NAME

No worse than before.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170822132255.23945-9-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Rebased, commit message rewritten]
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hmp.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/hmp.c b/hmp.c
index 03c1a78..7e0bd3d 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1527,23 +1527,20 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
     bool state = qdict_get_bool(qdict, "state");
     Error *err = NULL;
     MigrationCapabilityStatusList *caps = g_malloc0(sizeof(*caps));
-    int i;
+    int val;
 
-    for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
-        if (strcmp(cap, MigrationCapability_lookup[i]) == 0) {
-            caps->value = g_malloc0(sizeof(*caps->value));
-            caps->value->capability = i;
-            caps->value->state = state;
-            caps->next = NULL;
-            qmp_migrate_set_capabilities(caps, &err);
-            break;
-        }
+    val = qapi_enum_parse(MigrationCapability_lookup, cap, -1, &err);
+    if (val < 0) {
+        goto end;
     }
 
-    if (i == MIGRATION_CAPABILITY__MAX) {
-        error_setg(&err, QERR_INVALID_PARAMETER, cap);
-    }
+    caps->value = g_malloc0(sizeof(*caps->value));
+    caps->value->capability = val;
+    caps->value->state = state;
+    caps->next = NULL;
+    qmp_migrate_set_capabilities(caps, &err);
 
+end:
     qapi_free_MigrationCapabilityStatusList(caps);
 
     if (err) {
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 06/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_parameter()
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (4 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 05/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_capability() Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 07/16] block: Use qemu_enum_parse() in blkdebug_debug_breakpoint() Markus Armbruster
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth, Dr. David Alan Gilbert

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The error message on invalid parameter name changes from

    Invalid parameter "NAME"

to

    invalid parameter value: NAME

Slight degratation, perhaps.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170822132255.23945-10-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Rebased, assertion added, commit message rewritten]
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hmp.c | 138 +++++++++++++++++++++++++++++++++---------------------------------
 1 file changed, 68 insertions(+), 70 deletions(-)

diff --git a/hmp.c b/hmp.c
index 7e0bd3d..2b6e919 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1556,84 +1556,82 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
     MigrateSetParameters *p = g_new0(MigrateSetParameters, 1);
     uint64_t valuebw = 0;
     Error *err = NULL;
-    int i, ret;
+    int val, ret;
 
-    for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
-        if (strcmp(param, MigrationParameter_lookup[i]) == 0) {
-            switch (i) {
-            case MIGRATION_PARAMETER_COMPRESS_LEVEL:
-                p->has_compress_level = true;
-                visit_type_int(v, param, &p->compress_level, &err);
-                break;
-            case MIGRATION_PARAMETER_COMPRESS_THREADS:
-                p->has_compress_threads = true;
-                visit_type_int(v, param, &p->compress_threads, &err);
-                break;
-            case MIGRATION_PARAMETER_DECOMPRESS_THREADS:
-                p->has_decompress_threads = true;
-                visit_type_int(v, param, &p->decompress_threads, &err);
-                break;
-            case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL:
-                p->has_cpu_throttle_initial = true;
-                visit_type_int(v, param, &p->cpu_throttle_initial, &err);
-                break;
-            case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT:
-                p->has_cpu_throttle_increment = true;
-                visit_type_int(v, param, &p->cpu_throttle_increment, &err);
-                break;
-            case MIGRATION_PARAMETER_TLS_CREDS:
-                p->has_tls_creds = true;
-                p->tls_creds = g_new0(StrOrNull, 1);
-                p->tls_creds->type = QTYPE_QSTRING;
-                visit_type_str(v, param, &p->tls_creds->u.s, &err);
-                break;
-            case MIGRATION_PARAMETER_TLS_HOSTNAME:
-                p->has_tls_hostname = true;
-                p->tls_hostname = g_new0(StrOrNull, 1);
-                p->tls_hostname->type = QTYPE_QSTRING;
-                visit_type_str(v, param, &p->tls_hostname->u.s, &err);
-                break;
-            case MIGRATION_PARAMETER_MAX_BANDWIDTH:
-                p->has_max_bandwidth = true;
-                /*
-                 * Can't use visit_type_size() here, because it
-                 * defaults to Bytes rather than Mebibytes.
-                 */
-                ret = qemu_strtosz_MiB(valuestr, NULL, &valuebw);
-                if (ret < 0 || valuebw > INT64_MAX
-                    || (size_t)valuebw != valuebw) {
-                    error_setg(&err, "Invalid size %s", valuestr);
-                    break;
-                }
-                p->max_bandwidth = valuebw;
-                break;
-            case MIGRATION_PARAMETER_DOWNTIME_LIMIT:
-                p->has_downtime_limit = true;
-                visit_type_int(v, param, &p->downtime_limit, &err);
-                break;
-            case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY:
-                p->has_x_checkpoint_delay = true;
-                visit_type_int(v, param, &p->x_checkpoint_delay, &err);
-                break;
-            case MIGRATION_PARAMETER_BLOCK_INCREMENTAL:
-                p->has_block_incremental = true;
-                visit_type_bool(v, param, &p->block_incremental, &err);
-                break;
-            }
+    val = qapi_enum_parse(MigrationParameter_lookup, param, -1, &err);
+    if (val < 0) {
+        goto cleanup;
+    }
 
-            if (err) {
-                goto cleanup;
-            }
-
-            qmp_migrate_set_parameters(p, &err);
+    switch (val) {
+    case MIGRATION_PARAMETER_COMPRESS_LEVEL:
+        p->has_compress_level = true;
+        visit_type_int(v, param, &p->compress_level, &err);
+        break;
+    case MIGRATION_PARAMETER_COMPRESS_THREADS:
+        p->has_compress_threads = true;
+        visit_type_int(v, param, &p->compress_threads, &err);
+        break;
+    case MIGRATION_PARAMETER_DECOMPRESS_THREADS:
+        p->has_decompress_threads = true;
+        visit_type_int(v, param, &p->decompress_threads, &err);
+        break;
+    case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL:
+        p->has_cpu_throttle_initial = true;
+        visit_type_int(v, param, &p->cpu_throttle_initial, &err);
+        break;
+    case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT:
+        p->has_cpu_throttle_increment = true;
+        visit_type_int(v, param, &p->cpu_throttle_increment, &err);
+        break;
+    case MIGRATION_PARAMETER_TLS_CREDS:
+        p->has_tls_creds = true;
+        p->tls_creds = g_new0(StrOrNull, 1);
+        p->tls_creds->type = QTYPE_QSTRING;
+        visit_type_str(v, param, &p->tls_creds->u.s, &err);
+        break;
+    case MIGRATION_PARAMETER_TLS_HOSTNAME:
+        p->has_tls_hostname = true;
+        p->tls_hostname = g_new0(StrOrNull, 1);
+        p->tls_hostname->type = QTYPE_QSTRING;
+        visit_type_str(v, param, &p->tls_hostname->u.s, &err);
+        break;
+    case MIGRATION_PARAMETER_MAX_BANDWIDTH:
+        p->has_max_bandwidth = true;
+        /*
+         * Can't use visit_type_size() here, because it
+         * defaults to Bytes rather than Mebibytes.
+         */
+        ret = qemu_strtosz_MiB(valuestr, NULL, &valuebw);
+        if (ret < 0 || valuebw > INT64_MAX
+            || (size_t)valuebw != valuebw) {
+            error_setg(&err, "Invalid size %s", valuestr);
             break;
         }
+        p->max_bandwidth = valuebw;
+        break;
+    case MIGRATION_PARAMETER_DOWNTIME_LIMIT:
+        p->has_downtime_limit = true;
+        visit_type_int(v, param, &p->downtime_limit, &err);
+        break;
+    case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY:
+        p->has_x_checkpoint_delay = true;
+        visit_type_int(v, param, &p->x_checkpoint_delay, &err);
+        break;
+    case MIGRATION_PARAMETER_BLOCK_INCREMENTAL:
+        p->has_block_incremental = true;
+        visit_type_bool(v, param, &p->block_incremental, &err);
+        break;
+    default:
+        assert(0);
     }
 
-    if (i == MIGRATION_PARAMETER__MAX) {
-        error_setg(&err, QERR_INVALID_PARAMETER, param);
+    if (err) {
+        goto cleanup;
     }
 
+    qmp_migrate_set_parameters(p, &err);
+
  cleanup:
     qapi_free_MigrateSetParameters(p);
     visit_free(v);
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 07/16] block: Use qemu_enum_parse() in blkdebug_debug_breakpoint()
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (5 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 06/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_parameter() Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 08/16] quorum: Use qapi_enum_parse() in quorum_open() Markus Armbruster
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth, Kevin Wolf, Max Reitz, qemu-block

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The error message on invalid blkdebug events changes from

    qemu-system-x86_64: LOCATION: Invalid event name "VALUE"

to

    qemu-system-x86_64: LOCATION: invalid parameter value: VALUE

Slight degradation, but the message is sub-par even before the patch.
When complaining about a parameter value, both parameter name and
value should be mentioned, as the value may well not be unique.  Left
for another day.

Also left is the error message's unhelpful location: it points to the
config=FILENAME rather than into that file.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170822132255.23945-11-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Rebased, commit message rewritten]
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block/blkdebug.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/block/blkdebug.c b/block/blkdebug.c
index c19ab28..f1bbee9 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -32,6 +32,7 @@
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qstring.h"
+#include "qapi/util.h"
 #include "sysemu/qtest.h"
 
 typedef struct BDRVBlkdebugState {
@@ -149,20 +150,6 @@ static QemuOptsList *config_groups[] = {
     NULL
 };
 
-static int get_event_by_name(const char *name, BlkdebugEvent *event)
-{
-    int i;
-
-    for (i = 0; i < BLKDBG__MAX; i++) {
-        if (!strcmp(BlkdebugEvent_lookup[i], name)) {
-            *event = i;
-            return 0;
-        }
-    }
-
-    return -1;
-}
-
 struct add_rule_data {
     BDRVBlkdebugState *s;
     int action;
@@ -173,7 +160,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
     struct add_rule_data *d = opaque;
     BDRVBlkdebugState *s = d->s;
     const char* event_name;
-    BlkdebugEvent event;
+    int event;
     struct BlkdebugRule *rule;
     int64_t sector;
 
@@ -182,8 +169,9 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
     if (!event_name) {
         error_setg(errp, "Missing event name for rule");
         return -1;
-    } else if (get_event_by_name(event_name, &event) < 0) {
-        error_setg(errp, "Invalid event name \"%s\"", event_name);
+    }
+    event = qapi_enum_parse(BlkdebugEvent_lookup, event_name, -1, errp);
+    if (event < 0) {
         return -1;
     }
 
@@ -743,13 +731,13 @@ static int blkdebug_debug_breakpoint(BlockDriverState *bs, const char *event,
 {
     BDRVBlkdebugState *s = bs->opaque;
     struct BlkdebugRule *rule;
-    BlkdebugEvent blkdebug_event;
+    int blkdebug_event;
 
-    if (get_event_by_name(event, &blkdebug_event) < 0) {
+    blkdebug_event = qapi_enum_parse(BlkdebugEvent_lookup, event, -1, NULL);
+    if (blkdebug_event < 0) {
         return -ENOENT;
     }
 
-
     rule = g_malloc(sizeof(*rule));
     *rule = (struct BlkdebugRule) {
         .event  = blkdebug_event,
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 08/16] quorum: Use qapi_enum_parse() in quorum_open()
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (6 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 07/16] block: Use qemu_enum_parse() in blkdebug_debug_breakpoint() Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup() Markus Armbruster
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth, Alberto Garcia

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170822132255.23945-12-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Rebased, qemu_opt_get() factored out, commit message tweaked]
Cc: Alberto Garcia <berto@igalia.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block/quorum.c | 28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/block/quorum.c b/block/quorum.c
index d04da4f..cb66177 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -22,6 +22,7 @@
 #include "qapi/qmp/qjson.h"
 #include "qapi/qmp/qlist.h"
 #include "qapi/qmp/qstring.h"
+#include "qapi/util.h"
 #include "qapi-event.h"
 #include "crypto/hash.h"
 
@@ -867,30 +868,13 @@ static QemuOptsList quorum_runtime_opts = {
     },
 };
 
-static int parse_read_pattern(const char *opt)
-{
-    int i;
-
-    if (!opt) {
-        /* Set quorum as default */
-        return QUORUM_READ_PATTERN_QUORUM;
-    }
-
-    for (i = 0; i < QUORUM_READ_PATTERN__MAX; i++) {
-        if (!strcmp(opt, QuorumReadPattern_lookup[i])) {
-            return i;
-        }
-    }
-
-    return -EINVAL;
-}
-
 static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
                        Error **errp)
 {
     BDRVQuorumState *s = bs->opaque;
     Error *local_err = NULL;
     QemuOpts *opts = NULL;
+    const char *pattern_str;
     bool *opened;
     int i;
     int ret = 0;
@@ -925,7 +909,13 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
         goto exit;
     }
 
-    ret = parse_read_pattern(qemu_opt_get(opts, QUORUM_OPT_READ_PATTERN));
+    pattern_str = qemu_opt_get(opts, QUORUM_OPT_READ_PATTERN);
+    if (!pattern_str) {
+        ret = QUORUM_READ_PATTERN_QUORUM;
+    } else {
+        ret = qapi_enum_parse(QuorumReadPattern_lookup, pattern_str,
+                              -EINVAL, NULL);
+    }
     if (ret < 0) {
         error_setg(&local_err, "Please set read-pattern as fifo or quorum");
         goto exit;
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup()
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (7 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 08/16] quorum: Use qapi_enum_parse() in quorum_open() Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24 10:53   ` Marc-André Lureau
  2017-08-29 11:10   ` Daniel P. Berrange
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 10/16] qapi: Use qapi_enum_parse() in input_type_enum() Markus Armbruster
                   ` (8 subsequent siblings)
  17 siblings, 2 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth, Daniel P. Berrange

Cc: "Daniel P. Berrange" <berrange@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 crypto/block-luks.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/crypto/block-luks.c b/crypto/block-luks.c
index afb8543..c3cacdb 100644
--- a/crypto/block-luks.c
+++ b/crypto/block-luks.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qapi/util.h"
 #include "qemu/bswap.h"
 
 #include "crypto/block-luks.h"
@@ -265,39 +266,33 @@ qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg,
  * make that function emit a more friendly error message */
 static int qcrypto_block_luks_name_lookup(const char *name,
                                           const char *const *map,
-                                          size_t maplen,
                                           const char *type,
                                           Error **errp)
 {
-    size_t i;
-    for (i = 0; i < maplen; i++) {
-        if (g_str_equal(map[i], name)) {
-            return i;
-        }
-    }
+    int ret = qapi_enum_parse(map, name, -1, NULL);
 
-    error_setg(errp, "%s %s not supported", type, name);
-    return 0;
+    if (ret < 0) {
+        error_setg(errp, "%s %s not supported", type, name);
+        return 0;
+    }
+    return ret;
 }
 
 #define qcrypto_block_luks_cipher_mode_lookup(name, errp)               \
     qcrypto_block_luks_name_lookup(name,                                \
                                    QCryptoCipherMode_lookup,            \
-                                   QCRYPTO_CIPHER_MODE__MAX,            \
                                    "Cipher mode",                       \
                                    errp)
 
 #define qcrypto_block_luks_hash_name_lookup(name, errp)                 \
     qcrypto_block_luks_name_lookup(name,                                \
                                    QCryptoHashAlgorithm_lookup,         \
-                                   QCRYPTO_HASH_ALG__MAX,               \
                                    "Hash algorithm",                    \
                                    errp)
 
 #define qcrypto_block_luks_ivgen_name_lookup(name, errp)                \
     qcrypto_block_luks_name_lookup(name,                                \
                                    QCryptoIVGenAlgorithm_lookup,        \
-                                   QCRYPTO_IVGEN_ALG__MAX,              \
                                    "IV generator",                      \
                                    errp)
 
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 10/16] qapi: Use qapi_enum_parse() in input_type_enum()
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (8 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup() Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24 11:30   ` Marc-André Lureau
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 11/16] qapi: Avoid unnecessary use of enum lookup table's sentinel Markus Armbruster
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qapi/qapi-visit-core.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index ed6d2af..ec83ff6 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -14,6 +14,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qapi/util.h"
 #include "qemu-common.h"
 #include "qapi/qmp/qobject.h"
 #include "qapi/qmp/qerror.h"
@@ -353,7 +354,7 @@ static void input_type_enum(Visitor *v, const char *name, int *obj,
                             const char *const strings[], Error **errp)
 {
     Error *local_err = NULL;
-    int64_t value = 0;
+    int64_t value;
     char *enum_str;
 
     visit_type_str(v, name, &enum_str, &local_err);
@@ -362,14 +363,8 @@ static void input_type_enum(Visitor *v, const char *name, int *obj,
         return;
     }
 
-    while (strings[value] != NULL) {
-        if (strcmp(strings[value], enum_str) == 0) {
-            break;
-        }
-        value++;
-    }
-
-    if (strings[value] == NULL) {
+    value = qapi_enum_parse(strings, enum_str, -1, NULL);
+    if (value < 0) {
         error_setg(errp, QERR_INVALID_PARAMETER, enum_str);
         g_free(enum_str);
         return;
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 11/16] qapi: Avoid unnecessary use of enum lookup table's sentinel
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (9 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 10/16] qapi: Use qapi_enum_parse() in input_type_enum() Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24 11:34   ` Marc-André Lureau
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 12/16] qapi: Generate FOO_str() macro for QAPI enum FOO Markus Armbruster
                   ` (6 subsequent siblings)
  17 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

Currently, the FOO_lookup[] generated for QAPI enum types are
terminated by a NULL sentinel.

A future patch will generate enums with "holes".  NULL-termination
will cease to work then.

To prepare for that, replace "have we reached the sentinel?"
predicates by "have we reached the FOO__MAX value?" predicates.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 monitor.c                          | 4 ++--
 tests/test-qobject-input-visitor.c | 2 +-
 tests/test-string-input-visitor.c  | 2 +-
 ui/input-legacy.c                  | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/monitor.c b/monitor.c
index e0f8801..b45f55d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3249,7 +3249,7 @@ void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str)
     }
     len = strlen(str);
     readline_set_completion_index(rs, len);
-    for (i = 0; NetClientDriver_lookup[i]; i++) {
+    for (i = 0; i < NET_CLIENT_DRIVER__MAX; i++) {
         add_completion_option(rs, str, NetClientDriver_lookup[i]);
     }
 }
@@ -3537,7 +3537,7 @@ void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
         return;
     }
     readline_set_completion_index(rs, strlen(str));
-    for (i = 0; WatchdogExpirationAction_lookup[i]; i++) {
+    for (i = 0; i < WATCHDOG_EXPIRATION_ACTION__MAX; i++) {
         add_completion_option(rs, str, WatchdogExpirationAction_lookup[i]);
     }
 }
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index bcf0261..5bbfb65 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -382,7 +382,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
     Visitor *v;
     EnumOne i;
 
-    for (i = 0; EnumOne_lookup[i]; i++) {
+    for (i = 0; i < ENUM_ONE__MAX; i++) {
         EnumOne res = -1;
 
         v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]);
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index 79313a7..e7a7b80 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -279,7 +279,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
     Visitor *v;
     EnumOne i;
 
-    for (i = 0; EnumOne_lookup[i]; i++) {
+    for (i = 0; i < ENUM_ONE__MAX; i++) {
         EnumOne res = -1;
 
         v = visitor_input_test_init(data, EnumOne_lookup[i]);
diff --git a/ui/input-legacy.c b/ui/input-legacy.c
index 7159747..a5f1e82 100644
--- a/ui/input-legacy.c
+++ b/ui/input-legacy.c
@@ -61,7 +61,7 @@ int index_from_key(const char *key, size_t key_length)
 {
     int i;
 
-    for (i = 0; QKeyCode_lookup[i] != NULL; i++) {
+    for (i = 0; i < Q_KEY_CODE__MAX; i++) {
         if (!strncmp(key, QKeyCode_lookup[i], key_length) &&
             !QKeyCode_lookup[i][key_length]) {
             break;
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 12/16] qapi: Generate FOO_str() macro for QAPI enum FOO
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (10 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 11/16] qapi: Avoid unnecessary use of enum lookup table's sentinel Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-30 13:42   ` Marc-André Lureau
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 13/16] qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) Markus Armbruster
                   ` (5 subsequent siblings)
  17 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

The next commit will put it to use.  May look pointless now, but we're
going to change the FOO_lookup's type, and then it'll help.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block.c                      | 1 -
 block/blkdebug.c             | 1 -
 block/file-posix.c           | 1 -
 block/file-win32.c           | 1 -
 block/gluster.c              | 1 -
 block/parallels.c            | 1 -
 block/qcow2.c                | 1 -
 block/quorum.c               | 1 -
 blockdev.c                   | 1 -
 crypto/block-luks.c          | 1 -
 docs/devel/qapi-code-gen.txt | 3 +++
 hmp.c                        | 1 -
 include/qapi/util.h          | 1 +
 migration/global_state.c     | 1 -
 migration/migration.c        | 1 -
 qapi/qapi-util.c             | 8 +++++++-
 qapi/qapi-visit-core.c       | 1 -
 qemu-img.c                   | 1 -
 qemu-nbd.c                   | 1 -
 scripts/qapi-event.py        | 1 +
 scripts/qapi-types.py        | 4 ++++
 scripts/qapi.py              | 3 +++
 tests/test-qapi-util.c       | 1 -
 tpm.c                        | 1 -
 util/keyval.c                | 1 -
 25 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/block.c b/block.c
index dd0efa2..2d12131 100644
--- a/block.c
+++ b/block.c
@@ -42,7 +42,6 @@
 #include "qapi-event.h"
 #include "qemu/cutils.h"
 #include "qemu/id.h"
-#include "qapi/util.h"
 
 #ifdef CONFIG_BSD
 #include <sys/ioctl.h>
diff --git a/block/blkdebug.c b/block/blkdebug.c
index f1bbee9..b370fce 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -32,7 +32,6 @@
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qstring.h"
-#include "qapi/util.h"
 #include "sysemu/qtest.h"
 
 typedef struct BDRVBlkdebugState {
diff --git a/block/file-posix.c b/block/file-posix.c
index 97e8a92..d81eccc 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -31,7 +31,6 @@
 #include "block/thread-pool.h"
 #include "qemu/iov.h"
 #include "block/raw-aio.h"
-#include "qapi/util.h"
 #include "qapi/qmp/qstring.h"
 
 #if defined(__APPLE__) && (__MACH__)
diff --git a/block/file-win32.c b/block/file-win32.c
index 978d805..192ea81 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -31,7 +31,6 @@
 #include "block/thread-pool.h"
 #include "qemu/iov.h"
 #include "qapi/qmp/qstring.h"
-#include "qapi/util.h"
 #include <windows.h>
 #include <winioctl.h>
 
diff --git a/block/gluster.c b/block/gluster.c
index 8367e80..0614e0c 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -12,7 +12,6 @@
 #include "block/block_int.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
-#include "qapi/util.h"
 #include "qemu/uri.h"
 #include "qemu/error-report.h"
 #include "qemu/cutils.h"
diff --git a/block/parallels.c b/block/parallels.c
index eb92366..d812210 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -35,7 +35,6 @@
 #include "qemu/module.h"
 #include "qemu/bswap.h"
 #include "qemu/bitmap.h"
-#include "qapi/util.h"
 
 /**************************************************************/
 
diff --git a/block/qcow2.c b/block/qcow2.c
index 7aaf248..41e067e 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -30,7 +30,6 @@
 #include "qemu/error-report.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/qmp/qbool.h"
-#include "qapi/util.h"
 #include "qapi/qmp/types.h"
 #include "qapi-event.h"
 #include "trace.h"
diff --git a/block/quorum.c b/block/quorum.c
index cb66177..8d1c9f6 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -22,7 +22,6 @@
 #include "qapi/qmp/qjson.h"
 #include "qapi/qmp/qlist.h"
 #include "qapi/qmp/qstring.h"
-#include "qapi/util.h"
 #include "qapi-event.h"
 #include "crypto/hash.h"
 
diff --git a/blockdev.c b/blockdev.c
index 722a61e..f90bc93 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -44,7 +44,6 @@
 #include "qapi-visit.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/qobject-output-visitor.h"
-#include "qapi/util.h"
 #include "sysemu/sysemu.h"
 #include "block/block_int.h"
 #include "qmp-commands.h"
diff --git a/crypto/block-luks.c b/crypto/block-luks.c
index c3cacdb..84d189a 100644
--- a/crypto/block-luks.c
+++ b/crypto/block-luks.c
@@ -20,7 +20,6 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qapi/util.h"
 #include "qemu/bswap.h"
 
 #include "crypto/block-luks.h"
diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
index ae05327..f04c63f 100644
--- a/docs/devel/qapi-code-gen.txt
+++ b/docs/devel/qapi-code-gen.txt
@@ -1275,6 +1275,9 @@ Example:
         EXAMPLE_QAPI_EVENT__MAX = 1,
     } example_QAPIEvent;
 
+    #define example_QAPIEvent_str(val) \
+        qapi_enum_lookup(example_QAPIEvent_lookup, (val))
+
     extern const char *const example_QAPIEvent_lookup[];
 
     #endif
diff --git a/hmp.c b/hmp.c
index 2b6e919..5d980ac 100644
--- a/hmp.c
+++ b/hmp.c
@@ -31,7 +31,6 @@
 #include "qapi/qmp/qerror.h"
 #include "qapi/string-input-visitor.h"
 #include "qapi/string-output-visitor.h"
-#include "qapi/util.h"
 #include "qapi-visit.h"
 #include "qom/object_interfaces.h"
 #include "ui/console.h"
diff --git a/include/qapi/util.h b/include/qapi/util.h
index 4eb8a3f..5e50d0c 100644
--- a/include/qapi/util.h
+++ b/include/qapi/util.h
@@ -11,6 +11,7 @@
 #ifndef QAPI_UTIL_H
 #define QAPI_UTIL_H
 
+const char *qapi_enum_lookup(const char *const lookup[], int val);
 int qapi_enum_parse(const char * const lookup[], const char *buf,
                     int def, Error **errp);
 
diff --git a/migration/global_state.c b/migration/global_state.c
index 88c55f8..76cd3a1 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -14,7 +14,6 @@
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
-#include "qapi/util.h"
 #include "migration.h"
 #include "migration/global_state.h"
 #include "migration/vmstate.h"
diff --git a/migration/migration.c b/migration/migration.c
index c3fe0ed..1a2b3eb 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -31,7 +31,6 @@
 #include "migration/vmstate.h"
 #include "block/block.h"
 #include "qapi/qmp/qerror.h"
-#include "qapi/util.h"
 #include "qemu/rcu.h"
 #include "block.h"
 #include "postcopy-ram.h"
diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
index ee7594f..7af2f04 100644
--- a/qapi/qapi-util.c
+++ b/qapi/qapi-util.c
@@ -13,7 +13,13 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "qapi/util.h"
+
+const char *qapi_enum_lookup(const char *const lookup[], int val)
+{
+    assert(val >= 0);
+
+    return lookup[val];
+}
 
 int qapi_enum_parse(const char * const lookup[], const char *buf,
                     int def, Error **errp)
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index ec83ff6..f285879 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -14,7 +14,6 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qapi/util.h"
 #include "qemu-common.h"
 #include "qapi/qmp/qobject.h"
 #include "qapi/qmp/qerror.h"
diff --git a/qemu-img.c b/qemu-img.c
index 611ab7d..a72a2e3 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -26,7 +26,6 @@
 
 #include "qemu-version.h"
 #include "qapi/error.h"
-#include "qapi/util.h"
 #include "qapi-visit.h"
 #include "qapi/qobject-output-visitor.h"
 #include "qapi/qmp/qerror.h"
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 96e10d6..a97f3f4 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -34,7 +34,6 @@
 #include "qemu/log.h"
 #include "qemu/systemd.h"
 #include "block/snapshot.h"
-#include "qapi/util.h"
 #include "qapi/qmp/qstring.h"
 #include "qom/object_interfaces.h"
 #include "io/channel-socket.h"
diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py
index bcbef10..07b4b70 100644
--- a/scripts/qapi-event.py
+++ b/scripts/qapi-event.py
@@ -217,6 +217,7 @@ fdef.write(mcgen('''
 
 fdecl.write(mcgen('''
 #include "qapi/error.h"
+#include "qapi/util.h"
 #include "qapi/qmp/qdict.h"
 #include "%(prefix)sqapi-types.h"
 
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index b45e7b5..7e3051d 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -292,6 +292,10 @@ fdef.write(mcgen('''
 ''',
                  prefix=prefix))
 
+fdecl.write(mcgen('''
+#include "qapi/util.h"
+'''))
+
 schema = QAPISchema(input_file)
 gen = QAPISchemaGenTypeVisitor()
 schema.visit(gen)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 8aa2775..1cd713d 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1894,6 +1894,9 @@ typedef enum %(c_name)s {
 
     ret += mcgen('''
 
+#define %(c_name)s_str(val) \\
+    qapi_enum_lookup(%(c_name)s_lookup, (val))
+
 extern const char *const %(c_name)s_lookup[];
 ''',
                  c_name=c_name(name))
diff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c
index d72ee8c..7e1be1d 100644
--- a/tests/test-qapi-util.c
+++ b/tests/test-qapi-util.c
@@ -12,7 +12,6 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qapi/util.h"
 #include "test-qapi-types.h"
 
 static void test_qapi_enum_parse(void)
diff --git a/tpm.c b/tpm.c
index 7635fc7..38f3eb8 100644
--- a/tpm.c
+++ b/tpm.c
@@ -14,7 +14,6 @@
 #include "qemu/osdep.h"
 
 #include "qapi/qmp/qerror.h"
-#include "qapi/util.h"
 #include "sysemu/tpm_backend.h"
 #include "sysemu/tpm.h"
 #include "qemu/config-file.h"
diff --git a/util/keyval.c b/util/keyval.c
index 7dbda62..7dfc75c 100644
--- a/util/keyval.c
+++ b/util/keyval.c
@@ -82,7 +82,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qstring.h"
-#include "qapi/util.h"
 #include "qemu/cutils.h"
 #include "qemu/option.h"
 
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 13/16] qapi: Mechanically convert FOO_lookup[...] to FOO_str(...)
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (11 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 12/16] qapi: Generate FOO_str() macro for QAPI enum FOO Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24 11:52   ` Marc-André Lureau
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 14/16] qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup() Markus Armbruster
                   ` (4 subsequent siblings)
  17 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 backends/hostmem.c                  |  2 +-
 block/backup.c                      |  2 +-
 block/file-posix.c                  |  4 +--
 block/file-win32.c                  |  2 +-
 block/gluster.c                     |  4 +--
 block/iscsi.c                       |  2 +-
 block/nfs.c                         |  2 +-
 block/qcow2.c                       |  4 +--
 block/qed.c                         |  2 +-
 block/rbd.c                         |  2 +-
 block/sheepdog.c                    |  2 +-
 blockdev.c                          |  4 +--
 blockjob.c                          |  6 ++---
 chardev/char.c                      |  4 +--
 crypto/block-luks.c                 | 12 ++++-----
 crypto/block.c                      |  4 +--
 crypto/cipher-afalg.c               |  2 +-
 crypto/cipher-builtin.c             |  8 +++---
 crypto/cipher-gcrypt.c              |  4 +--
 crypto/cipher-nettle.c              |  8 +++---
 crypto/hmac-gcrypt.c                |  2 +-
 crypto/hmac-glib.c                  |  2 +-
 crypto/hmac-nettle.c                |  2 +-
 crypto/pbkdf-gcrypt.c               |  2 +-
 crypto/pbkdf-nettle.c               |  2 +-
 hmp.c                               | 54 ++++++++++++++++++-------------------
 hw/block/fdc.c                      |  6 ++---
 hw/char/escc.c                      |  2 +-
 hw/input/virtio-input-hid.c         |  4 +--
 migration/colo-failover.c           |  4 +--
 migration/colo.c                    | 14 +++++-----
 migration/global_state.c            |  2 +-
 monitor.c                           | 16 +++++------
 net/net.c                           |  4 +--
 qapi/qmp-dispatch.c                 |  2 +-
 tests/test-qapi-util.c              |  2 +-
 tests/test-qobject-input-visitor.c  |  4 +--
 tests/test-qobject-output-visitor.c |  2 +-
 tests/test-string-input-visitor.c   |  2 +-
 tests/test-string-output-visitor.c  |  4 +--
 tpm.c                               |  2 +-
 ui/input-legacy.c                   |  4 +--
 ui/input.c                          | 12 ++++-----
 ui/vnc.c                            |  6 ++---
 vl.c                                |  6 ++---
 45 files changed, 121 insertions(+), 121 deletions(-)

diff --git a/backends/hostmem.c b/backends/hostmem.c
index 4606b73..06e8898 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -304,7 +304,7 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
             return;
         } else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) {
             error_setg(errp, "host-nodes must be set for policy %s",
-                       HostMemPolicy_lookup[backend->policy]);
+                       HostMemPolicy_str(backend->policy));
             return;
         }
 
diff --git a/block/backup.c b/block/backup.c
index 504a089..517c300 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -596,7 +596,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
         error_setg(errp,
                    "a sync_bitmap was provided to backup_run, "
                    "but received an incompatible sync_mode (%s)",
-                   MirrorSyncMode_lookup[sync_mode]);
+                   MirrorSyncMode_str(sync_mode));
         return NULL;
     }
 
diff --git a/block/file-posix.c b/block/file-posix.c
index d81eccc..bfef91d 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1724,7 +1724,7 @@ static int raw_regular_truncate(int fd, int64_t offset, PreallocMode prealloc,
     default:
         result = -ENOTSUP;
         error_setg(errp, "Unsupported preallocation mode: %s",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         return result;
     }
 
@@ -1759,7 +1759,7 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset,
 
     if (prealloc != PREALLOC_MODE_OFF) {
         error_setg(errp, "Preallocation mode '%s' unsupported for this "
-                   "non-regular file", PreallocMode_lookup[prealloc]);
+                   "non-regular file", PreallocMode_str(prealloc));
         return -ENOTSUP;
     }
 
diff --git a/block/file-win32.c b/block/file-win32.c
index 192ea81..f2a1830 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -469,7 +469,7 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset,
 
     if (prealloc != PREALLOC_MODE_OFF) {
         error_setg(errp, "Unsupported preallocation mode '%s'",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         return -ENOTSUP;
     }
 
diff --git a/block/gluster.c b/block/gluster.c
index 0614e0c..29f9427 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -1047,7 +1047,7 @@ static int qemu_gluster_create(const char *filename,
     default:
         ret = -EINVAL;
         error_setg(errp, "Unsupported preallocation mode: %s",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         break;
     }
 
@@ -1099,7 +1099,7 @@ static int qemu_gluster_truncate(BlockDriverState *bs, int64_t offset,
 
     if (prealloc != PREALLOC_MODE_OFF) {
         error_setg(errp, "Unsupported preallocation mode '%s'",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         return -ENOTSUP;
     }
 
diff --git a/block/iscsi.c b/block/iscsi.c
index d557c99..8b47d30 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -2087,7 +2087,7 @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset,
 
     if (prealloc != PREALLOC_MODE_OFF) {
         error_setg(errp, "Unsupported preallocation mode '%s'",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         return -ENOTSUP;
     }
 
diff --git a/block/nfs.c b/block/nfs.c
index bec16b7..337fcd9 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -772,7 +772,7 @@ static int nfs_file_truncate(BlockDriverState *bs, int64_t offset,
 
     if (prealloc != PREALLOC_MODE_OFF) {
         error_setg(errp, "Unsupported preallocation mode '%s'",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         return -ENOTSUP;
     }
 
diff --git a/block/qcow2.c b/block/qcow2.c
index 41e067e..eb7c154 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2731,7 +2731,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
         int64_t prealloc_size =
             qcow2_calc_prealloc_size(total_size, cluster_size, refcount_order);
         qemu_opt_set_number(opts, BLOCK_OPT_SIZE, prealloc_size, &error_abort);
-        qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_lookup[prealloc],
+        qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_str(prealloc),
                      &error_abort);
     }
 
@@ -3096,7 +3096,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset,
         prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL)
     {
         error_setg(errp, "Unsupported preallocation mode '%s'",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         return -ENOTSUP;
     }
 
diff --git a/block/qed.c b/block/qed.c
index dc54bf4..28e2ec8 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -1399,7 +1399,7 @@ static int bdrv_qed_truncate(BlockDriverState *bs, int64_t offset,
 
     if (prealloc != PREALLOC_MODE_OFF) {
         error_setg(errp, "Unsupported preallocation mode '%s'",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         return -ENOTSUP;
     }
 
diff --git a/block/rbd.c b/block/rbd.c
index 9c3aa63..144f350 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -944,7 +944,7 @@ static int qemu_rbd_truncate(BlockDriverState *bs, int64_t offset,
 
     if (prealloc != PREALLOC_MODE_OFF) {
         error_setg(errp, "Unsupported preallocation mode '%s'",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         return -ENOTSUP;
     }
 
diff --git a/block/sheepdog.c b/block/sheepdog.c
index abb2e79..1052098 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2176,7 +2176,7 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset,
 
     if (prealloc != PREALLOC_MODE_OFF) {
         error_setg(errp, "Unsupported preallocation mode '%s'",
-                   PreallocMode_lookup[prealloc]);
+                   PreallocMode_str(prealloc));
         return -ENOTSUP;
     }
 
diff --git a/blockdev.c b/blockdev.c
index f90bc93..bfb2a95 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1466,8 +1466,8 @@ static int action_check_completion_mode(BlkActionState *s, Error **errp)
         error_setg(errp,
                    "Action '%s' does not support Transaction property "
                    "completion-mode = %s",
-                   TransactionActionKind_lookup[s->action->type],
-                   ActionCompletionMode_lookup[s->txn_props->completion_mode]);
+                   TransactionActionKind_str(s->action->type),
+                   ActionCompletionMode_str(s->txn_props->completion_mode));
         return -1;
     }
     return 0;
diff --git a/blockjob.c b/blockjob.c
index 70a7818..3a0c491 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -208,7 +208,7 @@ static char *child_job_get_parent_desc(BdrvChild *c)
 {
     BlockJob *job = c->opaque;
     return g_strdup_printf("%s job '%s'",
-                           BlockJobType_lookup[job->driver->job_type],
+                           BlockJobType_str(job->driver->job_type),
                            job->id);
 }
 
@@ -553,7 +553,7 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
         return NULL;
     }
     info = g_new0(BlockJobInfo, 1);
-    info->type      = g_strdup(BlockJobType_lookup[job->driver->job_type]);
+    info->type      = g_strdup(BlockJobType_str(job->driver->job_type));
     info->device    = g_strdup(job->id);
     info->len       = job->len;
     info->busy      = job->busy;
@@ -666,7 +666,7 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
     job->refcnt        = 1;
 
     error_setg(&job->blocker, "block device is in use by block job: %s",
-               BlockJobType_lookup[driver->job_type]);
+               BlockJobType_str(driver->job_type));
     block_job_add_bdrv(job, "main node", bs, 0, BLK_PERM_ALL, &error_abort);
     bs->job = job;
 
diff --git a/chardev/char.c b/chardev/char.c
index 5d283b9..b6fd5eb 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -931,7 +931,7 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
     ChardevReturn *ret;
     Chardev *chr;
 
-    cc = char_get_class(ChardevBackendKind_lookup[backend->type], errp);
+    cc = char_get_class(ChardevBackendKind_str(backend->type), errp);
     if (!cc) {
         return NULL;
     }
@@ -989,7 +989,7 @@ ChardevReturn *qmp_chardev_change(const char *id, ChardevBackend *backend,
         return NULL;
     }
 
-    cc = char_get_class(ChardevBackendKind_lookup[backend->type], errp);
+    cc = char_get_class(ChardevBackendKind_str(backend->type), errp);
     if (!cc) {
         return NULL;
     }
diff --git a/crypto/block-luks.c b/crypto/block-luks.c
index 84d189a..4e82895 100644
--- a/crypto/block-luks.c
+++ b/crypto/block-luks.c
@@ -257,7 +257,7 @@ qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg,
     }
 
     error_setg(errp, "Algorithm '%s' not supported",
-               QCryptoCipherAlgorithm_lookup[alg]);
+               QCryptoCipherAlgorithm_str(alg));
     return NULL;
 }
 
@@ -392,7 +392,7 @@ qcrypto_block_luks_essiv_cipher(QCryptoCipherAlgorithm cipher,
         break;
     default:
         error_setg(errp, "Cipher %s not supported with essiv",
-                   QCryptoCipherAlgorithm_lookup[cipher]);
+                   QCryptoCipherAlgorithm_str(cipher));
         return 0;
     }
 }
@@ -962,16 +962,16 @@ qcrypto_block_luks_create(QCryptoBlock *block,
         goto error;
     }
 
-    cipher_mode = QCryptoCipherMode_lookup[luks_opts.cipher_mode];
-    ivgen_alg = QCryptoIVGenAlgorithm_lookup[luks_opts.ivgen_alg];
+    cipher_mode = QCryptoCipherMode_str(luks_opts.cipher_mode);
+    ivgen_alg = QCryptoIVGenAlgorithm_str(luks_opts.ivgen_alg);
     if (luks_opts.has_ivgen_hash_alg) {
-        ivgen_hash_alg = QCryptoHashAlgorithm_lookup[luks_opts.ivgen_hash_alg];
+        ivgen_hash_alg = QCryptoHashAlgorithm_str(luks_opts.ivgen_hash_alg);
         cipher_mode_spec = g_strdup_printf("%s-%s:%s", cipher_mode, ivgen_alg,
                                            ivgen_hash_alg);
     } else {
         cipher_mode_spec = g_strdup_printf("%s-%s", cipher_mode, ivgen_alg);
     }
-    hash_alg = QCryptoHashAlgorithm_lookup[luks_opts.hash_alg];
+    hash_alg = QCryptoHashAlgorithm_str(luks_opts.hash_alg);
 
 
     if (strlen(cipher_alg) >= QCRYPTO_BLOCK_LUKS_CIPHER_NAME_LEN) {
diff --git a/crypto/block.c b/crypto/block.c
index b097d45..c382393 100644
--- a/crypto/block.c
+++ b/crypto/block.c
@@ -61,7 +61,7 @@ QCryptoBlock *qcrypto_block_open(QCryptoBlockOpenOptions *options,
     if (options->format >= G_N_ELEMENTS(qcrypto_block_drivers) ||
         !qcrypto_block_drivers[options->format]) {
         error_setg(errp, "Unsupported block driver %s",
-                   QCryptoBlockFormat_lookup[options->format]);
+                   QCryptoBlockFormat_str(options->format));
         g_free(block);
         return NULL;
     }
@@ -92,7 +92,7 @@ QCryptoBlock *qcrypto_block_create(QCryptoBlockCreateOptions *options,
     if (options->format >= G_N_ELEMENTS(qcrypto_block_drivers) ||
         !qcrypto_block_drivers[options->format]) {
         error_setg(errp, "Unsupported block driver %s",
-                   QCryptoBlockFormat_lookup[options->format]);
+                   QCryptoBlockFormat_str(options->format));
         g_free(block);
         return NULL;
     }
diff --git a/crypto/cipher-afalg.c b/crypto/cipher-afalg.c
index 01343b2..cd72284 100644
--- a/crypto/cipher-afalg.c
+++ b/crypto/cipher-afalg.c
@@ -52,7 +52,7 @@ qcrypto_afalg_cipher_format_name(QCryptoCipherAlgorithm alg,
         return NULL;
     }
 
-    mode_name = QCryptoCipherMode_lookup[mode];
+    mode_name = QCryptoCipherMode_str(mode);
     name = g_strdup_printf("%s(%s)", mode_name, alg_name);
 
     return name;
diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c
index 16a36d4..d8c811f 100644
--- a/crypto/cipher-builtin.c
+++ b/crypto/cipher-builtin.c
@@ -247,7 +247,7 @@ qcrypto_cipher_init_aes(QCryptoCipherMode mode,
         mode != QCRYPTO_CIPHER_MODE_ECB &&
         mode != QCRYPTO_CIPHER_MODE_XTS) {
         error_setg(errp, "Unsupported cipher mode %s",
-                   QCryptoCipherMode_lookup[mode]);
+                   QCryptoCipherMode_str(mode));
         return NULL;
     }
 
@@ -379,7 +379,7 @@ qcrypto_cipher_init_des_rfb(QCryptoCipherMode mode,
 
     if (mode != QCRYPTO_CIPHER_MODE_ECB) {
         error_setg(errp, "Unsupported cipher mode %s",
-                   QCryptoCipherMode_lookup[mode]);
+                   QCryptoCipherMode_str(mode));
         return NULL;
     }
 
@@ -440,7 +440,7 @@ static QCryptoCipherBuiltin *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
         break;
     default:
         error_setg(errp, "Unsupported cipher mode %s",
-                   QCryptoCipherMode_lookup[mode]);
+                   QCryptoCipherMode_str(mode));
         return NULL;
     }
 
@@ -460,7 +460,7 @@ static QCryptoCipherBuiltin *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
     default:
         error_setg(errp,
                    "Unsupported cipher algorithm %s",
-                   QCryptoCipherAlgorithm_lookup[alg]);
+                   QCryptoCipherAlgorithm_str(alg));
         return NULL;
     }
 
diff --git a/crypto/cipher-gcrypt.c b/crypto/cipher-gcrypt.c
index 0489147..10d75da 100644
--- a/crypto/cipher-gcrypt.c
+++ b/crypto/cipher-gcrypt.c
@@ -105,7 +105,7 @@ static QCryptoCipherGcrypt *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
         break;
     default:
         error_setg(errp, "Unsupported cipher mode %s",
-                   QCryptoCipherMode_lookup[mode]);
+                   QCryptoCipherMode_str(mode));
         return NULL;
     }
 
@@ -160,7 +160,7 @@ static QCryptoCipherGcrypt *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
 
     default:
         error_setg(errp, "Unsupported cipher algorithm %s",
-                   QCryptoCipherAlgorithm_lookup[alg]);
+                   QCryptoCipherAlgorithm_str(alg));
         return NULL;
     }
 
diff --git a/crypto/cipher-nettle.c b/crypto/cipher-nettle.c
index c51f119..3848cb3 100644
--- a/crypto/cipher-nettle.c
+++ b/crypto/cipher-nettle.c
@@ -281,7 +281,7 @@ static QCryptoCipherNettle *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
         break;
     default:
         error_setg(errp, "Unsupported cipher mode %s",
-                   QCryptoCipherMode_lookup[mode]);
+                   QCryptoCipherMode_str(mode));
         return NULL;
     }
 
@@ -420,7 +420,7 @@ static QCryptoCipherNettle *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
 
     default:
         error_setg(errp, "Unsupported cipher algorithm %s",
-                   QCryptoCipherAlgorithm_lookup[alg]);
+                   QCryptoCipherAlgorithm_str(alg));
         goto error;
     }
 
@@ -491,7 +491,7 @@ qcrypto_nettle_cipher_encrypt(QCryptoCipher *cipher,
 
     default:
         error_setg(errp, "Unsupported cipher mode %s",
-                   QCryptoCipherMode_lookup[cipher->mode]);
+                   QCryptoCipherMode_str(cipher->mode));
         return -1;
     }
     return 0;
@@ -537,7 +537,7 @@ qcrypto_nettle_cipher_decrypt(QCryptoCipher *cipher,
 
     default:
         error_setg(errp, "Unsupported cipher mode %s",
-                   QCryptoCipherMode_lookup[cipher->mode]);
+                   QCryptoCipherMode_str(cipher->mode));
         return -1;
     }
     return 0;
diff --git a/crypto/hmac-gcrypt.c b/crypto/hmac-gcrypt.c
index 76ca61b..0c6f979 100644
--- a/crypto/hmac-gcrypt.c
+++ b/crypto/hmac-gcrypt.c
@@ -52,7 +52,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
 
     if (!qcrypto_hmac_supports(alg)) {
         error_setg(errp, "Unsupported hmac algorithm %s",
-                   QCryptoHashAlgorithm_lookup[alg]);
+                   QCryptoHashAlgorithm_str(alg));
         return NULL;
     }
 
diff --git a/crypto/hmac-glib.c b/crypto/hmac-glib.c
index 8cf6b22..a6c1730 100644
--- a/crypto/hmac-glib.c
+++ b/crypto/hmac-glib.c
@@ -58,7 +58,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
 
     if (!qcrypto_hmac_supports(alg)) {
         error_setg(errp, "Unsupported hmac algorithm %s",
-                   QCryptoHashAlgorithm_lookup[alg]);
+                   QCryptoHashAlgorithm_str(alg));
         return NULL;
     }
 
diff --git a/crypto/hmac-nettle.c b/crypto/hmac-nettle.c
index 1d5a915..ec2d61b 100644
--- a/crypto/hmac-nettle.c
+++ b/crypto/hmac-nettle.c
@@ -106,7 +106,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
 
     if (!qcrypto_hmac_supports(alg)) {
         error_setg(errp, "Unsupported hmac algorithm %s",
-                   QCryptoHashAlgorithm_lookup[alg]);
+                   QCryptoHashAlgorithm_str(alg));
         return NULL;
     }
 
diff --git a/crypto/pbkdf-gcrypt.c b/crypto/pbkdf-gcrypt.c
index 4028985..54ca0d9 100644
--- a/crypto/pbkdf-gcrypt.c
+++ b/crypto/pbkdf-gcrypt.c
@@ -68,7 +68,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
         hash_map[hash] == GCRY_MD_NONE) {
         error_setg_errno(errp, ENOSYS,
                          "PBKDF does not support hash algorithm %s",
-                         QCryptoHashAlgorithm_lookup[hash]);
+                         QCryptoHashAlgorithm_str(hash));
         return -1;
     }
 
diff --git a/crypto/pbkdf-nettle.c b/crypto/pbkdf-nettle.c
index 6fb2671..212b3e8 100644
--- a/crypto/pbkdf-nettle.c
+++ b/crypto/pbkdf-nettle.c
@@ -110,7 +110,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
     default:
         error_setg_errno(errp, ENOSYS,
                          "PBKDF does not support hash algorithm %s",
-                         QCryptoHashAlgorithm_lookup[hash]);
+                         QCryptoHashAlgorithm_str(hash));
         return -1;
     }
     return 0;
diff --git a/hmp.c b/hmp.c
index 5d980ac..30819fe 100644
--- a/hmp.c
+++ b/hmp.c
@@ -106,7 +106,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict)
                    info->singlestep ? " (single step mode)" : "");
 
     if (!info->running && info->status != RUN_STATE_PAUSED) {
-        monitor_printf(mon, " (%s)", RunState_lookup[info->status]);
+        monitor_printf(mon, " (%s)", RunState_str(info->status));
     }
 
     monitor_printf(mon, "\n");
@@ -171,7 +171,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "capabilities: ");
         for (cap = caps; cap; cap = cap->next) {
             monitor_printf(mon, "%s: %s ",
-                           MigrationCapability_lookup[cap->value->capability],
+                           MigrationCapability_str(cap->value->capability),
                            cap->value->state ? "on" : "off");
         }
         monitor_printf(mon, "\n");
@@ -179,7 +179,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
 
     if (info->has_status) {
         monitor_printf(mon, "Migration status: %s",
-                       MigrationStatus_lookup[info->status]);
+                       MigrationStatus_str(info->status));
         if (info->status == MIGRATION_STATUS_FAILED &&
             info->has_error_desc) {
             monitor_printf(mon, " (%s)\n", info->error_desc);
@@ -277,7 +277,7 @@ void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict)
     if (caps) {
         for (cap = caps; cap; cap = cap->next) {
             monitor_printf(mon, "%s: %s\n",
-                           MigrationCapability_lookup[cap->value->capability],
+                           MigrationCapability_str(cap->value->capability),
                            cap->value->state ? "on" : "off");
         }
     }
@@ -294,48 +294,48 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
     if (params) {
         assert(params->has_compress_level);
         monitor_printf(mon, "%s: %" PRId64 "\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_LEVEL],
+            MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_LEVEL),
             params->compress_level);
         assert(params->has_compress_threads);
         monitor_printf(mon, "%s: %" PRId64 "\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_THREADS],
+            MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_THREADS),
             params->compress_threads);
         assert(params->has_decompress_threads);
         monitor_printf(mon, "%s: %" PRId64 "\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_DECOMPRESS_THREADS],
+            MigrationParameter_str(MIGRATION_PARAMETER_DECOMPRESS_THREADS),
             params->decompress_threads);
         assert(params->has_cpu_throttle_initial);
         monitor_printf(mon, "%s: %" PRId64 "\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL],
+            MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL),
             params->cpu_throttle_initial);
         assert(params->has_cpu_throttle_increment);
         monitor_printf(mon, "%s: %" PRId64 "\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT],
+            MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT),
             params->cpu_throttle_increment);
         assert(params->has_tls_creds);
         monitor_printf(mon, "%s: '%s'\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_CREDS],
+            MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS),
             params->tls_creds);
         assert(params->has_tls_hostname);
         monitor_printf(mon, "%s: '%s'\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
+            MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME),
             params->tls_hostname);
         assert(params->has_max_bandwidth);
         monitor_printf(mon, "%s: %" PRId64 " bytes/second\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH],
+            MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH),
             params->max_bandwidth);
         assert(params->has_downtime_limit);
         monitor_printf(mon, "%s: %" PRId64 " milliseconds\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_DOWNTIME_LIMIT],
+            MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT),
             params->downtime_limit);
         assert(params->has_x_checkpoint_delay);
         monitor_printf(mon, "%s: %" PRId64 "\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY],
+            MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY),
             params->x_checkpoint_delay);
         assert(params->has_block_incremental);
         monitor_printf(mon, "%s: %s\n",
-            MigrationParameter_lookup[MIGRATION_PARAMETER_BLOCK_INCREMENTAL],
-                       params->block_incremental ? "on" : "off");
+            MigrationParameter_str(MIGRATION_PARAMETER_BLOCK_INCREMENTAL),
+            params->block_incremental ? "on" : "off");
     }
 
     qapi_free_MigrationParameters(params);
@@ -431,7 +431,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
         }
         if (info->has_io_status && info->io_status != BLOCK_DEVICE_IO_STATUS_OK) {
             monitor_printf(mon, "    I/O status:       %s\n",
-                           BlockDeviceIoStatus_lookup[info->io_status]);
+                           BlockDeviceIoStatus_str(info->io_status));
         }
 
         if (info->removable) {
@@ -461,7 +461,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
 
     if (inserted->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF) {
         monitor_printf(mon, "    Detect zeroes:    %s\n",
-                       BlockdevDetectZeroesOptions_lookup[inserted->detect_zeroes]);
+                BlockdevDetectZeroesOptions_str(inserted->detect_zeroes));
     }
 
     if (inserted->bps  || inserted->bps_rd  || inserted->bps_wr  ||
@@ -612,7 +612,7 @@ static void hmp_info_VncBasicInfo(Monitor *mon, VncBasicInfo *info,
                    name,
                    info->host,
                    info->service,
-                   NetworkAddressFamily_lookup[info->family],
+                   NetworkAddressFamily_str(info->family),
                    info->websocket ? " (Websocket)" : "");
 }
 
@@ -622,8 +622,8 @@ static void hmp_info_vnc_authcrypt(Monitor *mon, const char *indent,
                                    VncVencryptSubAuth *vencrypt)
 {
     monitor_printf(mon, "%sAuth: %s (Sub: %s)\n", indent,
-                   VncPrimaryAuth_lookup[auth],
-                   vencrypt ? VncVencryptSubAuth_lookup[*vencrypt] : "none");
+                   VncPrimaryAuth_str(auth),
+                   vencrypt ? VncVencryptSubAuth_str(*vencrypt) : "none");
 }
 
 static void hmp_info_vnc_clients(Monitor *mon, VncClientInfoList *client)
@@ -738,7 +738,7 @@ void hmp_info_spice(Monitor *mon, const QDict *qdict)
     monitor_printf(mon, "        auth: %s\n", info->auth);
     monitor_printf(mon, "    compiled: %s\n", info->compiled_version);
     monitor_printf(mon, "  mouse-mode: %s\n",
-                   SpiceQueryMouseMode_lookup[info->mouse_mode]);
+                   SpiceQueryMouseMode_str(info->mouse_mode));
 
     if (!info->has_channels || info->channels == NULL) {
         monitor_printf(mon, "Channels: none\n");
@@ -1009,10 +1009,10 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
     for (info = info_list; info; info = info->next) {
         TPMInfo *ti = info->value;
         monitor_printf(mon, " tpm%d: model=%s\n",
-                       c, TpmModel_lookup[ti->model]);
+                       c, TpmModel_str(ti->model));
 
         monitor_printf(mon, "  \\ %s: type=%s",
-                       ti->id, TpmTypeOptionsKind_lookup[ti->options->type]);
+                       ti->id, TpmTypeOptionsKind_str(ti->options->type));
 
         switch (ti->options->type) {
         case TPM_TYPE_OPTIONS_KIND_PASSTHROUGH:
@@ -2368,7 +2368,7 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "  prealloc: %s\n",
                        m->value->prealloc ? "true" : "false");
         monitor_printf(mon, "  policy: %s\n",
-                       HostMemPolicy_lookup[m->value->policy]);
+                       HostMemPolicy_str(m->value->policy));
         visit_complete(v, &str);
         monitor_printf(mon, "  host nodes: %s\n", str);
 
@@ -2399,7 +2399,7 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
                 di = value->u.dimm.data;
 
                 monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
-                               MemoryDeviceInfoKind_lookup[value->type],
+                               MemoryDeviceInfoKind_str(value->type),
                                di->id ? di->id : "");
                 monitor_printf(mon, "  addr: 0x%" PRIx64 "\n", di->addr);
                 monitor_printf(mon, "  slot: %" PRId64 "\n", di->slot);
@@ -2793,7 +2793,7 @@ void hmp_info_dump(Monitor *mon, const QDict *qdict)
     DumpQueryResult *result = qmp_query_dump(NULL);
 
     assert(result && result->status < DUMP_STATUS__MAX);
-    monitor_printf(mon, "Status: %s\n", DumpStatus_lookup[result->status]);
+    monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
 
     if (result->status == DUMP_STATUS_ACTIVE) {
         float percent = 0;
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 4011290..db40e17 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -392,9 +392,9 @@ static int pick_geometry(FDrive *drv)
             FLOPPY_DPRINTF("User requested floppy drive type '%s', "
                            "but inserted medium appears to be a "
                            "%"PRId64" sector '%s' type\n",
-                           FloppyDriveType_lookup[drv->drive],
+                           FloppyDriveType_str(drv->drive),
                            nb_sectors,
-                           FloppyDriveType_lookup[parse->drive]);
+                           FloppyDriveType_str(parse->drive));
         }
         match = type_match;
     }
@@ -403,7 +403,7 @@ static int pick_geometry(FDrive *drv)
     if (match == -1) {
         error_setg(&error_abort, "No candidate geometries present in table "
                    " for floppy drive type '%s'",
-                   FloppyDriveType_lookup[drv->drive]);
+                   FloppyDriveType_str(drv->drive));
     }
 
     parse = &(fd_formats[match]);
diff --git a/hw/char/escc.c b/hw/char/escc.c
index 1aca564..3ab831a 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -848,7 +848,7 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
     assert(evt->type == INPUT_EVENT_KIND_KEY);
     key = evt->u.key.data;
     qcode = qemu_input_key_value_to_qcode(key->key);
-    trace_escc_sunkbd_event_in(qcode, QKeyCode_lookup[qcode],
+    trace_escc_sunkbd_event_in(qcode, QKeyCode_str(qcode),
                                key->down);
 
     if (qcode == Q_KEY_CODE_CAPS_LOCK) {
diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c
index 46c0381..4d3afc1 100644
--- a/hw/input/virtio-input-hid.c
+++ b/hw/input/virtio-input-hid.c
@@ -209,7 +209,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
         } else {
             if (key->down) {
                 fprintf(stderr, "%s: unmapped key: %d [%s]\n", __func__,
-                        qcode, QKeyCode_lookup[qcode]);
+                        qcode, QKeyCode_str(qcode));
             }
         }
         break;
@@ -224,7 +224,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
             if (btn->down) {
                 fprintf(stderr, "%s: unmapped button: %d [%s]\n", __func__,
                         btn->button,
-                        InputButton_lookup[btn->button]);
+                        InputButton_str(btn->button));
             }
         }
         break;
diff --git a/migration/colo-failover.c b/migration/colo-failover.c
index f991486..6563862 100644
--- a/migration/colo-failover.c
+++ b/migration/colo-failover.c
@@ -34,7 +34,7 @@ static void colo_failover_bh(void *opaque)
                                    FAILOVER_STATUS_ACTIVE);
     if (old_state != FAILOVER_STATUS_REQUIRE) {
         error_report("Unknown error for failover, old_state = %s",
-                    FailoverStatus_lookup[old_state]);
+                    FailoverStatus_str(old_state));
         return;
     }
 
@@ -64,7 +64,7 @@ FailoverStatus failover_set_state(FailoverStatus old_state,
 
     old = atomic_cmpxchg(&failover_state, old_state, new_state);
     if (old == old_state) {
-        trace_colo_failover_set_state(FailoverStatus_lookup[new_state]);
+        trace_colo_failover_set_state(FailoverStatus_str(new_state));
     }
     return old;
 }
diff --git a/migration/colo.c b/migration/colo.c
index a425543..dee3aa8 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -61,7 +61,7 @@ static void secondary_vm_do_failover(void)
                         FAILOVER_STATUS_RELAUNCH);
         if (old_state != FAILOVER_STATUS_ACTIVE) {
             error_report("Unknown error while do failover for secondary VM,"
-                         "old_state: %s", FailoverStatus_lookup[old_state]);
+                         "old_state: %s", FailoverStatus_str(old_state));
         }
         return;
     }
@@ -91,7 +91,7 @@ static void secondary_vm_do_failover(void)
                                    FAILOVER_STATUS_COMPLETED);
     if (old_state != FAILOVER_STATUS_ACTIVE) {
         error_report("Incorrect state (%s) while doing failover for "
-                     "secondary VM", FailoverStatus_lookup[old_state]);
+                     "secondary VM", FailoverStatus_str(old_state));
         return;
     }
     /* Notify COLO incoming thread that failover work is finished */
@@ -126,7 +126,7 @@ static void primary_vm_do_failover(void)
                                    FAILOVER_STATUS_COMPLETED);
     if (old_state != FAILOVER_STATUS_ACTIVE) {
         error_report("Incorrect state (%s) while doing failover for Primary VM",
-                     FailoverStatus_lookup[old_state]);
+                     FailoverStatus_str(old_state));
         return;
     }
     /* Notify COLO thread that failover work is finished */
@@ -222,7 +222,7 @@ static void colo_send_message(QEMUFile *f, COLOMessage msg,
     if (ret < 0) {
         error_setg_errno(errp, -ret, "Can't send COLO message");
     }
-    trace_colo_send_message(COLOMessage_lookup[msg]);
+    trace_colo_send_message(COLOMessage_str(msg));
 }
 
 static void colo_send_message_value(QEMUFile *f, COLOMessage msg,
@@ -242,7 +242,7 @@ static void colo_send_message_value(QEMUFile *f, COLOMessage msg,
     ret = qemu_file_get_error(f);
     if (ret < 0) {
         error_setg_errno(errp, -ret, "Failed to send value for message:%s",
-                         COLOMessage_lookup[msg]);
+                         COLOMessage_str(msg));
     }
 }
 
@@ -261,7 +261,7 @@ static COLOMessage colo_receive_message(QEMUFile *f, Error **errp)
         error_setg(errp, "%s: Invalid message", __func__);
         return msg;
     }
-    trace_colo_receive_message(COLOMessage_lookup[msg]);
+    trace_colo_receive_message(COLOMessage_str(msg));
     return msg;
 }
 
@@ -299,7 +299,7 @@ static uint64_t colo_receive_message_value(QEMUFile *f, uint32_t expect_msg,
     ret = qemu_file_get_error(f);
     if (ret < 0) {
         error_setg_errno(errp, -ret, "Failed to get value for COLO message: %s",
-                         COLOMessage_lookup[expect_msg]);
+                         COLOMessage_str(expect_msg));
     }
     return value;
 }
diff --git a/migration/global_state.c b/migration/global_state.c
index 76cd3a1..8db2f19 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -41,7 +41,7 @@ int global_state_store(void)
 
 void global_state_store_running(void)
 {
-    const char *state = RunState_lookup[RUN_STATE_RUNNING];
+    const char *state = RunState_str(RUN_STATE_RUNNING);
     strncpy((char *)global_state.runstate,
            state, sizeof(global_state.runstate));
 }
diff --git a/monitor.c b/monitor.c
index b45f55d..360757c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -928,7 +928,7 @@ EventInfoList *qmp_query_events(Error **errp)
     QAPIEvent e;
 
     for (e = 0 ; e < QAPI_EVENT__MAX ; e++) {
-        const char *event_name = QAPIEvent_lookup[e];
+        const char *event_name = QAPIEvent_str(e);
         assert(event_name != NULL);
         info = g_malloc0(sizeof(*info));
         info->value = g_malloc0(sizeof(*info->value));
@@ -3250,7 +3250,7 @@ void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str)
     len = strlen(str);
     readline_set_completion_index(rs, len);
     for (i = 0; i < NET_CLIENT_DRIVER__MAX; i++) {
-        add_completion_option(rs, str, NetClientDriver_lookup[i]);
+        add_completion_option(rs, str, NetClientDriver_str(i));
     }
 }
 
@@ -3434,8 +3434,8 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
     len = strlen(str);
     readline_set_completion_index(rs, len);
     for (i = 0; i < Q_KEY_CODE__MAX; i++) {
-        if (!strncmp(str, QKeyCode_lookup[i], len)) {
-            readline_add_completion(rs, QKeyCode_lookup[i]);
+        if (!strncmp(str, QKeyCode_str(i), len)) {
+            readline_add_completion(rs, QKeyCode_str(i));
         }
     }
 }
@@ -3538,7 +3538,7 @@ void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
     }
     readline_set_completion_index(rs, strlen(str));
     for (i = 0; i < WATCHDOG_EXPIRATION_ACTION__MAX; i++) {
-        add_completion_option(rs, str, WatchdogExpirationAction_lookup[i]);
+        add_completion_option(rs, str, WatchdogExpirationAction_str(i));
     }
 }
 
@@ -3552,7 +3552,7 @@ void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
     if (nb_args == 2) {
         int i;
         for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
-            const char *name = MigrationCapability_lookup[i];
+            const char *name = MigrationCapability_str(i);
             if (!strncmp(str, name, len)) {
                 readline_add_completion(rs, name);
             }
@@ -3573,7 +3573,7 @@ void migrate_set_parameter_completion(ReadLineState *rs, int nb_args,
     if (nb_args == 2) {
         int i;
         for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
-            const char *name = MigrationParameter_lookup[i];
+            const char *name = MigrationParameter_str(i);
             if (!strncmp(str, name, len)) {
                 readline_add_completion(rs, name);
             }
@@ -3852,7 +3852,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
         qdict = qdict_get_qdict(qobject_to_qdict(rsp), "error");
         if (qdict
             && !g_strcmp0(qdict_get_try_str(qdict, "class"),
-                    QapiErrorClass_lookup[ERROR_CLASS_COMMAND_NOT_FOUND])) {
+                    QapiErrorClass_str(ERROR_CLASS_COMMAND_NOT_FOUND))) {
             /* Provide a more useful error message */
             qdict_del(qdict, "desc");
             qdict_put_str(qdict, "desc", "Expecting capabilities negotiation"
diff --git a/net/net.c b/net/net.c
index 0e28099..2fa99c0 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1064,7 +1064,7 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
         /* FIXME drop when all init functions store an Error */
         if (errp && !*errp) {
             error_setg(errp, QERR_DEVICE_INIT_FAILED,
-                       NetClientDriver_lookup[netdev->type]);
+                       NetClientDriver_str(netdev->type));
         }
         return -1;
     }
@@ -1288,7 +1288,7 @@ void print_net_client(Monitor *mon, NetClientState *nc)
 
     monitor_printf(mon, "%s: index=%d,type=%s,%s\n", nc->name,
                    nc->queue_index,
-                   NetClientDriver_lookup[nc->info->type],
+                   NetClientDriver_str(nc->info->type),
                    nc->info_str);
     if (!QTAILQ_EMPTY(&nc->filters)) {
         monitor_printf(mon, "filters:\n");
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 5ad36f8..b41fa17 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -118,7 +118,7 @@ static QObject *do_qmp_dispatch(QmpCommandList *cmds, QObject *request,
 QObject *qmp_build_error_object(Error *err)
 {
     return qobject_from_jsonf("{ 'class': %s, 'desc': %s }",
-                              QapiErrorClass_lookup[error_get_class(err)],
+                              QapiErrorClass_str(error_get_class(err)),
                               error_get_pretty(err));
 }
 
diff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c
index 7e1be1d..0992bdb 100644
--- a/tests/test-qapi-util.c
+++ b/tests/test-qapi-util.c
@@ -31,7 +31,7 @@ static void test_qapi_enum_parse(void)
     ret = qapi_enum_parse(QType_lookup, "none", -1, &error_abort);
     g_assert_cmpint(ret, ==, QTYPE_NONE);
 
-    ret = qapi_enum_parse(QType_lookup, QType_lookup[QTYPE__MAX - 1],
+    ret = qapi_enum_parse(QType_lookup, QType_str(QTYPE__MAX - 1),
                           QTYPE__MAX - 1, &error_abort);
     g_assert_cmpint(ret, ==, QTYPE__MAX - 1);
 }
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index 5bbfb65..f8720aa 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -385,7 +385,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
     for (i = 0; i < ENUM_ONE__MAX; i++) {
         EnumOne res = -1;
 
-        v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]);
+        v = visitor_input_test_init(data, "%s", EnumOne_str(i));
 
         visit_type_EnumOne(v, NULL, &res, &error_abort);
         g_assert_cmpint(i, ==, res);
@@ -699,7 +699,7 @@ static void test_native_list_integer_helper(TestInputVisitorData *data,
         }
     }
     g_string_append_printf(gstr_union,  "{ 'type': '%s', 'data': [ %s ] }",
-                           UserDefNativeListUnionKind_lookup[kind],
+                           UserDefNativeListUnionKind_str(kind),
                            gstr_list->str);
     v = visitor_input_test_init_raw(data,  gstr_union->str);
 
diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c
index 7eb1620..d375100 100644
--- a/tests/test-qobject-output-visitor.c
+++ b/tests/test-qobject-output-visitor.c
@@ -133,7 +133,7 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
 
         qstr = qobject_to_qstring(visitor_get(data));
         g_assert(qstr);
-        g_assert_cmpstr(qstring_get_str(qstr), ==, EnumOne_lookup[i]);
+        g_assert_cmpstr(qstring_get_str(qstr), ==, EnumOne_str(i));
         visitor_reset(data);
     }
 }
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index e7a7b80..4f9c36b 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -282,7 +282,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
     for (i = 0; i < ENUM_ONE__MAX; i++) {
         EnumOne res = -1;
 
-        v = visitor_input_test_init(data, EnumOne_lookup[i]);
+        v = visitor_input_test_init(data, EnumOne_str(i));
 
         visit_type_EnumOne(v, NULL, &res, &err);
         g_assert(!err);
diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index e736db3..385cddb 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -194,12 +194,12 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
 
         str = visitor_get(data);
         if (data->human) {
-            char *str_human = g_strdup_printf("\"%s\"", EnumOne_lookup[i]);
+            char *str_human = g_strdup_printf("\"%s\"", EnumOne_str(i));
 
             g_assert_cmpstr(str, ==, str_human);
             g_free(str_human);
         } else {
-            g_assert_cmpstr(str, ==, EnumOne_lookup[i]);
+            g_assert_cmpstr(str, ==, EnumOne_str(i));
         }
         visitor_reset(data);
     }
diff --git a/tpm.c b/tpm.c
index 38f3eb8..111f1ca 100644
--- a/tpm.c
+++ b/tpm.c
@@ -62,7 +62,7 @@ static void tpm_display_backend_drivers(void)
             continue;
         }
         fprintf(stderr, "%12s   %s\n",
-                TpmType_lookup[i], be_drivers[i]->desc());
+                TpmType_str(i), be_drivers[i]->desc());
     }
     fprintf(stderr, "\n");
 }
diff --git a/ui/input-legacy.c b/ui/input-legacy.c
index a5f1e82..6bc3525 100644
--- a/ui/input-legacy.c
+++ b/ui/input-legacy.c
@@ -62,8 +62,8 @@ int index_from_key(const char *key, size_t key_length)
     int i;
 
     for (i = 0; i < Q_KEY_CODE__MAX; i++) {
-        if (!strncmp(key, QKeyCode_lookup[i], key_length) &&
-            !QKeyCode_lookup[i][key_length]) {
+        if (!strncmp(key, QKeyCode_str(i), key_length) &&
+            !QKeyCode_str(i)[key_length]) {
             break;
         }
     }
diff --git a/ui/input.c b/ui/input.c
index af05f06..3422d4a 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -151,7 +151,7 @@ void qmp_input_send_event(bool has_device, const char *device,
         if (!qemu_input_find_handler(1 << event->type, con)) {
             error_setg(errp, "Input handler not found for "
                              "event type %s",
-                            InputEventKind_lookup[event->type]);
+                            InputEventKind_str(event->type));
             return;
         }
     }
@@ -213,12 +213,12 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt)
         switch (key->key->type) {
         case KEY_VALUE_KIND_NUMBER:
             qcode = qemu_input_key_number_to_qcode(key->key->u.number.data);
-            name = QKeyCode_lookup[qcode];
+            name = QKeyCode_str(qcode);
             trace_input_event_key_number(idx, key->key->u.number.data,
                                          name, key->down);
             break;
         case KEY_VALUE_KIND_QCODE:
-            name = QKeyCode_lookup[key->key->u.qcode.data];
+            name = QKeyCode_str(key->key->u.qcode.data);
             trace_input_event_key_qcode(idx, name, key->down);
             break;
         case KEY_VALUE_KIND__MAX:
@@ -228,17 +228,17 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt)
         break;
     case INPUT_EVENT_KIND_BTN:
         btn = evt->u.btn.data;
-        name = InputButton_lookup[btn->button];
+        name = InputButton_str(btn->button);
         trace_input_event_btn(idx, name, btn->down);
         break;
     case INPUT_EVENT_KIND_REL:
         move = evt->u.rel.data;
-        name = InputAxis_lookup[move->axis];
+        name = InputAxis_str(move->axis);
         trace_input_event_rel(idx, name, move->value);
         break;
     case INPUT_EVENT_KIND_ABS:
         move = evt->u.abs.data;
-        name = InputAxis_lookup[move->axis];
+        name = InputAxis_str(move->axis);
         trace_input_event_abs(idx, name, move->value);
         break;
     case INPUT_EVENT_KIND__MAX:
diff --git a/ui/vnc.c b/ui/vnc.c
index 651cbb8..e1874a2 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -131,7 +131,7 @@ static void vnc_init_basic_info(SocketAddress *addr,
     case SOCKET_ADDRESS_TYPE_VSOCK:
     case SOCKET_ADDRESS_TYPE_FD:
         error_setg(errp, "Unsupported socket address type %s",
-                   SocketAddressType_lookup[addr->type]);
+                   SocketAddressType_str(addr->type));
         break;
     default:
         abort();
@@ -416,7 +416,7 @@ VncInfo *qmp_query_vnc(Error **errp)
         case SOCKET_ADDRESS_TYPE_VSOCK:
         case SOCKET_ADDRESS_TYPE_FD:
             error_setg(errp, "Unsupported socket address type %s",
-                       SocketAddressType_lookup[addr->type]);
+                       SocketAddressType_str(addr->type));
             goto out_error;
         default:
             abort();
@@ -1839,7 +1839,7 @@ static void vnc_release_modifiers(VncState *vs)
 
 static const char *code2name(int keycode)
 {
-    return QKeyCode_lookup[qemu_input_key_number_to_qcode(keycode)];
+    return QKeyCode_str(qemu_input_key_number_to_qcode(keycode));
 }
 
 static void key_event(VncState *vs, int down, uint32_t sym)
diff --git a/vl.c b/vl.c
index 8e247cc..0b45e1b 100644
--- a/vl.c
+++ b/vl.c
@@ -688,7 +688,7 @@ bool runstate_check(RunState state)
 
 bool runstate_store(char *str, size_t size)
 {
-    const char *state = RunState_lookup[current_run_state];
+    const char *state = RunState_str(current_run_state);
     size_t len = strlen(state) + 1;
 
     if (len > size) {
@@ -721,8 +721,8 @@ void runstate_set(RunState new_state)
 
     if (!runstate_valid_transitions[current_run_state][new_state]) {
         error_report("invalid runstate transition: '%s' -> '%s'",
-                     RunState_lookup[current_run_state],
-                     RunState_lookup[new_state]);
+                     RunState_str(current_run_state),
+                     RunState_str(new_state));
         abort();
     }
     trace_runstate_set(new_state);
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 14/16] qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup()
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (12 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 13/16] qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24 12:02   ` Marc-André Lureau
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO Markus Armbruster
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/core/qdev-properties.c | 7 +++++--
 qapi/qapi-visit-core.c    | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 078fc5d..7512bd4 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -72,7 +72,9 @@ static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque,
 
 static void set_default_value_enum(Object *obj, const Property *prop)
 {
-    object_property_set_str(obj, prop->info->enum_table[prop->defval.i],
+    object_property_set_str(obj,
+                            qapi_enum_lookup(prop->info->enum_table,
+                                             prop->defval.i),
                             prop->name, &error_abort);
 }
 
@@ -1095,7 +1097,8 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value)
     Property *prop;
 
     prop = qdev_prop_find(dev, name);
-    object_property_set_str(OBJECT(dev), prop->info->enum_table[value],
+    object_property_set_str(OBJECT(dev),
+                            qapi_enum_lookup(prop->info->enum_table, value),
                             name, &error_abort);
 }
 
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index f285879..30dc85b 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -345,7 +345,7 @@ static void output_type_enum(Visitor *v, const char *name, int *obj,
         return;
     }
 
-    enum_str = (char *)strings[value];
+    enum_str = (char *)qapi_enum_lookup(strings, value);
     visit_type_str(v, name, &enum_str, errp);
 }
 
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (13 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 14/16] qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup() Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24  9:55   ` Markus Armbruster
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 16/16] qapi: drop the sentinel in enum array Markus Armbruster
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Currently, a FOO_lookup is an array of strings terminated by a NULL
sentinel.

A future patch will generate enums with "holes".  NULL-termination
will cease to work then.

To prepare for that, store the length in the FOO_lookup by wrapping it
in a struct and adding a member for the length.

The sentinel will be dropped next.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170822132255.23945-13-marcandre.lureau@redhat.com>
[Basically redone]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 backends/hostmem.c                 |  2 +-
 block.c                            |  2 +-
 block/blkdebug.c                   |  4 ++--
 block/file-posix.c                 |  8 +++++---
 block/gluster.c                    |  4 ++--
 block/parallels.c                  | 14 ++++++++------
 block/qcow2.c                      |  4 ++--
 block/quorum.c                     |  2 +-
 blockdev.c                         |  2 +-
 crypto/block-luks.c                |  8 ++++----
 crypto/secret.c                    |  2 +-
 crypto/tlscreds.c                  |  2 +-
 hmp.c                              |  6 +++---
 hw/core/qdev-properties.c          | 10 +++++-----
 include/hw/qdev-core.h             |  2 +-
 include/qapi/util.h                |  9 +++++++--
 include/qapi/visitor.h             |  2 +-
 include/qom/object.h               |  4 ++--
 migration/global_state.c           |  2 +-
 net/filter.c                       |  2 +-
 qapi/qapi-util.c                   | 12 ++++++------
 qapi/qapi-visit-core.c             | 24 +++++++++++++-----------
 qemu-img.c                         |  2 +-
 qemu-nbd.c                         |  2 +-
 qom/object.c                       | 16 ++++++++--------
 scripts/qapi-visit.py              |  2 +-
 scripts/qapi.py                    | 13 ++++++++-----
 tests/check-qom-proplist.c         | 15 +++++++++------
 tests/test-qapi-util.c             | 10 +++++-----
 tests/test-qobject-input-visitor.c |  2 +-
 tpm.c                              |  2 +-
 31 files changed, 104 insertions(+), 87 deletions(-)

diff --git a/backends/hostmem.c b/backends/hostmem.c
index 06e8898..217cff6 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -395,7 +395,7 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)
         host_memory_backend_set_host_nodes,
         NULL, NULL, &error_abort);
     object_class_property_add_enum(oc, "policy", "HostMemPolicy",
-        HostMemPolicy_lookup,
+        &HostMemPolicy_lookup,
         host_memory_backend_get_policy,
         host_memory_backend_set_policy, &error_abort);
     object_class_property_add_str(oc, "id", get_id, set_id, &error_abort);
diff --git a/block.c b/block.c
index 2d12131..3bd1eb8 100644
--- a/block.c
+++ b/block.c
@@ -1332,7 +1332,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file,
     detect_zeroes = qemu_opt_get(opts, "detect-zeroes");
     if (detect_zeroes) {
         BlockdevDetectZeroesOptions value =
-            qapi_enum_parse(BlockdevDetectZeroesOptions_lookup,
+            qapi_enum_parse(&BlockdevDetectZeroesOptions_lookup,
                             detect_zeroes,
                             BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF,
                             &local_err);
diff --git a/block/blkdebug.c b/block/blkdebug.c
index b370fce..8e385ac 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -169,7 +169,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
         error_setg(errp, "Missing event name for rule");
         return -1;
     }
-    event = qapi_enum_parse(BlkdebugEvent_lookup, event_name, -1, errp);
+    event = qapi_enum_parse(&BlkdebugEvent_lookup, event_name, -1, errp);
     if (event < 0) {
         return -1;
     }
@@ -732,7 +732,7 @@ static int blkdebug_debug_breakpoint(BlockDriverState *bs, const char *event,
     struct BlkdebugRule *rule;
     int blkdebug_event;
 
-    blkdebug_event = qapi_enum_parse(BlkdebugEvent_lookup, event, -1, NULL);
+    blkdebug_event = qapi_enum_parse(&BlkdebugEvent_lookup, event, -1, NULL);
     if (blkdebug_event < 0) {
         return -ENOENT;
     }
diff --git a/block/file-posix.c b/block/file-posix.c
index bfef91d..6acbd56 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -437,7 +437,8 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
     aio_default = (bdrv_flags & BDRV_O_NATIVE_AIO)
                   ? BLOCKDEV_AIO_OPTIONS_NATIVE
                   : BLOCKDEV_AIO_OPTIONS_THREADS;
-    aio = qapi_enum_parse(BlockdevAioOptions_lookup, qemu_opt_get(opts, "aio"),
+    aio = qapi_enum_parse(&BlockdevAioOptions_lookup,
+                          qemu_opt_get(opts, "aio"),
                           aio_default, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
@@ -446,7 +447,8 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
     }
     s->use_linux_aio = (aio == BLOCKDEV_AIO_OPTIONS_NATIVE);
 
-    locking = qapi_enum_parse(OnOffAuto_lookup, qemu_opt_get(opts, "locking"),
+    locking = qapi_enum_parse(&OnOffAuto_lookup,
+                              qemu_opt_get(opts, "locking"),
                               ON_OFF_AUTO_AUTO, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
@@ -1973,7 +1975,7 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
                           BDRV_SECTOR_SIZE);
     nocow = qemu_opt_get_bool(opts, BLOCK_OPT_NOCOW, false);
     buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
-    prealloc = qapi_enum_parse(PreallocMode_lookup, buf,
+    prealloc = qapi_enum_parse(&PreallocMode_lookup, buf,
                                PREALLOC_MODE_OFF, &local_err);
     g_free(buf);
     if (local_err) {
diff --git a/block/gluster.c b/block/gluster.c
index 29f9427..0f4265a 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -543,7 +543,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
         if (!strcmp(ptr, "tcp")) {
             ptr = "inet";       /* accept legacy "tcp" */
         }
-        type = qapi_enum_parse(SocketAddressType_lookup, ptr, -1, NULL);
+        type = qapi_enum_parse(&SocketAddressType_lookup, ptr, -1, NULL);
         if (type != SOCKET_ADDRESS_TYPE_INET
             && type != SOCKET_ADDRESS_TYPE_UNIX) {
             error_setg(&local_err,
@@ -1000,7 +1000,7 @@ static int qemu_gluster_create(const char *filename,
                           BDRV_SECTOR_SIZE);
 
     tmp = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
-    prealloc = qapi_enum_parse(PreallocMode_lookup, tmp, PREALLOC_MODE_OFF,
+    prealloc = qapi_enum_parse(&PreallocMode_lookup, tmp, PREALLOC_MODE_OFF,
                                &local_err);
     g_free(tmp);
     if (local_err) {
diff --git a/block/parallels.c b/block/parallels.c
index d812210..cce7336 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -68,13 +68,15 @@ typedef enum ParallelsPreallocMode {
     PRL_PREALLOC_MODE__MAX = 2,
 } ParallelsPreallocMode;
 
-static const char *prealloc_mode_lookup[] = {
-    "falloc",
-    "truncate",
-    NULL,
+static QEnumLookup prealloc_mode_lookup = {
+    .array = (const char *const[]) {
+        "falloc",
+        "truncate",
+        NULL,
+    },
+    .size = PRL_PREALLOC_MODE__MAX
 };
 
-
 typedef struct BDRVParallelsState {
     /** Locking is conservative, the lock protects
      *   - image file extending (truncate, fallocate)
@@ -695,7 +697,7 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
         qemu_opt_get_size_del(opts, PARALLELS_OPT_PREALLOC_SIZE, 0);
     s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS);
     buf = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE);
-    s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, buf,
+    s->prealloc_mode = qapi_enum_parse(&prealloc_mode_lookup, buf,
                                        PRL_PREALLOC_MODE_FALLOCATE,
                                        &local_err);
     g_free(buf);
diff --git a/block/qcow2.c b/block/qcow2.c
index eb7c154..0841b7c 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2931,7 +2931,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)
         goto finish;
     }
     buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
-    prealloc = qapi_enum_parse(PreallocMode_lookup, buf,
+    prealloc = qapi_enum_parse(&PreallocMode_lookup, buf,
                                PREALLOC_MODE_OFF, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
@@ -3621,7 +3621,7 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
     }
 
     optstr = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
-    prealloc = qapi_enum_parse(PreallocMode_lookup, optstr,
+    prealloc = qapi_enum_parse(&PreallocMode_lookup, optstr,
                                PREALLOC_MODE_OFF, &local_err);
     g_free(optstr);
     if (local_err) {
diff --git a/block/quorum.c b/block/quorum.c
index 8d1c9f6..272f9a5 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -912,7 +912,7 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
     if (!pattern_str) {
         ret = QUORUM_READ_PATTERN_QUORUM;
     } else {
-        ret = qapi_enum_parse(QuorumReadPattern_lookup, pattern_str,
+        ret = qapi_enum_parse(&QuorumReadPattern_lookup, pattern_str,
                               -EINVAL, NULL);
     }
     if (ret < 0) {
diff --git a/blockdev.c b/blockdev.c
index bfb2a95..796beae 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -437,7 +437,7 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
 
     if (detect_zeroes) {
         *detect_zeroes =
-            qapi_enum_parse(BlockdevDetectZeroesOptions_lookup,
+            qapi_enum_parse(&BlockdevDetectZeroesOptions_lookup,
                             qemu_opt_get(opts, "detect-zeroes"),
                             BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF,
                             &local_error);
diff --git a/crypto/block-luks.c b/crypto/block-luks.c
index 4e82895..36bc856 100644
--- a/crypto/block-luks.c
+++ b/crypto/block-luks.c
@@ -264,7 +264,7 @@ qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg,
 /* XXX replace with qapi_enum_parse() in future, when we can
  * make that function emit a more friendly error message */
 static int qcrypto_block_luks_name_lookup(const char *name,
-                                          const char *const *map,
+                                          const QEnumLookup *map,
                                           const char *type,
                                           Error **errp)
 {
@@ -279,19 +279,19 @@ static int qcrypto_block_luks_name_lookup(const char *name,
 
 #define qcrypto_block_luks_cipher_mode_lookup(name, errp)               \
     qcrypto_block_luks_name_lookup(name,                                \
-                                   QCryptoCipherMode_lookup,            \
+                                   &QCryptoCipherMode_lookup,           \
                                    "Cipher mode",                       \
                                    errp)
 
 #define qcrypto_block_luks_hash_name_lookup(name, errp)                 \
     qcrypto_block_luks_name_lookup(name,                                \
-                                   QCryptoHashAlgorithm_lookup,         \
+                                   &QCryptoHashAlgorithm_lookup,        \
                                    "Hash algorithm",                    \
                                    errp)
 
 #define qcrypto_block_luks_ivgen_name_lookup(name, errp)                \
     qcrypto_block_luks_name_lookup(name,                                \
-                                   QCryptoIVGenAlgorithm_lookup,        \
+                                   &QCryptoIVGenAlgorithm_lookup,       \
                                    "IV generator",                      \
                                    errp)
 
diff --git a/crypto/secret.c b/crypto/secret.c
index 285ab7a..388abd7 100644
--- a/crypto/secret.c
+++ b/crypto/secret.c
@@ -378,7 +378,7 @@ qcrypto_secret_class_init(ObjectClass *oc, void *data)
                                    NULL);
     object_class_property_add_enum(oc, "format",
                                    "QCryptoSecretFormat",
-                                   QCryptoSecretFormat_lookup,
+                                   &QCryptoSecretFormat_lookup,
                                    qcrypto_secret_prop_get_format,
                                    qcrypto_secret_prop_set_format,
                                    NULL);
diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
index a896553..3cd4103 100644
--- a/crypto/tlscreds.c
+++ b/crypto/tlscreds.c
@@ -233,7 +233,7 @@ qcrypto_tls_creds_class_init(ObjectClass *oc, void *data)
                                   NULL);
     object_class_property_add_enum(oc, "endpoint",
                                    "QCryptoTLSCredsEndpoint",
-                                   QCryptoTLSCredsEndpoint_lookup,
+                                   &QCryptoTLSCredsEndpoint_lookup,
                                    qcrypto_tls_creds_prop_get_endpoint,
                                    qcrypto_tls_creds_prop_set_endpoint,
                                    NULL);
diff --git a/hmp.c b/hmp.c
index 30819fe..cd046c6 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1528,7 +1528,7 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
     MigrationCapabilityStatusList *caps = g_malloc0(sizeof(*caps));
     int val;
 
-    val = qapi_enum_parse(MigrationCapability_lookup, cap, -1, &err);
+    val = qapi_enum_parse(&MigrationCapability_lookup, cap, -1, &err);
     if (val < 0) {
         goto end;
     }
@@ -1557,7 +1557,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
     Error *err = NULL;
     int val, ret;
 
-    val = qapi_enum_parse(MigrationParameter_lookup, param, -1, &err);
+    val = qapi_enum_parse(&MigrationParameter_lookup, param, -1, &err);
     if (val < 0) {
         goto cleanup;
     }
@@ -1735,7 +1735,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
     } else {
         if (read_only) {
             read_only_mode =
-                qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup,
+                qapi_enum_parse(&BlockdevChangeReadOnlyMode_lookup,
                                 read_only,
                                 BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err);
             if (err) {
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 7512bd4..1dc80fc 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -587,7 +587,7 @@ const PropertyInfo qdev_prop_macaddr = {
 const PropertyInfo qdev_prop_on_off_auto = {
     .name = "OnOffAuto",
     .description = "on/off/auto",
-    .enum_table = OnOffAuto_lookup,
+    .enum_table = &OnOffAuto_lookup,
     .get = get_enum,
     .set = set_enum,
     .set_default_value = set_default_value_enum,
@@ -599,7 +599,7 @@ QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) != sizeof(int));
 
 const PropertyInfo qdev_prop_losttickpolicy = {
     .name  = "LostTickPolicy",
-    .enum_table  = LostTickPolicy_lookup,
+    .enum_table  = &LostTickPolicy_lookup,
     .get   = get_enum,
     .set   = set_enum,
     .set_default_value = set_default_value_enum,
@@ -613,7 +613,7 @@ const PropertyInfo qdev_prop_blockdev_on_error = {
     .name = "BlockdevOnError",
     .description = "Error handling policy, "
                    "report/ignore/enospc/stop/auto",
-    .enum_table = BlockdevOnError_lookup,
+    .enum_table = &BlockdevOnError_lookup,
     .get = get_enum,
     .set = set_enum,
     .set_default_value = set_default_value_enum,
@@ -627,7 +627,7 @@ const PropertyInfo qdev_prop_bios_chs_trans = {
     .name = "BiosAtaTranslation",
     .description = "Logical CHS translation algorithm, "
                    "auto/none/lba/large/rechs",
-    .enum_table = BiosAtaTranslation_lookup,
+    .enum_table = &BiosAtaTranslation_lookup,
     .get = get_enum,
     .set = set_enum,
     .set_default_value = set_default_value_enum,
@@ -639,7 +639,7 @@ const PropertyInfo qdev_prop_fdc_drive_type = {
     .name = "FdcDriveType",
     .description = "FDC drive type, "
                    "144/288/120/none/auto",
-    .enum_table = FloppyDriveType_lookup,
+    .enum_table = &FloppyDriveType_lookup,
     .get = get_enum,
     .set = set_enum,
     .set_default_value = set_default_value_enum,
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index ae31728..0891461 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -249,7 +249,7 @@ struct Property {
 struct PropertyInfo {
     const char *name;
     const char *description;
-    const char * const *enum_table;
+    const QEnumLookup *enum_table;
     int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
     void (*set_default_value)(Object *obj, const Property *prop);
     void (*create)(Object *obj, Property *prop, Error **errp);
diff --git a/include/qapi/util.h b/include/qapi/util.h
index 5e50d0c..a7c3c64 100644
--- a/include/qapi/util.h
+++ b/include/qapi/util.h
@@ -11,8 +11,13 @@
 #ifndef QAPI_UTIL_H
 #define QAPI_UTIL_H
 
-const char *qapi_enum_lookup(const char *const lookup[], int val);
-int qapi_enum_parse(const char * const lookup[], const char *buf,
+typedef struct QEnumLookup {
+    const char *const *array;
+    int size;
+} QEnumLookup;
+
+const char *qapi_enum_lookup(const QEnumLookup *lookup, int val);
+int qapi_enum_parse(const QEnumLookup *lookup, const char *buf,
                     int def, Error **errp);
 
 int parse_qapi_name(const char *name, bool complete);
diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
index 0f3b8cb..62a51a5 100644
--- a/include/qapi/visitor.h
+++ b/include/qapi/visitor.h
@@ -469,7 +469,7 @@ bool visit_optional(Visitor *v, const char *name, bool *present);
  * that visit_type_str() must have no unwelcome side effects.
  */
 void visit_type_enum(Visitor *v, const char *name, int *obj,
-                     const char *const strings[], Error **errp);
+                     const QEnumLookup *lookup, Error **errp);
 
 /*
  * Check if visitor is an input visitor.
diff --git a/include/qom/object.h b/include/qom/object.h
index 1b82899..f3e5cff 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1415,14 +1415,14 @@ void object_class_property_add_bool(ObjectClass *klass, const char *name,
  */
 void object_property_add_enum(Object *obj, const char *name,
                               const char *typename,
-                              const char * const *strings,
+                              const QEnumLookup *lookup,
                               int (*get)(Object *, Error **),
                               void (*set)(Object *, int, Error **),
                               Error **errp);
 
 void object_class_property_add_enum(ObjectClass *klass, const char *name,
                                     const char *typename,
-                                    const char * const *strings,
+                                    const QEnumLookup *lookup,
                                     int (*get)(Object *, Error **),
                                     void (*set)(Object *, int, Error **),
                                     Error **errp);
diff --git a/migration/global_state.c b/migration/global_state.c
index 8db2f19..dfdaf63 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -88,7 +88,7 @@ static int global_state_post_load(void *opaque, int version_id)
     s->received = true;
     trace_migrate_global_state_post_load(runstate);
 
-    r = qapi_enum_parse(RunState_lookup, runstate, -1, &local_err);
+    r = qapi_enum_parse(&RunState_lookup, runstate, -1, &local_err);
 
     if (r == -1) {
         if (local_err) {
diff --git a/net/filter.c b/net/filter.c
index 1dfd2ca..2fd7d7d 100644
--- a/net/filter.c
+++ b/net/filter.c
@@ -179,7 +179,7 @@ static void netfilter_init(Object *obj)
                             netfilter_get_netdev_id, netfilter_set_netdev_id,
                             NULL);
     object_property_add_enum(obj, "queue", "NetFilterDirection",
-                             NetFilterDirection_lookup,
+                             &NetFilterDirection_lookup,
                              netfilter_get_direction, netfilter_set_direction,
                              NULL);
     object_property_add_str(obj, "status",
diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
index 7af2f04..e9b266b 100644
--- a/qapi/qapi-util.c
+++ b/qapi/qapi-util.c
@@ -14,14 +14,14 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 
-const char *qapi_enum_lookup(const char *const lookup[], int val)
+const char *qapi_enum_lookup(const QEnumLookup *lookup, int val)
 {
-    assert(val >= 0);
+    assert(val >= 0 && val < lookup->size);
 
-    return lookup[val];
+    return lookup->array[val];
 }
 
-int qapi_enum_parse(const char * const lookup[], const char *buf,
+int qapi_enum_parse(const QEnumLookup *lookup, const char *buf,
                     int def, Error **errp)
 {
     int i;
@@ -30,8 +30,8 @@ int qapi_enum_parse(const char * const lookup[], const char *buf,
         return def;
     }
 
-    for (i = 0; lookup[i]; i++) {
-        if (!strcmp(buf, lookup[i])) {
+    for (i = 0; i < lookup->size; i++) {
+        if (!strcmp(buf, lookup->array[i])) {
             return i;
         }
     }
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index 30dc85b..3dcb968 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -333,24 +333,26 @@ void visit_type_null(Visitor *v, const char *name, QNull **obj,
 }
 
 static void output_type_enum(Visitor *v, const char *name, int *obj,
-                             const char *const strings[], Error **errp)
+                             const QEnumLookup *lookup, Error **errp)
 {
-    int i = 0;
     int value = *obj;
     char *enum_str;
 
-    while (strings[i++] != NULL);
-    if (value < 0 || value >= i - 1) {
+    /*
+     * TODO why is this an error, not an assertion?  If assertion:
+     * delete, and rely on qapi_enum_lookup()
+     */
+    if (value < 0 || value >= lookup->size) {
         error_setg(errp, QERR_INVALID_PARAMETER, name ? name : "null");
         return;
     }
 
-    enum_str = (char *)qapi_enum_lookup(strings, value);
+    enum_str = (char *)qapi_enum_lookup(lookup, value);
     visit_type_str(v, name, &enum_str, errp);
 }
 
 static void input_type_enum(Visitor *v, const char *name, int *obj,
-                            const char *const strings[], Error **errp)
+                            const QEnumLookup *lookup, Error **errp)
 {
     Error *local_err = NULL;
     int64_t value;
@@ -362,7 +364,7 @@ static void input_type_enum(Visitor *v, const char *name, int *obj,
         return;
     }
 
-    value = qapi_enum_parse(strings, enum_str, -1, NULL);
+    value = qapi_enum_parse(lookup, enum_str, -1, NULL);
     if (value < 0) {
         error_setg(errp, QERR_INVALID_PARAMETER, enum_str);
         g_free(enum_str);
@@ -374,16 +376,16 @@ static void input_type_enum(Visitor *v, const char *name, int *obj,
 }
 
 void visit_type_enum(Visitor *v, const char *name, int *obj,
-                     const char *const strings[], Error **errp)
+                     const QEnumLookup *lookup, Error **errp)
 {
-    assert(obj && strings);
+    assert(obj && lookup);
     trace_visit_type_enum(v, name, obj);
     switch (v->type) {
     case VISITOR_INPUT:
-        input_type_enum(v, name, obj, strings, errp);
+        input_type_enum(v, name, obj, lookup, errp);
         break;
     case VISITOR_OUTPUT:
-        output_type_enum(v, name, obj, strings, errp);
+        output_type_enum(v, name, obj, lookup, errp);
         break;
     case VISITOR_CLONE:
         /* nothing further to do, scalar value was already copied by
diff --git a/qemu-img.c b/qemu-img.c
index a72a2e3..df984b1 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3489,7 +3489,7 @@ static int img_resize(int argc, char **argv)
             image_opts = true;
             break;
         case OPTION_PREALLOCATION:
-            prealloc = qapi_enum_parse(PreallocMode_lookup, optarg,
+            prealloc = qapi_enum_parse(&PreallocMode_lookup, optarg,
                                        PREALLOC_MODE__MAX, NULL);
             if (prealloc == PREALLOC_MODE__MAX) {
                 error_report("Invalid preallocation mode '%s'", optarg);
diff --git a/qemu-nbd.c b/qemu-nbd.c
index a97f3f4..d75ca51 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -638,7 +638,7 @@ int main(int argc, char **argv)
             break;
         case QEMU_NBD_OPT_DETECT_ZEROES:
             detect_zeroes =
-                qapi_enum_parse(BlockdevDetectZeroesOptions_lookup,
+                qapi_enum_parse(&BlockdevDetectZeroesOptions_lookup,
                                 optarg,
                                 BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF,
                                 &local_err);
diff --git a/qom/object.c b/qom/object.c
index fe6e744..3e18537 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1246,7 +1246,7 @@ uint64_t object_property_get_uint(Object *obj, const char *name,
 }
 
 typedef struct EnumProperty {
-    const char * const *strings;
+    const QEnumLookup *lookup;
     int (*get)(Object *, Error **);
     void (*set)(Object *, int, Error **);
 } EnumProperty;
@@ -1284,7 +1284,7 @@ int object_property_get_enum(Object *obj, const char *name,
     visit_complete(v, &str);
     visit_free(v);
     v = string_input_visitor_new(str);
-    visit_type_enum(v, name, &ret, enumprop->strings, errp);
+    visit_type_enum(v, name, &ret, enumprop->lookup, errp);
 
     g_free(str);
     visit_free(v);
@@ -1950,7 +1950,7 @@ static void property_get_enum(Object *obj, Visitor *v, const char *name,
         return;
     }
 
-    visit_type_enum(v, name, &value, prop->strings, errp);
+    visit_type_enum(v, name, &value, prop->lookup, errp);
 }
 
 static void property_set_enum(Object *obj, Visitor *v, const char *name,
@@ -1960,7 +1960,7 @@ static void property_set_enum(Object *obj, Visitor *v, const char *name,
     int value;
     Error *err = NULL;
 
-    visit_type_enum(v, name, &value, prop->strings, &err);
+    visit_type_enum(v, name, &value, prop->lookup, &err);
     if (err) {
         error_propagate(errp, err);
         return;
@@ -1977,7 +1977,7 @@ static void property_release_enum(Object *obj, const char *name,
 
 void object_property_add_enum(Object *obj, const char *name,
                               const char *typename,
-                              const char * const *strings,
+                              const QEnumLookup *lookup,
                               int (*get)(Object *, Error **),
                               void (*set)(Object *, int, Error **),
                               Error **errp)
@@ -1985,7 +1985,7 @@ void object_property_add_enum(Object *obj, const char *name,
     Error *local_err = NULL;
     EnumProperty *prop = g_malloc(sizeof(*prop));
 
-    prop->strings = strings;
+    prop->lookup = lookup;
     prop->get = get;
     prop->set = set;
 
@@ -2002,7 +2002,7 @@ void object_property_add_enum(Object *obj, const char *name,
 
 void object_class_property_add_enum(ObjectClass *klass, const char *name,
                                     const char *typename,
-                                    const char * const *strings,
+                                    const QEnumLookup *lookup,
                                     int (*get)(Object *, Error **),
                                     void (*set)(Object *, int, Error **),
                                     Error **errp)
@@ -2010,7 +2010,7 @@ void object_class_property_add_enum(ObjectClass *klass, const char *name,
     Error *local_err = NULL;
     EnumProperty *prop = g_malloc(sizeof(*prop));
 
-    prop->strings = strings;
+    prop->lookup = lookup;
     prop->get = get;
     prop->set = set;
 
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index bd0b742..7e1cfc1 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -153,7 +153,7 @@ def gen_visit_enum(name):
 void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s *obj, Error **errp)
 {
     int value = *obj;
-    visit_type_enum(v, name, &value, %(c_name)s_lookup, errp);
+    visit_type_enum(v, name, &value, &%(c_name)s_lookup, errp);
     *obj = value;
 }
 ''',
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 1cd713d..61be538 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1849,19 +1849,22 @@ def guardend(name):
 def gen_enum_lookup(name, values, prefix=None):
     ret = mcgen('''
 
-const char *const %(c_name)s_lookup[] = {
+const QEnumLookup %(c_name)s_lookup = {
+    .array = (const char *const[]) {
 ''',
                 c_name=c_name(name))
     for value in values:
         index = c_enum_const(name, value, prefix)
         ret += mcgen('''
-    [%(index)s] = "%(value)s",
+        [%(index)s] = "%(value)s",
 ''',
                      index=index, value=value)
 
     max_index = c_enum_const(name, '_MAX', prefix)
     ret += mcgen('''
-    [%(max_index)s] = NULL,
+        [%(max_index)s] = NULL,
+    },
+    .size = %(max_index)s
 };
 ''',
                  max_index=max_index)
@@ -1895,9 +1898,9 @@ typedef enum %(c_name)s {
     ret += mcgen('''
 
 #define %(c_name)s_str(val) \\
-    qapi_enum_lookup(%(c_name)s_lookup, (val))
+    qapi_enum_lookup(&%(c_name)s_lookup, (val))
 
-extern const char *const %(c_name)s_lookup[];
+extern const QEnumLookup %(c_name)s_lookup;
 ''',
                  c_name=c_name(name))
     return ret
diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
index c51e6e7..07e351f 100644
--- a/tests/check-qom-proplist.c
+++ b/tests/check-qom-proplist.c
@@ -46,11 +46,14 @@ enum DummyAnimal {
     DUMMY_LAST,
 };
 
-static const char *const dummy_animal_map[DUMMY_LAST + 1] = {
-    [DUMMY_FROG] = "frog",
-    [DUMMY_ALLIGATOR] = "alligator",
-    [DUMMY_PLATYPUS] = "platypus",
-    [DUMMY_LAST] = NULL,
+const QEnumLookup dummy_animal_map = {
+    .array = (const char *const[]) {
+        [DUMMY_FROG] = "frog",
+        [DUMMY_ALLIGATOR] = "alligator",
+        [DUMMY_PLATYPUS] = "platypus",
+        [DUMMY_LAST] = NULL,
+    },
+    .size = DUMMY_LAST
 };
 
 struct DummyObject {
@@ -142,7 +145,7 @@ static void dummy_class_init(ObjectClass *cls, void *data)
                                   NULL);
     object_class_property_add_enum(cls, "av",
                                    "DummyAnimal",
-                                   dummy_animal_map,
+                                   &dummy_animal_map,
                                    dummy_get_av,
                                    dummy_set_av,
                                    NULL);
diff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c
index 0992bdb..4b5e4f8 100644
--- a/tests/test-qapi-util.c
+++ b/tests/test-qapi-util.c
@@ -19,19 +19,19 @@ static void test_qapi_enum_parse(void)
     Error *err = NULL;
     int ret;
 
-    ret = qapi_enum_parse(QType_lookup, NULL, QTYPE_NONE, &error_abort);
+    ret = qapi_enum_parse(&QType_lookup, NULL, QTYPE_NONE, &error_abort);
     g_assert_cmpint(ret, ==, QTYPE_NONE);
 
-    ret = qapi_enum_parse(QType_lookup, "junk", -1, NULL);
+    ret = qapi_enum_parse(&QType_lookup, "junk", -1, NULL);
     g_assert_cmpint(ret, ==, -1);
 
-    ret = qapi_enum_parse(QType_lookup, "junk", -1, &err);
+    ret = qapi_enum_parse(&QType_lookup, "junk", -1, &err);
     error_free_or_abort(&err);
 
-    ret = qapi_enum_parse(QType_lookup, "none", -1, &error_abort);
+    ret = qapi_enum_parse(&QType_lookup, "none", -1, &error_abort);
     g_assert_cmpint(ret, ==, QTYPE_NONE);
 
-    ret = qapi_enum_parse(QType_lookup, QType_str(QTYPE__MAX - 1),
+    ret = qapi_enum_parse(&QType_lookup, QType_str(QTYPE__MAX - 1),
                           QTYPE__MAX - 1, &error_abort);
     g_assert_cmpint(ret, ==, QTYPE__MAX - 1);
 }
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index f8720aa..fe59181 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -1110,7 +1110,7 @@ static void test_visitor_in_fail_struct_missing(TestInputVisitorData *data,
     error_free_or_abort(&err);
     visit_optional(v, "optional", &present);
     g_assert(!present);
-    visit_type_enum(v, "enum", &en, EnumOne_lookup, &err);
+    visit_type_enum(v, "enum", &en, &EnumOne_lookup, &err);
     error_free_or_abort(&err);
     visit_type_int(v, "i64", &i64, &err);
     error_free_or_abort(&err);
diff --git a/tpm.c b/tpm.c
index 111f1ca..2d830d0 100644
--- a/tpm.c
+++ b/tpm.c
@@ -33,7 +33,7 @@ void tpm_register_model(enum TpmModel model)
 
 const TPMDriverOps *tpm_get_backend_driver(const char *type)
 {
-    int i = qapi_enum_parse(TpmType_lookup, type, -1, NULL);
+    int i = qapi_enum_parse(&TpmType_lookup, type, -1, NULL);
 
     return i >= 0 ? be_drivers[i] : NULL;
 }
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Qemu-devel] [PATCH 16/16] qapi: drop the sentinel in enum array
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (14 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO Markus Armbruster
@ 2017-08-24  8:46 ` Markus Armbruster
  2017-08-24  9:22 ` [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string no-reply
  2017-09-01 12:43 ` Markus Armbruster
  17 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  8:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Now that all usages have been converted to user lookup helpers.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170822132255.23945-14-marcandre.lureau@redhat.com>
[Rebased, superfluous local variable dropped, missing
check-qom-proplist.c update added]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block/parallels.c          | 1 -
 scripts/qapi.py            | 4 +---
 tests/check-qom-proplist.c | 1 -
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/block/parallels.c b/block/parallels.c
index cce7336..2b6c6e5 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -72,7 +72,6 @@ static QEnumLookup prealloc_mode_lookup = {
     .array = (const char *const[]) {
         "falloc",
         "truncate",
-        NULL,
     },
     .size = PRL_PREALLOC_MODE__MAX
 };
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 61be538..a0993ee 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1860,14 +1860,12 @@ const QEnumLookup %(c_name)s_lookup = {
 ''',
                      index=index, value=value)
 
-    max_index = c_enum_const(name, '_MAX', prefix)
     ret += mcgen('''
-        [%(max_index)s] = NULL,
     },
     .size = %(max_index)s
 };
 ''',
-                 max_index=max_index)
+                 max_index=c_enum_const(name, '_MAX', prefix))
     return ret
 
 
diff --git a/tests/check-qom-proplist.c b/tests/check-qom-proplist.c
index 07e351f..92898e1 100644
--- a/tests/check-qom-proplist.c
+++ b/tests/check-qom-proplist.c
@@ -51,7 +51,6 @@ const QEnumLookup dummy_animal_map = {
         [DUMMY_FROG] = "frog",
         [DUMMY_ALLIGATOR] = "alligator",
         [DUMMY_PLATYPUS] = "platypus",
-        [DUMMY_LAST] = NULL,
     },
     .size = DUMMY_LAST
 };
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (15 preceding siblings ...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 16/16] qapi: drop the sentinel in enum array Markus Armbruster
@ 2017-08-24  9:22 ` no-reply
  2017-09-01 12:43 ` Markus Armbruster
  17 siblings, 0 replies; 37+ messages in thread
From: no-reply @ 2017-08-24  9:22 UTC (permalink / raw)
  To: armbru; +Cc: famz, qemu-devel, marcandre.lureau, mdroth

Hi,

This series failed automatic build test. Please find the testing commands and
their output below. If you have docker installed, you can probably reproduce it
locally.

Type: series
Message-id: 1503564371-26090-1-git-send-email-armbru@redhat.com
Subject: [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-quick@centos6
time make docker-test-build@min-glib
time make docker-test-mingw@fedora
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/1503564371-26090-1-git-send-email-armbru@redhat.com -> patchew/1503564371-26090-1-git-send-email-armbru@redhat.com
Switched to a new branch 'test'
32f9a1c785 qapi: drop the sentinel in enum array
c49ce76547 qapi: Change data type of the FOO_lookup generated for enum FOO
b98ed3882b qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup()
d5853f22a6 qapi: Mechanically convert FOO_lookup[...] to FOO_str(...)
6bd76935ec qapi: Generate FOO_str() macro for QAPI enum FOO
7e9ef1fa76 qapi: Avoid unnecessary use of enum lookup table's sentinel
c5bc76b7d7 qapi: Use qapi_enum_parse() in input_type_enum()
b9e2f91a8b crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup()
3734dffc61 quorum: Use qapi_enum_parse() in quorum_open()
d85fbdaea6 block: Use qemu_enum_parse() in blkdebug_debug_breakpoint()
2ea0560f92 hmp: Use qapi_enum_parse() in hmp_migrate_set_parameter()
b46a48a744 hmp: Use qapi_enum_parse() in hmp_migrate_set_capability()
d3c6fefe0f tpm: Clean up model registration & lookup
c91b7612f2 tpm: Clean up driver registration & lookup
d6dcd6e383 qapi: Drop superfluous qapi_enum_parse() parameter max
e792d5c1ad qapi: Update qapi-code-gen.txt examples to match current code

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into '/var/tmp/patchew-tester-tmp-lk2eywix/src/dtc'...
Submodule path 'dtc': checked out '558cd81bdd432769b59bff01240c44f82cfb1a9d'
  BUILD   centos6
make[1]: Entering directory '/var/tmp/patchew-tester-tmp-lk2eywix/src'
  ARCHIVE qemu.tgz
  ARCHIVE dtc.tgz
  COPY    RUNNER
    RUN test-quick in qemu:centos6 
Packages installed:
SDL-devel-1.2.14-7.el6_7.1.x86_64
bison-2.4.1-5.el6.x86_64
bzip2-devel-1.0.5-7.el6_0.x86_64
ccache-3.1.6-2.el6.x86_64
csnappy-devel-0-6.20150729gitd7bc683.el6.x86_64
flex-2.5.35-9.el6.x86_64
gcc-4.4.7-18.el6.x86_64
git-1.7.1-8.el6.x86_64
glib2-devel-2.28.8-9.el6.x86_64
libepoxy-devel-1.2-3.el6.x86_64
libfdt-devel-1.4.0-1.el6.x86_64
librdmacm-devel-1.0.21-0.el6.x86_64
lzo-devel-2.03-3.1.el6_5.1.x86_64
make-3.81-23.el6.x86_64
mesa-libEGL-devel-11.0.7-4.el6.x86_64
mesa-libgbm-devel-11.0.7-4.el6.x86_64
package g++ is not installed
pixman-devel-0.32.8-1.el6.x86_64
spice-glib-devel-0.26-8.el6.x86_64
spice-server-devel-0.12.4-16.el6.x86_64
tar-1.23-15.el6_8.x86_64
vte-devel-0.25.1-9.el6.x86_64
xen-devel-4.6.3-15.el6.x86_64
zlib-devel-1.2.3-29.el6.x86_64

Environment variables:
PACKAGES=bison     bzip2-devel     ccache     csnappy-devel     flex     g++     gcc     git     glib2-devel     libepoxy-devel     libfdt-devel     librdmacm-devel     lzo-devel     make     mesa-libEGL-devel     mesa-libgbm-devel     pixman-devel     SDL-devel     spice-glib-devel     spice-server-devel     tar     vte-devel     xen-devel     zlib-devel
HOSTNAME=923e820e6953
TERM=xterm
MAKEFLAGS= -j8
HISTSIZE=1000
J=8
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
MAIL=/var/spool/mail/root
PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
LANG=en_US.UTF-8
TARGET_LIST=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
FEATURES= dtc
DEBUG=
G_BROKEN_FILENAMES=1
CCACHE_HASHDIR=
_=/usr/bin/env

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/var/tmp/qemu-build/install
No C++ compiler available; disabling C++ specific optional code
Install prefix    /var/tmp/qemu-build/install
BIOS directory    /var/tmp/qemu-build/install/share/qemu
binary directory  /var/tmp/qemu-build/install/bin
library directory /var/tmp/qemu-build/install/lib
module directory  /var/tmp/qemu-build/install/lib/qemu
libexec directory /var/tmp/qemu-build/install/libexec
include directory /var/tmp/qemu-build/install/include
config directory  /var/tmp/qemu-build/install/etc
local state directory   /var/tmp/qemu-build/install/var
Manual directory  /var/tmp/qemu-build/install/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /tmp/qemu-test/src
C compiler        cc
Host C compiler   cc
C++ compiler      
Objective-C compiler cc
ARFLAGS           rv
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g 
QEMU_CFLAGS       -I/usr/include/pixman-1   -I$(SRC_PATH)/dtc/libfdt -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -DNCURSES_WIDECHAR   -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all  -I/usr/include/libpng12   -I/usr/include/libdrm     -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/spice-1   -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4  
LDFLAGS           -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
pixman            system
SDL support       yes (1.2.14)
GTK support       yes (2.24.23)
GTK GL support    no
VTE support       yes (0.25.1)
TLS priority      NORMAL
GNUTLS support    no
GNUTLS rnd        no
libgcrypt         no
libgcrypt kdf     no
nettle            no 
nettle kdf        no
libtasn1          no
curses support    yes
virgl support     no
curl support      no
mingw32 support   no
Audio drivers     oss
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  no
VNC JPEG support  yes
VNC PNG support   yes
xen support       yes
xen ctrl version  40600
pv dom build      no
brlapi support    no
bluez  support    no
Documentation     no
PIE               yes
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
HAX support       no
TCG support       yes
TCG debug enabled no
TCG interpreter   no
RDMA support      yes
fdt support       yes
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
vhost-vsock support yes
vhost-user support yes
Trace backends    log
spice support     yes (0.12.6/0.12.4)
rbd support       no
xfsctl support    no
smartcard support yes
libusb            no
usb net redir     no
OpenGL support    yes
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no
build guest agent yes
QGA VSS support   no
QGA w32 disk info no
QGA MSI support   no
seccomp support   no
coroutine backend ucontext
coroutine pool    yes
debug stack usage no
crypto afalg      no
GlusterFS support no
gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   no
TPM passthrough   yes
QOM debugging     yes
Live block migration yes
lzo support       yes
snappy support    no
bzip2 support     yes
NUMA host support no
tcmalloc support  no
jemalloc support  no
avx2 optimization no
replication support yes
VxHS block device no
mkdir -p dtc/libfdt
mkdir -p dtc/tests
  GEN     x86_64-softmmu/config-devices.mak.tmp
  GEN     config-host.h
  GEN     aarch64-softmmu/config-devices.mak.tmp
  GEN     qmp-commands.h
  GEN     qemu-options.def
  GEN     qapi-types.h
  GEN     qapi-visit.h
  GEN     qapi-event.h
  GEN     x86_64-softmmu/config-devices.mak
  GEN     aarch64-softmmu/config-devices.mak
  GEN     qmp-marshal.c
  GEN     qapi-types.c
  GEN     qapi-visit.c
  GEN     qapi-event.c
  GEN     qmp-introspect.h
  GEN     qmp-introspect.c
  GEN     trace/generated-tcg-tracers.h
  GEN     trace/generated-helpers-wrappers.h
  GEN     trace/generated-helpers.h
  GEN     trace/generated-helpers.c
  GEN     module_block.h
  GEN     tests/test-qapi-types.h
  GEN     tests/test-qapi-visit.h
  GEN     tests/test-qmp-commands.h
  GEN     tests/test-qapi-event.h
  GEN     tests/test-qmp-introspect.h
  GEN     trace-root.h
  GEN     util/trace.h
  GEN     crypto/trace.h
  GEN     io/trace.h
  GEN     migration/trace.h
  GEN     block/trace.h
  GEN     chardev/trace.h
  GEN     hw/block/trace.h
  GEN     hw/block/dataplane/trace.h
  GEN     hw/char/trace.h
  GEN     hw/intc/trace.h
  GEN     hw/net/trace.h
  GEN     hw/virtio/trace.h
  GEN     hw/audio/trace.h
  GEN     hw/misc/trace.h
  GEN     hw/usb/trace.h
  GEN     hw/scsi/trace.h
  GEN     hw/nvram/trace.h
  GEN     hw/display/trace.h
  GEN     hw/input/trace.h
  GEN     hw/timer/trace.h
  GEN     hw/dma/trace.h
  GEN     hw/sparc/trace.h
  GEN     hw/sd/trace.h
  GEN     hw/isa/trace.h
  GEN     hw/mem/trace.h
  GEN     hw/i386/trace.h
  GEN     hw/i386/xen/trace.h
  GEN     hw/9pfs/trace.h
  GEN     hw/ppc/trace.h
  GEN     hw/pci/trace.h
  GEN     hw/s390x/trace.h
  GEN     hw/vfio/trace.h
  GEN     hw/acpi/trace.h
  GEN     hw/arm/trace.h
  GEN     hw/alpha/trace.h
  GEN     hw/xen/trace.h
  GEN     ui/trace.h
  GEN     audio/trace.h
  GEN     net/trace.h
  GEN     target/arm/trace.h
  GEN     target/i386/trace.h
  GEN     target/mips/trace.h
  GEN     target/sparc/trace.h
  GEN     target/s390x/trace.h
  GEN     target/ppc/trace.h
  GEN     qom/trace.h
  GEN     linux-user/trace.h
  GEN     qapi/trace.h
  GEN     accel/tcg/trace.h
  GEN     accel/kvm/trace.h
  GEN     nbd/trace.h
  GEN     trace-root.c
  GEN     util/trace.c
  GEN     crypto/trace.c
  GEN     io/trace.c
  GEN     migration/trace.c
  GEN     block/trace.c
  GEN     chardev/trace.c
  GEN     hw/block/trace.c
  GEN     hw/block/dataplane/trace.c
  GEN     hw/char/trace.c
  GEN     hw/intc/trace.c
  GEN     hw/net/trace.c
  GEN     hw/virtio/trace.c
  GEN     hw/audio/trace.c
  GEN     hw/misc/trace.c
  GEN     hw/usb/trace.c
  GEN     hw/scsi/trace.c
  GEN     hw/nvram/trace.c
  GEN     hw/display/trace.c
  GEN     hw/input/trace.c
  GEN     hw/timer/trace.c
  GEN     hw/dma/trace.c
  GEN     hw/sparc/trace.c
  GEN     hw/sd/trace.c
  GEN     hw/isa/trace.c
  GEN     hw/mem/trace.c
  GEN     hw/i386/trace.c
  GEN     hw/i386/xen/trace.c
  GEN     hw/9pfs/trace.c
  GEN     hw/ppc/trace.c
  GEN     hw/pci/trace.c
  GEN     hw/s390x/trace.c
  GEN     hw/vfio/trace.c
  GEN     hw/acpi/trace.c
  GEN     hw/arm/trace.c
  GEN     hw/alpha/trace.c
  GEN     hw/xen/trace.c
  GEN     ui/trace.c
  GEN     audio/trace.c
  GEN     net/trace.c
  GEN     target/arm/trace.c
  GEN     target/i386/trace.c
  GEN     target/mips/trace.c
  GEN     target/sparc/trace.c
  GEN     target/s390x/trace.c
  GEN     target/ppc/trace.c
  GEN     qom/trace.c
  GEN     linux-user/trace.c
  GEN     qapi/trace.c
  GEN     accel/tcg/trace.c
  GEN     accel/kvm/trace.c
  GEN     nbd/trace.c
  GEN     config-all-devices.mak
	 DEP /tmp/qemu-test/src/dtc/tests/dumptrees.c
	 DEP /tmp/qemu-test/src/dtc/tests/trees.S
	 DEP /tmp/qemu-test/src/dtc/tests/testutils.c
	 DEP /tmp/qemu-test/src/dtc/tests/value-labels.c
	 DEP /tmp/qemu-test/src/dtc/tests/asm_tree_dump.c
	 DEP /tmp/qemu-test/src/dtc/tests/truncated_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/check_path.c
	 DEP /tmp/qemu-test/src/dtc/tests/overlay_bad_fixup.c
	 DEP /tmp/qemu-test/src/dtc/tests/subnode_iterate.c
	 DEP /tmp/qemu-test/src/dtc/tests/overlay.c
	 DEP /tmp/qemu-test/src/dtc/tests/property_iterate.c
	 DEP /tmp/qemu-test/src/dtc/tests/integer-expressions.c
	 DEP /tmp/qemu-test/src/dtc/tests/utilfdt_test.c
	 DEP /tmp/qemu-test/src/dtc/tests/path_offset_aliases.c
	 DEP /tmp/qemu-test/src/dtc/tests/add_subnode_with_nops.c
	 DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_unordered.c
	 DEP /tmp/qemu-test/src/dtc/tests/dtb_reverse.c
	 DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_ordered.c
	 DEP /tmp/qemu-test/src/dtc/tests/extra-terminating-null.c
	 DEP /tmp/qemu-test/src/dtc/tests/incbin.c
	 DEP /tmp/qemu-test/src/dtc/tests/boot-cpuid.c
	 DEP /tmp/qemu-test/src/dtc/tests/phandle_format.c
	 DEP /tmp/qemu-test/src/dtc/tests/path-references.c
	 DEP /tmp/qemu-test/src/dtc/tests/references.c
	 DEP /tmp/qemu-test/src/dtc/tests/string_escapes.c
	 DEP /tmp/qemu-test/src/dtc/tests/propname_escapes.c
	 DEP /tmp/qemu-test/src/dtc/tests/appendprop2.c
	 DEP /tmp/qemu-test/src/dtc/tests/appendprop1.c
	 DEP /tmp/qemu-test/src/dtc/tests/del_node.c
	 DEP /tmp/qemu-test/src/dtc/tests/del_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/setprop.c
	 DEP /tmp/qemu-test/src/dtc/tests/set_name.c
	 DEP /tmp/qemu-test/src/dtc/tests/rw_tree1.c
	 DEP /tmp/qemu-test/src/dtc/tests/open_pack.c
	 DEP /tmp/qemu-test/src/dtc/tests/nopulate.c
	 DEP /tmp/qemu-test/src/dtc/tests/mangle-layout.c
	 DEP /tmp/qemu-test/src/dtc/tests/move_and_save.c
	 DEP /tmp/qemu-test/src/dtc/tests/sw_tree1.c
	 DEP /tmp/qemu-test/src/dtc/tests/nop_node.c
	 DEP /tmp/qemu-test/src/dtc/tests/nop_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/setprop_inplace.c
	 DEP /tmp/qemu-test/src/dtc/tests/stringlist.c
	 DEP /tmp/qemu-test/src/dtc/tests/addr_size_cells.c
	 DEP /tmp/qemu-test/src/dtc/tests/notfound.c
	 DEP /tmp/qemu-test/src/dtc/tests/char_literal.c
	 DEP /tmp/qemu-test/src/dtc/tests/sized_cells.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_compatible.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_alias.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_check_compatible.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_phandle.c
	 DEP /tmp/qemu-test/src/dtc/tests/parent_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/supernode_atdepth_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_prop_value.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_path.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_phandle.c
	 DEP /tmp/qemu-test/src/dtc/tests/getprop.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_name.c
	 DEP /tmp/qemu-test/src/dtc/tests/subnode_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/find_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/path_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/root_node.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_overlay.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_mem_rsv.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_addresses.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_empty_tree.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_strerror.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_rw.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_sw.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_ro.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_wip.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt.c
	 DEP /tmp/qemu-test/src/dtc/util.c
	 DEP /tmp/qemu-test/src/dtc/fdtput.c
	 DEP /tmp/qemu-test/src/dtc/fdtget.c
	 DEP /tmp/qemu-test/src/dtc/fdtdump.c
	 LEX convert-dtsv0-lexer.lex.c
	 DEP /tmp/qemu-test/src/dtc/srcpos.c
	 BISON dtc-parser.tab.c
	 LEX dtc-lexer.lex.c
	 DEP /tmp/qemu-test/src/dtc/treesource.c
	 DEP /tmp/qemu-test/src/dtc/livetree.c
	 DEP /tmp/qemu-test/src/dtc/fstree.c
	 DEP /tmp/qemu-test/src/dtc/flattree.c
	 DEP /tmp/qemu-test/src/dtc/dtc.c
	 DEP /tmp/qemu-test/src/dtc/data.c
	 DEP /tmp/qemu-test/src/dtc/checks.c
	 DEP convert-dtsv0-lexer.lex.c
	 DEP dtc-parser.tab.c
	 DEP dtc-lexer.lex.c
	CHK version_gen.h
	UPD version_gen.h
	 DEP /tmp/qemu-test/src/dtc/util.c
	 CC libfdt/fdt.o
	 CC libfdt/fdt_ro.o
	 CC libfdt/fdt_sw.o
	 CC libfdt/fdt_wip.o
	 CC libfdt/fdt_rw.o
	 CC libfdt/fdt_empty_tree.o
	 CC libfdt/fdt_addresses.o
	 CC libfdt/fdt_strerror.o
	 CC libfdt/fdt_overlay.o
	 AR libfdt/libfdt.a
ar: creating libfdt/libfdt.a
a - libfdt/fdt.o
a - libfdt/fdt_ro.o
a - libfdt/fdt_wip.o
a - libfdt/fdt_sw.o
a - libfdt/fdt_rw.o
a - libfdt/fdt_strerror.o
a - libfdt/fdt_empty_tree.o
a - libfdt/fdt_addresses.o
a - libfdt/fdt_overlay.o
  GEN     qga/qapi-generated/qga-qapi-types.h
  CC      tests/qemu-iotests/socket_scm_helper.o
  GEN     qga/qapi-generated/qga-qapi-visit.h
  GEN     qga/qapi-generated/qga-qapi-visit.c
  GEN     qga/qapi-generated/qga-qapi-types.c
  GEN     qga/qapi-generated/qga-qmp-marshal.c
  GEN     qga/qapi-generated/qga-qmp-commands.h
  CC      qmp-introspect.o
  CC      qapi-types.o
  CC      qapi-visit.o
  CC      qapi-event.o
  CC      qapi/qapi-visit-core.o
  CC      qapi/qapi-dealloc-visitor.o
  CC      qapi/qobject-input-visitor.o
  CC      qapi/qobject-output-visitor.o
  CC      qapi/qmp-registry.o
  CC      qapi/qmp-dispatch.o
  CC      qapi/string-input-visitor.o
  CC      qapi/string-output-visitor.o
  CC      qapi/opts-visitor.o
  CC      qapi/qapi-clone-visitor.o
  CC      qapi/qmp-event.o
  CC      qapi/qapi-util.o
  CC      qobject/qnull.o
  CC      qobject/qnum.o
  CC      qobject/qstring.o
  CC      qobject/qdict.o
  CC      qobject/qlist.o
  CC      qobject/qbool.o
  CC      qobject/qjson.o
  CC      qobject/qobject.o
  CC      qobject/json-lexer.o
  CC      qobject/json-streamer.o
  CC      qobject/json-parser.o
  CC      trace/control.o
  CC      trace/qmp.o
  CC      util/osdep.o
  CC      util/cutils.o
  CC      util/unicode.o
  CC      util/qemu-timer-common.o
  CC      util/bufferiszero.o
  CC      util/lockcnt.o
  CC      util/aiocb.o
  CC      util/async.o
  CC      util/thread-pool.o
  CC      util/qemu-timer.o
  CC      util/main-loop.o
  CC      util/iohandler.o
  CC      util/aio-posix.o
  CC      util/compatfd.o
  CC      util/event_notifier-posix.o
  CC      util/mmap-alloc.o
  CC      util/oslib-posix.o
  CC      util/qemu-openpty.o
  CC      util/qemu-thread-posix.o
  CC      util/memfd.o
  CC      util/envlist.o
  CC      util/path.o
  CC      util/module.o
  CC      util/host-utils.o
  CC      util/bitmap.o
  CC      util/bitops.o
  CC      util/hbitmap.o
  CC      util/fifo8.o
  CC      util/acl.o
  CC      util/cacheinfo.o
  CC      util/error.o
  CC      util/qemu-error.o
  CC      util/id.o
  CC      util/iov.o
  CC      util/qemu-config.o
  CC      util/qemu-sockets.o
  CC      util/uri.o
  CC      util/notify.o
  CC      util/qemu-option.o
  CC      util/qemu-progress.o
  CC      util/keyval.o
  CC      util/hexdump.o
  CC      util/crc32c.o
  CC      util/uuid.o
  CC      util/throttle.o
  CC      util/getauxval.o
  CC      util/readline.o
  CC      util/rcu.o
  CC      util/qemu-coroutine.o
  CC      util/qemu-coroutine-lock.o
  CC      util/qemu-coroutine-io.o
  CC      util/qemu-coroutine-sleep.o
  CC      util/coroutine-ucontext.o
  CC      util/buffer.o
  CC      util/timed-average.o
  CC      util/base64.o
  CC      util/log.o
  CC      util/qdist.o
  CC      util/qht.o
  CC      util/range.o
  CC      util/stats64.o
  CC      util/systemd.o
  CC      trace-root.o
  CC      util/trace.o
  CC      crypto/trace.o
  CC      io/trace.o
  CC      migration/trace.o
  CC      block/trace.o
  CC      chardev/trace.o
  CC      hw/block/trace.o
  CC      hw/block/dataplane/trace.o
  CC      hw/char/trace.o
  CC      hw/intc/trace.o
  CC      hw/net/trace.o
  CC      hw/virtio/trace.o
  CC      hw/audio/trace.o
  CC      hw/misc/trace.o
  CC      hw/usb/trace.o
  CC      hw/scsi/trace.o
  CC      hw/nvram/trace.o
  CC      hw/display/trace.o
  CC      hw/input/trace.o
  CC      hw/timer/trace.o
  CC      hw/sparc/trace.o
  CC      hw/dma/trace.o
  CC      hw/sd/trace.o
  CC      hw/isa/trace.o
  CC      hw/mem/trace.o
  CC      hw/i386/trace.o
  CC      hw/i386/xen/trace.o
  CC      hw/9pfs/trace.o
  CC      hw/ppc/trace.o
  CC      hw/pci/trace.o
  CC      hw/s390x/trace.o
  CC      hw/acpi/trace.o
  CC      hw/vfio/trace.o
  CC      hw/arm/trace.o
  CC      hw/alpha/trace.o
  CC      hw/xen/trace.o
  CC      ui/trace.o
  CC      audio/trace.o
  CC      net/trace.o
  CC      target/arm/trace.o
  CC      target/mips/trace.o
  CC      target/i386/trace.o
  CC      target/sparc/trace.o
  CC      target/s390x/trace.o
  CC      target/ppc/trace.o
  CC      qom/trace.o
  CC      linux-user/trace.o
  CC      qapi/trace.o
  CC      accel/tcg/trace.o
  CC      accel/kvm/trace.o
  CC      nbd/trace.o
  CC      crypto/pbkdf-stub.o
  CC      stubs/arch-query-cpu-def.o
  CC      stubs/arch-query-cpu-model-expansion.o
  CC      stubs/arch-query-cpu-model-comparison.o
  CC      stubs/arch-query-cpu-model-baseline.o
  CC      stubs/bdrv-next-monitor-owned.o
  CC      stubs/blk-commit-all.o
  CC      stubs/blockdev-close-all-bdrv-states.o
  CC      stubs/clock-warp.o
  CC      stubs/cpu-get-clock.o
  CC      stubs/cpu-get-icount.o
  CC      stubs/dump.o
  CC      stubs/error-printf.o
  CC      stubs/fdset.o
  CC      stubs/gdbstub.o
  CC      stubs/get-vm-name.o
  CC      stubs/iothread.o
  CC      stubs/iothread-lock.o
  CC      stubs/is-daemonized.o
  CC      stubs/machine-init-done.o
  CC      stubs/migr-blocker.o
  CC      stubs/change-state-handler.o
  CC      stubs/monitor.o
  CC      stubs/notify-event.o
  CC      stubs/qtest.o
  CC      stubs/replay.o
  CC      stubs/runstate-check.o
  CC      stubs/set-fd-handler.o
  CC      stubs/slirp.o
  CC      stubs/sysbus.o
  CC      stubs/trace-control.o
  CC      stubs/uuid.o
  CC      stubs/vm-stop.o
  CC      stubs/vmstate.o
  CC      stubs/qmp_pc_dimm_device_list.o
  CC      stubs/target-monitor-defs.o
  CC      stubs/target-get-monitor-def.o
  CC      stubs/pc_madt_cpu_entry.o
  CC      stubs/vmgenid.o
  CC      stubs/xen-common.o
  CC      stubs/xen-hvm.o
  CC      contrib/ivshmem-client/ivshmem-client.o
  CC      contrib/ivshmem-client/main.o
  CC      contrib/ivshmem-server/ivshmem-server.o
  CC      contrib/ivshmem-server/main.o
  CC      qemu-nbd.o
  CC      block.o
  CC      blockjob.o
  CC      qemu-io-cmds.o
  CC      replication.o
  CC      block/raw-format.o
  CC      block/qcow.o
  CC      block/vdi.o
  CC      block/vmdk.o
  CC      block/cloop.o
  CC      block/bochs.o
  CC      block/vpc.o
  CC      block/vvfat.o
  CC      block/dmg.o
  CC      block/qcow2.o
  CC      block/qcow2-refcount.o
  CC      block/qcow2-cluster.o
  CC      block/qcow2-snapshot.o
  CC      block/qcow2-cache.o
  CC      block/qcow2-bitmap.o
  CC      block/qed.o
  CC      block/qed-l2-cache.o
  CC      block/qed-table.o
  CC      block/qed-cluster.o
  CC      block/qed-check.o
  CC      block/vhdx.o
  CC      block/vhdx-endian.o
  CC      block/vhdx-log.o
  CC      block/quorum.o
  CC      block/parallels.o
  CC      block/blkdebug.o
  CC      block/blkverify.o
  CC      block/blkreplay.o
  CC      block/block-backend.o
  CC      block/snapshot.o
  CC      block/qapi.o
  CC      block/file-posix.o
  CC      block/null.o
  CC      block/mirror.o
  CC      block/commit.o
  CC      block/io.o
  CC      block/throttle-groups.o
  CC      block/nbd.o
  CC      block/nbd-client.o
  CC      block/sheepdog.o
  CC      block/accounting.o
  CC      block/dirty-bitmap.o
  CC      block/write-threshold.o
  CC      block/backup.o
  CC      block/replication.o
  CC      block/crypto.o
  CC      nbd/server.o
  CC      nbd/client.o
  CC      nbd/common.o
  CC      block/dmg-bz2.o
  CC      crypto/init.o
  CC      crypto/hash.o
  CC      crypto/hash-glib.o
  CC      crypto/hmac.o
  CC      crypto/hmac-glib.o
  CC      crypto/aes.o
  CC      crypto/desrfb.o
  CC      crypto/cipher.o
  CC      crypto/tlscredsanon.o
  CC      crypto/tlscredsx509.o
  CC      crypto/tlscreds.o
  CC      crypto/tlssession.o
  CC      crypto/secret.o
  CC      crypto/random-platform.o
  CC      crypto/pbkdf.o
  CC      crypto/ivgen.o
  CC      crypto/ivgen-essiv.o
  CC      crypto/ivgen-plain64.o
  CC      crypto/ivgen-plain.o
  CC      crypto/afsplit.o
  CC      crypto/xts.o
  CC      crypto/block.o
  CC      crypto/block-qcow.o
  CC      crypto/block-luks.o
  CC      io/channel.o
  CC      io/channel-buffer.o
  CC      io/channel-command.o
  CC      io/channel-file.o
  CC      io/channel-socket.o
  CC      io/channel-tls.o
  CC      io/channel-watch.o
  CC      io/channel-websock.o
  CC      io/channel-util.o
  CC      io/dns-resolver.o
  CC      io/task.o
  CC      qom/object.o
  CC      qom/container.o
  CC      qom/qom-qobject.o
  CC      qom/object_interfaces.o
  GEN     qemu-img-cmds.h
  CC      qemu-io.o
  CC      qemu-bridge-helper.o
  CC      blockdev.o
  CC      blockdev-nbd.o
  CC      bootdevice.o
  CC      iothread.o
  CC      qdev-monitor.o
  CC      device-hotplug.o
  CC      os-posix.o
  CC      bt-host.o
  CC      bt-vhci.o
  CC      dma-helpers.o
  CC      vl.o
  CC      tpm.o
  CC      device_tree.o
  CC      qmp-marshal.o
  CC      qmp.o
  CC      hmp.o
  CC      cpus-common.o
  CC      audio/audio.o
  CC      audio/noaudio.o
  CC      audio/wavaudio.o
  CC      audio/mixeng.o
  CC      audio/sdlaudio.o
  CC      audio/ossaudio.o
  CC      audio/spiceaudio.o
  CC      audio/wavcapture.o
  CC      backends/rng-egd.o
  CC      backends/rng.o
  CC      backends/rng-random.o
  CC      backends/tpm.o
  CC      backends/hostmem.o
  CC      backends/hostmem-ram.o
  CC      backends/hostmem-file.o
  CC      backends/cryptodev.o
  CC      backends/cryptodev-builtin.o
  CC      block/stream.o
  CC      chardev/msmouse.o
  CC      chardev/wctablet.o
  CC      chardev/testdev.o
  CC      chardev/spice.o
  CC      disas/arm.o
  CC      disas/i386.o
  CC      fsdev/qemu-fsdev-dummy.o
  CC      fsdev/qemu-fsdev-opts.o
  CC      fsdev/qemu-fsdev-throttle.o
  CC      hw/acpi/core.o
  CC      hw/acpi/piix4.o
  CC      hw/acpi/pcihp.o
  CC      hw/acpi/ich9.o
  CC      hw/acpi/tco.o
  CC      hw/acpi/cpu_hotplug.o
  CC      hw/acpi/memory_hotplug.o
  CC      hw/acpi/cpu.o
  CC      hw/acpi/nvdimm.o
  CC      hw/acpi/vmgenid.o
  CC      hw/acpi/acpi_interface.o
  CC      hw/acpi/bios-linker-loader.o
  CC      hw/acpi/aml-build.o
  CC      hw/acpi/ipmi.o
  CC      hw/acpi/acpi-stub.o
  CC      hw/acpi/ipmi-stub.o
  CC      hw/audio/sb16.o
  CC      hw/audio/es1370.o
  CC      hw/audio/ac97.o
  CC      hw/audio/fmopl.o
  CC      hw/audio/adlib.o
  CC      hw/audio/gus.o
  CC      hw/audio/gusemu_hal.o
  CC      hw/audio/gusemu_mixer.o
  CC      hw/audio/cs4231a.o
  CC      hw/audio/intel-hda.o
  CC      hw/audio/hda-codec.o
  CC      hw/audio/pcspk.o
  CC      hw/audio/wm8750.o
  CC      hw/audio/pl041.o
  CC      hw/audio/lm4549.o
  CC      hw/audio/marvell_88w8618.o
  CC      hw/audio/soundhw.o
  CC      hw/block/block.o
  CC      hw/block/cdrom.o
  CC      hw/block/hd-geometry.o
  CC      hw/block/fdc.o
  CC      hw/block/m25p80.o
  CC      hw/block/nand.o
  CC      hw/block/pflash_cfi01.o
  CC      hw/block/pflash_cfi02.o
  CC      hw/block/xen_disk.o
  CC      hw/block/ecc.o
  CC      hw/block/onenand.o
  CC      hw/block/nvme.o
  CC      hw/bt/core.o
  CC      hw/bt/l2cap.o
  CC      hw/bt/sdp.o
  CC      hw/bt/hci.o
  CC      hw/bt/hid.o
  CC      hw/bt/hci-csr.o
  CC      hw/char/ipoctal232.o
  CC      hw/char/parallel.o
  CC      hw/char/pl011.o
  CC      hw/char/serial.o
  CC      hw/char/serial-isa.o
  CC      hw/char/serial-pci.o
  CC      hw/char/virtio-console.o
  CC      hw/char/xen_console.o
  CC      hw/char/cadence_uart.o
  CC      hw/char/cmsdk-apb-uart.o
  CC      hw/char/debugcon.o
  CC      hw/char/imx_serial.o
  CC      hw/core/qdev-properties.o
  CC      hw/core/qdev.o
  CC      hw/core/bus.o
  CC      hw/core/reset.o
  CC      hw/core/fw-path-provider.o
  CC      hw/core/irq.o
  CC      hw/core/hotplug.o
  CC      hw/core/nmi.o
  CC      hw/core/ptimer.o
  CC      hw/core/sysbus.o
  CC      hw/core/machine.o
  CC      hw/core/loader.o
  CC      hw/core/qdev-properties-system.o
  CC      hw/core/register.o
  CC      hw/core/or-irq.o
  CC      hw/core/platform-bus.o
  CC      hw/cpu/core.o
  CC      hw/display/ads7846.o
  CC      hw/display/cirrus_vga.o
  CC      hw/display/pl110.o
  CC      hw/display/ssd0303.o
  CC      hw/display/ssd0323.o
  CC      hw/display/xenfb.o
  CC      hw/display/vga-pci.o
  CC      hw/display/vga-isa.o
  CC      hw/display/vmware_vga.o
  CC      hw/display/blizzard.o
  CC      hw/display/exynos4210_fimd.o
  CC      hw/display/framebuffer.o
  CC      hw/display/tc6393xb.o
  CC      hw/display/qxl.o
  CC      hw/display/qxl-logger.o
  CC      hw/display/qxl-render.o
  CC      hw/dma/pl080.o
  CC      hw/dma/pl330.o
  CC      hw/dma/i8257.o
  CC      hw/dma/xlnx-zynq-devcfg.o
  CC      hw/gpio/max7310.o
  CC      hw/gpio/pl061.o
  CC      hw/gpio/zaurus.o
  CC      hw/i2c/core.o
  CC      hw/gpio/gpio_key.o
  CC      hw/i2c/smbus.o
  CC      hw/i2c/smbus_eeprom.o
  CC      hw/i2c/i2c-ddc.o
  CC      hw/i2c/versatile_i2c.o
  CC      hw/i2c/pm_smbus.o
  CC      hw/i2c/smbus_ich9.o
  CC      hw/i2c/bitbang_i2c.o
  CC      hw/i2c/exynos4210_i2c.o
  CC      hw/i2c/imx_i2c.o
  CC      hw/i2c/aspeed_i2c.o
  CC      hw/ide/core.o
  CC      hw/ide/atapi.o
  CC      hw/ide/qdev.o
  CC      hw/ide/pci.o
  CC      hw/ide/isa.o
  CC      hw/ide/piix.o
  CC      hw/ide/microdrive.o
  CC      hw/ide/ahci.o
  CC      hw/ide/ich.o
  CC      hw/input/hid.o
  CC      hw/input/lm832x.o
  CC      hw/input/pckbd.o
  CC      hw/input/pl050.o
  CC      hw/input/ps2.o
  CC      hw/input/stellaris_input.o
  CC      hw/input/tsc2005.o
  CC      hw/input/vmmouse.o
  CC      hw/input/virtio-input.o
  CC      hw/input/virtio-input-hid.o
  CC      hw/input/virtio-input-host.o
  CC      hw/intc/i8259_common.o
  CC      hw/intc/i8259.o
  CC      hw/intc/pl190.o
  CC      hw/intc/imx_avic.o
  CC      hw/intc/realview_gic.o
  CC      hw/intc/ioapic_common.o
  CC      hw/intc/arm_gic_common.o
  CC      hw/intc/arm_gic.o
  CC      hw/intc/arm_gicv2m.o
  CC      hw/intc/arm_gicv3_common.o
  CC      hw/intc/arm_gicv3.o
  CC      hw/intc/arm_gicv3_dist.o
  CC      hw/intc/arm_gicv3_redist.o
  CC      hw/intc/arm_gicv3_its_common.o
  CC      hw/intc/intc.o
  CC      hw/ipack/ipack.o
  CC      hw/ipack/tpci200.o
  CC      hw/ipmi/ipmi.o
  CC      hw/ipmi/ipmi_bmc_sim.o
  CC      hw/ipmi/ipmi_bmc_extern.o
  CC      hw/ipmi/isa_ipmi_kcs.o
  CC      hw/ipmi/isa_ipmi_bt.o
  CC      hw/isa/isa-bus.o
  CC      hw/isa/apm.o
  CC      hw/mem/pc-dimm.o
  CC      hw/mem/nvdimm.o
  CC      hw/misc/applesmc.o
  CC      hw/misc/max111x.o
  CC      hw/misc/tmp105.o
  CC      hw/misc/tmp421.o
  CC      hw/misc/debugexit.o
  CC      hw/misc/sga.o
  CC      hw/misc/pc-testdev.o
  CC      hw/misc/pci-testdev.o
  CC      hw/misc/edu.o
  CC      hw/misc/unimp.o
  CC      hw/misc/arm_l2x0.o
  CC      hw/misc/arm_integrator_debug.o
  CC      hw/misc/a9scu.o
  CC      hw/misc/arm11scu.o
  CC      hw/net/xen_nic.o
  CC      hw/net/ne2000.o
  CC      hw/net/eepro100.o
  CC      hw/net/pcnet-pci.o
  CC      hw/net/e1000.o
  CC      hw/net/pcnet.o
  CC      hw/net/e1000x_common.o
  CC      hw/net/net_tx_pkt.o
  CC      hw/net/net_rx_pkt.o
  CC      hw/net/e1000e.o
  CC      hw/net/e1000e_core.o
  CC      hw/net/rtl8139.o
  CC      hw/net/vmxnet3.o
  CC      hw/net/smc91c111.o
  CC      hw/net/lan9118.o
  CC      hw/net/ne2000-isa.o
  CC      hw/net/xgmac.o
  CC      hw/net/allwinner_emac.o
  CC      hw/net/imx_fec.o
  CC      hw/net/cadence_gem.o
  CC      hw/net/stellaris_enet.o
  CC      hw/net/ftgmac100.o
  CC      hw/net/rocker/rocker.o
  CC      hw/net/rocker/rocker_fp.o
  CC      hw/net/rocker/rocker_desc.o
  CC      hw/net/rocker/rocker_world.o
  CC      hw/net/rocker/rocker_of_dpa.o
  CC      hw/nvram/eeprom93xx.o
  CC      hw/nvram/fw_cfg.o
  CC      hw/nvram/chrp_nvram.o
  CC      hw/pci-bridge/pci_bridge_dev.o
  CC      hw/pci-bridge/pcie_root_port.o
  CC      hw/pci-bridge/gen_pcie_root_port.o
  CC      hw/pci-bridge/pci_expander_bridge.o
  CC      hw/pci-bridge/xio3130_upstream.o
  CC      hw/pci-bridge/xio3130_downstream.o
  CC      hw/pci-bridge/ioh3420.o
  CC      hw/pci-bridge/i82801b11.o
  CC      hw/pci-host/pam.o
  CC      hw/pci-host/versatile.o
  CC      hw/pci-host/piix.o
  CC      hw/pci-host/q35.o
  CC      hw/pci-host/gpex.o
  CC      hw/pci/pci.o
  CC      hw/pci/pci_bridge.o
  CC      hw/pci/msix.o
  CC      hw/pci/msi.o
  CC      hw/pci/shpc.o
  CC      hw/pci/slotid_cap.o
  CC      hw/pci/pci_host.o
  CC      hw/pci/pcie_host.o
  CC      hw/pci/pcie.o
  CC      hw/pci/pcie_aer.o
  CC      hw/pci/pcie_port.o
  CC      hw/pci/pci-stub.o
  CC      hw/pcmcia/pcmcia.o
  CC      hw/scsi/scsi-disk.o
  CC      hw/scsi/scsi-generic.o
  CC      hw/scsi/scsi-bus.o
  CC      hw/scsi/lsi53c895a.o
  CC      hw/scsi/mptsas.o
  CC      hw/scsi/mptconfig.o
  CC      hw/scsi/mptendian.o
  CC      hw/scsi/megasas.o
  CC      hw/scsi/vmw_pvscsi.o
  CC      hw/scsi/esp.o
  CC      hw/scsi/esp-pci.o
  CC      hw/sd/pl181.o
  CC      hw/sd/ssi-sd.o
  CC      hw/sd/sd.o
  CC      hw/sd/core.o
  CC      hw/sd/sdhci.o
  CC      hw/smbios/smbios.o
  CC      hw/smbios/smbios_type_38.o
  CC      hw/smbios/smbios-stub.o
  CC      hw/smbios/smbios_type_38-stub.o
  CC      hw/ssi/pl022.o
  CC      hw/ssi/ssi.o
  CC      hw/ssi/xilinx_spips.o
  CC      hw/ssi/aspeed_smc.o
  CC      hw/ssi/stm32f2xx_spi.o
  CC      hw/timer/arm_timer.o
  CC      hw/timer/arm_mptimer.o
  CC      hw/timer/armv7m_systick.o
  CC      hw/timer/a9gtimer.o
  CC      hw/timer/cadence_ttc.o
  CC      hw/timer/ds1338.o
  CC      hw/timer/hpet.o
  CC      hw/timer/i8254_common.o
  CC      hw/timer/i8254.o
  CC      hw/timer/pl031.o
  CC      hw/timer/twl92230.o
  CC      hw/timer/imx_epit.o
  CC      hw/timer/imx_gpt.o
  CC      hw/timer/stm32f2xx_timer.o
  CC      hw/timer/aspeed_timer.o
  CC      hw/tpm/tpm_tis.o
  CC      hw/timer/cmsdk-apb-timer.o
  CC      hw/tpm/tpm_passthrough.o
  CC      hw/tpm/tpm_util.o
  CC      hw/usb/core.o
  CC      hw/usb/combined-packet.o
  CC      hw/usb/bus.o
  CC      hw/usb/libhw.o
  CC      hw/usb/desc.o
  CC      hw/usb/desc-msos.o
  CC      hw/usb/hcd-uhci.o
  CC      hw/usb/hcd-ohci.o
  CC      hw/usb/hcd-ehci.o
  CC      hw/usb/hcd-ehci-pci.o
  CC      hw/usb/hcd-ehci-sysbus.o
  CC      hw/usb/hcd-xhci.o
  CC      hw/usb/hcd-xhci-nec.o
  CC      hw/usb/hcd-musb.o
  CC      hw/usb/dev-hub.o
  CC      hw/usb/dev-hid.o
  CC      hw/usb/dev-wacom.o
  CC      hw/usb/dev-storage.o
  CC      hw/usb/dev-uas.o
  CC      hw/usb/dev-audio.o
  CC      hw/usb/dev-serial.o
  CC      hw/usb/dev-network.o
  CC      hw/usb/dev-bluetooth.o
  CC      hw/usb/dev-smartcard-reader.o
  CC      hw/usb/ccid-card-passthru.o
  CC      hw/usb/ccid-card-emulated.o
  CC      hw/usb/dev-mtp.o
  CC      hw/usb/host-stub.o
  CC      hw/virtio/virtio-rng.o
  CC      hw/virtio/virtio-pci.o
  CC      hw/virtio/virtio-bus.o
  CC      hw/virtio/virtio-mmio.o
  CC      hw/virtio/vhost-stub.o
  CC      hw/watchdog/watchdog.o
  CC      hw/watchdog/wdt_i6300esb.o
  CC      hw/watchdog/wdt_ib700.o
  CC      hw/watchdog/wdt_aspeed.o
  CC      hw/xen/xen_backend.o
  CC      hw/xen/xen_devconfig.o
  CC      hw/xen/xen_pvdev.o
  CC      hw/xen/xen-common.o
  CC      migration/migration.o
  CC      migration/socket.o
  CC      migration/fd.o
  CC      migration/exec.o
  CC      migration/tls.o
  CC      migration/channel.o
  CC      migration/savevm.o
  CC      migration/colo-comm.o
  CC      migration/colo.o
  CC      migration/colo-failover.o
  CC      migration/vmstate.o
  CC      migration/vmstate-types.o
  CC      migration/page_cache.o
  CC      migration/qemu-file.o
  CC      migration/global_state.o
  CC      migration/qemu-file-channel.o
  CC      migration/xbzrle.o
  CC      migration/postcopy-ram.o
  CC      migration/qjson.o
  CC      migration/rdma.o
  CC      migration/block.o
  CC      net/net.o
  CC      net/queue.o
  CC      net/checksum.o
  CC      net/util.o
  CC      net/hub.o
  CC      net/socket.o
  CC      net/dump.o
  CC      net/eth.o
  CC      net/l2tpv3.o
  CC      net/vhost-user.o
  CC      net/slirp.o
  CC      net/filter.o
  CC      net/filter-buffer.o
  CC      net/filter-mirror.o
  CC      net/colo-compare.o
  CC      net/colo.o
  CC      net/filter-rewriter.o
  CC      net/filter-replay.o
  CC      net/tap.o
  CC      net/tap-linux.o
  CC      qom/cpu.o
  CC      replay/replay.o
  CC      replay/replay-internal.o
  CC      replay/replay-events.o
  CC      replay/replay-time.o
  CC      replay/replay-input.o
  CC      replay/replay-char.o
  CC      replay/replay-snapshot.o
  CC      replay/replay-net.o
/tmp/qemu-test/src/replay/replay-internal.c: In function ‘replay_put_array’:
/tmp/qemu-test/src/replay/replay-internal.c:65: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
  CC      replay/replay-audio.o
  CC      slirp/cksum.o
  CC      slirp/if.o
  CC      slirp/ip_icmp.o
  CC      slirp/ip6_icmp.o
  CC      slirp/ip6_input.o
  CC      slirp/ip6_output.o
  CC      slirp/ip_input.o
  CC      slirp/ip_output.o
  CC      slirp/dnssearch.o
  CC      slirp/dhcpv6.o
  CC      slirp/slirp.o
  CC      slirp/mbuf.o
  CC      slirp/misc.o
  CC      slirp/sbuf.o
  CC      slirp/socket.o
  CC      slirp/tcp_input.o
  CC      slirp/tcp_output.o
  CC      slirp/tcp_subr.o
  CC      slirp/tcp_timer.o
  CC      slirp/udp.o
  CC      slirp/udp6.o
  CC      slirp/bootp.o
  CC      slirp/tftp.o
  CC      slirp/arp_table.o
  CC      slirp/ndp_table.o
  CC      slirp/ncsi.o
  CC      ui/keymaps.o
  CC      ui/console.o
/tmp/qemu-test/src/slirp/tcp_input.c: In function ‘tcp_input’:
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_p’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_len’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_tos’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_id’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_off’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_ttl’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_sum’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_src.s_addr’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_dst.s_addr’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:220: warning: ‘save_ip6.ip_nh’ may be used uninitialized in this function
  CC      ui/cursor.o
  CC      ui/qemu-pixman.o
  CC      ui/input.o
  CC      ui/input-keymap.o
  CC      ui/input-legacy.o
  CC      ui/input-linux.o
  CC      ui/spice-core.o
  CC      ui/spice-input.o
  CC      ui/spice-display.o
  CC      ui/sdl.o
  CC      ui/sdl_zoom.o
  CC      ui/x_keymap.o
  CC      ui/curses.o
  CC      ui/vnc.o
  CC      ui/vnc-enc-zlib.o
  CC      ui/vnc-enc-hextile.o
  CC      ui/vnc-enc-tight.o
  CC      ui/vnc-palette.o
  CC      ui/vnc-enc-zrle.o
  CC      ui/vnc-auth-vencrypt.o
  CC      ui/vnc-ws.o
  CC      ui/vnc-jobs.o
  CC      ui/gtk.o
  CC      ui/shader.o
  VERT    ui/shader/texture-blit-vert.h
  FRAG    ui/shader/texture-blit-frag.h
  CC      ui/egl-helpers.o
  CC      ui/egl-context.o
  CC      ui/gtk-egl.o
  CC      chardev/char.o
  CC      chardev/char-fd.o
  CC      chardev/char-fe.o
  CC      chardev/char-file.o
  CC      chardev/char-io.o
  CC      chardev/char-mux.o
  CC      chardev/char-null.o
  CC      chardev/char-parallel.o
  CC      chardev/char-pipe.o
In file included from /usr/include/gtk-2.0/gtk/gtk.h:235,
                 from /tmp/qemu-test/src/include/ui/gtk.h:10,
                 from /tmp/qemu-test/src/ui/gtk-egl.c:21:
/usr/include/gtk-2.0/gtk/gtkitemfactory.h:47: warning: function declaration isn’t a prototype
  CC      chardev/char-pty.o
  CC      chardev/char-ringbuf.o
  CC      chardev/char-serial.o
  CC      chardev/char-socket.o
In file included from /usr/include/gtk-2.0/gtk/gtk.h:235,
                 from /tmp/qemu-test/src/include/ui/gtk.h:10,
                 from /tmp/qemu-test/src/ui/gtk.c:43:
/usr/include/gtk-2.0/gtk/gtkitemfactory.h:47: warning: function declaration isn’t a prototype
  CC      chardev/char-stdio.o
  CC      chardev/char-udp.o
  LINK    tests/qemu-iotests/socket_scm_helper
  CC      qga/commands.o
  CC      qga/guest-agent-command-state.o
  CC      qga/main.o
  AS      optionrom/multiboot.o
  AS      optionrom/linuxboot.o
  CC      optionrom/linuxboot_dma.o
cc: unrecognized option '-no-integrated-as'
cc: unrecognized option '-no-integrated-as'
  AS      optionrom/kvmvapic.o
  BUILD   optionrom/multiboot.img
  BUILD   optionrom/linuxboot.img
  BUILD   optionrom/linuxboot_dma.img
  BUILD   optionrom/kvmvapic.img
  BUILD   optionrom/multiboot.raw
  BUILD   optionrom/linuxboot.raw
  BUILD   optionrom/linuxboot_dma.raw
  BUILD   optionrom/kvmvapic.raw
  SIGN    optionrom/multiboot.bin
  CC      qga/commands-posix.o
  SIGN    optionrom/linuxboot.bin
  SIGN    optionrom/linuxboot_dma.bin
  CC      qga/channel-posix.o
  SIGN    optionrom/kvmvapic.bin
  CC      qga/qapi-generated/qga-qapi-types.o
  CC      qga/qapi-generated/qga-qapi-visit.o
  CC      qga/qapi-generated/qga-qmp-marshal.o
  AR      libqemuutil.a
  AR      libqemustub.a
  CC      qemu-img.o
  LINK    qemu-io
  LINK    qemu-bridge-helper
  CC      ui/console-gl.o
  LINK    ivshmem-client
  LINK    ivshmem-server
  LINK    qemu-nbd
  LINK    qemu-ga
  GEN     aarch64-softmmu/config-target.h
  GEN     aarch64-softmmu/hmp-commands-info.h
  GEN     aarch64-softmmu/hmp-commands.h
  GEN     x86_64-softmmu/config-target.h
  GEN     x86_64-softmmu/hmp-commands.h
  GEN     x86_64-softmmu/hmp-commands-info.h
  CC      aarch64-softmmu/exec.o
  CC      aarch64-softmmu/tcg/tcg.o
  CC      aarch64-softmmu/tcg/optimize.o
  CC      aarch64-softmmu/tcg/tcg-common.o
  CC      aarch64-softmmu/tcg/tcg-op.o
  CC      aarch64-softmmu/tcg/tcg-runtime.o
  CC      x86_64-softmmu/exec.o
  CC      x86_64-softmmu/tcg/tcg.o
  CC      aarch64-softmmu/fpu/softfloat.o
  CC      aarch64-softmmu/disas.o
  LINK    qemu-img
  GEN     aarch64-softmmu/gdbstub-xml.c
  CC      x86_64-softmmu/tcg/tcg-op.o
  CC      x86_64-softmmu/tcg/optimize.o
  CC      x86_64-softmmu/tcg/tcg-common.o
  CC      x86_64-softmmu/tcg/tcg-runtime.o
  CC      aarch64-softmmu/hax-stub.o
  CC      aarch64-softmmu/arch_init.o
  CC      aarch64-softmmu/cpus.o
  CC      aarch64-softmmu/monitor.o
  CC      aarch64-softmmu/gdbstub.o
  CC      aarch64-softmmu/balloon.o
  CC      aarch64-softmmu/ioport.o
  CC      aarch64-softmmu/numa.o
  CC      aarch64-softmmu/qtest.o
  CC      aarch64-softmmu/memory.o
  CC      aarch64-softmmu/memory_mapping.o
  CC      aarch64-softmmu/dump.o
  CC      aarch64-softmmu/migration/ram.o
  CC      x86_64-softmmu/fpu/softfloat.o
  CC      aarch64-softmmu/accel/accel.o
  CC      x86_64-softmmu/disas.o
  GEN     x86_64-softmmu/gdbstub-xml.c
  CC      aarch64-softmmu/accel/stubs/kvm-stub.o
  CC      x86_64-softmmu/hax-stub.o
  CC      aarch64-softmmu/accel/tcg/tcg-all.o
  CC      x86_64-softmmu/arch_init.o
  CC      x86_64-softmmu/cpus.o
  CC      aarch64-softmmu/accel/tcg/cputlb.o
  CC      x86_64-softmmu/monitor.o
  CC      x86_64-softmmu/gdbstub.o
  CC      aarch64-softmmu/accel/tcg/cpu-exec.o
  CC      x86_64-softmmu/balloon.o
  CC      aarch64-softmmu/accel/tcg/cpu-exec-common.o
  CC      x86_64-softmmu/ioport.o
  CC      x86_64-softmmu/numa.o
  CC      x86_64-softmmu/qtest.o
  CC      aarch64-softmmu/accel/tcg/translate-all.o
  CC      x86_64-softmmu/memory.o
  CC      x86_64-softmmu/memory_mapping.o
  CC      x86_64-softmmu/dump.o
  CC      x86_64-softmmu/migration/ram.o
  CC      x86_64-softmmu/accel/accel.o
  CC      aarch64-softmmu/hw/adc/stm32f2xx_adc.o
  CC      x86_64-softmmu/accel/kvm/kvm-all.o
  CC      x86_64-softmmu/accel/tcg/tcg-all.o
  CC      x86_64-softmmu/accel/tcg/cputlb.o
  CC      x86_64-softmmu/accel/tcg/cpu-exec.o
  CC      aarch64-softmmu/hw/block/virtio-blk.o
  CC      x86_64-softmmu/accel/tcg/cpu-exec-common.o
  CC      aarch64-softmmu/hw/block/dataplane/virtio-blk.o
  CC      x86_64-softmmu/accel/tcg/translate-all.o
  CC      aarch64-softmmu/hw/char/exynos4210_uart.o
  CC      aarch64-softmmu/hw/char/omap_uart.o
  CC      aarch64-softmmu/hw/char/digic-uart.o
  CC      x86_64-softmmu/hw/block/virtio-blk.o
  CC      x86_64-softmmu/hw/block/dataplane/virtio-blk.o
  CC      aarch64-softmmu/hw/char/stm32f2xx_usart.o
  CC      x86_64-softmmu/hw/char/virtio-serial-bus.o
  CC      x86_64-softmmu/hw/core/generic-loader.o
  CC      x86_64-softmmu/hw/core/null-machine.o
  CC      aarch64-softmmu/hw/char/bcm2835_aux.o
  CC      aarch64-softmmu/hw/char/virtio-serial-bus.o
  CC      aarch64-softmmu/hw/core/generic-loader.o
  CC      x86_64-softmmu/hw/display/vga.o
  CC      x86_64-softmmu/hw/display/virtio-gpu.o
  CC      x86_64-softmmu/hw/display/virtio-gpu-3d.o
  CC      aarch64-softmmu/hw/core/null-machine.o
  CC      x86_64-softmmu/hw/display/virtio-gpu-pci.o
  CC      x86_64-softmmu/hw/display/virtio-vga.o
  CC      aarch64-softmmu/hw/cpu/arm11mpcore.o
  CC      aarch64-softmmu/hw/cpu/realview_mpcore.o
  CC      x86_64-softmmu/hw/intc/apic.o
  CC      aarch64-softmmu/hw/cpu/a9mpcore.o
  CC      x86_64-softmmu/hw/intc/apic_common.o
  CC      aarch64-softmmu/hw/cpu/a15mpcore.o
  CC      aarch64-softmmu/hw/display/omap_dss.o
  CC      x86_64-softmmu/hw/intc/ioapic.o
  CC      aarch64-softmmu/hw/display/omap_lcdc.o
  CC      x86_64-softmmu/hw/isa/lpc_ich9.o
  CC      aarch64-softmmu/hw/display/pxa2xx_lcd.o
  CC      x86_64-softmmu/hw/misc/vmport.o
  CC      aarch64-softmmu/hw/display/bcm2835_fb.o
  CC      x86_64-softmmu/hw/misc/ivshmem.o
  CC      x86_64-softmmu/hw/misc/pvpanic.o
  CC      aarch64-softmmu/hw/display/vga.o
  CC      aarch64-softmmu/hw/display/virtio-gpu.o
  CC      aarch64-softmmu/hw/display/virtio-gpu-3d.o
  CC      x86_64-softmmu/hw/misc/hyperv_testdev.o
  CC      aarch64-softmmu/hw/display/virtio-gpu-pci.o
  CC      aarch64-softmmu/hw/display/dpcd.o
  CC      x86_64-softmmu/hw/misc/mmio_interface.o
  CC      aarch64-softmmu/hw/display/xlnx_dp.o
  CC      x86_64-softmmu/hw/net/virtio-net.o
  CC      aarch64-softmmu/hw/dma/xlnx_dpdma.o
  CC      x86_64-softmmu/hw/net/vhost_net.o
  CC      aarch64-softmmu/hw/dma/omap_dma.o
  CC      x86_64-softmmu/hw/scsi/virtio-scsi.o
  CC      aarch64-softmmu/hw/dma/soc_dma.o
  CC      aarch64-softmmu/hw/dma/pxa2xx_dma.o
  CC      x86_64-softmmu/hw/scsi/virtio-scsi-dataplane.o
  CC      aarch64-softmmu/hw/dma/bcm2835_dma.o
  CC      aarch64-softmmu/hw/gpio/omap_gpio.o
  CC      aarch64-softmmu/hw/gpio/imx_gpio.o
  CC      aarch64-softmmu/hw/gpio/bcm2835_gpio.o
  CC      x86_64-softmmu/hw/scsi/vhost-scsi-common.o
  CC      aarch64-softmmu/hw/i2c/omap_i2c.o
  CC      x86_64-softmmu/hw/scsi/vhost-scsi.o
  CC      x86_64-softmmu/hw/scsi/vhost-user-scsi.o
  CC      x86_64-softmmu/hw/timer/mc146818rtc.o
  CC      x86_64-softmmu/hw/vfio/common.o
  CC      x86_64-softmmu/hw/vfio/pci.o
  CC      x86_64-softmmu/hw/vfio/pci-quirks.o
  CC      aarch64-softmmu/hw/input/pxa2xx_keypad.o
  CC      aarch64-softmmu/hw/input/tsc210x.o
  CC      aarch64-softmmu/hw/intc/armv7m_nvic.o
  CC      aarch64-softmmu/hw/intc/exynos4210_gic.o
  CC      x86_64-softmmu/hw/vfio/platform.o
  CC      x86_64-softmmu/hw/vfio/spapr.o
  CC      aarch64-softmmu/hw/intc/exynos4210_combiner.o
  CC      x86_64-softmmu/hw/virtio/virtio.o
  CC      x86_64-softmmu/hw/virtio/virtio-balloon.o
  CC      aarch64-softmmu/hw/intc/omap_intc.o
  CC      aarch64-softmmu/hw/intc/bcm2835_ic.o
  CC      x86_64-softmmu/hw/virtio/vhost.o
  CC      aarch64-softmmu/hw/intc/bcm2836_control.o
  CC      x86_64-softmmu/hw/virtio/vhost-backend.o
  CC      x86_64-softmmu/hw/virtio/vhost-user.o
  CC      aarch64-softmmu/hw/intc/allwinner-a10-pic.o
  CC      aarch64-softmmu/hw/intc/aspeed_vic.o
  CC      aarch64-softmmu/hw/intc/arm_gicv3_cpuif.o
  CC      x86_64-softmmu/hw/virtio/vhost-vsock.o
  CC      aarch64-softmmu/hw/misc/ivshmem.o
  CC      aarch64-softmmu/hw/misc/arm_sysctl.o
  CC      x86_64-softmmu/hw/virtio/virtio-crypto.o
  CC      aarch64-softmmu/hw/misc/cbus.o
  CC      aarch64-softmmu/hw/misc/exynos4210_pmu.o
  CC      aarch64-softmmu/hw/misc/exynos4210_clk.o
  CC      aarch64-softmmu/hw/misc/exynos4210_rng.o
  CC      x86_64-softmmu/hw/virtio/virtio-crypto-pci.o
  CC      aarch64-softmmu/hw/misc/imx_ccm.o
  CC      x86_64-softmmu/hw/xen/xen-host-pci-device.o
  CC      aarch64-softmmu/hw/misc/imx31_ccm.o
  CC      aarch64-softmmu/hw/misc/imx25_ccm.o
  CC      aarch64-softmmu/hw/misc/imx6_ccm.o
  CC      aarch64-softmmu/hw/misc/imx6_src.o
  CC      aarch64-softmmu/hw/misc/mst_fpga.o
  CC      x86_64-softmmu/hw/xen/xen_pt.o
  CC      x86_64-softmmu/hw/xen/xen_pt_config_init.o
  CC      x86_64-softmmu/hw/xen/xen_pt_graphics.o
  CC      aarch64-softmmu/hw/misc/omap_clk.o
  CC      aarch64-softmmu/hw/misc/omap_gpmc.o
  CC      aarch64-softmmu/hw/misc/omap_l4.o
  CC      aarch64-softmmu/hw/misc/omap_sdrc.o
  CC      aarch64-softmmu/hw/misc/omap_tap.o
  CC      aarch64-softmmu/hw/misc/bcm2835_mbox.o
  CC      aarch64-softmmu/hw/misc/bcm2835_property.o
  CC      x86_64-softmmu/hw/xen/xen_pt_msi.o
  CC      aarch64-softmmu/hw/misc/bcm2835_rng.o
  CC      aarch64-softmmu/hw/misc/zynq_slcr.o
  CC      x86_64-softmmu/hw/i386/multiboot.o
  CC      aarch64-softmmu/hw/misc/zynq-xadc.o
  CC      x86_64-softmmu/hw/i386/pc.o
  CC      aarch64-softmmu/hw/misc/stm32f2xx_syscfg.o
  CC      aarch64-softmmu/hw/misc/mps2-scc.o
  CC      aarch64-softmmu/hw/misc/auxbus.o
  CC      aarch64-softmmu/hw/misc/aspeed_scu.o
  CC      x86_64-softmmu/hw/i386/pc_piix.o
  CC      aarch64-softmmu/hw/misc/aspeed_sdmc.o
  CC      x86_64-softmmu/hw/i386/pc_q35.o
  CC      x86_64-softmmu/hw/i386/pc_sysfw.o
  CC      aarch64-softmmu/hw/misc/mmio_interface.o
  CC      aarch64-softmmu/hw/net/virtio-net.o
  CC      aarch64-softmmu/hw/net/vhost_net.o
  CC      aarch64-softmmu/hw/pcmcia/pxa2xx.o
  CC      x86_64-softmmu/hw/i386/x86-iommu.o
  CC      aarch64-softmmu/hw/scsi/virtio-scsi.o
  CC      x86_64-softmmu/hw/i386/intel_iommu.o
  CC      aarch64-softmmu/hw/scsi/virtio-scsi-dataplane.o
  CC      aarch64-softmmu/hw/scsi/vhost-scsi-common.o
  CC      x86_64-softmmu/hw/i386/amd_iommu.o
  CC      x86_64-softmmu/hw/i386/kvmvapic.o
/tmp/qemu-test/src/hw/i386/pc_piix.c: In function ‘igd_passthrough_isa_bridge_create’:
/tmp/qemu-test/src/hw/i386/pc_piix.c:1065: warning: ‘pch_rev_id’ may be used uninitialized in this function
  CC      x86_64-softmmu/hw/i386/acpi-build.o
  CC      aarch64-softmmu/hw/scsi/vhost-scsi.o
  CC      aarch64-softmmu/hw/scsi/vhost-user-scsi.o
  CC      aarch64-softmmu/hw/sd/omap_mmc.o
  CC      aarch64-softmmu/hw/sd/pxa2xx_mmci.o
  CC      x86_64-softmmu/hw/i386/pci-assign-load-rom.o
  CC      aarch64-softmmu/hw/sd/bcm2835_sdhost.o
  CC      aarch64-softmmu/hw/ssi/omap_spi.o
  CC      aarch64-softmmu/hw/ssi/imx_spi.o
  CC      aarch64-softmmu/hw/timer/exynos4210_mct.o
  CC      x86_64-softmmu/hw/i386/../xenpv/xen_machine_pv.o
  CC      aarch64-softmmu/hw/timer/exynos4210_pwm.o
  CC      aarch64-softmmu/hw/timer/exynos4210_rtc.o
  CC      x86_64-softmmu/hw/i386/kvm/clock.o
  CC      aarch64-softmmu/hw/timer/omap_gptimer.o
/tmp/qemu-test/src/hw/i386/acpi-build.c: In function ‘build_append_pci_bus_devices’:
/tmp/qemu-test/src/hw/i386/acpi-build.c:539: warning: ‘notify_method’ may be used uninitialized in this function
  CC      aarch64-softmmu/hw/timer/omap_synctimer.o
  CC      x86_64-softmmu/hw/i386/kvm/apic.o
  CC      x86_64-softmmu/hw/i386/kvm/i8259.o
  CC      aarch64-softmmu/hw/timer/pxa2xx_timer.o
  CC      x86_64-softmmu/hw/i386/kvm/ioapic.o
  CC      x86_64-softmmu/hw/i386/kvm/i8254.o
  CC      x86_64-softmmu/hw/i386/kvm/pci-assign.o
  CC      x86_64-softmmu/hw/i386/xen/xen_platform.o
  CC      x86_64-softmmu/hw/i386/xen/xen_apic.o
  CC      aarch64-softmmu/hw/timer/digic-timer.o
  CC      x86_64-softmmu/hw/i386/xen/xen_pvdevice.o
  CC      aarch64-softmmu/hw/timer/allwinner-a10-pit.o
  CC      x86_64-softmmu/hw/i386/xen/xen-hvm.o
  CC      aarch64-softmmu/hw/usb/tusb6010.o
  CC      aarch64-softmmu/hw/vfio/common.o
  CC      aarch64-softmmu/hw/vfio/pci.o
  CC      aarch64-softmmu/hw/vfio/pci-quirks.o
  CC      aarch64-softmmu/hw/vfio/platform.o
  CC      x86_64-softmmu/hw/i386/xen/xen-mapcache.o
  CC      aarch64-softmmu/hw/vfio/calxeda-xgmac.o
  CC      aarch64-softmmu/hw/vfio/amd-xgbe.o
  CC      aarch64-softmmu/hw/vfio/spapr.o
  CC      aarch64-softmmu/hw/virtio/virtio.o
  CC      aarch64-softmmu/hw/virtio/virtio-balloon.o
  CC      aarch64-softmmu/hw/virtio/vhost.o
  CC      x86_64-softmmu/target/i386/helper.o
  CC      x86_64-softmmu/target/i386/cpu.o
  CC      aarch64-softmmu/hw/virtio/vhost-backend.o
  CC      x86_64-softmmu/target/i386/gdbstub.o
  CC      x86_64-softmmu/target/i386/xsave_helper.o
  CC      aarch64-softmmu/hw/virtio/vhost-user.o
  CC      x86_64-softmmu/target/i386/translate.o
  CC      x86_64-softmmu/target/i386/bpt_helper.o
  CC      aarch64-softmmu/hw/virtio/vhost-vsock.o
  CC      aarch64-softmmu/hw/virtio/virtio-crypto.o
  CC      x86_64-softmmu/target/i386/cc_helper.o
  CC      aarch64-softmmu/hw/virtio/virtio-crypto-pci.o
  CC      aarch64-softmmu/hw/arm/boot.o
  CC      x86_64-softmmu/target/i386/excp_helper.o
  CC      aarch64-softmmu/hw/arm/collie.o
  CC      aarch64-softmmu/hw/arm/exynos4_boards.o
  CC      x86_64-softmmu/target/i386/fpu_helper.o
  CC      aarch64-softmmu/hw/arm/gumstix.o
  CC      aarch64-softmmu/hw/arm/highbank.o
  CC      aarch64-softmmu/hw/arm/digic_boards.o
  CC      aarch64-softmmu/hw/arm/integratorcp.o
  CC      x86_64-softmmu/target/i386/int_helper.o
  CC      aarch64-softmmu/hw/arm/mainstone.o
  CC      aarch64-softmmu/hw/arm/musicpal.o
  CC      aarch64-softmmu/hw/arm/nseries.o
  CC      aarch64-softmmu/hw/arm/omap_sx1.o
  CC      aarch64-softmmu/hw/arm/palm.o
  CC      aarch64-softmmu/hw/arm/realview.o
  CC      x86_64-softmmu/target/i386/mem_helper.o
  CC      aarch64-softmmu/hw/arm/spitz.o
  CC      aarch64-softmmu/hw/arm/stellaris.o
  CC      aarch64-softmmu/hw/arm/tosa.o
  CC      x86_64-softmmu/target/i386/misc_helper.o
  CC      aarch64-softmmu/hw/arm/versatilepb.o
  CC      aarch64-softmmu/hw/arm/vexpress.o
  CC      aarch64-softmmu/hw/arm/virt.o
  CC      x86_64-softmmu/target/i386/mpx_helper.o
  CC      aarch64-softmmu/hw/arm/xilinx_zynq.o
  CC      aarch64-softmmu/hw/arm/z2.o
  CC      aarch64-softmmu/hw/arm/virt-acpi-build.o
  CC      aarch64-softmmu/hw/arm/netduino2.o
  CC      aarch64-softmmu/hw/arm/sysbus-fdt.o
  CC      aarch64-softmmu/hw/arm/armv7m.o
  CC      x86_64-softmmu/target/i386/seg_helper.o
  CC      aarch64-softmmu/hw/arm/exynos4210.o
  CC      aarch64-softmmu/hw/arm/pxa2xx.o
  CC      aarch64-softmmu/hw/arm/pxa2xx_gpio.o
  CC      aarch64-softmmu/hw/arm/pxa2xx_pic.o
  CC      aarch64-softmmu/hw/arm/digic.o
  CC      aarch64-softmmu/hw/arm/omap1.o
  CC      aarch64-softmmu/hw/arm/omap2.o
  CC      aarch64-softmmu/hw/arm/strongarm.o
  CC      aarch64-softmmu/hw/arm/allwinner-a10.o
  CC      aarch64-softmmu/hw/arm/cubieboard.o
  CC      aarch64-softmmu/hw/arm/bcm2835_peripherals.o
  CC      x86_64-softmmu/target/i386/smm_helper.o
  CC      aarch64-softmmu/hw/arm/bcm2836.o
  CC      aarch64-softmmu/hw/arm/raspi.o
  CC      aarch64-softmmu/hw/arm/stm32f205_soc.o
  CC      x86_64-softmmu/target/i386/svm_helper.o
  CC      x86_64-softmmu/target/i386/machine.o
  CC      aarch64-softmmu/hw/arm/xlnx-zynqmp.o
  CC      aarch64-softmmu/hw/arm/xlnx-ep108.o
  CC      aarch64-softmmu/hw/arm/fsl-imx25.o
  CC      aarch64-softmmu/hw/arm/imx25_pdk.o
  CC      x86_64-softmmu/target/i386/arch_memory_mapping.o
  CC      aarch64-softmmu/hw/arm/fsl-imx31.o
  CC      aarch64-softmmu/hw/arm/kzm.o
  CC      x86_64-softmmu/target/i386/arch_dump.o
  CC      aarch64-softmmu/hw/arm/fsl-imx6.o
  CC      aarch64-softmmu/hw/arm/sabrelite.o
  CC      x86_64-softmmu/target/i386/monitor.o
  CC      aarch64-softmmu/hw/arm/aspeed_soc.o
  CC      aarch64-softmmu/hw/arm/aspeed.o
  CC      aarch64-softmmu/hw/arm/mps2.o
  CC      x86_64-softmmu/target/i386/kvm.o
  CC      aarch64-softmmu/target/arm/arm-semi.o
  CC      aarch64-softmmu/target/arm/machine.o
  CC      aarch64-softmmu/target/arm/psci.o
  CC      x86_64-softmmu/target/i386/hyperv.o
  CC      aarch64-softmmu/target/arm/arch_dump.o
  GEN     trace/generated-helpers.c
  CC      x86_64-softmmu/trace/control-target.o
  CC      aarch64-softmmu/target/arm/monitor.o
  CC      aarch64-softmmu/target/arm/kvm-stub.o
  CC      aarch64-softmmu/target/arm/translate.o
  CC      aarch64-softmmu/target/arm/op_helper.o
  CC      x86_64-softmmu/gdbstub-xml.o
  CC      x86_64-softmmu/trace/generated-helpers.o
  CC      aarch64-softmmu/target/arm/helper.o
  CC      aarch64-softmmu/target/arm/cpu.o
  CC      aarch64-softmmu/target/arm/neon_helper.o
  CC      aarch64-softmmu/target/arm/iwmmxt_helper.o
  CC      aarch64-softmmu/target/arm/gdbstub.o
  CC      aarch64-softmmu/target/arm/cpu64.o
  LINK    x86_64-softmmu/qemu-system-x86_64
  CC      aarch64-softmmu/target/arm/translate-a64.o
  CC      aarch64-softmmu/target/arm/helper-a64.o
  CC      aarch64-softmmu/target/arm/gdbstub64.o
  CC      aarch64-softmmu/target/arm/crypto_helper.o
  CC      aarch64-softmmu/target/arm/arm-powerctl.o
  GEN     trace/generated-helpers.c
  CC      aarch64-softmmu/trace/control-target.o
  CC      aarch64-softmmu/gdbstub-xml.o
  CC      aarch64-softmmu/trace/generated-helpers.o
/tmp/qemu-test/src/target/arm/translate-a64.c: In function ‘handle_shri_with_rndacc’:
/tmp/qemu-test/src/target/arm/translate-a64.c:6372: warning: ‘tcg_src_hi’ may be used uninitialized in this function
/tmp/qemu-test/src/target/arm/translate-a64.c: In function ‘disas_simd_scalar_two_reg_misc’:
/tmp/qemu-test/src/target/arm/translate-a64.c:8099: warning: ‘rmode’ may be used uninitialized in this function
  LINK    aarch64-softmmu/qemu-system-aarch64
  TEST    tests/qapi-schema/alternate-any.out
  TEST    tests/qapi-schema/alternate-array.out
  TEST    tests/qapi-schema/alternate-base.out
  TEST    tests/qapi-schema/alternate-clash.out
  TEST    tests/qapi-schema/alternate-conflict-dict.out
  TEST    tests/qapi-schema/alternate-conflict-enum-bool.out
  TEST    tests/qapi-schema/alternate-conflict-enum-int.out
  TEST    tests/qapi-schema/alternate-conflict-string.out
  TEST    tests/qapi-schema/alternate-empty.out
  TEST    tests/qapi-schema/alternate-nested.out
  TEST    tests/qapi-schema/alternate-unknown.out
  TEST    tests/qapi-schema/args-alternate.out
  TEST    tests/qapi-schema/args-any.out
  TEST    tests/qapi-schema/args-array-unknown.out
  TEST    tests/qapi-schema/args-bad-boxed.out
  TEST    tests/qapi-schema/args-array-empty.out
  TEST    tests/qapi-schema/args-boxed-anon.out
  TEST    tests/qapi-schema/args-boxed-empty.out
  TEST    tests/qapi-schema/args-boxed-string.out
  TEST    tests/qapi-schema/args-invalid.out
  TEST    tests/qapi-schema/args-member-array-bad.out
  TEST    tests/qapi-schema/args-int.out
  TEST    tests/qapi-schema/args-member-case.out
  TEST    tests/qapi-schema/args-member-unknown.out
  TEST    tests/qapi-schema/args-name-clash.out
  TEST    tests/qapi-schema/args-unknown.out
  TEST    tests/qapi-schema/args-union.out
  TEST    tests/qapi-schema/bad-data.out
  TEST    tests/qapi-schema/bad-base.out
  TEST    tests/qapi-schema/bad-ident.out
  TEST    tests/qapi-schema/bad-type-bool.out
  TEST    tests/qapi-schema/bad-type-dict.out
  TEST    tests/qapi-schema/bad-type-int.out
  TEST    tests/qapi-schema/base-cycle-direct.out
  TEST    tests/qapi-schema/base-cycle-indirect.out
  TEST    tests/qapi-schema/command-int.out
  TEST    tests/qapi-schema/comments.out
  TEST    tests/qapi-schema/doc-bad-alternate-member.out
  TEST    tests/qapi-schema/doc-bad-command-arg.out
  TEST    tests/qapi-schema/doc-bad-symbol.out
  TEST    tests/qapi-schema/doc-bad-union-member.out
  TEST    tests/qapi-schema/doc-before-include.out
  TEST    tests/qapi-schema/doc-before-pragma.out
  TEST    tests/qapi-schema/doc-duplicated-arg.out
  TEST    tests/qapi-schema/doc-duplicated-return.out
  TEST    tests/qapi-schema/doc-duplicated-since.out
  TEST    tests/qapi-schema/doc-empty-arg.out
  TEST    tests/qapi-schema/doc-empty-section.out
  TEST    tests/qapi-schema/doc-empty-symbol.out
  TEST    tests/qapi-schema/doc-good.out
  TEST    tests/qapi-schema/doc-interleaved-section.out
  TEST    tests/qapi-schema/doc-invalid-end.out
  TEST    tests/qapi-schema/doc-invalid-end2.out
  TEST    tests/qapi-schema/doc-invalid-return.out
  TEST    tests/qapi-schema/doc-invalid-section.out
  TEST    tests/qapi-schema/doc-invalid-start.out
  TEST    tests/qapi-schema/doc-missing.out
  TEST    tests/qapi-schema/doc-missing-colon.out
  TEST    tests/qapi-schema/doc-missing-expr.out
  TEST    tests/qapi-schema/doc-no-symbol.out
  TEST    tests/qapi-schema/doc-missing-space.out
  TEST    tests/qapi-schema/double-data.out
  TEST    tests/qapi-schema/double-type.out
  TEST    tests/qapi-schema/duplicate-key.out
  TEST    tests/qapi-schema/empty.out
  TEST    tests/qapi-schema/enum-bad-name.out
  TEST    tests/qapi-schema/enum-bad-prefix.out
  TEST    tests/qapi-schema/enum-clash-member.out
  TEST    tests/qapi-schema/enum-dict-member.out
  TEST    tests/qapi-schema/enum-int-member.out
  TEST    tests/qapi-schema/enum-member-case.out
  TEST    tests/qapi-schema/enum-missing-data.out
  TEST    tests/qapi-schema/enum-wrong-data.out
  TEST    tests/qapi-schema/escape-outside-string.out
  TEST    tests/qapi-schema/escape-too-big.out
  TEST    tests/qapi-schema/escape-too-short.out
  TEST    tests/qapi-schema/event-boxed-empty.out
  TEST    tests/qapi-schema/event-case.out
  TEST    tests/qapi-schema/event-nest-struct.out
  TEST    tests/qapi-schema/flat-union-array-branch.out
  TEST    tests/qapi-schema/flat-union-bad-base.out
  TEST    tests/qapi-schema/flat-union-bad-discriminator.out
  TEST    tests/qapi-schema/flat-union-base-any.out
  TEST    tests/qapi-schema/flat-union-base-union.out
  TEST    tests/qapi-schema/flat-union-clash-member.out
  TEST    tests/qapi-schema/flat-union-empty.out
  TEST    tests/qapi-schema/flat-union-incomplete-branch.out
  TEST    tests/qapi-schema/flat-union-inline.out
  TEST    tests/qapi-schema/flat-union-int-branch.out
  TEST    tests/qapi-schema/flat-union-invalid-branch-key.out
  TEST    tests/qapi-schema/flat-union-invalid-discriminator.out
  TEST    tests/qapi-schema/flat-union-no-base.out
  TEST    tests/qapi-schema/flat-union-optional-discriminator.out
  TEST    tests/qapi-schema/flat-union-string-discriminator.out
  TEST    tests/qapi-schema/funny-char.out
  TEST    tests/qapi-schema/ident-with-escape.out
  TEST    tests/qapi-schema/include-before-err.out
  TEST    tests/qapi-schema/include-cycle.out
  TEST    tests/qapi-schema/include-extra-junk.out
  TEST    tests/qapi-schema/include-format-err.out
  TEST    tests/qapi-schema/include-nested-err.out
  TEST    tests/qapi-schema/include-no-file.out
  TEST    tests/qapi-schema/include-non-file.out
  TEST    tests/qapi-schema/include-relpath.out
  TEST    tests/qapi-schema/include-repetition.out
  TEST    tests/qapi-schema/include-self-cycle.out
  TEST    tests/qapi-schema/include-simple.out
  TEST    tests/qapi-schema/indented-expr.out
  TEST    tests/qapi-schema/leading-comma-list.out
  TEST    tests/qapi-schema/leading-comma-object.out
  TEST    tests/qapi-schema/missing-colon.out
  TEST    tests/qapi-schema/missing-comma-list.out
  TEST    tests/qapi-schema/missing-comma-object.out
  TEST    tests/qapi-schema/missing-type.out
  TEST    tests/qapi-schema/nested-struct-data.out
  TEST    tests/qapi-schema/non-objects.out
  TEST    tests/qapi-schema/pragma-doc-required-crap.out
  TEST    tests/qapi-schema/pragma-extra-junk.out
  TEST    tests/qapi-schema/pragma-name-case-whitelist-crap.out
  TEST    tests/qapi-schema/pragma-non-dict.out
  TEST    tests/qapi-schema/pragma-returns-whitelist-crap.out
  TEST    tests/qapi-schema/qapi-schema-test.out
  TEST    tests/qapi-schema/quoted-structural-chars.out
  TEST    tests/qapi-schema/redefined-builtin.out
  TEST    tests/qapi-schema/redefined-command.out
  TEST    tests/qapi-schema/redefined-event.out
  TEST    tests/qapi-schema/redefined-type.out
  TEST    tests/qapi-schema/reserved-command-q.out
  TEST    tests/qapi-schema/reserved-enum-q.out
  TEST    tests/qapi-schema/reserved-member-has.out
  TEST    tests/qapi-schema/reserved-member-q.out
  TEST    tests/qapi-schema/reserved-member-u.out
  TEST    tests/qapi-schema/reserved-member-underscore.out
  TEST    tests/qapi-schema/reserved-type-kind.out
  TEST    tests/qapi-schema/reserved-type-list.out
  TEST    tests/qapi-schema/returns-alternate.out
  TEST    tests/qapi-schema/returns-array-bad.out
  TEST    tests/qapi-schema/returns-dict.out
  TEST    tests/qapi-schema/returns-unknown.out
  TEST    tests/qapi-schema/returns-whitelist.out
  TEST    tests/qapi-schema/struct-base-clash-deep.out
  TEST    tests/qapi-schema/struct-base-clash.out
  TEST    tests/qapi-schema/struct-data-invalid.out
  TEST    tests/qapi-schema/struct-member-invalid.out
  TEST    tests/qapi-schema/trailing-comma-list.out
  TEST    tests/qapi-schema/trailing-comma-object.out
  TEST    tests/qapi-schema/type-bypass-bad-gen.out
  TEST    tests/qapi-schema/unclosed-list.out
  TEST    tests/qapi-schema/unclosed-object.out
  TEST    tests/qapi-schema/unclosed-string.out
  TEST    tests/qapi-schema/unicode-str.out
  TEST    tests/qapi-schema/union-base-empty.out
  TEST    tests/qapi-schema/union-base-no-discriminator.out
  TEST    tests/qapi-schema/union-branch-case.out
  TEST    tests/qapi-schema/union-clash-branches.out
  TEST    tests/qapi-schema/union-empty.out
  TEST    tests/qapi-schema/union-invalid-base.out
  TEST    tests/qapi-schema/union-optional-branch.out
  TEST    tests/qapi-schema/union-unknown.out
  TEST    tests/qapi-schema/unknown-escape.out
  TEST    tests/qapi-schema/unknown-expr-key.out
  GEN     tests/qapi-schema/doc-good.test.texi
  CC      tests/check-qdict.o
  CC      tests/test-char.o
  CC      tests/check-qnum.o
  CC      tests/check-qstring.o
  CC      tests/check-qlist.o
  CC      tests/check-qnull.o
  CC      tests/check-qjson.o
  CC      tests/test-qobject-output-visitor.o
  GEN     tests/test-qapi-visit.c
  GEN     tests/test-qapi-types.c
  GEN     tests/test-qapi-event.c
  GEN     tests/test-qmp-introspect.c
  CC      tests/test-clone-visitor.o
  CC      tests/test-qobject-input-visitor.o
  CC      tests/test-qmp-commands.o
  GEN     tests/test-qmp-marshal.c
  CC      tests/test-string-input-visitor.o
  CC      tests/test-string-output-visitor.o
  CC      tests/test-qmp-event.o
  CC      tests/test-opts-visitor.o
  CC      tests/test-coroutine.o
  CC      tests/iothread.o
  CC      tests/test-visitor-serialization.o
  CC      tests/test-iov.o
  CC      tests/test-aio.o
  CC      tests/test-aio-multithread.o
  CC      tests/test-throttle.o
  CC      tests/test-thread-pool.o
  CC      tests/test-hbitmap.o
  CC      tests/test-blockjob.o
  CC      tests/test-blockjob-txn.o
  CC      tests/test-x86-cpuid.o
  CC      tests/test-xbzrle.o
  CC      tests/test-vmstate.o
  CC      tests/test-cutils.o
  CC      tests/test-shift128.o
  CC      tests/test-mul64.o
  CC      tests/test-int128.o
  CC      tests/rcutorture.o
/tmp/qemu-test/src/tests/test-int128.c:180: warning: ‘__noclone__’ attribute directive ignored
  CC      tests/test-rcu-list.o
  CC      tests/test-qdist.o
  CC      tests/test-qht.o
  CC      tests/test-qht-par.o
  CC      tests/qht-bench.o
  CC      tests/test-bitops.o
  CC      tests/test-bitcnt.o
  CC      tests/check-qom-interface.o
  CC      tests/check-qom-proplist.o
  CC      tests/test-qemu-opts.o
  CC      tests/test-keyval.o
  CC      tests/test-write-threshold.o
  CC      tests/test-crypto-hash.o
  CC      tests/test-crypto-hmac.o
  CC      tests/test-crypto-cipher.o
  CC      tests/test-crypto-secret.o
  CC      tests/test-qga.o
  CC      tests/libqtest.o
  CC      tests/test-io-task.o
  CC      tests/test-timed-average.o
  CC      tests/test-io-channel-socket.o
  CC      tests/io-channel-helpers.o
  CC      tests/test-io-channel-file.o
  CC      tests/test-io-channel-command.o
  CC      tests/test-io-channel-buffer.o
  CC      tests/test-base64.o
  CC      tests/test-crypto-ivgen.o
  CC      tests/test-crypto-afsplit.o
  CC      tests/test-crypto-xts.o
  CC      tests/test-crypto-block.o
  CC      tests/test-logging.o
  CC      tests/test-replication.o
  CC      tests/test-bufferiszero.o
  CC      tests/test-uuid.o
  CC      tests/ptimer-test.o
  CC      tests/ptimer-test-stubs.o
  CC      tests/test-qapi-util.o
  CC      tests/vhost-user-test.o
  CC      tests/libqos/pci.o
  CC      tests/libqos/fw_cfg.o
  CC      tests/libqos/malloc.o
  CC      tests/libqos/i2c.o
  CC      tests/libqos/libqos.o
  CC      tests/libqos/malloc-spapr.o
  CC      tests/libqos/libqos-spapr.o
  CC      tests/libqos/rtas.o
  CC      tests/libqos/pci-spapr.o
  CC      tests/libqos/pci-pc.o
  CC      tests/libqos/malloc-pc.o
  CC      tests/libqos/libqos-pc.o
  CC      tests/libqos/ahci.o
  CC      tests/libqos/virtio.o
  CC      tests/libqos/virtio-pci.o
  CC      tests/libqos/virtio-mmio.o
  CC      tests/libqos/malloc-generic.o
  CC      tests/endianness-test.o
  CC      tests/fdc-test.o
  CC      tests/ide-test.o
  CC      tests/ahci-test.o
  CC      tests/hd-geo-test.o
  CC      tests/boot-order-test.o
  CC      tests/bios-tables-test.o
  CC      tests/boot-sector.o
  CC      tests/acpi-utils.o
  CC      tests/boot-serial-test.o
  CC      tests/pxe-test.o
  CC      tests/rtc-test.o
  CC      tests/ipmi-kcs-test.o
  CC      tests/ipmi-bt-test.o
  CC      tests/i440fx-test.o
  CC      tests/fw_cfg-test.o
  CC      tests/drive_del-test.o
  CC      tests/wdt_ib700-test.o
  CC      tests/tco-test.o
  CC      tests/e1000-test.o
  CC      tests/e1000e-test.o
  CC      tests/rtl8139-test.o
  CC      tests/pcnet-test.o
  CC      tests/eepro100-test.o
  CC      tests/ne2000-test.o
  CC      tests/nvme-test.o
  CC      tests/ac97-test.o
  CC      tests/es1370-test.o
  CC      tests/virtio-net-test.o
  CC      tests/virtio-balloon-test.o
  CC      tests/virtio-blk-test.o
  CC      tests/virtio-rng-test.o
  CC      tests/virtio-scsi-test.o
  CC      tests/virtio-serial-test.o
  CC      tests/virtio-console-test.o
  CC      tests/tpci200-test.o
  CC      tests/ipoctal232-test.o
  CC      tests/display-vga-test.o
  CC      tests/intel-hda-test.o
  CC      tests/ivshmem-test.o
  CC      tests/megasas-test.o
  CC      tests/vmxnet3-test.o
  CC      tests/pvpanic-test.o
  CC      tests/i82801b11-test.o
  CC      tests/ioh3420-test.o
  CC      tests/usb-hcd-ohci-test.o
  CC      tests/libqos/usb.o
  CC      tests/usb-hcd-uhci-test.o
  CC      tests/usb-hcd-ehci-test.o
  CC      tests/usb-hcd-xhci-test.o
  CC      tests/pc-cpu-test.o
  CC      tests/q35-test.o
  CC      tests/vmgenid-test.o
  CC      tests/test-netfilter.o
  CC      tests/test-filter-mirror.o
  CC      tests/test-filter-redirector.o
  CC      tests/postcopy-test.o
  CC      tests/test-x86-cpuid-compat.o
  CC      tests/numa-test.o
  CC      tests/qmp-test.o
  CC      tests/device-introspect-test.o
  CC      tests/qom-test.o
  CC      tests/test-hmp.o
  LINK    tests/check-qdict
  LINK    tests/test-char
  LINK    tests/check-qnum
  LINK    tests/check-qstring
  LINK    tests/check-qlist
  LINK    tests/check-qnull
  LINK    tests/check-qjson
  CC      tests/test-qapi-types.o
  CC      tests/test-qapi-event.o
  CC      tests/test-qmp-introspect.o
  CC      tests/test-qapi-visit.o
  CC      tests/test-qmp-marshal.o
  LINK    tests/test-coroutine
  LINK    tests/test-iov
  LINK    tests/test-aio
  LINK    tests/test-aio-multithread
  LINK    tests/test-throttle
  LINK    tests/test-thread-pool
  LINK    tests/test-hbitmap
  LINK    tests/test-blockjob
  LINK    tests/test-blockjob-txn
  LINK    tests/test-x86-cpuid
  LINK    tests/test-xbzrle
  LINK    tests/test-vmstate
  LINK    tests/test-cutils
  LINK    tests/test-shift128
  LINK    tests/test-mul64
  LINK    tests/test-int128
  LINK    tests/rcutorture
  LINK    tests/test-rcu-list
  LINK    tests/test-qdist
  LINK    tests/test-qht
  LINK    tests/qht-bench
  LINK    tests/test-bitops
  LINK    tests/test-bitcnt
  LINK    tests/check-qom-interface
  LINK    tests/check-qom-proplist
  LINK    tests/test-qemu-opts
  LINK    tests/test-keyval
  LINK    tests/test-write-threshold
  LINK    tests/test-crypto-hash
  LINK    tests/test-crypto-hmac
  LINK    tests/test-crypto-cipher
  LINK    tests/test-crypto-secret
  LINK    tests/test-qga
  LINK    tests/test-timed-average
  LINK    tests/test-io-task
  LINK    tests/test-io-channel-socket
  LINK    tests/test-io-channel-file
  LINK    tests/test-io-channel-command
  LINK    tests/test-io-channel-buffer
  LINK    tests/test-base64
  LINK    tests/test-crypto-ivgen
  LINK    tests/test-crypto-afsplit
  LINK    tests/test-crypto-xts
  LINK    tests/test-crypto-block
  LINK    tests/test-logging
  LINK    tests/test-replication
  LINK    tests/test-bufferiszero
  LINK    tests/test-uuid
  LINK    tests/ptimer-test
  LINK    tests/test-qapi-util
  LINK    tests/vhost-user-test
  LINK    tests/endianness-test
  LINK    tests/fdc-test
  LINK    tests/ide-test
  LINK    tests/ahci-test
  LINK    tests/hd-geo-test
  LINK    tests/boot-order-test
  LINK    tests/bios-tables-test
  LINK    tests/boot-serial-test
  LINK    tests/pxe-test
  LINK    tests/rtc-test
  LINK    tests/ipmi-kcs-test
  LINK    tests/ipmi-bt-test
  LINK    tests/i440fx-test
  LINK    tests/fw_cfg-test
  LINK    tests/drive_del-test
  LINK    tests/wdt_ib700-test
  LINK    tests/tco-test
  LINK    tests/e1000-test
  LINK    tests/e1000e-test
  LINK    tests/rtl8139-test
  LINK    tests/pcnet-test
  LINK    tests/eepro100-test
  LINK    tests/ne2000-test
  LINK    tests/nvme-test
  LINK    tests/ac97-test
  LINK    tests/es1370-test
  LINK    tests/virtio-net-test
  LINK    tests/virtio-balloon-test
  LINK    tests/virtio-blk-test
  LINK    tests/virtio-rng-test
  LINK    tests/virtio-scsi-test
  LINK    tests/virtio-serial-test
  LINK    tests/virtio-console-test
  LINK    tests/tpci200-test
  LINK    tests/ipoctal232-test
  LINK    tests/display-vga-test
  LINK    tests/intel-hda-test
  LINK    tests/ivshmem-test
  LINK    tests/megasas-test
  LINK    tests/vmxnet3-test
  LINK    tests/pvpanic-test
  LINK    tests/i82801b11-test
  LINK    tests/ioh3420-test
  LINK    tests/usb-hcd-ohci-test
  LINK    tests/usb-hcd-uhci-test
  LINK    tests/usb-hcd-ehci-test
  LINK    tests/usb-hcd-xhci-test
  LINK    tests/pc-cpu-test
  LINK    tests/q35-test
  LINK    tests/vmgenid-test
  LINK    tests/test-netfilter
  LINK    tests/test-filter-mirror
  LINK    tests/test-filter-redirector
  LINK    tests/postcopy-test
  LINK    tests/test-x86-cpuid-compat
  LINK    tests/numa-test
  LINK    tests/qmp-test
  LINK    tests/device-introspect-test
  LINK    tests/qom-test
  LINK    tests/test-hmp
  GTESTER tests/check-qdict
  GTESTER tests/check-qnum
  GTESTER tests/check-qstring
  GTESTER tests/test-char
  GTESTER tests/check-qlist
  GTESTER tests/check-qnull
  GTESTER tests/check-qjson
  LINK    tests/test-qobject-output-visitor
  LINK    tests/test-clone-visitor
  LINK    tests/test-qobject-input-visitor
  LINK    tests/test-qmp-commands
  LINK    tests/test-string-input-visitor
  LINK    tests/test-string-output-visitor
  LINK    tests/test-qmp-event
  GTESTER tests/test-coroutine
  LINK    tests/test-opts-visitor
  LINK    tests/test-visitor-serialization
  GTESTER tests/test-iov
  GTESTER tests/test-aio
  GTESTER tests/test-throttle
  GTESTER tests/test-aio-multithread
  GTESTER tests/test-thread-pool
  GTESTER tests/test-hbitmap
  GTESTER tests/test-blockjob
  GTESTER tests/test-blockjob-txn
  GTESTER tests/test-x86-cpuid
  GTESTER tests/test-xbzrle
  GTESTER tests/test-vmstate
Failed to load simple/primitive:b_1
Failed to load simple/primitive:i64_2
Failed to load simple/primitive:i32_1
Failed to load simple/primitive:i32_1
Failed to load test/with_tmp:a
Failed to load test/tmp_child_parent:f
Failed to load test/tmp_child:parent
Failed to load test/with_tmp:tmp
Failed to load test/tmp_child:diff
Failed to load test/with_tmp:tmp
Failed to load test/tmp_child:diff
Failed to load test/with_tmp:tmp
  GTESTER tests/test-cutils
  GTESTER tests/test-shift128
  GTESTER tests/test-mul64
  GTESTER tests/test-int128
  GTESTER tests/rcutorture
  GTESTER tests/test-rcu-list
  GTESTER tests/test-qdist
  GTESTER tests/test-qht
  LINK    tests/test-qht-par
  GTESTER tests/test-bitops
  GTESTER tests/test-bitcnt
  GTESTER tests/check-qom-interface
  GTESTER tests/check-qom-proplist
  GTESTER tests/test-qemu-opts
  GTESTER tests/test-keyval
  GTESTER tests/test-write-threshold
  GTESTER tests/test-crypto-hash
  GTESTER tests/test-crypto-hmac
  GTESTER tests/test-crypto-cipher
  GTESTER tests/test-crypto-secret
  GTESTER tests/test-qga
  GTESTER tests/test-timed-average
  GTESTER tests/test-io-task
  GTESTER tests/test-io-channel-socket
  GTESTER tests/test-io-channel-file
  GTESTER tests/test-io-channel-command
  GTESTER tests/test-io-channel-buffer
  GTESTER tests/test-base64
  GTESTER tests/test-crypto-ivgen
  GTESTER tests/test-crypto-afsplit
  GTESTER tests/test-crypto-xts
  GTESTER tests/test-crypto-block
  GTESTER tests/test-logging
  GTESTER tests/test-replication
  GTESTER tests/test-bufferiszero
  GTESTER tests/test-uuid
  GTESTER tests/ptimer-test
  GTESTER tests/test-qapi-util
  GTESTER check-qtest-x86_64
  GTESTER check-qtest-aarch64
  GTESTER tests/test-qobject-output-visitor
  GTESTER tests/test-clone-visitor
  GTESTER tests/test-qobject-input-visitor
  GTESTER tests/test-qmp-commands
  GTESTER tests/test-string-input-visitor
  GTESTER tests/test-string-output-visitor
  GTESTER tests/test-qmp-event
  GTESTER tests/test-opts-visitor
  GTESTER tests/test-visitor-serialization
  GTESTER tests/test-qht-par
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
make[1]: Leaving directory '/var/tmp/patchew-tester-tmp-lk2eywix/src'

real	9m43.149s
user	0m5.425s
sys	0m2.026s
  BUILD   min-glib
make[1]: Entering directory '/var/tmp/patchew-tester-tmp-lk2eywix/src'
  ARCHIVE qemu.tgz
  ARCHIVE dtc.tgz
  COPY    RUNNER
    RUN test-build in qemu:min-glib 
Environment variables:
HOSTNAME=77736f9d9d35
TERM=xterm
MAKEFLAGS= -j8
HISTSIZE=1000
J=8
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
MAIL=/var/spool/mail/root
PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
LANG=en_US.UTF-8
TARGET_LIST=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
FEATURES= dtc
DEBUG=
G_BROKEN_FILENAMES=1
CCACHE_HASHDIR=
_=/usr/bin/env

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/var/tmp/qemu-build/install
No C++ compiler available; disabling C++ specific optional code
Install prefix    /var/tmp/qemu-build/install
BIOS directory    /var/tmp/qemu-build/install/share/qemu
binary directory  /var/tmp/qemu-build/install/bin
library directory /var/tmp/qemu-build/install/lib
module directory  /var/tmp/qemu-build/install/lib/qemu
libexec directory /var/tmp/qemu-build/install/libexec
include directory /var/tmp/qemu-build/install/include
config directory  /var/tmp/qemu-build/install/etc
local state directory   /var/tmp/qemu-build/install/var
Manual directory  /var/tmp/qemu-build/install/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path       /tmp/qemu-test/src
C compiler        cc
Host C compiler   cc
C++ compiler      
Objective-C compiler cc
ARFLAGS           rv
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g 
QEMU_CFLAGS       -I/usr/include/pixman-1   -I$(SRC_PATH)/dtc/libfdt -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all
LDFLAGS           -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
pixman            system
SDL support       yes (1.2.14)
GTK support       no 
GTK GL support    no
VTE support       no 
TLS priority      NORMAL
GNUTLS support    no
GNUTLS rnd        no
libgcrypt         no
libgcrypt kdf     no
nettle            no 
nettle kdf        no
libtasn1          no
curses support    no
virgl support     no
curl support      no
mingw32 support   no
Audio drivers     oss
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  no
VNC JPEG support  no
VNC PNG support   no
xen support       no
brlapi support    no
bluez  support    no
Documentation     no
PIE               yes
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
HAX support       no
TCG support       yes
TCG debug enabled no
TCG interpreter   no
RDMA support      no
fdt support       yes
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
vhost-vsock support yes
vhost-user support yes
Trace backends    log
spice support     no 
rbd support       no
xfsctl support    no
smartcard support no
libusb            no
usb net redir     no
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no
build guest agent yes
QGA VSS support   no
QGA w32 disk info no
QGA MSI support   no
seccomp support   no
coroutine backend ucontext
coroutine pool    yes
debug stack usage no
crypto afalg      no
GlusterFS support no
gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   no
TPM passthrough   yes
QOM debugging     yes
Live block migration yes
lzo support       no
snappy support    no
bzip2 support     no
NUMA host support no
tcmalloc support  no
jemalloc support  no
avx2 optimization no
replication support yes
VxHS block device no
mkdir -p dtc/libfdt
mkdir -p dtc/tests
  GEN     x86_64-softmmu/config-devices.mak.tmp
  GEN     aarch64-softmmu/config-devices.mak.tmp
  GEN     qmp-commands.h
  GEN     config-host.h
  GEN     qemu-options.def
  GEN     qapi-types.h
  GEN     qapi-visit.h
  GEN     qapi-event.h
  GEN     aarch64-softmmu/config-devices.mak
  GEN     x86_64-softmmu/config-devices.mak
  GEN     qmp-marshal.c
  GEN     qapi-types.c
  GEN     qapi-visit.c
  GEN     qapi-event.c
  GEN     qmp-introspect.h
  GEN     qmp-introspect.c
  GEN     trace/generated-tcg-tracers.h
  GEN     trace/generated-helpers-wrappers.h
  GEN     trace/generated-helpers.h
  GEN     trace/generated-helpers.c
  GEN     module_block.h
  GEN     tests/test-qapi-types.h
  GEN     tests/test-qapi-visit.h
  GEN     tests/test-qmp-commands.h
  GEN     tests/test-qapi-event.h
  GEN     tests/test-qmp-introspect.h
  GEN     trace-root.h
  GEN     util/trace.h
  GEN     crypto/trace.h
  GEN     io/trace.h
  GEN     migration/trace.h
  GEN     block/trace.h
  GEN     chardev/trace.h
  GEN     hw/block/trace.h
  GEN     hw/block/dataplane/trace.h
  GEN     hw/char/trace.h
  GEN     hw/intc/trace.h
  GEN     hw/net/trace.h
  GEN     hw/virtio/trace.h
  GEN     hw/audio/trace.h
  GEN     hw/misc/trace.h
  GEN     hw/usb/trace.h
  GEN     hw/scsi/trace.h
  GEN     hw/nvram/trace.h
  GEN     hw/display/trace.h
  GEN     hw/input/trace.h
  GEN     hw/timer/trace.h
  GEN     hw/dma/trace.h
  GEN     hw/sparc/trace.h
  GEN     hw/sd/trace.h
  GEN     hw/isa/trace.h
  GEN     hw/mem/trace.h
  GEN     hw/i386/trace.h
  GEN     hw/i386/xen/trace.h
  GEN     hw/9pfs/trace.h
  GEN     hw/ppc/trace.h
  GEN     hw/pci/trace.h
  GEN     hw/s390x/trace.h
  GEN     hw/vfio/trace.h
  GEN     hw/acpi/trace.h
  GEN     hw/arm/trace.h
  GEN     hw/alpha/trace.h
  GEN     hw/xen/trace.h
  GEN     ui/trace.h
  GEN     audio/trace.h
  GEN     net/trace.h
  GEN     target/arm/trace.h
  GEN     target/i386/trace.h
  GEN     target/mips/trace.h
  GEN     target/sparc/trace.h
  GEN     target/s390x/trace.h
  GEN     target/ppc/trace.h
  GEN     qom/trace.h
  GEN     linux-user/trace.h
  GEN     qapi/trace.h
  GEN     accel/tcg/trace.h
  GEN     accel/kvm/trace.h
  GEN     nbd/trace.h
  GEN     trace-root.c
  GEN     util/trace.c
  GEN     crypto/trace.c
  GEN     io/trace.c
  GEN     migration/trace.c
  GEN     block/trace.c
  GEN     chardev/trace.c
  GEN     hw/block/trace.c
  GEN     hw/block/dataplane/trace.c
  GEN     hw/char/trace.c
  GEN     hw/intc/trace.c
  GEN     hw/net/trace.c
  GEN     hw/virtio/trace.c
  GEN     hw/audio/trace.c
  GEN     hw/misc/trace.c
  GEN     hw/usb/trace.c
  GEN     hw/scsi/trace.c
  GEN     hw/nvram/trace.c
  GEN     hw/display/trace.c
  GEN     hw/input/trace.c
  GEN     hw/timer/trace.c
  GEN     hw/dma/trace.c
  GEN     hw/sparc/trace.c
  GEN     hw/sd/trace.c
  GEN     hw/isa/trace.c
  GEN     hw/mem/trace.c
  GEN     hw/i386/xen/trace.c
  GEN     hw/9pfs/trace.c
  GEN     hw/i386/trace.c
  GEN     hw/ppc/trace.c
  GEN     hw/pci/trace.c
  GEN     hw/s390x/trace.c
  GEN     hw/vfio/trace.c
  GEN     hw/acpi/trace.c
  GEN     hw/arm/trace.c
  GEN     hw/alpha/trace.c
  GEN     hw/xen/trace.c
  GEN     ui/trace.c
  GEN     audio/trace.c
  GEN     net/trace.c
  GEN     target/arm/trace.c
  GEN     target/i386/trace.c
  GEN     target/mips/trace.c
  GEN     target/sparc/trace.c
  GEN     target/s390x/trace.c
  GEN     target/ppc/trace.c
  GEN     qom/trace.c
  GEN     linux-user/trace.c
  GEN     qapi/trace.c
  GEN     accel/tcg/trace.c
  GEN     accel/kvm/trace.c
  GEN     nbd/trace.c
  GEN     config-all-devices.mak
	 DEP /tmp/qemu-test/src/dtc/tests/trees.S
	 DEP /tmp/qemu-test/src/dtc/tests/dumptrees.c
	 DEP /tmp/qemu-test/src/dtc/tests/testutils.c
	 DEP /tmp/qemu-test/src/dtc/tests/value-labels.c
	 DEP /tmp/qemu-test/src/dtc/tests/asm_tree_dump.c
	 DEP /tmp/qemu-test/src/dtc/tests/truncated_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/check_path.c
	 DEP /tmp/qemu-test/src/dtc/tests/overlay_bad_fixup.c
	 DEP /tmp/qemu-test/src/dtc/tests/overlay.c
	 DEP /tmp/qemu-test/src/dtc/tests/subnode_iterate.c
	 DEP /tmp/qemu-test/src/dtc/tests/property_iterate.c
	 DEP /tmp/qemu-test/src/dtc/tests/utilfdt_test.c
	 DEP /tmp/qemu-test/src/dtc/tests/integer-expressions.c
	 DEP /tmp/qemu-test/src/dtc/tests/path_offset_aliases.c
	 DEP /tmp/qemu-test/src/dtc/tests/add_subnode_with_nops.c
	 DEP /tmp/qemu-test/src/dtc/tests/dtb_reverse.c
	 DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_ordered.c
	 DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_unordered.c
	 DEP /tmp/qemu-test/src/dtc/tests/extra-terminating-null.c
	 DEP /tmp/qemu-test/src/dtc/tests/incbin.c
	 DEP /tmp/qemu-test/src/dtc/tests/boot-cpuid.c
	 DEP /tmp/qemu-test/src/dtc/tests/path-references.c
	 DEP /tmp/qemu-test/src/dtc/tests/phandle_format.c
	 DEP /tmp/qemu-test/src/dtc/tests/references.c
	 DEP /tmp/qemu-test/src/dtc/tests/string_escapes.c
	 DEP /tmp/qemu-test/src/dtc/tests/propname_escapes.c
	 DEP /tmp/qemu-test/src/dtc/tests/appendprop2.c
	 DEP /tmp/qemu-test/src/dtc/tests/appendprop1.c
	 DEP /tmp/qemu-test/src/dtc/tests/del_node.c
	 DEP /tmp/qemu-test/src/dtc/tests/del_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/setprop.c
	 DEP /tmp/qemu-test/src/dtc/tests/set_name.c
	 DEP /tmp/qemu-test/src/dtc/tests/rw_tree1.c
	 DEP /tmp/qemu-test/src/dtc/tests/open_pack.c
	 DEP /tmp/qemu-test/src/dtc/tests/nopulate.c
	 DEP /tmp/qemu-test/src/dtc/tests/mangle-layout.c
	 DEP /tmp/qemu-test/src/dtc/tests/move_and_save.c
	 DEP /tmp/qemu-test/src/dtc/tests/sw_tree1.c
	 DEP /tmp/qemu-test/src/dtc/tests/nop_node.c
	 DEP /tmp/qemu-test/src/dtc/tests/nop_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/setprop_inplace.c
	 DEP /tmp/qemu-test/src/dtc/tests/stringlist.c
	 DEP /tmp/qemu-test/src/dtc/tests/addr_size_cells.c
	 DEP /tmp/qemu-test/src/dtc/tests/notfound.c
	 DEP /tmp/qemu-test/src/dtc/tests/sized_cells.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_alias.c
	 DEP /tmp/qemu-test/src/dtc/tests/char_literal.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_compatible.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_check_compatible.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_phandle.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_prop_value.c
	 DEP /tmp/qemu-test/src/dtc/tests/parent_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/supernode_atdepth_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_path.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_phandle.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_name.c
	 DEP /tmp/qemu-test/src/dtc/tests/getprop.c
	 DEP /tmp/qemu-test/src/dtc/tests/path_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/find_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/subnode_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/root_node.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_mem_rsv.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_overlay.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_addresses.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_strerror.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_empty_tree.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_rw.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_sw.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_wip.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_ro.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt.c
	 DEP /tmp/qemu-test/src/dtc/util.c
	 DEP /tmp/qemu-test/src/dtc/fdtput.c
	 DEP /tmp/qemu-test/src/dtc/fdtget.c
	 DEP /tmp/qemu-test/src/dtc/fdtdump.c
	 LEX convert-dtsv0-lexer.lex.c
make[1]: flex: Command not found
	 DEP /tmp/qemu-test/src/dtc/srcpos.c
	 BISON dtc-parser.tab.c
make[1]: bison: Command not found
	 LEX dtc-lexer.lex.c
make[1]: flex: Command not found
	 DEP /tmp/qemu-test/src/dtc/treesource.c
	 DEP /tmp/qemu-test/src/dtc/livetree.c
	 DEP /tmp/qemu-test/src/dtc/fstree.c
	 DEP /tmp/qemu-test/src/dtc/flattree.c
	 DEP /tmp/qemu-test/src/dtc/dtc.c
	 DEP /tmp/qemu-test/src/dtc/data.c
	 DEP /tmp/qemu-test/src/dtc/checks.c
	CHK version_gen.h
	 BISON dtc-parser.tab.c
make[1]: bison: Command not found
	 LEX convert-dtsv0-lexer.lex.c
	 LEX dtc-lexer.lex.c
make[1]: flex: Command not found
make[1]: flex: Command not found
	UPD version_gen.h
	 DEP /tmp/qemu-test/src/dtc/util.c
	 LEX convert-dtsv0-lexer.lex.c
	 BISON dtc-parser.tab.c
make[1]: flex: Command not found
make[1]: bison: Command not found
	 LEX dtc-lexer.lex.c
make[1]: flex: Command not found
	 CC libfdt/fdt_ro.o
	 CC libfdt/fdt_wip.o
	 CC libfdt/fdt_sw.o
	 CC libfdt/fdt.o
	 CC libfdt/fdt_rw.o
	 CC libfdt/fdt_addresses.o
	 CC libfdt/fdt_empty_tree.o
	 CC libfdt/fdt_strerror.o
	 CC libfdt/fdt_overlay.o
	 AR libfdt/libfdt.a
ar: creating libfdt/libfdt.a
a - libfdt/fdt.o
a - libfdt/fdt_ro.o
a - libfdt/fdt_wip.o
a - libfdt/fdt_sw.o
a - libfdt/fdt_rw.o
a - libfdt/fdt_strerror.o
a - libfdt/fdt_empty_tree.o
a - libfdt/fdt_addresses.o
a - libfdt/fdt_overlay.o
	 LEX convert-dtsv0-lexer.lex.c
	 BISON dtc-parser.tab.c
make[1]: flex: Command not found
	 LEX dtc-lexer.lex.c
make[1]: bison: Command not found
make[1]: flex: Command not found
  CC      tests/qemu-iotests/socket_scm_helper.o
  GEN     qga/qapi-generated/qga-qapi-types.h
  GEN     qga/qapi-generated/qga-qapi-visit.h
  GEN     qga/qapi-generated/qga-qmp-commands.h
  GEN     qga/qapi-generated/qga-qapi-visit.c
  CC      qmp-introspect.o
  GEN     qga/qapi-generated/qga-qapi-types.c
  GEN     qga/qapi-generated/qga-qmp-marshal.c
  CC      qapi-types.o
  CC      qapi-visit.o
  CC      qapi-event.o
  CC      qapi/qapi-visit-core.o
  CC      qapi/qapi-dealloc-visitor.o
  CC      qapi/qobject-input-visitor.o
  CC      qapi/qobject-output-visitor.o
  CC      qapi/qmp-registry.o
  CC      qapi/qmp-dispatch.o
  CC      qapi/string-input-visitor.o
  CC      qapi/string-output-visitor.o
  CC      qapi/opts-visitor.o
  CC      qapi/qapi-clone-visitor.o
  CC      qapi/qmp-event.o
  CC      qapi/qapi-util.o
  CC      qobject/qnull.o
  CC      qobject/qnum.o
  CC      qobject/qstring.o
  CC      qobject/qdict.o
  CC      qobject/qlist.o
  CC      qobject/qbool.o
  CC      qobject/qjson.o
  CC      qobject/qobject.o
  CC      qobject/json-lexer.o
  CC      qobject/json-streamer.o
  CC      qobject/json-parser.o
  CC      trace/control.o
  CC      trace/qmp.o
  CC      util/cutils.o
  CC      util/osdep.o
  CC      util/unicode.o
  CC      util/qemu-timer-common.o
  CC      util/bufferiszero.o
  CC      util/lockcnt.o
  CC      util/aiocb.o
  CC      util/async.o
  CC      util/thread-pool.o
  CC      util/qemu-timer.o
  CC      util/main-loop.o
  CC      util/iohandler.o
  CC      util/aio-posix.o
  CC      util/compatfd.o
  CC      util/event_notifier-posix.o
  CC      util/mmap-alloc.o
  CC      util/oslib-posix.o
  CC      util/qemu-openpty.o
  CC      util/qemu-thread-posix.o
  CC      util/memfd.o
  CC      util/envlist.o
  CC      util/path.o
  CC      util/module.o
  CC      util/host-utils.o
  CC      util/bitmap.o
  CC      util/bitops.o
  CC      util/hbitmap.o
  CC      util/fifo8.o
  CC      util/acl.o
  CC      util/cacheinfo.o
  CC      util/error.o
  CC      util/qemu-error.o
  CC      util/id.o
  CC      util/iov.o
  CC      util/qemu-config.o
  CC      util/qemu-sockets.o
  CC      util/uri.o
  CC      util/notify.o
  CC      util/qemu-option.o
  CC      util/qemu-progress.o
  CC      util/keyval.o
  CC      util/hexdump.o
  CC      util/crc32c.o
  CC      util/uuid.o
  CC      util/throttle.o
  CC      util/getauxval.o
  CC      util/readline.o
  CC      util/rcu.o
  CC      util/qemu-coroutine.o
  CC      util/qemu-coroutine-lock.o
  CC      util/qemu-coroutine-io.o
  CC      util/qemu-coroutine-sleep.o
  CC      util/coroutine-ucontext.o
  CC      util/buffer.o
  CC      util/timed-average.o
  CC      util/base64.o
  CC      util/log.o
  CC      util/qdist.o
  CC      util/qht.o
  CC      util/range.o
  CC      util/stats64.o
  CC      util/systemd.o
  CC      trace-root.o
  CC      util/trace.o
  CC      crypto/trace.o
  CC      io/trace.o
  CC      migration/trace.o
  CC      block/trace.o
  CC      chardev/trace.o
  CC      hw/block/trace.o
  CC      hw/block/dataplane/trace.o
  CC      hw/char/trace.o
  CC      hw/intc/trace.o
  CC      hw/net/trace.o
  CC      hw/virtio/trace.o
  CC      hw/audio/trace.o
  CC      hw/misc/trace.o
  CC      hw/usb/trace.o
  CC      hw/scsi/trace.o
  CC      hw/nvram/trace.o
  CC      hw/display/trace.o
  CC      hw/input/trace.o
  CC      hw/timer/trace.o
  CC      hw/dma/trace.o
  CC      hw/sparc/trace.o
  CC      hw/sd/trace.o
  CC      hw/isa/trace.o
  CC      hw/mem/trace.o
  CC      hw/i386/trace.o
  CC      hw/i386/xen/trace.o
  CC      hw/9pfs/trace.o
  CC      hw/ppc/trace.o
  CC      hw/pci/trace.o
  CC      hw/s390x/trace.o
  CC      hw/vfio/trace.o
  CC      hw/acpi/trace.o
  CC      hw/arm/trace.o
  CC      hw/alpha/trace.o
  CC      hw/xen/trace.o
  CC      ui/trace.o
  CC      audio/trace.o
  CC      net/trace.o
  CC      target/arm/trace.o
  CC      target/i386/trace.o
  CC      target/mips/trace.o
  CC      target/sparc/trace.o
  CC      target/s390x/trace.o
  CC      target/ppc/trace.o
  CC      qom/trace.o
  CC      linux-user/trace.o
  CC      qapi/trace.o
  CC      accel/tcg/trace.o
  CC      accel/kvm/trace.o
  CC      nbd/trace.o
  CC      crypto/pbkdf-stub.o
  CC      stubs/arch-query-cpu-def.o
  CC      stubs/arch-query-cpu-model-expansion.o
  CC      stubs/arch-query-cpu-model-comparison.o
  CC      stubs/arch-query-cpu-model-baseline.o
  CC      stubs/bdrv-next-monitor-owned.o
  CC      stubs/blk-commit-all.o
  CC      stubs/blockdev-close-all-bdrv-states.o
  CC      stubs/clock-warp.o
  CC      stubs/cpu-get-clock.o
  CC      stubs/cpu-get-icount.o
  CC      stubs/dump.o
  CC      stubs/error-printf.o
  CC      stubs/fdset.o
  CC      stubs/gdbstub.o
  CC      stubs/get-vm-name.o
  CC      stubs/iothread.o
  CC      stubs/iothread-lock.o
  CC      stubs/is-daemonized.o
  CC      stubs/machine-init-done.o
  CC      stubs/migr-blocker.o
  CC      stubs/change-state-handler.o
  CC      stubs/monitor.o
  CC      stubs/notify-event.o
  CC      stubs/qtest.o
  CC      stubs/replay.o
  CC      stubs/runstate-check.o
  CC      stubs/set-fd-handler.o
  CC      stubs/slirp.o
  CC      stubs/sysbus.o
  CC      stubs/trace-control.o
  CC      stubs/uuid.o
  CC      stubs/vmstate.o
  CC      stubs/vm-stop.o
  CC      stubs/qmp_pc_dimm_device_list.o
  CC      stubs/target-monitor-defs.o
  CC      stubs/target-get-monitor-def.o
  CC      stubs/pc_madt_cpu_entry.o
  CC      stubs/vmgenid.o
  CC      stubs/xen-common.o
  CC      stubs/xen-hvm.o
  CC      contrib/ivshmem-client/ivshmem-client.o
  CC      contrib/ivshmem-client/main.o
  CC      contrib/ivshmem-server/ivshmem-server.o
  CC      contrib/ivshmem-server/main.o
  CC      qemu-nbd.o
  CC      block.o
  CC      blockjob.o
  CC      qemu-io-cmds.o
  CC      replication.o
  CC      block/raw-format.o
  CC      block/qcow.o
  CC      block/vdi.o
  CC      block/vmdk.o
  CC      block/cloop.o
  CC      block/bochs.o
  CC      block/vpc.o
  CC      block/vvfat.o
  CC      block/dmg.o
  CC      block/qcow2.o
  CC      block/qcow2-refcount.o
  CC      block/qcow2-cluster.o
  CC      block/qcow2-snapshot.o
  CC      block/qcow2-cache.o
  CC      block/qcow2-bitmap.o
  CC      block/qed.o
  CC      block/qed-l2-cache.o
  CC      block/qed-table.o
  CC      block/qed-cluster.o
  CC      block/qed-check.o
  CC      block/vhdx.o
  CC      block/vhdx-endian.o
  CC      block/vhdx-log.o
  CC      block/quorum.o
  CC      block/parallels.o
  CC      block/blkdebug.o
  CC      block/blkverify.o
  CC      block/blkreplay.o
  CC      block/block-backend.o
  CC      block/snapshot.o
  CC      block/qapi.o
  CC      block/file-posix.o
  CC      block/null.o
  CC      block/mirror.o
  CC      block/commit.o
  CC      block/io.o
  CC      block/throttle-groups.o
  CC      block/nbd.o
  CC      block/nbd-client.o
  CC      block/sheepdog.o
  CC      block/accounting.o
  CC      block/dirty-bitmap.o
  CC      block/write-threshold.o
  CC      block/backup.o
  CC      block/replication.o
  CC      block/crypto.o
  CC      nbd/server.o
  CC      nbd/client.o
  CC      nbd/common.o
  CC      crypto/init.o
  CC      crypto/hash.o
  CC      crypto/hash-glib.o
  CC      crypto/hmac.o
  CC      crypto/hmac-glib.o
  CC      crypto/aes.o
  CC      crypto/desrfb.o
  CC      crypto/cipher.o
  CC      crypto/tlscreds.o
  CC      crypto/tlscredsanon.o
  CC      crypto/tlscredsx509.o
  CC      crypto/tlssession.o
  CC      crypto/secret.o
  CC      crypto/ivgen.o
  CC      crypto/pbkdf.o
  CC      crypto/random-platform.o
  CC      crypto/ivgen-essiv.o
  CC      crypto/ivgen-plain.o
  CC      crypto/ivgen-plain64.o
  CC      crypto/afsplit.o
  CC      crypto/xts.o
  CC      crypto/block.o
  CC      crypto/block-qcow.o
  CC      crypto/block-luks.o
  CC      io/channel.o
  CC      io/channel-buffer.o
  CC      io/channel-command.o
  CC      io/channel-file.o
  CC      io/channel-socket.o
  CC      io/channel-tls.o
  CC      io/channel-watch.o
  CC      io/channel-websock.o
  CC      io/channel-util.o
  CC      io/dns-resolver.o
  CC      io/task.o
  CC      qom/object.o
  CC      qom/container.o
  CC      qom/qom-qobject.o
  CC      qom/object_interfaces.o
  GEN     qemu-img-cmds.h
  CC      qemu-io.o
  CC      qemu-bridge-helper.o
  CC      blockdev.o
  CC      blockdev-nbd.o
  CC      bootdevice.o
  CC      iothread.o
  CC      qdev-monitor.o
  CC      device-hotplug.o
  CC      os-posix.o
  CC      bt-host.o
  CC      bt-vhci.o
  CC      dma-helpers.o
  CC      vl.o
  CC      tpm.o
  CC      device_tree.o
  CC      qmp-marshal.o
  CC      qmp.o
  CC      hmp.o
  CC      cpus-common.o
  CC      audio/audio.o
  CC      audio/noaudio.o
  CC      audio/wavaudio.o
  CC      audio/mixeng.o
  CC      audio/sdlaudio.o
  CC      audio/ossaudio.o
  CC      audio/wavcapture.o
  CC      backends/rng.o
  CC      backends/rng-egd.o
  CC      backends/rng-random.o
  CC      backends/tpm.o
  CC      backends/hostmem.o
  CC      backends/hostmem-ram.o
  CC      backends/hostmem-file.o
  CC      backends/cryptodev.o
  CC      backends/cryptodev-builtin.o
  CC      block/stream.o
  CC      chardev/msmouse.o
  CC      chardev/wctablet.o
  CC      chardev/testdev.o
  CC      disas/arm.o
  CC      disas/i386.o
  CC      fsdev/qemu-fsdev-dummy.o
  CC      fsdev/qemu-fsdev-opts.o
  CC      fsdev/qemu-fsdev-throttle.o
  CC      hw/acpi/core.o
  CC      hw/acpi/piix4.o
  CC      hw/acpi/pcihp.o
  CC      hw/acpi/ich9.o
  CC      hw/acpi/tco.o
  CC      hw/acpi/cpu_hotplug.o
  CC      hw/acpi/memory_hotplug.o
  CC      hw/acpi/cpu.o
  CC      hw/acpi/nvdimm.o
  CC      hw/acpi/vmgenid.o
  CC      hw/acpi/acpi_interface.o
  CC      hw/acpi/bios-linker-loader.o
  CC      hw/acpi/aml-build.o
  CC      hw/acpi/ipmi.o
  CC      hw/acpi/acpi-stub.o
  CC      hw/acpi/ipmi-stub.o
  CC      hw/audio/sb16.o
  CC      hw/audio/es1370.o
  CC      hw/audio/ac97.o
  CC      hw/audio/fmopl.o
  CC      hw/audio/adlib.o
  CC      hw/audio/gus.o
  CC      hw/audio/gusemu_hal.o
  CC      hw/audio/gusemu_mixer.o
  CC      hw/audio/cs4231a.o
  CC      hw/audio/intel-hda.o
  CC      hw/audio/hda-codec.o
  CC      hw/audio/pcspk.o
  CC      hw/audio/wm8750.o
  CC      hw/audio/pl041.o
  CC      hw/audio/lm4549.o
  CC      hw/audio/marvell_88w8618.o
  CC      hw/audio/soundhw.o
  CC      hw/block/block.o
  CC      hw/block/cdrom.o
  CC      hw/block/hd-geometry.o
  CC      hw/block/fdc.o
  CC      hw/block/m25p80.o
  CC      hw/block/nand.o
  CC      hw/block/pflash_cfi01.o
  CC      hw/block/pflash_cfi02.o
  CC      hw/block/ecc.o
  CC      hw/block/onenand.o
  CC      hw/block/nvme.o
  CC      hw/bt/core.o
  CC      hw/bt/l2cap.o
  CC      hw/bt/sdp.o
  CC      hw/bt/hci.o
  CC      hw/bt/hid.o
  CC      hw/bt/hci-csr.o
  CC      hw/char/ipoctal232.o
  CC      hw/char/parallel.o
  CC      hw/char/pl011.o
  CC      hw/char/serial.o
  CC      hw/char/serial-isa.o
  CC      hw/char/serial-pci.o
  CC      hw/char/virtio-console.o
  CC      hw/char/cadence_uart.o
  CC      hw/char/cmsdk-apb-uart.o
  CC      hw/char/debugcon.o
  CC      hw/char/imx_serial.o
  CC      hw/core/qdev.o
  CC      hw/core/qdev-properties.o
  CC      hw/core/bus.o
  CC      hw/core/reset.o
  CC      hw/core/fw-path-provider.o
  CC      hw/core/irq.o
  CC      hw/core/hotplug.o
  CC      hw/core/nmi.o
  CC      hw/core/ptimer.o
  CC      hw/core/sysbus.o
  CC      hw/core/machine.o
  CC      hw/core/loader.o
  CC      hw/core/qdev-properties-system.o
  CC      hw/core/register.o
  CC      hw/core/or-irq.o
  CC      hw/core/platform-bus.o
  CC      hw/cpu/core.o
  CC      hw/display/ads7846.o
  CC      hw/display/cirrus_vga.o
  CC      hw/display/pl110.o
  CC      hw/display/ssd0303.o
  CC      hw/display/ssd0323.o
  CC      hw/display/vga-pci.o
  CC      hw/display/vga-isa.o
  CC      hw/display/vmware_vga.o
  CC      hw/display/blizzard.o
  CC      hw/display/exynos4210_fimd.o
  CC      hw/display/framebuffer.o
  CC      hw/display/tc6393xb.o
  CC      hw/dma/pl080.o
  CC      hw/dma/pl330.o
  CC      hw/dma/i8257.o
  CC      hw/dma/xlnx-zynq-devcfg.o
  CC      hw/gpio/max7310.o
  CC      hw/gpio/pl061.o
  CC      hw/gpio/zaurus.o
  CC      hw/gpio/gpio_key.o
  CC      hw/i2c/core.o
  CC      hw/i2c/smbus.o
  CC      hw/i2c/smbus_eeprom.o
  CC      hw/i2c/i2c-ddc.o
  CC      hw/i2c/versatile_i2c.o
  CC      hw/i2c/smbus_ich9.o
  CC      hw/i2c/pm_smbus.o
  CC      hw/i2c/bitbang_i2c.o
  CC      hw/i2c/exynos4210_i2c.o
  CC      hw/i2c/imx_i2c.o
  CC      hw/i2c/aspeed_i2c.o
  CC      hw/ide/core.o
  CC      hw/ide/atapi.o
  CC      hw/ide/qdev.o
  CC      hw/ide/pci.o
  CC      hw/ide/isa.o
  CC      hw/ide/piix.o
  CC      hw/ide/microdrive.o
  CC      hw/ide/ahci.o
  CC      hw/ide/ich.o
  CC      hw/input/hid.o
  CC      hw/input/lm832x.o
  CC      hw/input/pckbd.o
  CC      hw/input/pl050.o
  CC      hw/input/ps2.o
  CC      hw/input/stellaris_input.o
  CC      hw/input/tsc2005.o
  CC      hw/input/vmmouse.o
  CC      hw/input/virtio-input.o
  CC      hw/input/virtio-input-hid.o
  CC      hw/input/virtio-input-host.o
  CC      hw/intc/i8259.o
  CC      hw/intc/i8259_common.o
  CC      hw/intc/pl190.o
  CC      hw/intc/imx_avic.o
  CC      hw/intc/realview_gic.o
  CC      hw/intc/ioapic_common.o
  CC      hw/intc/arm_gic_common.o
  CC      hw/intc/arm_gic.o
  CC      hw/intc/arm_gicv2m.o
  CC      hw/intc/arm_gicv3_common.o
  CC      hw/intc/arm_gicv3.o
  CC      hw/intc/arm_gicv3_dist.o
  CC      hw/intc/arm_gicv3_redist.o
  CC      hw/intc/arm_gicv3_its_common.o
  CC      hw/intc/intc.o
  CC      hw/ipack/ipack.o
  CC      hw/ipack/tpci200.o
  CC      hw/ipmi/ipmi.o
  CC      hw/ipmi/ipmi_bmc_sim.o
  CC      hw/ipmi/ipmi_bmc_extern.o
  CC      hw/ipmi/isa_ipmi_kcs.o
  CC      hw/ipmi/isa_ipmi_bt.o
  CC      hw/isa/isa-bus.o
  CC      hw/isa/apm.o
  CC      hw/mem/pc-dimm.o
  CC      hw/mem/nvdimm.o
  CC      hw/misc/applesmc.o
  CC      hw/misc/max111x.o
  CC      hw/misc/tmp105.o
  CC      hw/misc/tmp421.o
  CC      hw/misc/debugexit.o
  CC      hw/misc/sga.o
  CC      hw/misc/pc-testdev.o
  CC      hw/misc/pci-testdev.o
  CC      hw/misc/edu.o
  CC      hw/misc/unimp.o
  CC      hw/misc/arm_l2x0.o
  CC      hw/misc/arm_integrator_debug.o
  CC      hw/misc/a9scu.o
  CC      hw/misc/arm11scu.o
  CC      hw/net/ne2000.o
  CC      hw/net/eepro100.o
  CC      hw/net/pcnet-pci.o
  CC      hw/net/pcnet.o
  CC      hw/net/e1000.o
  CC      hw/net/e1000x_common.o
  CC      hw/net/net_tx_pkt.o
  CC      hw/net/net_rx_pkt.o
  CC      hw/net/e1000e.o
  CC      hw/net/e1000e_core.o
  CC      hw/net/rtl8139.o
  CC      hw/net/vmxnet3.o
  CC      hw/net/smc91c111.o
  CC      hw/net/lan9118.o
  CC      hw/net/ne2000-isa.o
  CC      hw/net/xgmac.o
  CC      hw/net/allwinner_emac.o
  CC      hw/net/imx_fec.o
  CC      hw/net/cadence_gem.o
  CC      hw/net/stellaris_enet.o
  CC      hw/net/ftgmac100.o
  CC      hw/net/rocker/rocker.o
  CC      hw/net/rocker/rocker_fp.o
  CC      hw/net/rocker/rocker_desc.o
  CC      hw/net/rocker/rocker_world.o
  CC      hw/net/rocker/rocker_of_dpa.o
  CC      hw/nvram/eeprom93xx.o
  CC      hw/nvram/fw_cfg.o
  CC      hw/nvram/chrp_nvram.o
  CC      hw/pci-bridge/pci_bridge_dev.o
  CC      hw/pci-bridge/pcie_root_port.o
  CC      hw/pci-bridge/gen_pcie_root_port.o
  CC      hw/pci-bridge/pci_expander_bridge.o
  CC      hw/pci-bridge/xio3130_upstream.o
  CC      hw/pci-bridge/xio3130_downstream.o
  CC      hw/pci-bridge/ioh3420.o
  CC      hw/pci-bridge/i82801b11.o
  CC      hw/pci-host/pam.o
  CC      hw/pci-host/versatile.o
  CC      hw/pci-host/piix.o
  CC      hw/pci-host/q35.o
  CC      hw/pci-host/gpex.o
  CC      hw/pci/pci.o
  CC      hw/pci/pci_bridge.o
  CC      hw/pci/msix.o
  CC      hw/pci/msi.o
  CC      hw/pci/shpc.o
  CC      hw/pci/slotid_cap.o
  CC      hw/pci/pci_host.o
  CC      hw/pci/pcie_host.o
  CC      hw/pci/pcie.o
  CC      hw/pci/pcie_aer.o
  CC      hw/pci/pcie_port.o
  CC      hw/pci/pci-stub.o
  CC      hw/pcmcia/pcmcia.o
  CC      hw/scsi/scsi-disk.o
  CC      hw/scsi/scsi-generic.o
  CC      hw/scsi/scsi-bus.o
  CC      hw/scsi/lsi53c895a.o
  CC      hw/scsi/mptsas.o
  CC      hw/scsi/mptconfig.o
  CC      hw/scsi/mptendian.o
  CC      hw/scsi/megasas.o
  CC      hw/scsi/vmw_pvscsi.o
  CC      hw/scsi/esp.o
  CC      hw/scsi/esp-pci.o
  CC      hw/sd/pl181.o
  CC      hw/sd/ssi-sd.o
  CC      hw/sd/sd.o
  CC      hw/sd/core.o
  CC      hw/sd/sdhci.o
  CC      hw/smbios/smbios.o
  CC      hw/smbios/smbios_type_38.o
  CC      hw/smbios/smbios-stub.o
  CC      hw/smbios/smbios_type_38-stub.o
  CC      hw/ssi/pl022.o
  CC      hw/ssi/ssi.o
  CC      hw/ssi/xilinx_spips.o
  CC      hw/ssi/aspeed_smc.o
  CC      hw/ssi/stm32f2xx_spi.o
  CC      hw/timer/arm_timer.o
  CC      hw/timer/arm_mptimer.o
  CC      hw/timer/armv7m_systick.o
  CC      hw/timer/a9gtimer.o
  CC      hw/timer/cadence_ttc.o
  CC      hw/timer/ds1338.o
  CC      hw/timer/hpet.o
  CC      hw/timer/i8254_common.o
  CC      hw/timer/i8254.o
  CC      hw/timer/pl031.o
  CC      hw/timer/twl92230.o
  CC      hw/timer/imx_epit.o
  CC      hw/timer/imx_gpt.o
  CC      hw/timer/stm32f2xx_timer.o
  CC      hw/timer/aspeed_timer.o
  CC      hw/timer/cmsdk-apb-timer.o
  CC      hw/tpm/tpm_tis.o
  CC      hw/tpm/tpm_passthrough.o
  CC      hw/tpm/tpm_util.o
  CC      hw/usb/core.o
  CC      hw/usb/combined-packet.o
  CC      hw/usb/bus.o
  CC      hw/usb/libhw.o
  CC      hw/usb/desc.o
  CC      hw/usb/desc-msos.o
  CC      hw/usb/hcd-uhci.o
  CC      hw/usb/hcd-ohci.o
  CC      hw/usb/hcd-ehci.o
  CC      hw/usb/hcd-ehci-pci.o
  CC      hw/usb/hcd-ehci-sysbus.o
  CC      hw/usb/hcd-xhci.o
  CC      hw/usb/hcd-xhci-nec.o
  CC      hw/usb/hcd-musb.o
  CC      hw/usb/dev-hub.o
  CC      hw/usb/dev-hid.o
  CC      hw/usb/dev-wacom.o
  CC      hw/usb/dev-storage.o
  CC      hw/usb/dev-uas.o
  CC      hw/usb/dev-audio.o
  CC      hw/usb/dev-serial.o
  CC      hw/usb/dev-network.o
  CC      hw/usb/dev-bluetooth.o
  CC      hw/usb/dev-smartcard-reader.o
  CC      hw/usb/dev-mtp.o
  CC      hw/usb/host-stub.o
  CC      hw/virtio/virtio-rng.o
  CC      hw/virtio/virtio-pci.o
  CC      hw/virtio/virtio-bus.o
  CC      hw/virtio/virtio-mmio.o
  CC      hw/virtio/vhost-stub.o
  CC      hw/watchdog/watchdog.o
  CC      hw/watchdog/wdt_i6300esb.o
  CC      hw/watchdog/wdt_ib700.o
  CC      hw/watchdog/wdt_aspeed.o
  CC      migration/migration.o
  CC      migration/socket.o
  CC      migration/fd.o
  CC      migration/exec.o
  CC      migration/tls.o
  CC      migration/channel.o
  CC      migration/savevm.o
  CC      migration/colo-comm.o
  CC      migration/colo.o
  CC      migration/colo-failover.o
  CC      migration/vmstate.o
  CC      migration/vmstate-types.o
  CC      migration/page_cache.o
  CC      migration/qemu-file.o
  CC      migration/global_state.o
  CC      migration/qemu-file-channel.o
  CC      migration/xbzrle.o
  CC      migration/postcopy-ram.o
  CC      migration/qjson.o
  CC      migration/block.o
  CC      net/net.o
  CC      net/queue.o
  CC      net/checksum.o
  CC      net/util.o
  CC      net/hub.o
  CC      net/socket.o
  CC      net/dump.o
  CC      net/eth.o
  CC      net/l2tpv3.o
  CC      net/vhost-user.o
  CC      net/slirp.o
  CC      net/filter.o
  CC      net/filter-buffer.o
  CC      net/filter-mirror.o
  CC      net/colo-compare.o
  CC      net/colo.o
  CC      net/filter-rewriter.o
  CC      net/filter-replay.o
  CC      net/tap.o
  CC      net/tap-linux.o
  CC      qom/cpu.o
  CC      replay/replay.o
  CC      replay/replay-internal.o
  CC      replay/replay-events.o
  CC      replay/replay-time.o
  CC      replay/replay-input.o
  CC      replay/replay-char.o
  CC      replay/replay-snapshot.o
/tmp/qemu-test/src/replay/replay-internal.c: In function ‘replay_put_array’:
/tmp/qemu-test/src/replay/replay-internal.c:65: warning: ignoring return value of ‘fwrite’, declared with attribute warn_unused_result
  CC      replay/replay-net.o
  CC      replay/replay-audio.o
  CC      slirp/cksum.o
  CC      slirp/if.o
  CC      slirp/ip_icmp.o
  CC      slirp/ip6_icmp.o
  CC      slirp/ip6_input.o
  CC      slirp/ip6_output.o
  CC      slirp/ip_input.o
  CC      slirp/ip_output.o
  CC      slirp/dnssearch.o
  CC      slirp/dhcpv6.o
  CC      slirp/slirp.o
  CC      slirp/mbuf.o
  CC      slirp/misc.o
  CC      slirp/sbuf.o
  CC      slirp/socket.o
  CC      slirp/tcp_input.o
  CC      slirp/tcp_output.o
  CC      slirp/tcp_subr.o
  CC      slirp/tcp_timer.o
  CC      slirp/udp.o
  CC      slirp/udp6.o
  CC      slirp/bootp.o
  CC      slirp/tftp.o
  CC      slirp/arp_table.o
  CC      slirp/ndp_table.o
  CC      slirp/ncsi.o
  CC      ui/keymaps.o
  CC      ui/console.o
/tmp/qemu-test/src/slirp/tcp_input.c: In function ‘tcp_input’:
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_p’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_len’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_tos’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_id’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_off’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_ttl’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_sum’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_src.s_addr’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:219: warning: ‘save_ip.ip_dst.s_addr’ may be used uninitialized in this function
/tmp/qemu-test/src/slirp/tcp_input.c:220: warning: ‘save_ip6.ip_nh’ may be used uninitialized in this function
  CC      ui/cursor.o
  CC      ui/qemu-pixman.o
  CC      ui/input.o
  CC      ui/input-keymap.o
  CC      ui/input-legacy.o
  CC      ui/input-linux.o
  CC      ui/sdl.o
  CC      ui/sdl_zoom.o
  CC      ui/x_keymap.o
  CC      ui/vnc.o
  CC      ui/vnc-enc-zlib.o
  CC      ui/vnc-enc-hextile.o
  CC      ui/vnc-enc-tight.o
  CC      ui/vnc-palette.o
  CC      ui/vnc-enc-zrle.o
  CC      ui/vnc-auth-vencrypt.o
  CC      ui/vnc-ws.o
  CC      ui/vnc-jobs.o
  CC      chardev/char.o
  CC      chardev/char-fd.o
  CC      chardev/char-fe.o
  CC      chardev/char-file.o
  CC      chardev/char-io.o
  CC      chardev/char-mux.o
  CC      chardev/char-null.o
  CC      chardev/char-parallel.o
  CC      chardev/char-pipe.o
  CC      chardev/char-pty.o
  CC      chardev/char-ringbuf.o
  CC      chardev/char-serial.o
  CC      chardev/char-socket.o
  CC      chardev/char-stdio.o
  CC      chardev/char-udp.o
  LINK    tests/qemu-iotests/socket_scm_helper
  CC      qga/commands.o
  CC      qga/guest-agent-command-state.o
  AS      optionrom/multiboot.o
  AS      optionrom/linuxboot.o
  CC      optionrom/linuxboot_dma.o
cc: unrecognized option '-no-integrated-as'
cc: unrecognized option '-no-integrated-as'
  AS      optionrom/kvmvapic.o
  CC      qga/main.o
  BUILD   optionrom/multiboot.img
  BUILD   optionrom/linuxboot.img
  BUILD   optionrom/linuxboot_dma.img
  BUILD   optionrom/kvmvapic.img
  BUILD   optionrom/multiboot.raw
  BUILD   optionrom/linuxboot.raw
  BUILD   optionrom/linuxboot_dma.raw
  BUILD   optionrom/kvmvapic.raw
  CC      qga/commands-posix.o
  SIGN    optionrom/multiboot.bin
  SIGN    optionrom/linuxboot.bin
  SIGN    optionrom/linuxboot_dma.bin
  SIGN    optionrom/kvmvapic.bin
  CC      qga/channel-posix.o
  CC      qga/qapi-generated/qga-qapi-types.o
  CC      qga/qapi-generated/qga-qapi-visit.o
  CC      qga/qapi-generated/qga-qmp-marshal.o
  AR      libqemuutil.a
  AR      libqemustub.a
  CC      qemu-img.o
  LINK    qemu-io
  LINK    qemu-bridge-helper
  LINK    ivshmem-client
  LINK    ivshmem-server
  LINK    qemu-nbd
  LINK    qemu-ga
  GEN     x86_64-softmmu/hmp-commands-info.h
  GEN     x86_64-softmmu/hmp-commands.h
  GEN     x86_64-softmmu/config-target.h
  GEN     aarch64-softmmu/hmp-commands.h
  GEN     aarch64-softmmu/hmp-commands-info.h
  GEN     aarch64-softmmu/config-target.h
  CC      x86_64-softmmu/tcg/tcg.o
  CC      x86_64-softmmu/tcg/optimize.o
  CC      x86_64-softmmu/exec.o
  CC      x86_64-softmmu/tcg/tcg-common.o
  CC      x86_64-softmmu/tcg/tcg-op.o
  CC      x86_64-softmmu/tcg/tcg-runtime.o
  CC      aarch64-softmmu/exec.o
  CC      x86_64-softmmu/fpu/softfloat.o
  CC      x86_64-softmmu/disas.o
  GEN     x86_64-softmmu/gdbstub-xml.c
  CC      x86_64-softmmu/hax-stub.o
  CC      x86_64-softmmu/arch_init.o
  CC      x86_64-softmmu/cpus.o
  CC      x86_64-softmmu/monitor.o
  CC      x86_64-softmmu/gdbstub.o
  CC      x86_64-softmmu/balloon.o
  LINK    qemu-img
  CC      x86_64-softmmu/ioport.o
  CC      x86_64-softmmu/numa.o
  CC      x86_64-softmmu/qtest.o
  CC      x86_64-softmmu/memory.o
  CC      x86_64-softmmu/memory_mapping.o
  CC      aarch64-softmmu/tcg/tcg.o
  CC      x86_64-softmmu/dump.o
  CC      aarch64-softmmu/tcg/tcg-op.o
  CC      x86_64-softmmu/migration/ram.o
  CC      x86_64-softmmu/accel/accel.o
  CC      x86_64-softmmu/accel/kvm/kvm-all.o
  CC      aarch64-softmmu/tcg/optimize.o
  CC      aarch64-softmmu/tcg/tcg-common.o
  CC      aarch64-softmmu/tcg/tcg-runtime.o
  CC      aarch64-softmmu/fpu/softfloat.o
  CC      aarch64-softmmu/disas.o
  CC      x86_64-softmmu/accel/tcg/tcg-all.o
  CC      x86_64-softmmu/accel/tcg/cputlb.o
  GEN     aarch64-softmmu/gdbstub-xml.c
  CC      x86_64-softmmu/accel/tcg/cpu-exec.o
  CC      x86_64-softmmu/accel/tcg/cpu-exec-common.o
  CC      x86_64-softmmu/accel/tcg/translate-all.o
  CC      aarch64-softmmu/hax-stub.o
  CC      x86_64-softmmu/hw/block/virtio-blk.o
  CC      x86_64-softmmu/hw/block/dataplane/virtio-blk.o
  CC      x86_64-softmmu/hw/char/virtio-serial-bus.o
  CC      aarch64-softmmu/arch_init.o
  CC      x86_64-softmmu/hw/core/generic-loader.o
  CC      x86_64-softmmu/hw/core/null-machine.o
  CC      x86_64-softmmu/hw/display/vga.o
  CC      aarch64-softmmu/cpus.o
  CC      x86_64-softmmu/hw/display/virtio-gpu.o
  CC      aarch64-softmmu/monitor.o
  CC      aarch64-softmmu/gdbstub.o
  CC      x86_64-softmmu/hw/display/virtio-gpu-3d.o
  CC      x86_64-softmmu/hw/display/virtio-gpu-pci.o
  CC      aarch64-softmmu/balloon.o
  CC      aarch64-softmmu/ioport.o
  CC      x86_64-softmmu/hw/display/virtio-vga.o
  CC      x86_64-softmmu/hw/intc/apic.o
  CC      x86_64-softmmu/hw/intc/apic_common.o
  CC      aarch64-softmmu/numa.o
  CC      aarch64-softmmu/qtest.o
  CC      x86_64-softmmu/hw/intc/ioapic.o
  CC      aarch64-softmmu/memory.o
  CC      aarch64-softmmu/memory_mapping.o
  CC      x86_64-softmmu/hw/isa/lpc_ich9.o
  CC      aarch64-softmmu/dump.o
  CC      x86_64-softmmu/hw/misc/vmport.o
  CC      aarch64-softmmu/migration/ram.o
  CC      x86_64-softmmu/hw/misc/ivshmem.o
  CC      aarch64-softmmu/accel/accel.o
  CC      aarch64-softmmu/accel/stubs/kvm-stub.o
  CC      x86_64-softmmu/hw/misc/pvpanic.o
  CC      aarch64-softmmu/accel/tcg/tcg-all.o
  CC      x86_64-softmmu/hw/misc/hyperv_testdev.o
  CC      x86_64-softmmu/hw/misc/mmio_interface.o
  CC      x86_64-softmmu/hw/net/virtio-net.o
  CC      x86_64-softmmu/hw/net/vhost_net.o
  CC      x86_64-softmmu/hw/scsi/virtio-scsi.o
  CC      x86_64-softmmu/hw/scsi/virtio-scsi-dataplane.o
  CC      aarch64-softmmu/accel/tcg/cputlb.o
  CC      aarch64-softmmu/accel/tcg/cpu-exec.o
  CC      x86_64-softmmu/hw/scsi/vhost-scsi-common.o
  CC      aarch64-softmmu/accel/tcg/cpu-exec-common.o
  CC      aarch64-softmmu/accel/tcg/translate-all.o
  CC      x86_64-softmmu/hw/scsi/vhost-scsi.o
  CC      x86_64-softmmu/hw/scsi/vhost-user-scsi.o
  CC      x86_64-softmmu/hw/timer/mc146818rtc.o
  CC      aarch64-softmmu/hw/adc/stm32f2xx_adc.o
  CC      x86_64-softmmu/hw/vfio/common.o
  CC      aarch64-softmmu/hw/block/virtio-blk.o
  CC      x86_64-softmmu/hw/vfio/pci.o
  CC      x86_64-softmmu/hw/vfio/pci-quirks.o
  CC      x86_64-softmmu/hw/vfio/platform.o
  CC      x86_64-softmmu/hw/vfio/spapr.o
  CC      x86_64-softmmu/hw/virtio/virtio.o
  CC      x86_64-softmmu/hw/virtio/virtio-balloon.o
  CC      x86_64-softmmu/hw/virtio/vhost.o
  CC      x86_64-softmmu/hw/virtio/vhost-backend.o
  CC      x86_64-softmmu/hw/virtio/vhost-user.o
  CC      x86_64-softmmu/hw/virtio/vhost-vsock.o
  CC      aarch64-softmmu/hw/block/dataplane/virtio-blk.o
  CC      aarch64-softmmu/hw/char/exynos4210_uart.o
  CC      x86_64-softmmu/hw/virtio/virtio-crypto.o
  CC      x86_64-softmmu/hw/virtio/virtio-crypto-pci.o
  CC      aarch64-softmmu/hw/char/omap_uart.o
  CC      aarch64-softmmu/hw/char/digic-uart.o
  CC      x86_64-softmmu/hw/i386/multiboot.o
  CC      x86_64-softmmu/hw/i386/pc.o
  CC      aarch64-softmmu/hw/char/stm32f2xx_usart.o
  CC      x86_64-softmmu/hw/i386/pc_piix.o
  CC      aarch64-softmmu/hw/char/bcm2835_aux.o
  CC      aarch64-softmmu/hw/char/virtio-serial-bus.o
  CC      x86_64-softmmu/hw/i386/pc_q35.o
  CC      x86_64-softmmu/hw/i386/pc_sysfw.o
  CC      x86_64-softmmu/hw/i386/x86-iommu.o
  CC      aarch64-softmmu/hw/core/generic-loader.o
  CC      aarch64-softmmu/hw/core/null-machine.o
  CC      x86_64-softmmu/hw/i386/intel_iommu.o
  CC      x86_64-softmmu/hw/i386/amd_iommu.o
  CC      x86_64-softmmu/hw/i386/kvmvapic.o
  CC      aarch64-softmmu/hw/cpu/arm11mpcore.o
  CC      aarch64-softmmu/hw/cpu/realview_mpcore.o
  CC      aarch64-softmmu/hw/cpu/a9mpcore.o
/tmp/qemu-test/src/hw/i386/pc_piix.c: In function ‘igd_passthrough_isa_bridge_create’:
/tmp/qemu-test/src/hw/i386/pc_piix.c:1065: warning: ‘pch_rev_id’ may be used uninitialized in this function
  CC      x86_64-softmmu/hw/i386/acpi-build.o
  CC      x86_64-softmmu/hw/i386/pci-assign-load-rom.o
  CC      aarch64-softmmu/hw/cpu/a15mpcore.o
  CC      aarch64-softmmu/hw/display/omap_dss.o
  CC      aarch64-softmmu/hw/display/omap_lcdc.o
  CC      x86_64-softmmu/hw/i386/kvm/clock.o
  CC      aarch64-softmmu/hw/display/pxa2xx_lcd.o
  CC      aarch64-softmmu/hw/display/bcm2835_fb.o
  CC      x86_64-softmmu/hw/i386/kvm/apic.o
  CC      aarch64-softmmu/hw/display/vga.o
  CC      x86_64-softmmu/hw/i386/kvm/i8259.o
  CC      x86_64-softmmu/hw/i386/kvm/ioapic.o
  CC      x86_64-softmmu/hw/i386/kvm/i8254.o
  CC      x86_64-softmmu/hw/i386/kvm/pci-assign.o
  CC      x86_64-softmmu/target/i386/helper.o
  CC      x86_64-softmmu/target/i386/cpu.o
  CC      x86_64-softmmu/target/i386/gdbstub.o
/tmp/qemu-test/src/hw/i386/acpi-build.c: In function ‘build_append_pci_bus_devices’:
/tmp/qemu-test/src/hw/i386/acpi-build.c:539: warning: ‘notify_method’ may be used uninitialized in this function
  CC      aarch64-softmmu/hw/display/virtio-gpu.o
  CC      aarch64-softmmu/hw/display/virtio-gpu-3d.o
  CC      x86_64-softmmu/target/i386/xsave_helper.o
  CC      aarch64-softmmu/hw/display/virtio-gpu-pci.o
  CC      x86_64-softmmu/target/i386/translate.o
  CC      x86_64-softmmu/target/i386/bpt_helper.o
  CC      aarch64-softmmu/hw/display/dpcd.o
  CC      x86_64-softmmu/target/i386/cc_helper.o
  CC      aarch64-softmmu/hw/display/xlnx_dp.o
  CC      aarch64-softmmu/hw/dma/xlnx_dpdma.o
  CC      aarch64-softmmu/hw/dma/omap_dma.o
  CC      aarch64-softmmu/hw/dma/soc_dma.o
  CC      x86_64-softmmu/target/i386/excp_helper.o
  CC      aarch64-softmmu/hw/dma/pxa2xx_dma.o
  CC      x86_64-softmmu/target/i386/fpu_helper.o
  CC      aarch64-softmmu/hw/dma/bcm2835_dma.o
  CC      aarch64-softmmu/hw/gpio/omap_gpio.o
  CC      x86_64-softmmu/target/i386/int_helper.o
  CC      aarch64-softmmu/hw/gpio/imx_gpio.o
  CC      x86_64-softmmu/target/i386/mem_helper.o
  CC      x86_64-softmmu/target/i386/misc_helper.o
  CC      x86_64-softmmu/target/i386/mpx_helper.o
  CC      x86_64-softmmu/target/i386/seg_helper.o
  CC      aarch64-softmmu/hw/gpio/bcm2835_gpio.o
  CC      aarch64-softmmu/hw/i2c/omap_i2c.o
  CC      aarch64-softmmu/hw/input/pxa2xx_keypad.o
  CC      x86_64-softmmu/target/i386/smm_helper.o
  CC      x86_64-softmmu/target/i386/svm_helper.o
  CC      x86_64-softmmu/target/i386/machine.o
  CC      aarch64-softmmu/hw/input/tsc210x.o
  CC      aarch64-softmmu/hw/intc/armv7m_nvic.o
  CC      aarch64-softmmu/hw/intc/exynos4210_gic.o
  CC      x86_64-softmmu/target/i386/arch_memory_mapping.o
  CC      aarch64-softmmu/hw/intc/exynos4210_combiner.o
  CC      x86_64-softmmu/target/i386/arch_dump.o
  CC      aarch64-softmmu/hw/intc/omap_intc.o
  CC      aarch64-softmmu/hw/intc/bcm2835_ic.o
  CC      aarch64-softmmu/hw/intc/bcm2836_control.o
  CC      aarch64-softmmu/hw/intc/allwinner-a10-pic.o
  CC      aarch64-softmmu/hw/intc/aspeed_vic.o
  CC      aarch64-softmmu/hw/intc/arm_gicv3_cpuif.o
  CC      x86_64-softmmu/target/i386/monitor.o
  CC      x86_64-softmmu/target/i386/kvm.o
  CC      x86_64-softmmu/target/i386/hyperv.o
  CC      aarch64-softmmu/hw/misc/ivshmem.o
  CC      aarch64-softmmu/hw/misc/arm_sysctl.o
  CC      aarch64-softmmu/hw/misc/cbus.o
  GEN     trace/generated-helpers.c
  CC      x86_64-softmmu/trace/control-target.o
  CC      aarch64-softmmu/hw/misc/exynos4210_pmu.o
  CC      aarch64-softmmu/hw/misc/exynos4210_clk.o
  CC      aarch64-softmmu/hw/misc/exynos4210_rng.o
  CC      aarch64-softmmu/hw/misc/imx_ccm.o
  CC      x86_64-softmmu/gdbstub-xml.o
  CC      aarch64-softmmu/hw/misc/imx31_ccm.o
  CC      x86_64-softmmu/trace/generated-helpers.o
  CC      aarch64-softmmu/hw/misc/imx25_ccm.o
  CC      aarch64-softmmu/hw/misc/imx6_ccm.o
  CC      aarch64-softmmu/hw/misc/imx6_src.o
  CC      aarch64-softmmu/hw/misc/mst_fpga.o
  CC      aarch64-softmmu/hw/misc/omap_clk.o
  CC      aarch64-softmmu/hw/misc/omap_gpmc.o
  CC      aarch64-softmmu/hw/misc/omap_l4.o
  CC      aarch64-softmmu/hw/misc/omap_sdrc.o
  CC      aarch64-softmmu/hw/misc/omap_tap.o
  CC      aarch64-softmmu/hw/misc/bcm2835_mbox.o
  CC      aarch64-softmmu/hw/misc/bcm2835_property.o
  CC      aarch64-softmmu/hw/misc/bcm2835_rng.o
  CC      aarch64-softmmu/hw/misc/zynq_slcr.o
  CC      aarch64-softmmu/hw/misc/zynq-xadc.o
  CC      aarch64-softmmu/hw/misc/stm32f2xx_syscfg.o
  CC      aarch64-softmmu/hw/misc/mps2-scc.o
  CC      aarch64-softmmu/hw/misc/auxbus.o
  CC      aarch64-softmmu/hw/misc/aspeed_scu.o
  CC      aarch64-softmmu/hw/misc/aspeed_sdmc.o
  CC      aarch64-softmmu/hw/misc/mmio_interface.o
  CC      aarch64-softmmu/hw/net/virtio-net.o
  CC      aarch64-softmmu/hw/net/vhost_net.o
  CC      aarch64-softmmu/hw/pcmcia/pxa2xx.o
  CC      aarch64-softmmu/hw/scsi/virtio-scsi.o
  CC      aarch64-softmmu/hw/scsi/virtio-scsi-dataplane.o
  CC      aarch64-softmmu/hw/scsi/vhost-scsi-common.o
  CC      aarch64-softmmu/hw/scsi/vhost-scsi.o
  CC      aarch64-softmmu/hw/scsi/vhost-user-scsi.o
  CC      aarch64-softmmu/hw/sd/omap_mmc.o
  LINK    x86_64-softmmu/qemu-system-x86_64
  CC      aarch64-softmmu/hw/sd/pxa2xx_mmci.o
  CC      aarch64-softmmu/hw/sd/bcm2835_sdhost.o
  CC      aarch64-softmmu/hw/ssi/omap_spi.o
  CC      aarch64-softmmu/hw/ssi/imx_spi.o
  CC      aarch64-softmmu/hw/timer/exynos4210_mct.o
  CC      aarch64-softmmu/hw/timer/exynos4210_pwm.o
  CC      aarch64-softmmu/hw/timer/exynos4210_rtc.o
  CC      aarch64-softmmu/hw/timer/omap_gptimer.o
  CC      aarch64-softmmu/hw/timer/omap_synctimer.o
  CC      aarch64-softmmu/hw/timer/pxa2xx_timer.o
  CC      aarch64-softmmu/hw/timer/digic-timer.o
  CC      aarch64-softmmu/hw/timer/allwinner-a10-pit.o
  CC      aarch64-softmmu/hw/usb/tusb6010.o
  CC      aarch64-softmmu/hw/vfio/common.o
  CC      aarch64-softmmu/hw/vfio/pci.o
  CC      aarch64-softmmu/hw/vfio/pci-quirks.o
  CC      aarch64-softmmu/hw/vfio/platform.o
  CC      aarch64-softmmu/hw/vfio/calxeda-xgmac.o
  CC      aarch64-softmmu/hw/vfio/amd-xgbe.o
  CC      aarch64-softmmu/hw/vfio/spapr.o
  CC      aarch64-softmmu/hw/virtio/virtio.o
  CC      aarch64-softmmu/hw/virtio/virtio-balloon.o
  CC      aarch64-softmmu/hw/virtio/vhost.o
  CC      aarch64-softmmu/hw/virtio/vhost-backend.o
  CC      aarch64-softmmu/hw/virtio/vhost-user.o
  CC      aarch64-softmmu/hw/virtio/vhost-vsock.o
  CC      aarch64-softmmu/hw/virtio/virtio-crypto.o
  CC      aarch64-softmmu/hw/virtio/virtio-crypto-pci.o
  CC      aarch64-softmmu/hw/arm/boot.o
  CC      aarch64-softmmu/hw/arm/collie.o
  CC      aarch64-softmmu/hw/arm/exynos4_boards.o
  CC      aarch64-softmmu/hw/arm/gumstix.o
  CC      aarch64-softmmu/hw/arm/highbank.o
  CC      aarch64-softmmu/hw/arm/digic_boards.o
  CC      aarch64-softmmu/hw/arm/mainstone.o
  CC      aarch64-softmmu/hw/arm/musicpal.o
  CC      aarch64-softmmu/hw/arm/integratorcp.o
  CC      aarch64-softmmu/hw/arm/nseries.o
  CC      aarch64-softmmu/hw/arm/omap_sx1.o
  CC      aarch64-softmmu/hw/arm/palm.o
  CC      aarch64-softmmu/hw/arm/realview.o
  CC      aarch64-softmmu/hw/arm/spitz.o
  CC      aarch64-softmmu/hw/arm/stellaris.o
  CC      aarch64-softmmu/hw/arm/tosa.o
  CC      aarch64-softmmu/hw/arm/versatilepb.o
  CC      aarch64-softmmu/hw/arm/vexpress.o
  CC      aarch64-softmmu/hw/arm/virt.o
  CC      aarch64-softmmu/hw/arm/xilinx_zynq.o
  CC      aarch64-softmmu/hw/arm/z2.o
  CC      aarch64-softmmu/hw/arm/virt-acpi-build.o
  CC      aarch64-softmmu/hw/arm/netduino2.o
  CC      aarch64-softmmu/hw/arm/sysbus-fdt.o
  CC      aarch64-softmmu/hw/arm/armv7m.o
  CC      aarch64-softmmu/hw/arm/exynos4210.o
  CC      aarch64-softmmu/hw/arm/pxa2xx.o
  CC      aarch64-softmmu/hw/arm/pxa2xx_gpio.o
  CC      aarch64-softmmu/hw/arm/pxa2xx_pic.o
  CC      aarch64-softmmu/hw/arm/digic.o
  CC      aarch64-softmmu/hw/arm/omap1.o
  CC      aarch64-softmmu/hw/arm/omap2.o
  CC      aarch64-softmmu/hw/arm/strongarm.o
  CC      aarch64-softmmu/hw/arm/allwinner-a10.o
  CC      aarch64-softmmu/hw/arm/cubieboard.o
  CC      aarch64-softmmu/hw/arm/bcm2835_peripherals.o
  CC      aarch64-softmmu/hw/arm/bcm2836.o
  CC      aarch64-softmmu/hw/arm/raspi.o
  CC      aarch64-softmmu/hw/arm/stm32f205_soc.o
  CC      aarch64-softmmu/hw/arm/xlnx-zynqmp.o
  CC      aarch64-softmmu/hw/arm/xlnx-ep108.o
  CC      aarch64-softmmu/hw/arm/fsl-imx25.o
  CC      aarch64-softmmu/hw/arm/imx25_pdk.o
  CC      aarch64-softmmu/hw/arm/fsl-imx31.o
  CC      aarch64-softmmu/hw/arm/kzm.o
  CC      aarch64-softmmu/hw/arm/fsl-imx6.o
  CC      aarch64-softmmu/hw/arm/sabrelite.o
  CC      aarch64-softmmu/hw/arm/aspeed_soc.o
  CC      aarch64-softmmu/hw/arm/aspeed.o
  CC      aarch64-softmmu/hw/arm/mps2.o
  CC      aarch64-softmmu/target/arm/arm-semi.o
  CC      aarch64-softmmu/target/arm/machine.o
  CC      aarch64-softmmu/target/arm/psci.o
  CC      aarch64-softmmu/target/arm/arch_dump.o
  CC      aarch64-softmmu/target/arm/monitor.o
  CC      aarch64-softmmu/target/arm/kvm-stub.o
  CC      aarch64-softmmu/target/arm/translate.o
  CC      aarch64-softmmu/target/arm/op_helper.o
  CC      aarch64-softmmu/target/arm/helper.o
  CC      aarch64-softmmu/target/arm/cpu.o
  CC      aarch64-softmmu/target/arm/neon_helper.o
  CC      aarch64-softmmu/target/arm/iwmmxt_helper.o
  CC      aarch64-softmmu/target/arm/gdbstub.o
  CC      aarch64-softmmu/target/arm/cpu64.o
  CC      aarch64-softmmu/target/arm/translate-a64.o
  CC      aarch64-softmmu/target/arm/helper-a64.o
  CC      aarch64-softmmu/target/arm/gdbstub64.o
  CC      aarch64-softmmu/target/arm/crypto_helper.o
  CC      aarch64-softmmu/target/arm/arm-powerctl.o
  GEN     trace/generated-helpers.c
  CC      aarch64-softmmu/trace/control-target.o
  CC      aarch64-softmmu/gdbstub-xml.o
  CC      aarch64-softmmu/trace/generated-helpers.o
/tmp/qemu-test/src/target/arm/translate-a64.c: In function ‘handle_shri_with_rndacc’:
/tmp/qemu-test/src/target/arm/translate-a64.c:6372: warning: ‘tcg_src_hi’ may be used uninitialized in this function
/tmp/qemu-test/src/target/arm/translate-a64.c: In function ‘disas_simd_scalar_two_reg_misc’:
/tmp/qemu-test/src/target/arm/translate-a64.c:8099: warning: ‘rmode’ may be used uninitialized in this function
  LINK    aarch64-softmmu/qemu-system-aarch64
make[1]: Leaving directory '/var/tmp/patchew-tester-tmp-lk2eywix/src'

real	3m27.669s
user	0m6.592s
sys	0m2.366s
  BUILD   fedora
make[1]: Entering directory '/var/tmp/patchew-tester-tmp-lk2eywix/src'
  ARCHIVE qemu.tgz
  ARCHIVE dtc.tgz
  COPY    RUNNER
    RUN test-mingw in qemu:fedora 
Packages installed:
PyYAML-3.11-13.fc25.x86_64
SDL-devel-1.2.15-21.fc24.x86_64
bc-1.06.95-16.fc24.x86_64
bison-3.0.4-4.fc24.x86_64
bzip2-1.0.6-21.fc25.x86_64
ccache-3.3.4-1.fc25.x86_64
clang-3.9.1-2.fc25.x86_64
findutils-4.6.0-8.fc25.x86_64
flex-2.6.0-3.fc25.x86_64
gcc-6.3.1-1.fc25.x86_64
gcc-c++-6.3.1-1.fc25.x86_64
git-2.9.4-1.fc25.x86_64
glib2-devel-2.50.3-1.fc25.x86_64
hostname-3.15-8.fc25.x86_64
libaio-devel-0.3.110-6.fc24.x86_64
libfdt-devel-1.4.2-1.fc25.x86_64
make-4.1-6.fc25.x86_64
mingw32-SDL-1.2.15-7.fc24.noarch
mingw32-bzip2-1.0.6-7.fc24.noarch
mingw32-curl-7.47.0-1.fc24.noarch
mingw32-glib2-2.50.3-1.fc25.noarch
mingw32-gmp-6.1.1-1.fc25.noarch
mingw32-gnutls-3.5.5-2.fc25.noarch
mingw32-gtk2-2.24.31-2.fc25.noarch
mingw32-gtk3-3.22.17-1.fc25.noarch
mingw32-libjpeg-turbo-1.5.1-1.fc25.noarch
mingw32-libpng-1.6.27-1.fc25.noarch
mingw32-libssh2-1.4.3-5.fc24.noarch
mingw32-libtasn1-4.9-1.fc25.noarch
mingw32-nettle-3.3-1.fc25.noarch
mingw32-pixman-0.34.0-1.fc25.noarch
mingw32-pkg-config-0.28-6.fc24.x86_64
mingw64-SDL-1.2.15-7.fc24.noarch
mingw64-bzip2-1.0.6-7.fc24.noarch
mingw64-curl-7.47.0-1.fc24.noarch
mingw64-glib2-2.50.3-1.fc25.noarch
mingw64-gmp-6.1.1-1.fc25.noarch
mingw64-gnutls-3.5.5-2.fc25.noarch
mingw64-gtk2-2.24.31-2.fc25.noarch
mingw64-gtk3-3.22.17-1.fc25.noarch
mingw64-libjpeg-turbo-1.5.1-1.fc25.noarch
mingw64-libpng-1.6.27-1.fc25.noarch
mingw64-libssh2-1.4.3-5.fc24.noarch
mingw64-libtasn1-4.9-1.fc25.noarch
mingw64-nettle-3.3-1.fc25.noarch
mingw64-pixman-0.34.0-1.fc25.noarch
mingw64-pkg-config-0.28-6.fc24.x86_64
package python2 is not installed
perl-5.24.2-387.fc25.x86_64
pixman-devel-0.34.0-2.fc24.x86_64
sparse-0.5.0-10.fc25.x86_64
tar-1.29-3.fc25.x86_64
which-2.21-1.fc25.x86_64
zlib-devel-1.2.8-10.fc24.x86_64

Environment variables:
PACKAGES=ccache git tar PyYAML sparse flex bison python2 bzip2 hostname     glib2-devel pixman-devel zlib-devel SDL-devel libfdt-devel     gcc gcc-c++ clang make perl which bc findutils libaio-devel     mingw32-pixman mingw32-glib2 mingw32-gmp mingw32-SDL mingw32-pkg-config     mingw32-gtk2 mingw32-gtk3 mingw32-gnutls mingw32-nettle mingw32-libtasn1     mingw32-libjpeg-turbo mingw32-libpng mingw32-curl mingw32-libssh2     mingw32-bzip2     mingw64-pixman mingw64-glib2 mingw64-gmp mingw64-SDL mingw64-pkg-config     mingw64-gtk2 mingw64-gtk3 mingw64-gnutls mingw64-nettle mingw64-libtasn1     mingw64-libjpeg-turbo mingw64-libpng mingw64-curl mingw64-libssh2     mingw64-bzip2
HOSTNAME=9238ab671ff4
TERM=xterm
MAKEFLAGS= -j8
HISTSIZE=1000
J=8
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36:
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
MAIL=/var/spool/mail/root
PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
TARGET_LIST=
HISTCONTROL=ignoredups
FGC=f25
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
DISTTAG=f25container
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
FEATURES=mingw clang pyyaml dtc
DEBUG=
_=/usr/bin/env

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/var/tmp/qemu-build/install --cross-prefix=x86_64-w64-mingw32- --enable-trace-backends=simple --enable-debug --enable-gnutls --enable-nettle --enable-curl --enable-vnc --enable-bzip2 --enable-guest-agent --with-sdlabi=1.2 --with-gtkabi=2.0
Install prefix    /var/tmp/qemu-build/install
BIOS directory    /var/tmp/qemu-build/install
binary directory  /var/tmp/qemu-build/install
library directory /var/tmp/qemu-build/install/lib
module directory  /var/tmp/qemu-build/install/lib
libexec directory /var/tmp/qemu-build/install/libexec
include directory /var/tmp/qemu-build/install/include
config directory  /var/tmp/qemu-build/install
local state directory   queried at runtime
Windows SDK       no
Source path       /tmp/qemu-test/src
C compiler        x86_64-w64-mingw32-gcc
Host C compiler   cc
C++ compiler      x86_64-w64-mingw32-g++
Objective-C compiler clang
ARFLAGS           rv
CFLAGS            -g 
QEMU_CFLAGS       -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/pixman-1  -I$(SRC_PATH)/dtc/libfdt -Werror -mms-bitfields -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/glib-2.0 -I/usr/x86_64-w64-mingw32/sys-root/mingw/lib/glib-2.0/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include  -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include  -I/usr/x86_64-w64-mingw32/sys-root/mingw/include   -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 
LDFLAGS           -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase -Wl,--warn-common -m64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
gprof enabled     no
sparse enabled    no
strip binaries    no
profiler          no
static build      no
pixman            system
SDL support       yes (1.2.15)
GTK support       yes (2.24.31)
GTK GL support    no
VTE support       no 
TLS priority      NORMAL
GNUTLS support    yes
GNUTLS rnd        yes
libgcrypt         no
libgcrypt kdf     no
nettle            yes (3.3)
nettle kdf        yes
libtasn1          yes
curses support    no
virgl support     no
curl support      yes
mingw32 support   yes
Audio drivers     dsound
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  no
VNC JPEG support  yes
VNC PNG support   yes
xen support       no
brlapi support    no
bluez  support    no
Documentation     no
PIE               no
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support no
Install blobs     yes
KVM support       no
HAX support       yes
TCG support       yes
TCG debug enabled yes
TCG interpreter   no
RDMA support      no
fdt support       yes
preadv support    no
fdatasync         no
madvise           no
posix_madvise     no
libcap-ng support no
vhost-net support no
vhost-scsi support no
vhost-vsock support no
vhost-user support no
Trace backends    simple
Trace output file trace-<pid>
spice support     no 
rbd support       no
xfsctl support    no
smartcard support no
libusb            no
usb net redir     no
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no
build guest agent yes
QGA VSS support   no
QGA w32 disk info yes
QGA MSI support   no
seccomp support   no
coroutine backend win32
coroutine pool    yes
debug stack usage no
crypto afalg      no
GlusterFS support no
gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   yes
TPM passthrough   no
QOM debugging     yes
Live block migration yes
lzo support       no
snappy support    no
bzip2 support     yes
NUMA host support no
tcmalloc support  no
jemalloc support  no
avx2 optimization yes
replication support yes
VxHS block device no
mkdir -p dtc/libfdt
mkdir -p dtc/tests
  GEN     x86_64-softmmu/config-devices.mak.tmp
  GEN     aarch64-softmmu/config-devices.mak.tmp
  GEN     config-host.h
  GEN     qemu-options.def
  GEN     qmp-commands.h
  GEN     qapi-types.h
  GEN     qapi-visit.h
  GEN     qapi-event.h
  GEN     x86_64-softmmu/config-devices.mak
  GEN     aarch64-softmmu/config-devices.mak
  GEN     qmp-marshal.c
  GEN     qapi-types.c
  GEN     qapi-visit.c
  GEN     qapi-event.c
  GEN     qmp-introspect.h
  GEN     qmp-introspect.c
  GEN     trace/generated-tcg-tracers.h
  GEN     trace/generated-helpers-wrappers.h
  GEN     trace/generated-helpers.h
  GEN     trace/generated-helpers.c
  GEN     module_block.h
  GEN     tests/test-qapi-types.h
  GEN     tests/test-qapi-visit.h
  GEN     tests/test-qmp-commands.h
  GEN     tests/test-qapi-event.h
  GEN     tests/test-qmp-introspect.h
  GEN     trace-root.h
  GEN     util/trace.h
  GEN     crypto/trace.h
  GEN     io/trace.h
  GEN     migration/trace.h
  GEN     block/trace.h
  GEN     chardev/trace.h
  GEN     hw/block/trace.h
  GEN     hw/block/dataplane/trace.h
  GEN     hw/char/trace.h
  GEN     hw/intc/trace.h
  GEN     hw/net/trace.h
  GEN     hw/virtio/trace.h
  GEN     hw/audio/trace.h
  GEN     hw/misc/trace.h
  GEN     hw/usb/trace.h
  GEN     hw/scsi/trace.h
  GEN     hw/nvram/trace.h
  GEN     hw/display/trace.h
  GEN     hw/input/trace.h
  GEN     hw/timer/trace.h
  GEN     hw/dma/trace.h
  GEN     hw/sparc/trace.h
  GEN     hw/sd/trace.h
  GEN     hw/isa/trace.h
  GEN     hw/mem/trace.h
  GEN     hw/i386/trace.h
  GEN     hw/i386/xen/trace.h
  GEN     hw/9pfs/trace.h
  GEN     hw/ppc/trace.h
  GEN     hw/pci/trace.h
  GEN     hw/s390x/trace.h
  GEN     hw/vfio/trace.h
  GEN     hw/acpi/trace.h
  GEN     hw/arm/trace.h
  GEN     hw/alpha/trace.h
  GEN     hw/xen/trace.h
  GEN     ui/trace.h
  GEN     audio/trace.h
  GEN     net/trace.h
  GEN     target/arm/trace.h
  GEN     target/i386/trace.h
  GEN     target/mips/trace.h
  GEN     target/sparc/trace.h
  GEN     target/s390x/trace.h
  GEN     target/ppc/trace.h
  GEN     qom/trace.h
  GEN     linux-user/trace.h
  GEN     qapi/trace.h
  GEN     accel/tcg/trace.h
  GEN     accel/kvm/trace.h
  GEN     nbd/trace.h
  GEN     trace-root.c
  GEN     util/trace.c
  GEN     crypto/trace.c
  GEN     io/trace.c
  GEN     migration/trace.c
  GEN     block/trace.c
  GEN     chardev/trace.c
  GEN     hw/block/trace.c
  GEN     hw/block/dataplane/trace.c
  GEN     hw/char/trace.c
  GEN     hw/intc/trace.c
  GEN     hw/net/trace.c
  GEN     hw/virtio/trace.c
  GEN     hw/audio/trace.c
  GEN     hw/misc/trace.c
  GEN     hw/usb/trace.c
  GEN     hw/scsi/trace.c
  GEN     hw/nvram/trace.c
  GEN     hw/display/trace.c
  GEN     hw/input/trace.c
  GEN     hw/timer/trace.c
  GEN     hw/dma/trace.c
  GEN     hw/sparc/trace.c
  GEN     hw/sd/trace.c
  GEN     hw/isa/trace.c
  GEN     hw/mem/trace.c
  GEN     hw/i386/trace.c
  GEN     hw/i386/xen/trace.c
  GEN     hw/9pfs/trace.c
  GEN     hw/ppc/trace.c
  GEN     hw/pci/trace.c
  GEN     hw/s390x/trace.c
  GEN     hw/vfio/trace.c
  GEN     hw/acpi/trace.c
  GEN     hw/arm/trace.c
  GEN     hw/alpha/trace.c
  GEN     hw/xen/trace.c
  GEN     ui/trace.c
  GEN     audio/trace.c
  GEN     net/trace.c
  GEN     target/arm/trace.c
  GEN     target/i386/trace.c
  GEN     target/mips/trace.c
  GEN     target/sparc/trace.c
  GEN     target/s390x/trace.c
  GEN     target/ppc/trace.c
  GEN     qom/trace.c
  GEN     linux-user/trace.c
  GEN     qapi/trace.c
  GEN     accel/tcg/trace.c
  GEN     accel/kvm/trace.c
  GEN     nbd/trace.c
  GEN     config-all-devices.mak
	 DEP /tmp/qemu-test/src/dtc/tests/dumptrees.c
	 DEP /tmp/qemu-test/src/dtc/tests/trees.S
	 DEP /tmp/qemu-test/src/dtc/tests/testutils.c
	 DEP /tmp/qemu-test/src/dtc/tests/value-labels.c
	 DEP /tmp/qemu-test/src/dtc/tests/asm_tree_dump.c
	 DEP /tmp/qemu-test/src/dtc/tests/truncated_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/check_path.c
	 DEP /tmp/qemu-test/src/dtc/tests/overlay_bad_fixup.c
	 DEP /tmp/qemu-test/src/dtc/tests/overlay.c
	 DEP /tmp/qemu-test/src/dtc/tests/subnode_iterate.c
	 DEP /tmp/qemu-test/src/dtc/tests/integer-expressions.c
	 DEP /tmp/qemu-test/src/dtc/tests/property_iterate.c
	 DEP /tmp/qemu-test/src/dtc/tests/path_offset_aliases.c
	 DEP /tmp/qemu-test/src/dtc/tests/utilfdt_test.c
	 DEP /tmp/qemu-test/src/dtc/tests/add_subnode_with_nops.c
	 DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_unordered.c
	 DEP /tmp/qemu-test/src/dtc/tests/dtb_reverse.c
	 DEP /tmp/qemu-test/src/dtc/tests/dtbs_equal_ordered.c
	 DEP /tmp/qemu-test/src/dtc/tests/incbin.c
	 DEP /tmp/qemu-test/src/dtc/tests/extra-terminating-null.c
	 DEP /tmp/qemu-test/src/dtc/tests/boot-cpuid.c
	 DEP /tmp/qemu-test/src/dtc/tests/phandle_format.c
	 DEP /tmp/qemu-test/src/dtc/tests/path-references.c
	 DEP /tmp/qemu-test/src/dtc/tests/references.c
	 DEP /tmp/qemu-test/src/dtc/tests/string_escapes.c
	 DEP /tmp/qemu-test/src/dtc/tests/propname_escapes.c
	 DEP /tmp/qemu-test/src/dtc/tests/appendprop2.c
	 DEP /tmp/qemu-test/src/dtc/tests/appendprop1.c
	 DEP /tmp/qemu-test/src/dtc/tests/del_node.c
	 DEP /tmp/qemu-test/src/dtc/tests/del_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/setprop.c
	 DEP /tmp/qemu-test/src/dtc/tests/set_name.c
	 DEP /tmp/qemu-test/src/dtc/tests/rw_tree1.c
	 DEP /tmp/qemu-test/src/dtc/tests/open_pack.c
	 DEP /tmp/qemu-test/src/dtc/tests/nopulate.c
	 DEP /tmp/qemu-test/src/dtc/tests/move_and_save.c
	 DEP /tmp/qemu-test/src/dtc/tests/mangle-layout.c
	 DEP /tmp/qemu-test/src/dtc/tests/sw_tree1.c
	 DEP /tmp/qemu-test/src/dtc/tests/nop_node.c
	 DEP /tmp/qemu-test/src/dtc/tests/nop_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/stringlist.c
	 DEP /tmp/qemu-test/src/dtc/tests/setprop_inplace.c
	 DEP /tmp/qemu-test/src/dtc/tests/addr_size_cells.c
	 DEP /tmp/qemu-test/src/dtc/tests/notfound.c
	 DEP /tmp/qemu-test/src/dtc/tests/sized_cells.c
	 DEP /tmp/qemu-test/src/dtc/tests/char_literal.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_alias.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_compatible.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_check_compatible.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_phandle.c
	 DEP /tmp/qemu-test/src/dtc/tests/node_offset_by_prop_value.c
	 DEP /tmp/qemu-test/src/dtc/tests/parent_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/supernode_atdepth_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_path.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_phandle.c
	 DEP /tmp/qemu-test/src/dtc/tests/getprop.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_name.c
	 DEP /tmp/qemu-test/src/dtc/tests/path_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/subnode_offset.c
	 DEP /tmp/qemu-test/src/dtc/tests/find_property.c
	 DEP /tmp/qemu-test/src/dtc/tests/root_node.c
	 DEP /tmp/qemu-test/src/dtc/tests/get_mem_rsv.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_overlay.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_addresses.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_empty_tree.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_strerror.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_rw.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_sw.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_wip.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt_ro.c
	 DEP /tmp/qemu-test/src/dtc/libfdt/fdt.c
	 DEP /tmp/qemu-test/src/dtc/util.c
	 DEP /tmp/qemu-test/src/dtc/fdtput.c
	 DEP /tmp/qemu-test/src/dtc/fdtget.c
	 DEP /tmp/qemu-test/src/dtc/fdtdump.c
	 LEX convert-dtsv0-lexer.lex.c
	 DEP /tmp/qemu-test/src/dtc/srcpos.c
	 BISON dtc-parser.tab.c
	 LEX dtc-lexer.lex.c
	 DEP /tmp/qemu-test/src/dtc/treesource.c
	 DEP /tmp/qemu-test/src/dtc/livetree.c
	 DEP /tmp/qemu-test/src/dtc/fstree.c
	 DEP /tmp/qemu-test/src/dtc/flattree.c
	 DEP /tmp/qemu-test/src/dtc/dtc.c
	 DEP /tmp/qemu-test/src/dtc/data.c
	 DEP /tmp/qemu-test/src/dtc/checks.c
	 DEP convert-dtsv0-lexer.lex.c
	 DEP dtc-lexer.lex.c
	 DEP dtc-parser.tab.c
	CHK version_gen.h
	UPD version_gen.h
	 DEP /tmp/qemu-test/src/dtc/util.c
	 CC libfdt/fdt.o
	 CC libfdt/fdt_wip.o
	 CC libfdt/fdt_ro.o
	 CC libfdt/fdt_sw.o
	 CC libfdt/fdt_rw.o
	 CC libfdt/fdt_strerror.o
	 CC libfdt/fdt_empty_tree.o
	 CC libfdt/fdt_addresses.o
	 CC libfdt/fdt_overlay.o
	 AR libfdt/libfdt.a
x86_64-w64-mingw32-ar: creating libfdt/libfdt.a
a - libfdt/fdt.o
a - libfdt/fdt_ro.o
a - libfdt/fdt_wip.o
a - libfdt/fdt_sw.o
a - libfdt/fdt_rw.o
a - libfdt/fdt_strerror.o
a - libfdt/fdt_empty_tree.o
a - libfdt/fdt_addresses.o
a - libfdt/fdt_overlay.o
  RC      version.o
  GEN     qga/qapi-generated/qga-qapi-types.h
  GEN     qga/qapi-generated/qga-qapi-visit.h
  GEN     qga/qapi-generated/qga-qapi-types.c
  GEN     qga/qapi-generated/qga-qapi-visit.c
  GEN     qga/qapi-generated/qga-qmp-marshal.c
  GEN     qga/qapi-generated/qga-qmp-commands.h
  CC      qmp-introspect.o
  CC      qapi-types.o
  CC      qapi-visit.o
  CC      qapi-event.o
  CC      qapi/qapi-dealloc-visitor.o
  CC      qapi/qobject-input-visitor.o
  CC      qapi/qobject-output-visitor.o
  CC      qapi/qmp-registry.o
  CC      qapi/qapi-visit-core.o
  CC      qapi/qmp-dispatch.o
  CC      qapi/string-input-visitor.o
  CC      qapi/string-output-visitor.o
  CC      qapi/opts-visitor.o
  CC      qapi/qapi-clone-visitor.o
  CC      qapi/qmp-event.o
  CC      qapi/qapi-util.o
  CC      qobject/qnull.o
  CC      qobject/qnum.o
  CC      qobject/qstring.o
  CC      qobject/qdict.o
  CC      qobject/qlist.o
  CC      qobject/qbool.o
  CC      qobject/qjson.o
  CC      qobject/qobject.o
  CC      qobject/json-streamer.o
  CC      qobject/json-parser.o
  CC      trace/simple.o
  CC      qobject/json-lexer.o
  CC      trace/control.o
  CC      trace/qmp.o
  CC      util/osdep.o
  CC      util/cutils.o
  CC      util/unicode.o
  CC      util/qemu-timer-common.o
  CC      util/bufferiszero.o
  CC      util/lockcnt.o
  CC      util/aiocb.o
  CC      util/async.o
  CC      util/thread-pool.o
  CC      util/qemu-timer.o
  CC      util/main-loop.o
  CC      util/iohandler.o
  CC      util/aio-win32.o
  CC      util/event_notifier-win32.o
  CC      util/oslib-win32.o
  CC      util/qemu-thread-win32.o
  CC      util/envlist.o
  CC      util/path.o
  CC      util/module.o
  CC      util/host-utils.o
  CC      util/bitmap.o
  CC      util/bitops.o
  CC      util/hbitmap.o
  CC      util/fifo8.o
  CC      util/acl.o
  CC      util/cacheinfo.o
  CC      util/error.o
  CC      util/qemu-error.o
  CC      util/id.o
  CC      util/iov.o
  CC      util/qemu-config.o
  CC      util/qemu-sockets.o
  CC      util/uri.o
  CC      util/notify.o
  CC      util/qemu-option.o
  CC      util/qemu-progress.o
  CC      util/keyval.o
  CC      util/hexdump.o
  CC      util/crc32c.o
  CC      util/uuid.o
  CC      util/throttle.o
  CC      util/getauxval.o
  CC      util/readline.o
  CC      util/rcu.o
  CC      util/qemu-coroutine.o
  CC      util/qemu-coroutine-lock.o
  CC      util/qemu-coroutine-io.o
  CC      util/qemu-coroutine-sleep.o
  CC      util/coroutine-win32.o
  CC      util/buffer.o
  CC      util/timed-average.o
  CC      util/base64.o
  CC      util/log.o
  CC      util/qdist.o
  CC      util/qht.o
  CC      util/range.o
  CC      util/stats64.o
  CC      util/systemd.o
  CC      trace-root.o
  CC      util/trace.o
  CC      crypto/trace.o
  CC      io/trace.o
  CC      migration/trace.o
  CC      block/trace.o
  CC      chardev/trace.o
  CC      hw/block/trace.o
  CC      hw/block/dataplane/trace.o
  CC      hw/char/trace.o
  CC      hw/intc/trace.o
  CC      hw/net/trace.o
  CC      hw/virtio/trace.o
  CC      hw/audio/trace.o
  CC      hw/misc/trace.o
  CC      hw/usb/trace.o
  CC      hw/scsi/trace.o
  CC      hw/nvram/trace.o
  CC      hw/display/trace.o
  CC      hw/input/trace.o
  CC      hw/timer/trace.o
  CC      hw/dma/trace.o
  CC      hw/sparc/trace.o
  CC      hw/sd/trace.o
  CC      hw/isa/trace.o
  CC      hw/mem/trace.o
  CC      hw/i386/trace.o
  CC      hw/i386/xen/trace.o
  CC      hw/9pfs/trace.o
  CC      hw/ppc/trace.o
  CC      hw/pci/trace.o
  CC      hw/s390x/trace.o
  CC      hw/vfio/trace.o
  CC      hw/acpi/trace.o
  CC      hw/arm/trace.o
  CC      hw/alpha/trace.o
  CC      hw/xen/trace.o
  CC      ui/trace.o
  CC      audio/trace.o
  CC      net/trace.o
  CC      target/arm/trace.o
  CC      target/i386/trace.o
  CC      target/mips/trace.o
  CC      target/sparc/trace.o
  CC      target/s390x/trace.o
  CC      target/ppc/trace.o
  CC      qom/trace.o
  CC      linux-user/trace.o
  CC      qapi/trace.o
  CC      accel/tcg/trace.o
  CC      accel/kvm/trace.o
  CC      nbd/trace.o
  CC      crypto/pbkdf-stub.o
  CC      stubs/arch-query-cpu-def.o
  CC      stubs/arch-query-cpu-model-expansion.o
  CC      stubs/arch-query-cpu-model-comparison.o
  CC      stubs/arch-query-cpu-model-baseline.o
  CC      stubs/bdrv-next-monitor-owned.o
  CC      stubs/blk-commit-all.o
  CC      stubs/blockdev-close-all-bdrv-states.o
  CC      stubs/clock-warp.o
  CC      stubs/cpu-get-clock.o
  CC      stubs/cpu-get-icount.o
  CC      stubs/dump.o
  CC      stubs/error-printf.o
  CC      stubs/fdset.o
  CC      stubs/gdbstub.o
  CC      stubs/get-vm-name.o
  CC      stubs/iothread.o
  CC      stubs/iothread-lock.o
  CC      stubs/is-daemonized.o
  CC      stubs/machine-init-done.o
  CC      stubs/migr-blocker.o
  CC      stubs/change-state-handler.o
  CC      stubs/monitor.o
  CC      stubs/notify-event.o
  CC      stubs/qtest.o
  CC      stubs/replay.o
  CC      stubs/runstate-check.o
  CC      stubs/set-fd-handler.o
  CC      stubs/slirp.o
  CC      stubs/sysbus.o
  CC      stubs/trace-control.o
  CC      stubs/uuid.o
  CC      stubs/vm-stop.o
  CC      stubs/vmstate.o
  CC      stubs/fd-register.o
  CC      stubs/qmp_pc_dimm_device_list.o
  CC      stubs/target-monitor-defs.o
  CC      stubs/target-get-monitor-def.o
  CC      stubs/pc_madt_cpu_entry.o
  CC      stubs/vmgenid.o
  CC      stubs/xen-common.o
  CC      stubs/xen-hvm.o
  GEN     qemu-img-cmds.h
  CC      block.o
  CC      blockjob.o
  CC      qemu-io-cmds.o
  CC      replication.o
  CC      block/raw-format.o
  CC      block/qcow.o
  CC      block/vdi.o
  CC      block/vmdk.o
  CC      block/cloop.o
  CC      block/bochs.o
  CC      block/vpc.o
  CC      block/vvfat.o
  CC      block/dmg.o
  CC      block/qcow2.o
  CC      block/qcow2-refcount.o
  CC      block/qcow2-cluster.o
  CC      block/qcow2-snapshot.o
  CC      block/qcow2-cache.o
  CC      block/qcow2-bitmap.o
  CC      block/qed.o
  CC      block/qed-l2-cache.o
  CC      block/qed-table.o
  CC      block/qed-cluster.o
  CC      block/qed-check.o
  CC      block/vhdx.o
  CC      block/vhdx-endian.o
  CC      block/vhdx-log.o
  CC      block/quorum.o
  CC      block/parallels.o
  CC      block/blkdebug.o
  CC      block/blkverify.o
  CC      block/blkreplay.o
  CC      block/block-backend.o
  CC      block/snapshot.o
  CC      block/qapi.o
  CC      block/win32-aio.o
  CC      block/file-win32.o
  CC      block/null.o
  CC      block/mirror.o
  CC      block/commit.o
  CC      block/io.o
  CC      block/throttle-groups.o
  CC      block/nbd.o
/tmp/qemu-test/src/block/file-win32.c: In function 'get_aio_option':
/tmp/qemu-test/src/block/file-win32.c:305:27: error: incompatible type for argument 1 of 'qapi_enum_parse'
     aio = qapi_enum_parse(BlockdevAioOptions_lookup, qemu_opt_get(opts, "aio"),
                           ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./qapi-types.h:19:0,
                 from /tmp/qemu-test/src/include/qapi/error.h:118,
                 from /tmp/qemu-test/src/block/file-win32.c:25:
/tmp/qemu-test/src/include/qapi/util.h:20:5: note: expected 'const QEnumLookup * {aka const struct QEnumLookup *}' but argument is of type 'QEnumLookup {aka const struct QEnumLookup}'
 int qapi_enum_parse(const QEnumLookup *lookup, const char *buf,
     ^~~~~~~~~~~~~~~
/tmp/qemu-test/src/rules.mak:66: recipe for target 'block/file-win32.o' failed
make: *** [block/file-win32.o] Error 1
make: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "./tests/docker/docker.py", line 382, in <module>
    sys.exit(main())
  File "./tests/docker/docker.py", line 379, in main
    return args.cmdobj.run(args, argv)
  File "./tests/docker/docker.py", line 237, in run
    return Docker().run(argv, args.keep, quiet=args.quiet)
  File "./tests/docker/docker.py", line 205, in run
    quiet=quiet)
  File "./tests/docker/docker.py", line 123, in _do_check
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib64/python2.7/subprocess.py", line 186, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'run', '--label', 'com.qemu.instance.uuid=7c655cf288ad11e7863052540069c830', '-u', '0', '-t', '--rm', '--net=none', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=8', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/var/tmp/patchew-tester-tmp-lk2eywix/src/docker-src.2017-08-24-05.20.31.14952:/var/tmp/qemu:z,ro', '-v', '/root/.cache/qemu-docker-ccache:/var/tmp/ccache:z', 'qemu:fedora', '/var/tmp/qemu/run', 'test-mingw']' returned non-zero exit status 2
make[1]: *** [tests/docker/Makefile.include:139: docker-run] Error 1
make[1]: Leaving directory '/var/tmp/patchew-tester-tmp-lk2eywix/src'
make: *** [tests/docker/Makefile.include:168: docker-run-test-mingw@fedora] Error 2

real	2m1.240s
user	0m5.206s
sys	0m1.703s
=== OUTPUT END ===

Test command exited with code: 2


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO Markus Armbruster
@ 2017-08-24  9:55   ` Markus Armbruster
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24  9:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

Markus Armbruster <armbru@redhat.com> writes:

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Currently, a FOO_lookup is an array of strings terminated by a NULL
> sentinel.
>
> A future patch will generate enums with "holes".  NULL-termination
> will cease to work then.
>
> To prepare for that, store the length in the FOO_lookup by wrapping it
> in a struct and adding a member for the length.
>
> The sentinel will be dropped next.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Message-Id: <20170822132255.23945-13-marcandre.lureau@redhat.com>
> [Basically redone]
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Fixup for Windows (thanks, Patchew!)


>From 594a6c8eb29e728e9fb960d321ca2d17f9bd9cd1 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Thu, 24 Aug 2017 11:48:46 +0200
Subject: [PATCH] fixup! qapi: Change data type of the FOO_lookup generated for
 enum FOO

---
 block/file-win32.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/file-win32.c b/block/file-win32.c
index f2a1830..639221b 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -302,7 +302,8 @@ static bool get_aio_option(QemuOpts *opts, int flags, Error **errp)
 
     aio_default = (flags & BDRV_O_NATIVE_AIO) ? BLOCKDEV_AIO_OPTIONS_NATIVE
                                               : BLOCKDEV_AIO_OPTIONS_THREADS;
-    aio = qapi_enum_parse(BlockdevAioOptions_lookup, qemu_opt_get(opts, "aio"),
+    aio = qapi_enum_parse(&BlockdevAioOptions_lookup,
+                          qemu_opt_get(opts, "aio"),
                           aio_default, errp);
 
     switch (aio) {
-- 
2.7.5

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code Markus Armbruster
@ 2017-08-24 10:43   ` Marc-André Lureau
  2017-08-24 16:32   ` Eric Blake
  1 sibling, 0 replies; 37+ messages in thread
From: Marc-André Lureau @ 2017-08-24 10:43 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: mdroth

On Thu, Aug 24, 2017 at 10:55 AM Markus Armbruster <armbru@redhat.com>
wrote:

> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>


Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

(tbh, I find it tedious and not really useful to have generated code in the
doc though)

---
>  docs/devel/qapi-code-gen.txt | 47
> +++++++++++++++++++++++++++++++++++---------
>  1 file changed, 38 insertions(+), 9 deletions(-)
>
> diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
> index 9903ac4..ae05327 100644
> --- a/docs/devel/qapi-code-gen.txt
> +++ b/docs/devel/qapi-code-gen.txt
> @@ -957,6 +957,8 @@ Example:
>
>      typedef struct UserDefOneList UserDefOneList;
>
> +    typedef struct q_obj_my_command_arg q_obj_my_command_arg;
> +
>      struct UserDefOne {
>          int64_t integer;
>          bool has_string;
> @@ -972,6 +974,10 @@ Example:
>
>      void qapi_free_UserDefOneList(UserDefOneList *obj);
>
> +    struct q_obj_my_command_arg {
> +        UserDefOneList *arg1;
> +    };
> +
>      #endif
>      $ cat qapi-generated/example-qapi-types.c
>  [Uninteresting stuff omitted...]
> @@ -1036,6 +1042,8 @@ Example:
>      void visit_type_UserDefOne(Visitor *v, const char *name, UserDefOne
> **obj, Error **errp);
>      void visit_type_UserDefOneList(Visitor *v, const char *name,
> UserDefOneList **obj, Error **errp);
>
> +    void visit_type_q_obj_my_command_arg_members(Visitor *v,
> q_obj_my_command_arg *obj, Error **errp);
> +
>      #endif
>      $ cat qapi-generated/example-qapi-visit.c
>  [Uninteresting stuff omitted...]
> @@ -1104,6 +1112,9 @@ Example:
>              }
>          }
>
> +        if (!err) {
> +            visit_check_list(v, &err);
> +        }
>          visit_end_list(v, (void **)obj);
>          if (err && visit_is_input(v)) {
>              qapi_free_UserDefOneList(*obj);
> @@ -1113,6 +1124,19 @@ Example:
>          error_propagate(errp, err);
>      }
>
> +    void visit_type_q_obj_my_command_arg_members(Visitor *v,
> q_obj_my_command_arg *obj, Error **errp)
> +    {
> +        Error *err = NULL;
> +
> +        visit_type_UserDefOneList(v, "arg1", &obj->arg1, &err);
> +        if (err) {
> +            goto out;
> +        }
> +
> +    out:
> +        error_propagate(errp, err);
> +    }
> +
>  === scripts/qapi-commands.py ===
>
>  Used to generate the marshaling/dispatch functions for the commands
> @@ -1145,9 +1169,12 @@ Example:
>
>      #include "example-qapi-types.h"
>      #include "qapi/qmp/qdict.h"
> +    #include "qapi/qmp/dispatch.h"
>      #include "qapi/error.h"
>
> +    void example_qmp_init_marshal(QmpCommandList *cmds);
>      UserDefOne *qmp_my_command(UserDefOneList *arg1, Error **errp);
> +    void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp);
>
>      #endif
>      $ cat qapi-generated/example-qmp-marshal.c
> @@ -1170,19 +1197,19 @@ Example:
>          visit_free(v);
>      }
>
> -    static void qmp_marshal_my_command(QDict *args, QObject **ret, Error
> **errp)
> +    void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp)
>      {
>          Error *err = NULL;
>          UserDefOne *retval;
>          Visitor *v;
> -        UserDefOneList *arg1 = NULL;
> +        q_obj_my_command_arg arg = {0};
>
>          v = qobject_input_visitor_new(QOBJECT(args));
>          visit_start_struct(v, NULL, NULL, 0, &err);
>          if (err) {
>              goto out;
>          }
> -        visit_type_UserDefOneList(v, "arg1", &arg1, &err);
> +        visit_type_q_obj_my_command_arg_members(v, &arg, &err);
>          if (!err) {
>              visit_check_struct(v, &err);
>          }
> @@ -1191,7 +1218,7 @@ Example:
>              goto out;
>          }
>
> -        retval = qmp_my_command(arg1, &err);
> +        retval = qmp_my_command(arg.arg1, &err);
>          if (err) {
>              goto out;
>          }
> @@ -1203,17 +1230,18 @@ Example:
>          visit_free(v);
>          v = qapi_dealloc_visitor_new();
>          visit_start_struct(v, NULL, NULL, 0, NULL);
> -        visit_type_UserDefOneList(v, "arg1", &arg1, NULL);
> +        visit_type_q_obj_my_command_arg_members(v, &arg, NULL);
>          visit_end_struct(v, NULL);
>          visit_free(v);
>      }
>
> -    static void qmp_init_marshal(void)
> +    void example_qmp_init_marshal(QmpCommandList *cmds)
>      {
> -        qmp_register_command("my-command", qmp_marshal_my_command,
> QCO_NO_OPTIONS);
> -    }
> +        QTAILQ_INIT(cmds);
>
> -    qapi_init(qmp_init_marshal);
> +        qmp_register_command(cmds, "my-command",
> +                             qmp_marshal_my_command, QCO_NO_OPTIONS);
> +    }
>
>  === scripts/qapi-event.py ===
>
> @@ -1258,6 +1286,7 @@ Example:
>          QDict *qmp;
>          Error *err = NULL;
>          QMPEventFuncEmit emit;
> +
>          emit = qmp_event_get_func_emit();
>          if (!emit) {
>              return;
> --
> 2.7.5
>
>
> --
Marc-André Lureau

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max Markus Armbruster
@ 2017-08-24 10:45   ` Marc-André Lureau
  2017-08-24 16:38   ` Eric Blake
  1 sibling, 0 replies; 37+ messages in thread
From: Marc-André Lureau @ 2017-08-24 10:45 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU, Michael Roth

On Thu, Aug 24, 2017 at 10:45 AM, Markus Armbruster <armbru@redhat.com> wrote:
> The lookup tables have a sentinel, no need to make callers pass their
> size.
>
> Fun: the header has it in the wrong position.  Good riddance.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  block.c                  |  1 -
>  block/file-posix.c       |  7 +++----
>  block/file-win32.c       |  2 +-
>  block/gluster.c          |  6 ++----
>  block/parallels.c        |  3 ++-
>  block/qcow2.c            |  6 ++----
>  blockdev.c               |  1 -
>  hmp.c                    |  2 +-
>  include/qapi/util.h      |  2 +-
>  migration/global_state.c |  3 +--
>  qapi/qapi-util.c         |  4 ++--
>  qemu-img.c               |  3 +--
>  qemu-nbd.c               |  1 -
>  tests/test-qapi-util.c   | 15 +++++----------
>  14 files changed, 21 insertions(+), 35 deletions(-)
>
> diff --git a/block.c b/block.c
> index 3615a68..dd0efa2 100644
> --- a/block.c
> +++ b/block.c
> @@ -1335,7 +1335,6 @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file,
>          BlockdevDetectZeroesOptions value =
>              qapi_enum_parse(BlockdevDetectZeroesOptions_lookup,
>                              detect_zeroes,
> -                            BLOCKDEV_DETECT_ZEROES_OPTIONS__MAX,
>                              BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF,
>                              &local_err);
>          if (local_err) {
> diff --git a/block/file-posix.c b/block/file-posix.c
> index cb3bfce..97e8a92 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -439,7 +439,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
>                    ? BLOCKDEV_AIO_OPTIONS_NATIVE
>                    : BLOCKDEV_AIO_OPTIONS_THREADS;
>      aio = qapi_enum_parse(BlockdevAioOptions_lookup, qemu_opt_get(opts, "aio"),
> -                          BLOCKDEV_AIO_OPTIONS__MAX, aio_default, &local_err);
> +                          aio_default, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
>          ret = -EINVAL;
> @@ -448,7 +448,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
>      s->use_linux_aio = (aio == BLOCKDEV_AIO_OPTIONS_NATIVE);
>
>      locking = qapi_enum_parse(OnOffAuto_lookup, qemu_opt_get(opts, "locking"),
> -                              ON_OFF_AUTO__MAX, ON_OFF_AUTO_AUTO, &local_err);
> +                              ON_OFF_AUTO_AUTO, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
>          ret = -EINVAL;
> @@ -1975,8 +1975,7 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
>      nocow = qemu_opt_get_bool(opts, BLOCK_OPT_NOCOW, false);
>      buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
>      prealloc = qapi_enum_parse(PreallocMode_lookup, buf,
> -                               PREALLOC_MODE__MAX, PREALLOC_MODE_OFF,
> -                               &local_err);
> +                               PREALLOC_MODE_OFF, &local_err);
>      g_free(buf);
>      if (local_err) {
>          error_propagate(errp, local_err);
> diff --git a/block/file-win32.c b/block/file-win32.c
> index 4706335..978d805 100644
> --- a/block/file-win32.c
> +++ b/block/file-win32.c
> @@ -304,7 +304,7 @@ static bool get_aio_option(QemuOpts *opts, int flags, Error **errp)
>      aio_default = (flags & BDRV_O_NATIVE_AIO) ? BLOCKDEV_AIO_OPTIONS_NATIVE
>                                                : BLOCKDEV_AIO_OPTIONS_THREADS;
>      aio = qapi_enum_parse(BlockdevAioOptions_lookup, qemu_opt_get(opts, "aio"),
> -                          BLOCKDEV_AIO_OPTIONS__MAX, aio_default, errp);
> +                          aio_default, errp);
>
>      switch (aio) {
>      case BLOCKDEV_AIO_OPTIONS_NATIVE:
> diff --git a/block/gluster.c b/block/gluster.c
> index 3064a45..8367e80 100644
> --- a/block/gluster.c
> +++ b/block/gluster.c
> @@ -544,8 +544,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
>          if (!strcmp(ptr, "tcp")) {
>              ptr = "inet";       /* accept legacy "tcp" */
>          }
> -        type = qapi_enum_parse(SocketAddressType_lookup, ptr,
> -                               SOCKET_ADDRESS_TYPE__MAX, -1, NULL);
> +        type = qapi_enum_parse(SocketAddressType_lookup, ptr, -1, NULL);
>          if (type != SOCKET_ADDRESS_TYPE_INET
>              && type != SOCKET_ADDRESS_TYPE_UNIX) {
>              error_setg(&local_err,
> @@ -1002,8 +1001,7 @@ static int qemu_gluster_create(const char *filename,
>                            BDRV_SECTOR_SIZE);
>
>      tmp = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
> -    prealloc = qapi_enum_parse(PreallocMode_lookup, tmp,
> -                               PREALLOC_MODE__MAX, PREALLOC_MODE_OFF,
> +    prealloc = qapi_enum_parse(PreallocMode_lookup, tmp, PREALLOC_MODE_OFF,
>                                 &local_err);
>      g_free(tmp);
>      if (local_err) {
> diff --git a/block/parallels.c b/block/parallels.c
> index e1e06d2..eb92366 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -697,7 +697,8 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
>      s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS);
>      buf = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE);
>      s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, buf,
> -            PRL_PREALLOC_MODE__MAX, PRL_PREALLOC_MODE_FALLOCATE, &local_err);
> +                                       PRL_PREALLOC_MODE_FALLOCATE,
> +                                       &local_err);
>      g_free(buf);
>      if (local_err != NULL) {
>          goto fail_options;
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 40ba26c..7aaf248 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2933,8 +2933,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)
>      }
>      buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
>      prealloc = qapi_enum_parse(PreallocMode_lookup, buf,
> -                               PREALLOC_MODE__MAX, PREALLOC_MODE_OFF,
> -                               &local_err);
> +                               PREALLOC_MODE_OFF, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
>          ret = -EINVAL;
> @@ -3624,8 +3623,7 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
>
>      optstr = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
>      prealloc = qapi_enum_parse(PreallocMode_lookup, optstr,
> -                               PREALLOC_MODE__MAX, PREALLOC_MODE_OFF,
> -                               &local_err);
> +                               PREALLOC_MODE_OFF, &local_err);
>      g_free(optstr);
>      if (local_err) {
>          goto err;
> diff --git a/blockdev.c b/blockdev.c
> index 02cd69b..722a61e 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -440,7 +440,6 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
>          *detect_zeroes =
>              qapi_enum_parse(BlockdevDetectZeroesOptions_lookup,
>                              qemu_opt_get(opts, "detect-zeroes"),
> -                            BLOCKDEV_DETECT_ZEROES_OPTIONS__MAX,
>                              BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF,
>                              &local_error);
>          if (local_error) {
> diff --git a/hmp.c b/hmp.c
> index fd80dce..03c1a78 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1742,7 +1742,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
>          if (read_only) {
>              read_only_mode =
>                  qapi_enum_parse(BlockdevChangeReadOnlyMode_lookup,
> -                                read_only, BLOCKDEV_CHANGE_READ_ONLY_MODE__MAX,
> +                                read_only,
>                                  BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err);
>              if (err) {
>                  hmp_handle_error(mon, &err);
> diff --git a/include/qapi/util.h b/include/qapi/util.h
> index 7436ed8..4eb8a3f 100644
> --- a/include/qapi/util.h
> +++ b/include/qapi/util.h
> @@ -12,7 +12,7 @@
>  #define QAPI_UTIL_H
>
>  int qapi_enum_parse(const char * const lookup[], const char *buf,
> -                    int max, int def, Error **errp);
> +                    int def, Error **errp);
>
>  int parse_qapi_name(const char *name, bool complete);
>
> diff --git a/migration/global_state.c b/migration/global_state.c
> index dcbbcb2..88c55f8 100644
> --- a/migration/global_state.c
> +++ b/migration/global_state.c
> @@ -89,8 +89,7 @@ static int global_state_post_load(void *opaque, int version_id)
>      s->received = true;
>      trace_migrate_global_state_post_load(runstate);
>
> -    r = qapi_enum_parse(RunState_lookup, runstate, RUN_STATE__MAX,
> -                                -1, &local_err);
> +    r = qapi_enum_parse(RunState_lookup, runstate, -1, &local_err);
>
>      if (r == -1) {
>          if (local_err) {
> diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
> index 46eda7d..ee7594f 100644
> --- a/qapi/qapi-util.c
> +++ b/qapi/qapi-util.c
> @@ -16,7 +16,7 @@
>  #include "qapi/util.h"
>
>  int qapi_enum_parse(const char * const lookup[], const char *buf,
> -                    int max, int def, Error **errp)
> +                    int def, Error **errp)
>  {
>      int i;
>
> @@ -24,7 +24,7 @@ int qapi_enum_parse(const char * const lookup[], const char *buf,
>          return def;
>      }
>
> -    for (i = 0; i < max; i++) {
> +    for (i = 0; lookup[i]; i++) {
>          if (!strcmp(buf, lookup[i])) {
>              return i;
>          }
> diff --git a/qemu-img.c b/qemu-img.c
> index 56ef49e..611ab7d 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -3491,8 +3491,7 @@ static int img_resize(int argc, char **argv)
>              break;
>          case OPTION_PREALLOCATION:
>              prealloc = qapi_enum_parse(PreallocMode_lookup, optarg,
> -                                       PREALLOC_MODE__MAX, PREALLOC_MODE__MAX,
> -                                       NULL);
> +                                       PREALLOC_MODE__MAX, NULL);
>              if (prealloc == PREALLOC_MODE__MAX) {
>                  error_report("Invalid preallocation mode '%s'", optarg);
>                  return 1;
> diff --git a/qemu-nbd.c b/qemu-nbd.c
> index 27164b8..96e10d6 100644
> --- a/qemu-nbd.c
> +++ b/qemu-nbd.c
> @@ -641,7 +641,6 @@ int main(int argc, char **argv)
>              detect_zeroes =
>                  qapi_enum_parse(BlockdevDetectZeroesOptions_lookup,
>                                  optarg,
> -                                BLOCKDEV_DETECT_ZEROES_OPTIONS__MAX,
>                                  BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF,
>                                  &local_err);
>              if (local_err) {
> diff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c
> index e869757..d72ee8c 100644
> --- a/tests/test-qapi-util.c
> +++ b/tests/test-qapi-util.c
> @@ -20,25 +20,20 @@ static void test_qapi_enum_parse(void)
>      Error *err = NULL;
>      int ret;
>
> -    ret = qapi_enum_parse(QType_lookup, NULL, QTYPE__MAX, QTYPE_NONE,
> -                          &error_abort);
> +    ret = qapi_enum_parse(QType_lookup, NULL, QTYPE_NONE, &error_abort);
>      g_assert_cmpint(ret, ==, QTYPE_NONE);
>
> -    ret = qapi_enum_parse(QType_lookup, "junk", QTYPE__MAX, -1,
> -                          NULL);
> +    ret = qapi_enum_parse(QType_lookup, "junk", -1, NULL);
>      g_assert_cmpint(ret, ==, -1);
>
> -    ret = qapi_enum_parse(QType_lookup, "junk", QTYPE__MAX, -1,
> -                          &err);
> +    ret = qapi_enum_parse(QType_lookup, "junk", -1, &err);
>      error_free_or_abort(&err);
>
> -    ret = qapi_enum_parse(QType_lookup, "none", QTYPE__MAX, -1,
> -                          &error_abort);
> +    ret = qapi_enum_parse(QType_lookup, "none", -1, &error_abort);
>      g_assert_cmpint(ret, ==, QTYPE_NONE);
>
>      ret = qapi_enum_parse(QType_lookup, QType_lookup[QTYPE__MAX - 1],
> -                          QTYPE__MAX, QTYPE__MAX - 1,
> -                          &error_abort);
> +                          QTYPE__MAX - 1, &error_abort);
>      g_assert_cmpint(ret, ==, QTYPE__MAX - 1);
>  }
>
> --
> 2.7.5
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 04/16] tpm: Clean up model registration & lookup
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 04/16] tpm: Clean up model " Markus Armbruster
@ 2017-08-24 10:50   ` Marc-André Lureau
  2017-08-24 18:35     ` Markus Armbruster
  0 siblings, 1 reply; 37+ messages in thread
From: Marc-André Lureau @ 2017-08-24 10:50 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU, Stefan Berger, Michael Roth

Hi

On Thu, Aug 24, 2017 at 10:45 AM, Markus Armbruster <armbru@redhat.com> wrote:
> We have a strict separation between enum TpmModel and tpm_models[]:
>
> * TpmModel may have any number of members.  It just happens to have one.
>
> * tpm_register_model() uses the first empty slot in tmp_models[].
>
>   If you register more than tpm_models[] has space,
>   tpn_register_model() fails.  Its caller silently ignores the
>   failure.

tpm_

>
>   Register the same TpmModel more than once has no effect other than
>   wasting tpm_models[] slots: tpm_model_is_registered() is happy with
>   the first one it finds.
>
> Since we only ever register one model, and tpm_models[] has space for
> just that one, this contraption even works.
>
> Turn tpm_models[] into a straight map from enum TpmType to bool.  Much
> simpler.
>
> Cc: Stefan Berger <stefanb@us.ibm.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  include/sysemu/tpm_backend.h |  2 +-
>  tpm.c                        | 37 +++++--------------------------------
>  2 files changed, 6 insertions(+), 33 deletions(-)
>
> diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
> index 1d21c6b..b0a9731 100644
> --- a/include/sysemu/tpm_backend.h
> +++ b/include/sysemu/tpm_backend.h
> @@ -226,7 +226,7 @@ TPMVersion tpm_backend_get_tpm_version(TPMBackend *s);
>  TPMBackend *qemu_find_tpm(const char *id);
>
>  const TPMDriverOps *tpm_get_backend_driver(const char *type);
> -int tpm_register_model(enum TpmModel model);
> +void tpm_register_model(enum TpmModel model);
>  void tpm_register_driver(const TPMDriverOps *tdo);
>
>  #endif
> diff --git a/tpm.c b/tpm.c
> index 6f39ec9..7635fc7 100644
> --- a/tpm.c
> +++ b/tpm.c
> @@ -24,39 +24,12 @@
>  static QLIST_HEAD(, TPMBackend) tpm_backends =
>      QLIST_HEAD_INITIALIZER(tpm_backends);
>
> -
> -#define TPM_MAX_MODELS      1
> -
>  static TPMDriverOps const *be_drivers[TPM_TYPE__MAX];
> +static bool tpm_models[TPM_MODEL__MAX];
>
> -static enum TpmModel tpm_models[TPM_MAX_MODELS] = {
> -    TPM_MODEL__MAX,
> -};
> -
> -int tpm_register_model(enum TpmModel model)
> +void tpm_register_model(enum TpmModel model)
>  {
> -    int i;
> -
> -    for (i = 0; i < TPM_MAX_MODELS; i++) {
> -        if (tpm_models[i] == TPM_MODEL__MAX) {
> -            tpm_models[i] = model;
> -            return 0;
> -        }
> -    }
> -    error_report("Could not register TPM model");
> -    return 1;
> -}
> -
> -static bool tpm_model_is_registered(enum TpmModel model)
> -{
> -    int i;
> -
> -    for (i = 0; i < TPM_MAX_MODELS; i++) {
> -        if (tpm_models[i] == model) {
> -            return true;
> -        }
> -    }
> -    return false;
> +    tpm_models[model] = true;

Ah, no need for an assert() here indeed (it took me a minute).

>  }
>
>  const TPMDriverOps *tpm_get_backend_driver(const char *type)
> @@ -270,7 +243,7 @@ TPMInfoList *qmp_query_tpm(Error **errp)
>      TPMInfoList *info, *head = NULL, *cur_item = NULL;
>
>      QLIST_FOREACH(drv, &tpm_backends, list) {
> -        if (!tpm_model_is_registered(drv->fe_model)) {
> +        if (!tpm_models[drv->fe_model]) {
>              continue;
>          }
>          info = g_new0(TPMInfoList, 1);
> @@ -317,7 +290,7 @@ TpmModelList *qmp_query_tpm_models(Error **errp)
>      TpmModelList *head = NULL, *prev = NULL, *cur_item;
>
>      for (i = 0; i < TPM_MODEL__MAX; i++) {
> -        if (!tpm_model_is_registered(i)) {
> +        if (!tpm_models[i]) {
>              continue;
>          }
>          cur_item = g_new0(TpmModelList, 1);
> --
> 2.7.5
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup()
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup() Markus Armbruster
@ 2017-08-24 10:53   ` Marc-André Lureau
  2017-08-29 11:10   ` Daniel P. Berrange
  1 sibling, 0 replies; 37+ messages in thread
From: Marc-André Lureau @ 2017-08-24 10:53 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU, Michael Roth

On Thu, Aug 24, 2017 at 10:46 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Cc: "Daniel P. Berrange" <berrange@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  crypto/block-luks.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/crypto/block-luks.c b/crypto/block-luks.c
> index afb8543..c3cacdb 100644
> --- a/crypto/block-luks.c
> +++ b/crypto/block-luks.c
> @@ -20,6 +20,7 @@
>
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qapi/util.h"
>  #include "qemu/bswap.h"
>
>  #include "crypto/block-luks.h"
> @@ -265,39 +266,33 @@ qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg,
>   * make that function emit a more friendly error message */
>  static int qcrypto_block_luks_name_lookup(const char *name,
>                                            const char *const *map,
> -                                          size_t maplen,
>                                            const char *type,
>                                            Error **errp)
>  {
> -    size_t i;
> -    for (i = 0; i < maplen; i++) {
> -        if (g_str_equal(map[i], name)) {
> -            return i;
> -        }
> -    }
> +    int ret = qapi_enum_parse(map, name, -1, NULL);
>
> -    error_setg(errp, "%s %s not supported", type, name);
> -    return 0;
> +    if (ret < 0) {
> +        error_setg(errp, "%s %s not supported", type, name);
> +        return 0;
> +    }
> +    return ret;
>  }
>
>  #define qcrypto_block_luks_cipher_mode_lookup(name, errp)               \
>      qcrypto_block_luks_name_lookup(name,                                \
>                                     QCryptoCipherMode_lookup,            \
> -                                   QCRYPTO_CIPHER_MODE__MAX,            \
>                                     "Cipher mode",                       \
>                                     errp)
>
>  #define qcrypto_block_luks_hash_name_lookup(name, errp)                 \
>      qcrypto_block_luks_name_lookup(name,                                \
>                                     QCryptoHashAlgorithm_lookup,         \
> -                                   QCRYPTO_HASH_ALG__MAX,               \
>                                     "Hash algorithm",                    \
>                                     errp)
>
>  #define qcrypto_block_luks_ivgen_name_lookup(name, errp)                \
>      qcrypto_block_luks_name_lookup(name,                                \
>                                     QCryptoIVGenAlgorithm_lookup,        \
> -                                   QCRYPTO_IVGEN_ALG__MAX,              \
>                                     "IV generator",                      \
>                                     errp)
>
> --
> 2.7.5
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 10/16] qapi: Use qapi_enum_parse() in input_type_enum()
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 10/16] qapi: Use qapi_enum_parse() in input_type_enum() Markus Armbruster
@ 2017-08-24 11:30   ` Marc-André Lureau
  0 siblings, 0 replies; 37+ messages in thread
From: Marc-André Lureau @ 2017-08-24 11:30 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU, Michael Roth

On Thu, Aug 24, 2017 at 10:46 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  qapi/qapi-visit-core.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
> index ed6d2af..ec83ff6 100644
> --- a/qapi/qapi-visit-core.c
> +++ b/qapi/qapi-visit-core.c
> @@ -14,6 +14,7 @@
>
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qapi/util.h"
>  #include "qemu-common.h"
>  #include "qapi/qmp/qobject.h"
>  #include "qapi/qmp/qerror.h"
> @@ -353,7 +354,7 @@ static void input_type_enum(Visitor *v, const char *name, int *obj,
>                              const char *const strings[], Error **errp)
>  {
>      Error *local_err = NULL;
> -    int64_t value = 0;
> +    int64_t value;
>      char *enum_str;
>
>      visit_type_str(v, name, &enum_str, &local_err);
> @@ -362,14 +363,8 @@ static void input_type_enum(Visitor *v, const char *name, int *obj,
>          return;
>      }
>
> -    while (strings[value] != NULL) {
> -        if (strcmp(strings[value], enum_str) == 0) {
> -            break;
> -        }
> -        value++;
> -    }
> -
> -    if (strings[value] == NULL) {
> +    value = qapi_enum_parse(strings, enum_str, -1, NULL);
> +    if (value < 0) {
>          error_setg(errp, QERR_INVALID_PARAMETER, enum_str);
>          g_free(enum_str);
>          return;
> --
> 2.7.5
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 11/16] qapi: Avoid unnecessary use of enum lookup table's sentinel
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 11/16] qapi: Avoid unnecessary use of enum lookup table's sentinel Markus Armbruster
@ 2017-08-24 11:34   ` Marc-André Lureau
  0 siblings, 0 replies; 37+ messages in thread
From: Marc-André Lureau @ 2017-08-24 11:34 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU, Michael Roth

On Thu, Aug 24, 2017 at 10:46 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Currently, the FOO_lookup[] generated for QAPI enum types are
> terminated by a NULL sentinel.
>
> A future patch will generate enums with "holes".  NULL-termination
> will cease to work then.
>
> To prepare for that, replace "have we reached the sentinel?"
> predicates by "have we reached the FOO__MAX value?" predicates.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  monitor.c                          | 4 ++--
>  tests/test-qobject-input-visitor.c | 2 +-
>  tests/test-string-input-visitor.c  | 2 +-
>  ui/input-legacy.c                  | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index e0f8801..b45f55d 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3249,7 +3249,7 @@ void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str)
>      }
>      len = strlen(str);
>      readline_set_completion_index(rs, len);
> -    for (i = 0; NetClientDriver_lookup[i]; i++) {
> +    for (i = 0; i < NET_CLIENT_DRIVER__MAX; i++) {
>          add_completion_option(rs, str, NetClientDriver_lookup[i]);
>      }
>  }
> @@ -3537,7 +3537,7 @@ void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
>          return;
>      }
>      readline_set_completion_index(rs, strlen(str));
> -    for (i = 0; WatchdogExpirationAction_lookup[i]; i++) {
> +    for (i = 0; i < WATCHDOG_EXPIRATION_ACTION__MAX; i++) {
>          add_completion_option(rs, str, WatchdogExpirationAction_lookup[i]);
>      }
>  }
> diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
> index bcf0261..5bbfb65 100644
> --- a/tests/test-qobject-input-visitor.c
> +++ b/tests/test-qobject-input-visitor.c
> @@ -382,7 +382,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
>      Visitor *v;
>      EnumOne i;
>
> -    for (i = 0; EnumOne_lookup[i]; i++) {
> +    for (i = 0; i < ENUM_ONE__MAX; i++) {
>          EnumOne res = -1;
>
>          v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]);
> diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
> index 79313a7..e7a7b80 100644
> --- a/tests/test-string-input-visitor.c
> +++ b/tests/test-string-input-visitor.c
> @@ -279,7 +279,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
>      Visitor *v;
>      EnumOne i;
>
> -    for (i = 0; EnumOne_lookup[i]; i++) {
> +    for (i = 0; i < ENUM_ONE__MAX; i++) {
>          EnumOne res = -1;
>
>          v = visitor_input_test_init(data, EnumOne_lookup[i]);
> diff --git a/ui/input-legacy.c b/ui/input-legacy.c
> index 7159747..a5f1e82 100644
> --- a/ui/input-legacy.c
> +++ b/ui/input-legacy.c
> @@ -61,7 +61,7 @@ int index_from_key(const char *key, size_t key_length)
>  {
>      int i;
>
> -    for (i = 0; QKeyCode_lookup[i] != NULL; i++) {
> +    for (i = 0; i < Q_KEY_CODE__MAX; i++) {
>          if (!strncmp(key, QKeyCode_lookup[i], key_length) &&
>              !QKeyCode_lookup[i][key_length]) {
>              break;
> --
> 2.7.5
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 13/16] qapi: Mechanically convert FOO_lookup[...] to FOO_str(...)
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 13/16] qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) Markus Armbruster
@ 2017-08-24 11:52   ` Marc-André Lureau
  0 siblings, 0 replies; 37+ messages in thread
From: Marc-André Lureau @ 2017-08-24 11:52 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU, Michael Roth

On Thu, Aug 24, 2017 at 10:46 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Looks like you got them all!

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  backends/hostmem.c                  |  2 +-
>  block/backup.c                      |  2 +-
>  block/file-posix.c                  |  4 +--
>  block/file-win32.c                  |  2 +-
>  block/gluster.c                     |  4 +--
>  block/iscsi.c                       |  2 +-
>  block/nfs.c                         |  2 +-
>  block/qcow2.c                       |  4 +--
>  block/qed.c                         |  2 +-
>  block/rbd.c                         |  2 +-
>  block/sheepdog.c                    |  2 +-
>  blockdev.c                          |  4 +--
>  blockjob.c                          |  6 ++---
>  chardev/char.c                      |  4 +--
>  crypto/block-luks.c                 | 12 ++++-----
>  crypto/block.c                      |  4 +--
>  crypto/cipher-afalg.c               |  2 +-
>  crypto/cipher-builtin.c             |  8 +++---
>  crypto/cipher-gcrypt.c              |  4 +--
>  crypto/cipher-nettle.c              |  8 +++---
>  crypto/hmac-gcrypt.c                |  2 +-
>  crypto/hmac-glib.c                  |  2 +-
>  crypto/hmac-nettle.c                |  2 +-
>  crypto/pbkdf-gcrypt.c               |  2 +-
>  crypto/pbkdf-nettle.c               |  2 +-
>  hmp.c                               | 54 ++++++++++++++++++-------------------
>  hw/block/fdc.c                      |  6 ++---
>  hw/char/escc.c                      |  2 +-
>  hw/input/virtio-input-hid.c         |  4 +--
>  migration/colo-failover.c           |  4 +--
>  migration/colo.c                    | 14 +++++-----
>  migration/global_state.c            |  2 +-
>  monitor.c                           | 16 +++++------
>  net/net.c                           |  4 +--
>  qapi/qmp-dispatch.c                 |  2 +-
>  tests/test-qapi-util.c              |  2 +-
>  tests/test-qobject-input-visitor.c  |  4 +--
>  tests/test-qobject-output-visitor.c |  2 +-
>  tests/test-string-input-visitor.c   |  2 +-
>  tests/test-string-output-visitor.c  |  4 +--
>  tpm.c                               |  2 +-
>  ui/input-legacy.c                   |  4 +--
>  ui/input.c                          | 12 ++++-----
>  ui/vnc.c                            |  6 ++---
>  vl.c                                |  6 ++---
>  45 files changed, 121 insertions(+), 121 deletions(-)
>
> diff --git a/backends/hostmem.c b/backends/hostmem.c
> index 4606b73..06e8898 100644
> --- a/backends/hostmem.c
> +++ b/backends/hostmem.c
> @@ -304,7 +304,7 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
>              return;
>          } else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) {
>              error_setg(errp, "host-nodes must be set for policy %s",
> -                       HostMemPolicy_lookup[backend->policy]);
> +                       HostMemPolicy_str(backend->policy));
>              return;
>          }
>
> diff --git a/block/backup.c b/block/backup.c
> index 504a089..517c300 100644
> --- a/block/backup.c
> +++ b/block/backup.c
> @@ -596,7 +596,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
>          error_setg(errp,
>                     "a sync_bitmap was provided to backup_run, "
>                     "but received an incompatible sync_mode (%s)",
> -                   MirrorSyncMode_lookup[sync_mode]);
> +                   MirrorSyncMode_str(sync_mode));
>          return NULL;
>      }
>
> diff --git a/block/file-posix.c b/block/file-posix.c
> index d81eccc..bfef91d 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -1724,7 +1724,7 @@ static int raw_regular_truncate(int fd, int64_t offset, PreallocMode prealloc,
>      default:
>          result = -ENOTSUP;
>          error_setg(errp, "Unsupported preallocation mode: %s",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          return result;
>      }
>
> @@ -1759,7 +1759,7 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset,
>
>      if (prealloc != PREALLOC_MODE_OFF) {
>          error_setg(errp, "Preallocation mode '%s' unsupported for this "
> -                   "non-regular file", PreallocMode_lookup[prealloc]);
> +                   "non-regular file", PreallocMode_str(prealloc));
>          return -ENOTSUP;
>      }
>
> diff --git a/block/file-win32.c b/block/file-win32.c
> index 192ea81..f2a1830 100644
> --- a/block/file-win32.c
> +++ b/block/file-win32.c
> @@ -469,7 +469,7 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset,
>
>      if (prealloc != PREALLOC_MODE_OFF) {
>          error_setg(errp, "Unsupported preallocation mode '%s'",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          return -ENOTSUP;
>      }
>
> diff --git a/block/gluster.c b/block/gluster.c
> index 0614e0c..29f9427 100644
> --- a/block/gluster.c
> +++ b/block/gluster.c
> @@ -1047,7 +1047,7 @@ static int qemu_gluster_create(const char *filename,
>      default:
>          ret = -EINVAL;
>          error_setg(errp, "Unsupported preallocation mode: %s",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          break;
>      }
>
> @@ -1099,7 +1099,7 @@ static int qemu_gluster_truncate(BlockDriverState *bs, int64_t offset,
>
>      if (prealloc != PREALLOC_MODE_OFF) {
>          error_setg(errp, "Unsupported preallocation mode '%s'",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          return -ENOTSUP;
>      }
>
> diff --git a/block/iscsi.c b/block/iscsi.c
> index d557c99..8b47d30 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -2087,7 +2087,7 @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset,
>
>      if (prealloc != PREALLOC_MODE_OFF) {
>          error_setg(errp, "Unsupported preallocation mode '%s'",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          return -ENOTSUP;
>      }
>
> diff --git a/block/nfs.c b/block/nfs.c
> index bec16b7..337fcd9 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -772,7 +772,7 @@ static int nfs_file_truncate(BlockDriverState *bs, int64_t offset,
>
>      if (prealloc != PREALLOC_MODE_OFF) {
>          error_setg(errp, "Unsupported preallocation mode '%s'",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          return -ENOTSUP;
>      }
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 41e067e..eb7c154 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2731,7 +2731,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
>          int64_t prealloc_size =
>              qcow2_calc_prealloc_size(total_size, cluster_size, refcount_order);
>          qemu_opt_set_number(opts, BLOCK_OPT_SIZE, prealloc_size, &error_abort);
> -        qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_lookup[prealloc],
> +        qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_str(prealloc),
>                       &error_abort);
>      }
>
> @@ -3096,7 +3096,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset,
>          prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL)
>      {
>          error_setg(errp, "Unsupported preallocation mode '%s'",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          return -ENOTSUP;
>      }
>
> diff --git a/block/qed.c b/block/qed.c
> index dc54bf4..28e2ec8 100644
> --- a/block/qed.c
> +++ b/block/qed.c
> @@ -1399,7 +1399,7 @@ static int bdrv_qed_truncate(BlockDriverState *bs, int64_t offset,
>
>      if (prealloc != PREALLOC_MODE_OFF) {
>          error_setg(errp, "Unsupported preallocation mode '%s'",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          return -ENOTSUP;
>      }
>
> diff --git a/block/rbd.c b/block/rbd.c
> index 9c3aa63..144f350 100644
> --- a/block/rbd.c
> +++ b/block/rbd.c
> @@ -944,7 +944,7 @@ static int qemu_rbd_truncate(BlockDriverState *bs, int64_t offset,
>
>      if (prealloc != PREALLOC_MODE_OFF) {
>          error_setg(errp, "Unsupported preallocation mode '%s'",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          return -ENOTSUP;
>      }
>
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index abb2e79..1052098 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -2176,7 +2176,7 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset,
>
>      if (prealloc != PREALLOC_MODE_OFF) {
>          error_setg(errp, "Unsupported preallocation mode '%s'",
> -                   PreallocMode_lookup[prealloc]);
> +                   PreallocMode_str(prealloc));
>          return -ENOTSUP;
>      }
>
> diff --git a/blockdev.c b/blockdev.c
> index f90bc93..bfb2a95 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1466,8 +1466,8 @@ static int action_check_completion_mode(BlkActionState *s, Error **errp)
>          error_setg(errp,
>                     "Action '%s' does not support Transaction property "
>                     "completion-mode = %s",
> -                   TransactionActionKind_lookup[s->action->type],
> -                   ActionCompletionMode_lookup[s->txn_props->completion_mode]);
> +                   TransactionActionKind_str(s->action->type),
> +                   ActionCompletionMode_str(s->txn_props->completion_mode));
>          return -1;
>      }
>      return 0;
> diff --git a/blockjob.c b/blockjob.c
> index 70a7818..3a0c491 100644
> --- a/blockjob.c
> +++ b/blockjob.c
> @@ -208,7 +208,7 @@ static char *child_job_get_parent_desc(BdrvChild *c)
>  {
>      BlockJob *job = c->opaque;
>      return g_strdup_printf("%s job '%s'",
> -                           BlockJobType_lookup[job->driver->job_type],
> +                           BlockJobType_str(job->driver->job_type),
>                             job->id);
>  }
>
> @@ -553,7 +553,7 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
>          return NULL;
>      }
>      info = g_new0(BlockJobInfo, 1);
> -    info->type      = g_strdup(BlockJobType_lookup[job->driver->job_type]);
> +    info->type      = g_strdup(BlockJobType_str(job->driver->job_type));
>      info->device    = g_strdup(job->id);
>      info->len       = job->len;
>      info->busy      = job->busy;
> @@ -666,7 +666,7 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
>      job->refcnt        = 1;
>
>      error_setg(&job->blocker, "block device is in use by block job: %s",
> -               BlockJobType_lookup[driver->job_type]);
> +               BlockJobType_str(driver->job_type));
>      block_job_add_bdrv(job, "main node", bs, 0, BLK_PERM_ALL, &error_abort);
>      bs->job = job;
>
> diff --git a/chardev/char.c b/chardev/char.c
> index 5d283b9..b6fd5eb 100644
> --- a/chardev/char.c
> +++ b/chardev/char.c
> @@ -931,7 +931,7 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
>      ChardevReturn *ret;
>      Chardev *chr;
>
> -    cc = char_get_class(ChardevBackendKind_lookup[backend->type], errp);
> +    cc = char_get_class(ChardevBackendKind_str(backend->type), errp);
>      if (!cc) {
>          return NULL;
>      }
> @@ -989,7 +989,7 @@ ChardevReturn *qmp_chardev_change(const char *id, ChardevBackend *backend,
>          return NULL;
>      }
>
> -    cc = char_get_class(ChardevBackendKind_lookup[backend->type], errp);
> +    cc = char_get_class(ChardevBackendKind_str(backend->type), errp);
>      if (!cc) {
>          return NULL;
>      }
> diff --git a/crypto/block-luks.c b/crypto/block-luks.c
> index 84d189a..4e82895 100644
> --- a/crypto/block-luks.c
> +++ b/crypto/block-luks.c
> @@ -257,7 +257,7 @@ qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg,
>      }
>
>      error_setg(errp, "Algorithm '%s' not supported",
> -               QCryptoCipherAlgorithm_lookup[alg]);
> +               QCryptoCipherAlgorithm_str(alg));
>      return NULL;
>  }
>
> @@ -392,7 +392,7 @@ qcrypto_block_luks_essiv_cipher(QCryptoCipherAlgorithm cipher,
>          break;
>      default:
>          error_setg(errp, "Cipher %s not supported with essiv",
> -                   QCryptoCipherAlgorithm_lookup[cipher]);
> +                   QCryptoCipherAlgorithm_str(cipher));
>          return 0;
>      }
>  }
> @@ -962,16 +962,16 @@ qcrypto_block_luks_create(QCryptoBlock *block,
>          goto error;
>      }
>
> -    cipher_mode = QCryptoCipherMode_lookup[luks_opts.cipher_mode];
> -    ivgen_alg = QCryptoIVGenAlgorithm_lookup[luks_opts.ivgen_alg];
> +    cipher_mode = QCryptoCipherMode_str(luks_opts.cipher_mode);
> +    ivgen_alg = QCryptoIVGenAlgorithm_str(luks_opts.ivgen_alg);
>      if (luks_opts.has_ivgen_hash_alg) {
> -        ivgen_hash_alg = QCryptoHashAlgorithm_lookup[luks_opts.ivgen_hash_alg];
> +        ivgen_hash_alg = QCryptoHashAlgorithm_str(luks_opts.ivgen_hash_alg);
>          cipher_mode_spec = g_strdup_printf("%s-%s:%s", cipher_mode, ivgen_alg,
>                                             ivgen_hash_alg);
>      } else {
>          cipher_mode_spec = g_strdup_printf("%s-%s", cipher_mode, ivgen_alg);
>      }
> -    hash_alg = QCryptoHashAlgorithm_lookup[luks_opts.hash_alg];
> +    hash_alg = QCryptoHashAlgorithm_str(luks_opts.hash_alg);
>
>
>      if (strlen(cipher_alg) >= QCRYPTO_BLOCK_LUKS_CIPHER_NAME_LEN) {
> diff --git a/crypto/block.c b/crypto/block.c
> index b097d45..c382393 100644
> --- a/crypto/block.c
> +++ b/crypto/block.c
> @@ -61,7 +61,7 @@ QCryptoBlock *qcrypto_block_open(QCryptoBlockOpenOptions *options,
>      if (options->format >= G_N_ELEMENTS(qcrypto_block_drivers) ||
>          !qcrypto_block_drivers[options->format]) {
>          error_setg(errp, "Unsupported block driver %s",
> -                   QCryptoBlockFormat_lookup[options->format]);
> +                   QCryptoBlockFormat_str(options->format));
>          g_free(block);
>          return NULL;
>      }
> @@ -92,7 +92,7 @@ QCryptoBlock *qcrypto_block_create(QCryptoBlockCreateOptions *options,
>      if (options->format >= G_N_ELEMENTS(qcrypto_block_drivers) ||
>          !qcrypto_block_drivers[options->format]) {
>          error_setg(errp, "Unsupported block driver %s",
> -                   QCryptoBlockFormat_lookup[options->format]);
> +                   QCryptoBlockFormat_str(options->format));
>          g_free(block);
>          return NULL;
>      }
> diff --git a/crypto/cipher-afalg.c b/crypto/cipher-afalg.c
> index 01343b2..cd72284 100644
> --- a/crypto/cipher-afalg.c
> +++ b/crypto/cipher-afalg.c
> @@ -52,7 +52,7 @@ qcrypto_afalg_cipher_format_name(QCryptoCipherAlgorithm alg,
>          return NULL;
>      }
>
> -    mode_name = QCryptoCipherMode_lookup[mode];
> +    mode_name = QCryptoCipherMode_str(mode);
>      name = g_strdup_printf("%s(%s)", mode_name, alg_name);
>
>      return name;
> diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c
> index 16a36d4..d8c811f 100644
> --- a/crypto/cipher-builtin.c
> +++ b/crypto/cipher-builtin.c
> @@ -247,7 +247,7 @@ qcrypto_cipher_init_aes(QCryptoCipherMode mode,
>          mode != QCRYPTO_CIPHER_MODE_ECB &&
>          mode != QCRYPTO_CIPHER_MODE_XTS) {
>          error_setg(errp, "Unsupported cipher mode %s",
> -                   QCryptoCipherMode_lookup[mode]);
> +                   QCryptoCipherMode_str(mode));
>          return NULL;
>      }
>
> @@ -379,7 +379,7 @@ qcrypto_cipher_init_des_rfb(QCryptoCipherMode mode,
>
>      if (mode != QCRYPTO_CIPHER_MODE_ECB) {
>          error_setg(errp, "Unsupported cipher mode %s",
> -                   QCryptoCipherMode_lookup[mode]);
> +                   QCryptoCipherMode_str(mode));
>          return NULL;
>      }
>
> @@ -440,7 +440,7 @@ static QCryptoCipherBuiltin *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
>          break;
>      default:
>          error_setg(errp, "Unsupported cipher mode %s",
> -                   QCryptoCipherMode_lookup[mode]);
> +                   QCryptoCipherMode_str(mode));
>          return NULL;
>      }
>
> @@ -460,7 +460,7 @@ static QCryptoCipherBuiltin *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
>      default:
>          error_setg(errp,
>                     "Unsupported cipher algorithm %s",
> -                   QCryptoCipherAlgorithm_lookup[alg]);
> +                   QCryptoCipherAlgorithm_str(alg));
>          return NULL;
>      }
>
> diff --git a/crypto/cipher-gcrypt.c b/crypto/cipher-gcrypt.c
> index 0489147..10d75da 100644
> --- a/crypto/cipher-gcrypt.c
> +++ b/crypto/cipher-gcrypt.c
> @@ -105,7 +105,7 @@ static QCryptoCipherGcrypt *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
>          break;
>      default:
>          error_setg(errp, "Unsupported cipher mode %s",
> -                   QCryptoCipherMode_lookup[mode]);
> +                   QCryptoCipherMode_str(mode));
>          return NULL;
>      }
>
> @@ -160,7 +160,7 @@ static QCryptoCipherGcrypt *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
>
>      default:
>          error_setg(errp, "Unsupported cipher algorithm %s",
> -                   QCryptoCipherAlgorithm_lookup[alg]);
> +                   QCryptoCipherAlgorithm_str(alg));
>          return NULL;
>      }
>
> diff --git a/crypto/cipher-nettle.c b/crypto/cipher-nettle.c
> index c51f119..3848cb3 100644
> --- a/crypto/cipher-nettle.c
> +++ b/crypto/cipher-nettle.c
> @@ -281,7 +281,7 @@ static QCryptoCipherNettle *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
>          break;
>      default:
>          error_setg(errp, "Unsupported cipher mode %s",
> -                   QCryptoCipherMode_lookup[mode]);
> +                   QCryptoCipherMode_str(mode));
>          return NULL;
>      }
>
> @@ -420,7 +420,7 @@ static QCryptoCipherNettle *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
>
>      default:
>          error_setg(errp, "Unsupported cipher algorithm %s",
> -                   QCryptoCipherAlgorithm_lookup[alg]);
> +                   QCryptoCipherAlgorithm_str(alg));
>          goto error;
>      }
>
> @@ -491,7 +491,7 @@ qcrypto_nettle_cipher_encrypt(QCryptoCipher *cipher,
>
>      default:
>          error_setg(errp, "Unsupported cipher mode %s",
> -                   QCryptoCipherMode_lookup[cipher->mode]);
> +                   QCryptoCipherMode_str(cipher->mode));
>          return -1;
>      }
>      return 0;
> @@ -537,7 +537,7 @@ qcrypto_nettle_cipher_decrypt(QCryptoCipher *cipher,
>
>      default:
>          error_setg(errp, "Unsupported cipher mode %s",
> -                   QCryptoCipherMode_lookup[cipher->mode]);
> +                   QCryptoCipherMode_str(cipher->mode));
>          return -1;
>      }
>      return 0;
> diff --git a/crypto/hmac-gcrypt.c b/crypto/hmac-gcrypt.c
> index 76ca61b..0c6f979 100644
> --- a/crypto/hmac-gcrypt.c
> +++ b/crypto/hmac-gcrypt.c
> @@ -52,7 +52,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
>
>      if (!qcrypto_hmac_supports(alg)) {
>          error_setg(errp, "Unsupported hmac algorithm %s",
> -                   QCryptoHashAlgorithm_lookup[alg]);
> +                   QCryptoHashAlgorithm_str(alg));
>          return NULL;
>      }
>
> diff --git a/crypto/hmac-glib.c b/crypto/hmac-glib.c
> index 8cf6b22..a6c1730 100644
> --- a/crypto/hmac-glib.c
> +++ b/crypto/hmac-glib.c
> @@ -58,7 +58,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
>
>      if (!qcrypto_hmac_supports(alg)) {
>          error_setg(errp, "Unsupported hmac algorithm %s",
> -                   QCryptoHashAlgorithm_lookup[alg]);
> +                   QCryptoHashAlgorithm_str(alg));
>          return NULL;
>      }
>
> diff --git a/crypto/hmac-nettle.c b/crypto/hmac-nettle.c
> index 1d5a915..ec2d61b 100644
> --- a/crypto/hmac-nettle.c
> +++ b/crypto/hmac-nettle.c
> @@ -106,7 +106,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
>
>      if (!qcrypto_hmac_supports(alg)) {
>          error_setg(errp, "Unsupported hmac algorithm %s",
> -                   QCryptoHashAlgorithm_lookup[alg]);
> +                   QCryptoHashAlgorithm_str(alg));
>          return NULL;
>      }
>
> diff --git a/crypto/pbkdf-gcrypt.c b/crypto/pbkdf-gcrypt.c
> index 4028985..54ca0d9 100644
> --- a/crypto/pbkdf-gcrypt.c
> +++ b/crypto/pbkdf-gcrypt.c
> @@ -68,7 +68,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
>          hash_map[hash] == GCRY_MD_NONE) {
>          error_setg_errno(errp, ENOSYS,
>                           "PBKDF does not support hash algorithm %s",
> -                         QCryptoHashAlgorithm_lookup[hash]);
> +                         QCryptoHashAlgorithm_str(hash));
>          return -1;
>      }
>
> diff --git a/crypto/pbkdf-nettle.c b/crypto/pbkdf-nettle.c
> index 6fb2671..212b3e8 100644
> --- a/crypto/pbkdf-nettle.c
> +++ b/crypto/pbkdf-nettle.c
> @@ -110,7 +110,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
>      default:
>          error_setg_errno(errp, ENOSYS,
>                           "PBKDF does not support hash algorithm %s",
> -                         QCryptoHashAlgorithm_lookup[hash]);
> +                         QCryptoHashAlgorithm_str(hash));
>          return -1;
>      }
>      return 0;
> diff --git a/hmp.c b/hmp.c
> index 5d980ac..30819fe 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -106,7 +106,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict)
>                     info->singlestep ? " (single step mode)" : "");
>
>      if (!info->running && info->status != RUN_STATE_PAUSED) {
> -        monitor_printf(mon, " (%s)", RunState_lookup[info->status]);
> +        monitor_printf(mon, " (%s)", RunState_str(info->status));
>      }
>
>      monitor_printf(mon, "\n");
> @@ -171,7 +171,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
>          monitor_printf(mon, "capabilities: ");
>          for (cap = caps; cap; cap = cap->next) {
>              monitor_printf(mon, "%s: %s ",
> -                           MigrationCapability_lookup[cap->value->capability],
> +                           MigrationCapability_str(cap->value->capability),
>                             cap->value->state ? "on" : "off");
>          }
>          monitor_printf(mon, "\n");
> @@ -179,7 +179,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
>
>      if (info->has_status) {
>          monitor_printf(mon, "Migration status: %s",
> -                       MigrationStatus_lookup[info->status]);
> +                       MigrationStatus_str(info->status));
>          if (info->status == MIGRATION_STATUS_FAILED &&
>              info->has_error_desc) {
>              monitor_printf(mon, " (%s)\n", info->error_desc);
> @@ -277,7 +277,7 @@ void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict)
>      if (caps) {
>          for (cap = caps; cap; cap = cap->next) {
>              monitor_printf(mon, "%s: %s\n",
> -                           MigrationCapability_lookup[cap->value->capability],
> +                           MigrationCapability_str(cap->value->capability),
>                             cap->value->state ? "on" : "off");
>          }
>      }
> @@ -294,48 +294,48 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
>      if (params) {
>          assert(params->has_compress_level);
>          monitor_printf(mon, "%s: %" PRId64 "\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_LEVEL],
> +            MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_LEVEL),
>              params->compress_level);
>          assert(params->has_compress_threads);
>          monitor_printf(mon, "%s: %" PRId64 "\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_THREADS],
> +            MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_THREADS),
>              params->compress_threads);
>          assert(params->has_decompress_threads);
>          monitor_printf(mon, "%s: %" PRId64 "\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_DECOMPRESS_THREADS],
> +            MigrationParameter_str(MIGRATION_PARAMETER_DECOMPRESS_THREADS),
>              params->decompress_threads);
>          assert(params->has_cpu_throttle_initial);
>          monitor_printf(mon, "%s: %" PRId64 "\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL],
> +            MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL),
>              params->cpu_throttle_initial);
>          assert(params->has_cpu_throttle_increment);
>          monitor_printf(mon, "%s: %" PRId64 "\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT],
> +            MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT),
>              params->cpu_throttle_increment);
>          assert(params->has_tls_creds);
>          monitor_printf(mon, "%s: '%s'\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_CREDS],
> +            MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS),
>              params->tls_creds);
>          assert(params->has_tls_hostname);
>          monitor_printf(mon, "%s: '%s'\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
> +            MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME),
>              params->tls_hostname);
>          assert(params->has_max_bandwidth);
>          monitor_printf(mon, "%s: %" PRId64 " bytes/second\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH],
> +            MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH),
>              params->max_bandwidth);
>          assert(params->has_downtime_limit);
>          monitor_printf(mon, "%s: %" PRId64 " milliseconds\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_DOWNTIME_LIMIT],
> +            MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT),
>              params->downtime_limit);
>          assert(params->has_x_checkpoint_delay);
>          monitor_printf(mon, "%s: %" PRId64 "\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY],
> +            MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY),
>              params->x_checkpoint_delay);
>          assert(params->has_block_incremental);
>          monitor_printf(mon, "%s: %s\n",
> -            MigrationParameter_lookup[MIGRATION_PARAMETER_BLOCK_INCREMENTAL],
> -                       params->block_incremental ? "on" : "off");
> +            MigrationParameter_str(MIGRATION_PARAMETER_BLOCK_INCREMENTAL),
> +            params->block_incremental ? "on" : "off");
>      }
>
>      qapi_free_MigrationParameters(params);
> @@ -431,7 +431,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
>          }
>          if (info->has_io_status && info->io_status != BLOCK_DEVICE_IO_STATUS_OK) {
>              monitor_printf(mon, "    I/O status:       %s\n",
> -                           BlockDeviceIoStatus_lookup[info->io_status]);
> +                           BlockDeviceIoStatus_str(info->io_status));
>          }
>
>          if (info->removable) {
> @@ -461,7 +461,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
>
>      if (inserted->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF) {
>          monitor_printf(mon, "    Detect zeroes:    %s\n",
> -                       BlockdevDetectZeroesOptions_lookup[inserted->detect_zeroes]);
> +                BlockdevDetectZeroesOptions_str(inserted->detect_zeroes));
>      }
>
>      if (inserted->bps  || inserted->bps_rd  || inserted->bps_wr  ||
> @@ -612,7 +612,7 @@ static void hmp_info_VncBasicInfo(Monitor *mon, VncBasicInfo *info,
>                     name,
>                     info->host,
>                     info->service,
> -                   NetworkAddressFamily_lookup[info->family],
> +                   NetworkAddressFamily_str(info->family),
>                     info->websocket ? " (Websocket)" : "");
>  }
>
> @@ -622,8 +622,8 @@ static void hmp_info_vnc_authcrypt(Monitor *mon, const char *indent,
>                                     VncVencryptSubAuth *vencrypt)
>  {
>      monitor_printf(mon, "%sAuth: %s (Sub: %s)\n", indent,
> -                   VncPrimaryAuth_lookup[auth],
> -                   vencrypt ? VncVencryptSubAuth_lookup[*vencrypt] : "none");
> +                   VncPrimaryAuth_str(auth),
> +                   vencrypt ? VncVencryptSubAuth_str(*vencrypt) : "none");
>  }
>
>  static void hmp_info_vnc_clients(Monitor *mon, VncClientInfoList *client)
> @@ -738,7 +738,7 @@ void hmp_info_spice(Monitor *mon, const QDict *qdict)
>      monitor_printf(mon, "        auth: %s\n", info->auth);
>      monitor_printf(mon, "    compiled: %s\n", info->compiled_version);
>      monitor_printf(mon, "  mouse-mode: %s\n",
> -                   SpiceQueryMouseMode_lookup[info->mouse_mode]);
> +                   SpiceQueryMouseMode_str(info->mouse_mode));
>
>      if (!info->has_channels || info->channels == NULL) {
>          monitor_printf(mon, "Channels: none\n");
> @@ -1009,10 +1009,10 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
>      for (info = info_list; info; info = info->next) {
>          TPMInfo *ti = info->value;
>          monitor_printf(mon, " tpm%d: model=%s\n",
> -                       c, TpmModel_lookup[ti->model]);
> +                       c, TpmModel_str(ti->model));
>
>          monitor_printf(mon, "  \\ %s: type=%s",
> -                       ti->id, TpmTypeOptionsKind_lookup[ti->options->type]);
> +                       ti->id, TpmTypeOptionsKind_str(ti->options->type));
>
>          switch (ti->options->type) {
>          case TPM_TYPE_OPTIONS_KIND_PASSTHROUGH:
> @@ -2368,7 +2368,7 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
>          monitor_printf(mon, "  prealloc: %s\n",
>                         m->value->prealloc ? "true" : "false");
>          monitor_printf(mon, "  policy: %s\n",
> -                       HostMemPolicy_lookup[m->value->policy]);
> +                       HostMemPolicy_str(m->value->policy));
>          visit_complete(v, &str);
>          monitor_printf(mon, "  host nodes: %s\n", str);
>
> @@ -2399,7 +2399,7 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
>                  di = value->u.dimm.data;
>
>                  monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
> -                               MemoryDeviceInfoKind_lookup[value->type],
> +                               MemoryDeviceInfoKind_str(value->type),
>                                 di->id ? di->id : "");
>                  monitor_printf(mon, "  addr: 0x%" PRIx64 "\n", di->addr);
>                  monitor_printf(mon, "  slot: %" PRId64 "\n", di->slot);
> @@ -2793,7 +2793,7 @@ void hmp_info_dump(Monitor *mon, const QDict *qdict)
>      DumpQueryResult *result = qmp_query_dump(NULL);
>
>      assert(result && result->status < DUMP_STATUS__MAX);
> -    monitor_printf(mon, "Status: %s\n", DumpStatus_lookup[result->status]);
> +    monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
>
>      if (result->status == DUMP_STATUS_ACTIVE) {
>          float percent = 0;
> diff --git a/hw/block/fdc.c b/hw/block/fdc.c
> index 4011290..db40e17 100644
> --- a/hw/block/fdc.c
> +++ b/hw/block/fdc.c
> @@ -392,9 +392,9 @@ static int pick_geometry(FDrive *drv)
>              FLOPPY_DPRINTF("User requested floppy drive type '%s', "
>                             "but inserted medium appears to be a "
>                             "%"PRId64" sector '%s' type\n",
> -                           FloppyDriveType_lookup[drv->drive],
> +                           FloppyDriveType_str(drv->drive),
>                             nb_sectors,
> -                           FloppyDriveType_lookup[parse->drive]);
> +                           FloppyDriveType_str(parse->drive));
>          }
>          match = type_match;
>      }
> @@ -403,7 +403,7 @@ static int pick_geometry(FDrive *drv)
>      if (match == -1) {
>          error_setg(&error_abort, "No candidate geometries present in table "
>                     " for floppy drive type '%s'",
> -                   FloppyDriveType_lookup[drv->drive]);
> +                   FloppyDriveType_str(drv->drive));
>      }
>
>      parse = &(fd_formats[match]);
> diff --git a/hw/char/escc.c b/hw/char/escc.c
> index 1aca564..3ab831a 100644
> --- a/hw/char/escc.c
> +++ b/hw/char/escc.c
> @@ -848,7 +848,7 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
>      assert(evt->type == INPUT_EVENT_KIND_KEY);
>      key = evt->u.key.data;
>      qcode = qemu_input_key_value_to_qcode(key->key);
> -    trace_escc_sunkbd_event_in(qcode, QKeyCode_lookup[qcode],
> +    trace_escc_sunkbd_event_in(qcode, QKeyCode_str(qcode),
>                                 key->down);
>
>      if (qcode == Q_KEY_CODE_CAPS_LOCK) {
> diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c
> index 46c0381..4d3afc1 100644
> --- a/hw/input/virtio-input-hid.c
> +++ b/hw/input/virtio-input-hid.c
> @@ -209,7 +209,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
>          } else {
>              if (key->down) {
>                  fprintf(stderr, "%s: unmapped key: %d [%s]\n", __func__,
> -                        qcode, QKeyCode_lookup[qcode]);
> +                        qcode, QKeyCode_str(qcode));
>              }
>          }
>          break;
> @@ -224,7 +224,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
>              if (btn->down) {
>                  fprintf(stderr, "%s: unmapped button: %d [%s]\n", __func__,
>                          btn->button,
> -                        InputButton_lookup[btn->button]);
> +                        InputButton_str(btn->button));
>              }
>          }
>          break;
> diff --git a/migration/colo-failover.c b/migration/colo-failover.c
> index f991486..6563862 100644
> --- a/migration/colo-failover.c
> +++ b/migration/colo-failover.c
> @@ -34,7 +34,7 @@ static void colo_failover_bh(void *opaque)
>                                     FAILOVER_STATUS_ACTIVE);
>      if (old_state != FAILOVER_STATUS_REQUIRE) {
>          error_report("Unknown error for failover, old_state = %s",
> -                    FailoverStatus_lookup[old_state]);
> +                    FailoverStatus_str(old_state));
>          return;
>      }
>
> @@ -64,7 +64,7 @@ FailoverStatus failover_set_state(FailoverStatus old_state,
>
>      old = atomic_cmpxchg(&failover_state, old_state, new_state);
>      if (old == old_state) {
> -        trace_colo_failover_set_state(FailoverStatus_lookup[new_state]);
> +        trace_colo_failover_set_state(FailoverStatus_str(new_state));
>      }
>      return old;
>  }
> diff --git a/migration/colo.c b/migration/colo.c
> index a425543..dee3aa8 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -61,7 +61,7 @@ static void secondary_vm_do_failover(void)
>                          FAILOVER_STATUS_RELAUNCH);
>          if (old_state != FAILOVER_STATUS_ACTIVE) {
>              error_report("Unknown error while do failover for secondary VM,"
> -                         "old_state: %s", FailoverStatus_lookup[old_state]);
> +                         "old_state: %s", FailoverStatus_str(old_state));
>          }
>          return;
>      }
> @@ -91,7 +91,7 @@ static void secondary_vm_do_failover(void)
>                                     FAILOVER_STATUS_COMPLETED);
>      if (old_state != FAILOVER_STATUS_ACTIVE) {
>          error_report("Incorrect state (%s) while doing failover for "
> -                     "secondary VM", FailoverStatus_lookup[old_state]);
> +                     "secondary VM", FailoverStatus_str(old_state));
>          return;
>      }
>      /* Notify COLO incoming thread that failover work is finished */
> @@ -126,7 +126,7 @@ static void primary_vm_do_failover(void)
>                                     FAILOVER_STATUS_COMPLETED);
>      if (old_state != FAILOVER_STATUS_ACTIVE) {
>          error_report("Incorrect state (%s) while doing failover for Primary VM",
> -                     FailoverStatus_lookup[old_state]);
> +                     FailoverStatus_str(old_state));
>          return;
>      }
>      /* Notify COLO thread that failover work is finished */
> @@ -222,7 +222,7 @@ static void colo_send_message(QEMUFile *f, COLOMessage msg,
>      if (ret < 0) {
>          error_setg_errno(errp, -ret, "Can't send COLO message");
>      }
> -    trace_colo_send_message(COLOMessage_lookup[msg]);
> +    trace_colo_send_message(COLOMessage_str(msg));
>  }
>
>  static void colo_send_message_value(QEMUFile *f, COLOMessage msg,
> @@ -242,7 +242,7 @@ static void colo_send_message_value(QEMUFile *f, COLOMessage msg,
>      ret = qemu_file_get_error(f);
>      if (ret < 0) {
>          error_setg_errno(errp, -ret, "Failed to send value for message:%s",
> -                         COLOMessage_lookup[msg]);
> +                         COLOMessage_str(msg));
>      }
>  }
>
> @@ -261,7 +261,7 @@ static COLOMessage colo_receive_message(QEMUFile *f, Error **errp)
>          error_setg(errp, "%s: Invalid message", __func__);
>          return msg;
>      }
> -    trace_colo_receive_message(COLOMessage_lookup[msg]);
> +    trace_colo_receive_message(COLOMessage_str(msg));
>      return msg;
>  }
>
> @@ -299,7 +299,7 @@ static uint64_t colo_receive_message_value(QEMUFile *f, uint32_t expect_msg,
>      ret = qemu_file_get_error(f);
>      if (ret < 0) {
>          error_setg_errno(errp, -ret, "Failed to get value for COLO message: %s",
> -                         COLOMessage_lookup[expect_msg]);
> +                         COLOMessage_str(expect_msg));
>      }
>      return value;
>  }
> diff --git a/migration/global_state.c b/migration/global_state.c
> index 76cd3a1..8db2f19 100644
> --- a/migration/global_state.c
> +++ b/migration/global_state.c
> @@ -41,7 +41,7 @@ int global_state_store(void)
>
>  void global_state_store_running(void)
>  {
> -    const char *state = RunState_lookup[RUN_STATE_RUNNING];
> +    const char *state = RunState_str(RUN_STATE_RUNNING);
>      strncpy((char *)global_state.runstate,
>             state, sizeof(global_state.runstate));
>  }
> diff --git a/monitor.c b/monitor.c
> index b45f55d..360757c 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -928,7 +928,7 @@ EventInfoList *qmp_query_events(Error **errp)
>      QAPIEvent e;
>
>      for (e = 0 ; e < QAPI_EVENT__MAX ; e++) {
> -        const char *event_name = QAPIEvent_lookup[e];
> +        const char *event_name = QAPIEvent_str(e);
>          assert(event_name != NULL);
>          info = g_malloc0(sizeof(*info));
>          info->value = g_malloc0(sizeof(*info->value));
> @@ -3250,7 +3250,7 @@ void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str)
>      len = strlen(str);
>      readline_set_completion_index(rs, len);
>      for (i = 0; i < NET_CLIENT_DRIVER__MAX; i++) {
> -        add_completion_option(rs, str, NetClientDriver_lookup[i]);
> +        add_completion_option(rs, str, NetClientDriver_str(i));
>      }
>  }
>
> @@ -3434,8 +3434,8 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
>      len = strlen(str);
>      readline_set_completion_index(rs, len);
>      for (i = 0; i < Q_KEY_CODE__MAX; i++) {
> -        if (!strncmp(str, QKeyCode_lookup[i], len)) {
> -            readline_add_completion(rs, QKeyCode_lookup[i]);
> +        if (!strncmp(str, QKeyCode_str(i), len)) {
> +            readline_add_completion(rs, QKeyCode_str(i));
>          }
>      }
>  }
> @@ -3538,7 +3538,7 @@ void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
>      }
>      readline_set_completion_index(rs, strlen(str));
>      for (i = 0; i < WATCHDOG_EXPIRATION_ACTION__MAX; i++) {
> -        add_completion_option(rs, str, WatchdogExpirationAction_lookup[i]);
> +        add_completion_option(rs, str, WatchdogExpirationAction_str(i));
>      }
>  }
>
> @@ -3552,7 +3552,7 @@ void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
>      if (nb_args == 2) {
>          int i;
>          for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
> -            const char *name = MigrationCapability_lookup[i];
> +            const char *name = MigrationCapability_str(i);
>              if (!strncmp(str, name, len)) {
>                  readline_add_completion(rs, name);
>              }
> @@ -3573,7 +3573,7 @@ void migrate_set_parameter_completion(ReadLineState *rs, int nb_args,
>      if (nb_args == 2) {
>          int i;
>          for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
> -            const char *name = MigrationParameter_lookup[i];
> +            const char *name = MigrationParameter_str(i);
>              if (!strncmp(str, name, len)) {
>                  readline_add_completion(rs, name);
>              }
> @@ -3852,7 +3852,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
>          qdict = qdict_get_qdict(qobject_to_qdict(rsp), "error");
>          if (qdict
>              && !g_strcmp0(qdict_get_try_str(qdict, "class"),
> -                    QapiErrorClass_lookup[ERROR_CLASS_COMMAND_NOT_FOUND])) {
> +                    QapiErrorClass_str(ERROR_CLASS_COMMAND_NOT_FOUND))) {
>              /* Provide a more useful error message */
>              qdict_del(qdict, "desc");
>              qdict_put_str(qdict, "desc", "Expecting capabilities negotiation"
> diff --git a/net/net.c b/net/net.c
> index 0e28099..2fa99c0 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1064,7 +1064,7 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
>          /* FIXME drop when all init functions store an Error */
>          if (errp && !*errp) {
>              error_setg(errp, QERR_DEVICE_INIT_FAILED,
> -                       NetClientDriver_lookup[netdev->type]);
> +                       NetClientDriver_str(netdev->type));
>          }
>          return -1;
>      }
> @@ -1288,7 +1288,7 @@ void print_net_client(Monitor *mon, NetClientState *nc)
>
>      monitor_printf(mon, "%s: index=%d,type=%s,%s\n", nc->name,
>                     nc->queue_index,
> -                   NetClientDriver_lookup[nc->info->type],
> +                   NetClientDriver_str(nc->info->type),
>                     nc->info_str);
>      if (!QTAILQ_EMPTY(&nc->filters)) {
>          monitor_printf(mon, "filters:\n");
> diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
> index 5ad36f8..b41fa17 100644
> --- a/qapi/qmp-dispatch.c
> +++ b/qapi/qmp-dispatch.c
> @@ -118,7 +118,7 @@ static QObject *do_qmp_dispatch(QmpCommandList *cmds, QObject *request,
>  QObject *qmp_build_error_object(Error *err)
>  {
>      return qobject_from_jsonf("{ 'class': %s, 'desc': %s }",
> -                              QapiErrorClass_lookup[error_get_class(err)],
> +                              QapiErrorClass_str(error_get_class(err)),
>                                error_get_pretty(err));
>  }
>
> diff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c
> index 7e1be1d..0992bdb 100644
> --- a/tests/test-qapi-util.c
> +++ b/tests/test-qapi-util.c
> @@ -31,7 +31,7 @@ static void test_qapi_enum_parse(void)
>      ret = qapi_enum_parse(QType_lookup, "none", -1, &error_abort);
>      g_assert_cmpint(ret, ==, QTYPE_NONE);
>
> -    ret = qapi_enum_parse(QType_lookup, QType_lookup[QTYPE__MAX - 1],
> +    ret = qapi_enum_parse(QType_lookup, QType_str(QTYPE__MAX - 1),
>                            QTYPE__MAX - 1, &error_abort);
>      g_assert_cmpint(ret, ==, QTYPE__MAX - 1);
>  }
> diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
> index 5bbfb65..f8720aa 100644
> --- a/tests/test-qobject-input-visitor.c
> +++ b/tests/test-qobject-input-visitor.c
> @@ -385,7 +385,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
>      for (i = 0; i < ENUM_ONE__MAX; i++) {
>          EnumOne res = -1;
>
> -        v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]);
> +        v = visitor_input_test_init(data, "%s", EnumOne_str(i));
>
>          visit_type_EnumOne(v, NULL, &res, &error_abort);
>          g_assert_cmpint(i, ==, res);
> @@ -699,7 +699,7 @@ static void test_native_list_integer_helper(TestInputVisitorData *data,
>          }
>      }
>      g_string_append_printf(gstr_union,  "{ 'type': '%s', 'data': [ %s ] }",
> -                           UserDefNativeListUnionKind_lookup[kind],
> +                           UserDefNativeListUnionKind_str(kind),
>                             gstr_list->str);
>      v = visitor_input_test_init_raw(data,  gstr_union->str);
>
> diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c
> index 7eb1620..d375100 100644
> --- a/tests/test-qobject-output-visitor.c
> +++ b/tests/test-qobject-output-visitor.c
> @@ -133,7 +133,7 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
>
>          qstr = qobject_to_qstring(visitor_get(data));
>          g_assert(qstr);
> -        g_assert_cmpstr(qstring_get_str(qstr), ==, EnumOne_lookup[i]);
> +        g_assert_cmpstr(qstring_get_str(qstr), ==, EnumOne_str(i));
>          visitor_reset(data);
>      }
>  }
> diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
> index e7a7b80..4f9c36b 100644
> --- a/tests/test-string-input-visitor.c
> +++ b/tests/test-string-input-visitor.c
> @@ -282,7 +282,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
>      for (i = 0; i < ENUM_ONE__MAX; i++) {
>          EnumOne res = -1;
>
> -        v = visitor_input_test_init(data, EnumOne_lookup[i]);
> +        v = visitor_input_test_init(data, EnumOne_str(i));
>
>          visit_type_EnumOne(v, NULL, &res, &err);
>          g_assert(!err);
> diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
> index e736db3..385cddb 100644
> --- a/tests/test-string-output-visitor.c
> +++ b/tests/test-string-output-visitor.c
> @@ -194,12 +194,12 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
>
>          str = visitor_get(data);
>          if (data->human) {
> -            char *str_human = g_strdup_printf("\"%s\"", EnumOne_lookup[i]);
> +            char *str_human = g_strdup_printf("\"%s\"", EnumOne_str(i));
>
>              g_assert_cmpstr(str, ==, str_human);
>              g_free(str_human);
>          } else {
> -            g_assert_cmpstr(str, ==, EnumOne_lookup[i]);
> +            g_assert_cmpstr(str, ==, EnumOne_str(i));
>          }
>          visitor_reset(data);
>      }
> diff --git a/tpm.c b/tpm.c
> index 38f3eb8..111f1ca 100644
> --- a/tpm.c
> +++ b/tpm.c
> @@ -62,7 +62,7 @@ static void tpm_display_backend_drivers(void)
>              continue;
>          }
>          fprintf(stderr, "%12s   %s\n",
> -                TpmType_lookup[i], be_drivers[i]->desc());
> +                TpmType_str(i), be_drivers[i]->desc());
>      }
>      fprintf(stderr, "\n");
>  }
> diff --git a/ui/input-legacy.c b/ui/input-legacy.c
> index a5f1e82..6bc3525 100644
> --- a/ui/input-legacy.c
> +++ b/ui/input-legacy.c
> @@ -62,8 +62,8 @@ int index_from_key(const char *key, size_t key_length)
>      int i;
>
>      for (i = 0; i < Q_KEY_CODE__MAX; i++) {
> -        if (!strncmp(key, QKeyCode_lookup[i], key_length) &&
> -            !QKeyCode_lookup[i][key_length]) {
> +        if (!strncmp(key, QKeyCode_str(i), key_length) &&
> +            !QKeyCode_str(i)[key_length]) {
>              break;
>          }
>      }
> diff --git a/ui/input.c b/ui/input.c
> index af05f06..3422d4a 100644
> --- a/ui/input.c
> +++ b/ui/input.c
> @@ -151,7 +151,7 @@ void qmp_input_send_event(bool has_device, const char *device,
>          if (!qemu_input_find_handler(1 << event->type, con)) {
>              error_setg(errp, "Input handler not found for "
>                               "event type %s",
> -                            InputEventKind_lookup[event->type]);
> +                            InputEventKind_str(event->type));
>              return;
>          }
>      }
> @@ -213,12 +213,12 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt)
>          switch (key->key->type) {
>          case KEY_VALUE_KIND_NUMBER:
>              qcode = qemu_input_key_number_to_qcode(key->key->u.number.data);
> -            name = QKeyCode_lookup[qcode];
> +            name = QKeyCode_str(qcode);
>              trace_input_event_key_number(idx, key->key->u.number.data,
>                                           name, key->down);
>              break;
>          case KEY_VALUE_KIND_QCODE:
> -            name = QKeyCode_lookup[key->key->u.qcode.data];
> +            name = QKeyCode_str(key->key->u.qcode.data);
>              trace_input_event_key_qcode(idx, name, key->down);
>              break;
>          case KEY_VALUE_KIND__MAX:
> @@ -228,17 +228,17 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt)
>          break;
>      case INPUT_EVENT_KIND_BTN:
>          btn = evt->u.btn.data;
> -        name = InputButton_lookup[btn->button];
> +        name = InputButton_str(btn->button);
>          trace_input_event_btn(idx, name, btn->down);
>          break;
>      case INPUT_EVENT_KIND_REL:
>          move = evt->u.rel.data;
> -        name = InputAxis_lookup[move->axis];
> +        name = InputAxis_str(move->axis);
>          trace_input_event_rel(idx, name, move->value);
>          break;
>      case INPUT_EVENT_KIND_ABS:
>          move = evt->u.abs.data;
> -        name = InputAxis_lookup[move->axis];
> +        name = InputAxis_str(move->axis);
>          trace_input_event_abs(idx, name, move->value);
>          break;
>      case INPUT_EVENT_KIND__MAX:
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 651cbb8..e1874a2 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -131,7 +131,7 @@ static void vnc_init_basic_info(SocketAddress *addr,
>      case SOCKET_ADDRESS_TYPE_VSOCK:
>      case SOCKET_ADDRESS_TYPE_FD:
>          error_setg(errp, "Unsupported socket address type %s",
> -                   SocketAddressType_lookup[addr->type]);
> +                   SocketAddressType_str(addr->type));
>          break;
>      default:
>          abort();
> @@ -416,7 +416,7 @@ VncInfo *qmp_query_vnc(Error **errp)
>          case SOCKET_ADDRESS_TYPE_VSOCK:
>          case SOCKET_ADDRESS_TYPE_FD:
>              error_setg(errp, "Unsupported socket address type %s",
> -                       SocketAddressType_lookup[addr->type]);
> +                       SocketAddressType_str(addr->type));
>              goto out_error;
>          default:
>              abort();
> @@ -1839,7 +1839,7 @@ static void vnc_release_modifiers(VncState *vs)
>
>  static const char *code2name(int keycode)
>  {
> -    return QKeyCode_lookup[qemu_input_key_number_to_qcode(keycode)];
> +    return QKeyCode_str(qemu_input_key_number_to_qcode(keycode));
>  }
>
>  static void key_event(VncState *vs, int down, uint32_t sym)
> diff --git a/vl.c b/vl.c
> index 8e247cc..0b45e1b 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -688,7 +688,7 @@ bool runstate_check(RunState state)
>
>  bool runstate_store(char *str, size_t size)
>  {
> -    const char *state = RunState_lookup[current_run_state];
> +    const char *state = RunState_str(current_run_state);
>      size_t len = strlen(state) + 1;
>
>      if (len > size) {
> @@ -721,8 +721,8 @@ void runstate_set(RunState new_state)
>
>      if (!runstate_valid_transitions[current_run_state][new_state]) {
>          error_report("invalid runstate transition: '%s' -> '%s'",
> -                     RunState_lookup[current_run_state],
> -                     RunState_lookup[new_state]);
> +                     RunState_str(current_run_state),
> +                     RunState_str(new_state));
>          abort();
>      }
>      trace_runstate_set(new_state);
> --
> 2.7.5
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 14/16] qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup()
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 14/16] qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup() Markus Armbruster
@ 2017-08-24 12:02   ` Marc-André Lureau
  0 siblings, 0 replies; 37+ messages in thread
From: Marc-André Lureau @ 2017-08-24 12:02 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU, Michael Roth

On Thu, Aug 24, 2017 at 10:46 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  hw/core/qdev-properties.c | 7 +++++--
>  qapi/qapi-visit-core.c    | 2 +-
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index 078fc5d..7512bd4 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c
> @@ -72,7 +72,9 @@ static void set_enum(Object *obj, Visitor *v, const char *name, void *opaque,
>
>  static void set_default_value_enum(Object *obj, const Property *prop)
>  {
> -    object_property_set_str(obj, prop->info->enum_table[prop->defval.i],
> +    object_property_set_str(obj,
> +                            qapi_enum_lookup(prop->info->enum_table,
> +                                             prop->defval.i),
>                              prop->name, &error_abort);
>  }
>
> @@ -1095,7 +1097,8 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value)
>      Property *prop;
>
>      prop = qdev_prop_find(dev, name);
> -    object_property_set_str(OBJECT(dev), prop->info->enum_table[value],
> +    object_property_set_str(OBJECT(dev),
> +                            qapi_enum_lookup(prop->info->enum_table, value),
>                              name, &error_abort);
>  }
>
> diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
> index f285879..30dc85b 100644
> --- a/qapi/qapi-visit-core.c
> +++ b/qapi/qapi-visit-core.c
> @@ -345,7 +345,7 @@ static void output_type_enum(Visitor *v, const char *name, int *obj,
>          return;
>      }
>
> -    enum_str = (char *)strings[value];
> +    enum_str = (char *)qapi_enum_lookup(strings, value);
>      visit_type_str(v, name, &enum_str, errp);
>  }
>
> --
> 2.7.5
>
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code Markus Armbruster
  2017-08-24 10:43   ` Marc-André Lureau
@ 2017-08-24 16:32   ` Eric Blake
  2017-08-24 18:29     ` Markus Armbruster
  1 sibling, 1 reply; 37+ messages in thread
From: Eric Blake @ 2017-08-24 16:32 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: marcandre.lureau, mdroth

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

On 08/24/2017 03:45 AM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  docs/devel/qapi-code-gen.txt | 47 +++++++++++++++++++++++++++++++++++---------
>  1 file changed, 38 insertions(+), 9 deletions(-)

Might be nice to call out which commit(s) failed to update the docs when
they tweaked the generated output.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max
  2017-08-24  8:45 ` [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max Markus Armbruster
  2017-08-24 10:45   ` Marc-André Lureau
@ 2017-08-24 16:38   ` Eric Blake
  2017-08-24 18:35     ` Markus Armbruster
  1 sibling, 1 reply; 37+ messages in thread
From: Eric Blake @ 2017-08-24 16:38 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: marcandre.lureau, mdroth

[-- Attachment #1: Type: text/plain, Size: 1578 bytes --]

On 08/24/2017 03:45 AM, Markus Armbruster wrote:
> The lookup tables have a sentinel, no need to make callers pass their
> size.
> 
> Fun: the header has it in the wrong position.  Good riddance.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  block.c                  |  1 -
>  block/file-posix.c       |  7 +++----
>  block/file-win32.c       |  2 +-
>  block/gluster.c          |  6 ++----
>  block/parallels.c        |  3 ++-
>  block/qcow2.c            |  6 ++----
>  blockdev.c               |  1 -
>  hmp.c                    |  2 +-
>  include/qapi/util.h      |  2 +-
>  migration/global_state.c |  3 +--

This would be a patch where using scripts/git.orderfile to highlight the
interface change first would make review a bit quicker :)

> +++ b/include/qapi/util.h
> @@ -12,7 +12,7 @@
>  #define QAPI_UTIL_H
>  
>  int qapi_enum_parse(const char * const lookup[], const char *buf,
> -                    int max, int def, Error **errp);
> +                    int def, Error **errp);

I'm not sure what you meant by wrong position; were you thinking that
lookup/max should be immediately adjacent (since max is a property of
the lookup[] parameter), and sticking 'buf' in between the two is what
meant 'max' was in the wrong position?

The change itself is reasonable, even if the commit message needs a
tweak to answer my question.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code
  2017-08-24 16:32   ` Eric Blake
@ 2017-08-24 18:29     ` Markus Armbruster
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24 18:29 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, marcandre.lureau, mdroth

Eric Blake <eblake@redhat.com> writes:

> On 08/24/2017 03:45 AM, Markus Armbruster wrote:
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  docs/devel/qapi-code-gen.txt | 47 +++++++++++++++++++++++++++++++++++---------
>>  1 file changed, 38 insertions(+), 9 deletions(-)
>
> Might be nice to call out which commit(s) failed to update the docs when
> they tweaked the generated output.

I commonly do that for code, because knowing when something broke can be
useful.  I feel it's less useful for these examples.

Marc-André finds them "tedious and not really useful" in general.  If
everybody feels like that, we can delete them.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max
  2017-08-24 16:38   ` Eric Blake
@ 2017-08-24 18:35     ` Markus Armbruster
  2017-08-24 18:56       ` Eric Blake
  0 siblings, 1 reply; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24 18:35 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, marcandre.lureau, mdroth

Eric Blake <eblake@redhat.com> writes:

> On 08/24/2017 03:45 AM, Markus Armbruster wrote:
>> The lookup tables have a sentinel, no need to make callers pass their
>> size.
>> 
>> Fun: the header has it in the wrong position.  Good riddance.
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  block.c                  |  1 -
>>  block/file-posix.c       |  7 +++----
>>  block/file-win32.c       |  2 +-
>>  block/gluster.c          |  6 ++----
>>  block/parallels.c        |  3 ++-
>>  block/qcow2.c            |  6 ++----
>>  blockdev.c               |  1 -
>>  hmp.c                    |  2 +-
>>  include/qapi/util.h      |  2 +-
>>  migration/global_state.c |  3 +--
>
> This would be a patch where using scripts/git.orderfile to highlight the
> interface change first would make review a bit quicker :)
>
>> +++ b/include/qapi/util.h
>> @@ -12,7 +12,7 @@
>>  #define QAPI_UTIL_H
>>  
>>  int qapi_enum_parse(const char * const lookup[], const char *buf,
>> -                    int max, int def, Error **errp);
>> +                    int def, Error **errp);
>
> I'm not sure what you meant by wrong position; were you thinking that
> lookup/max should be immediately adjacent (since max is a property of
> the lookup[] parameter), and sticking 'buf' in between the two is what
> meant 'max' was in the wrong position?

Compare the declaration above with the definition below:

    diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
    index 46eda7d..ee7594f 100644
    --- a/qapi/qapi-util.c
    +++ b/qapi/qapi-util.c
    @@ -16,7 +16,7 @@
     #include "qapi/util.h"

     int qapi_enum_parse(const char * const lookup[], const char *buf,
    -                    int max, int def, Error **errp)
    +                    int def, Error **errp)
     {
         int i;

Declaration has max before def, definition has it the other way round.

Such errors are one reason I prefer to have documentation next to
definitions, which are authoritative, rather than declarations, which
may or may not match the definition.

> The change itself is reasonable, even if the commit message needs a
> tweak to answer my question.

Care to suggest a wording?

> Reviewed-by: Eric Blake <eblake@redhat.com>

Thanks!

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 04/16] tpm: Clean up model registration & lookup
  2017-08-24 10:50   ` Marc-André Lureau
@ 2017-08-24 18:35     ` Markus Armbruster
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24 18:35 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: Stefan Berger, QEMU, Michael Roth

Marc-André Lureau <marcandre.lureau@gmail.com> writes:

> Hi
>
> On Thu, Aug 24, 2017 at 10:45 AM, Markus Armbruster <armbru@redhat.com> wrote:
>> We have a strict separation between enum TpmModel and tpm_models[]:
>>
>> * TpmModel may have any number of members.  It just happens to have one.
>>
>> * tpm_register_model() uses the first empty slot in tmp_models[].
>>
>>   If you register more than tpm_models[] has space,
>>   tpn_register_model() fails.  Its caller silently ignores the
>>   failure.
>
> tpm_

Will fix.

>>
>>   Register the same TpmModel more than once has no effect other than
>>   wasting tpm_models[] slots: tpm_model_is_registered() is happy with
>>   the first one it finds.
>>
>> Since we only ever register one model, and tpm_models[] has space for
>> just that one, this contraption even works.
>>
>> Turn tpm_models[] into a straight map from enum TpmType to bool.  Much
>> simpler.
>>
>> Cc: Stefan Berger <stefanb@us.ibm.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Thanks!

[...]

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max
  2017-08-24 18:35     ` Markus Armbruster
@ 2017-08-24 18:56       ` Eric Blake
  2017-08-24 19:24         ` Markus Armbruster
  0 siblings, 1 reply; 37+ messages in thread
From: Eric Blake @ 2017-08-24 18:56 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, marcandre.lureau, mdroth

[-- Attachment #1: Type: text/plain, Size: 2510 bytes --]

On 08/24/2017 01:35 PM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
> 
>> On 08/24/2017 03:45 AM, Markus Armbruster wrote:
>>> The lookup tables have a sentinel, no need to make callers pass their
>>> size.
>>>
>>> Fun: the header has it in the wrong position.  Good riddance.
>>>

>>> +++ b/include/qapi/util.h
>>> @@ -12,7 +12,7 @@
>>>  #define QAPI_UTIL_H
>>>  
>>>  int qapi_enum_parse(const char * const lookup[], const char *buf,
>>> -                    int max, int def, Error **errp);
>>> +                    int def, Error **errp);
>>
>> I'm not sure what you meant by wrong position; were you thinking that
>> lookup/max should be immediately adjacent (since max is a property of
>> the lookup[] parameter), and sticking 'buf' in between the two is what
>> meant 'max' was in the wrong position?
> 
> Compare the declaration above with the definition below:
> 
>     diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
>     index 46eda7d..ee7594f 100644
>     --- a/qapi/qapi-util.c
>     +++ b/qapi/qapi-util.c
>     @@ -16,7 +16,7 @@
>      #include "qapi/util.h"
> 
>      int qapi_enum_parse(const char * const lookup[], const char *buf,
>     -                    int max, int def, Error **errp)
>     +                    int def, Error **errp)
>      {
>          int i;
> 
> Declaration has max before def, definition has it the other way round.

Huh?  On current master (commit 248b2373), the two look like they match
to me:

$ git grep -A1 qapi_enum_parse'.*const look'
include/qapi/util.h:int qapi_enum_parse(const char * const lookup[],
const char *buf,
include/qapi/util.h-                    int max, int def, Error **errp);
--
qapi/qapi-util.c:int qapi_enum_parse(const char * const lookup[], const
char *buf,
qapi/qapi-util.c-                    int max, int def, Error **errp)


> 
> Such errors are one reason I prefer to have documentation next to
> definitions, which are authoritative, rather than declarations, which
> may or may not match the definition.
> 
>> The change itself is reasonable, even if the commit message needs a
>> tweak to answer my question.
> 
> Care to suggest a wording?

At this point, I find the claim to be bogus, so I suggest you delete the
'Fun:' paragraph.

> 
>> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> Thanks!
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max
  2017-08-24 18:56       ` Eric Blake
@ 2017-08-24 19:24         ` Markus Armbruster
  0 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-08-24 19:24 UTC (permalink / raw)
  To: Eric Blake; +Cc: marcandre.lureau, qemu-devel, mdroth

Eric Blake <eblake@redhat.com> writes:

> On 08/24/2017 01:35 PM, Markus Armbruster wrote:
>> Eric Blake <eblake@redhat.com> writes:
>> 
>>> On 08/24/2017 03:45 AM, Markus Armbruster wrote:
>>>> The lookup tables have a sentinel, no need to make callers pass their
>>>> size.
>>>>
>>>> Fun: the header has it in the wrong position.  Good riddance.
>>>>
>
>>>> +++ b/include/qapi/util.h
>>>> @@ -12,7 +12,7 @@
>>>>  #define QAPI_UTIL_H
>>>>  
>>>>  int qapi_enum_parse(const char * const lookup[], const char *buf,
>>>> -                    int max, int def, Error **errp);
>>>> +                    int def, Error **errp);
>>>
>>> I'm not sure what you meant by wrong position; were you thinking that
>>> lookup/max should be immediately adjacent (since max is a property of
>>> the lookup[] parameter), and sticking 'buf' in between the two is what
>>> meant 'max' was in the wrong position?
>> 
>> Compare the declaration above with the definition below:
>> 
>>     diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
>>     index 46eda7d..ee7594f 100644
>>     --- a/qapi/qapi-util.c
>>     +++ b/qapi/qapi-util.c
>>     @@ -16,7 +16,7 @@
>>      #include "qapi/util.h"
>> 
>>      int qapi_enum_parse(const char * const lookup[], const char *buf,
>>     -                    int max, int def, Error **errp)
>>     +                    int def, Error **errp)
>>      {
>>          int i;
>> 
>> Declaration has max before def, definition has it the other way round.
>
> Huh?  On current master (commit 248b2373), the two look like they match
> to me:
>
> $ git grep -A1 qapi_enum_parse'.*const look'
> include/qapi/util.h:int qapi_enum_parse(const char * const lookup[],
> const char *buf,
> include/qapi/util.h-                    int max, int def, Error **errp);
> --
> qapi/qapi-util.c:int qapi_enum_parse(const char * const lookup[], const
> char *buf,
> qapi/qapi-util.c-                    int max, int def, Error **errp)
>
>
>> 
>> Such errors are one reason I prefer to have documentation next to
>> definitions, which are authoritative, rather than declarations, which
>> may or may not match the definition.
>> 
>>> The change itself is reasonable, even if the commit message needs a
>>> tweak to answer my question.
>> 
>> Care to suggest a wording?
>
> At this point, I find the claim to be bogus, so I suggest you delete the
> 'Fun:' paragraph.

Sure.

>>> Reviewed-by: Eric Blake <eblake@redhat.com>
>> 
>> Thanks!

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup()
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup() Markus Armbruster
  2017-08-24 10:53   ` Marc-André Lureau
@ 2017-08-29 11:10   ` Daniel P. Berrange
  1 sibling, 0 replies; 37+ messages in thread
From: Daniel P. Berrange @ 2017-08-29 11:10 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, marcandre.lureau, mdroth

On Thu, Aug 24, 2017 at 10:46:04AM +0200, Markus Armbruster wrote:
> Cc: "Daniel P. Berrange" <berrange@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  crypto/block-luks.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)

Acked-by: Daniel P. Berrange <berrange@redhat.com>

> 
> diff --git a/crypto/block-luks.c b/crypto/block-luks.c
> index afb8543..c3cacdb 100644
> --- a/crypto/block-luks.c
> +++ b/crypto/block-luks.c
> @@ -20,6 +20,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qapi/util.h"
>  #include "qemu/bswap.h"
>  
>  #include "crypto/block-luks.h"
> @@ -265,39 +266,33 @@ qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg,
>   * make that function emit a more friendly error message */
>  static int qcrypto_block_luks_name_lookup(const char *name,
>                                            const char *const *map,
> -                                          size_t maplen,
>                                            const char *type,
>                                            Error **errp)
>  {
> -    size_t i;
> -    for (i = 0; i < maplen; i++) {
> -        if (g_str_equal(map[i], name)) {
> -            return i;
> -        }
> -    }
> +    int ret = qapi_enum_parse(map, name, -1, NULL);
>  
> -    error_setg(errp, "%s %s not supported", type, name);
> -    return 0;
> +    if (ret < 0) {
> +        error_setg(errp, "%s %s not supported", type, name);
> +        return 0;
> +    }
> +    return ret;
>  }
>  
>  #define qcrypto_block_luks_cipher_mode_lookup(name, errp)               \
>      qcrypto_block_luks_name_lookup(name,                                \
>                                     QCryptoCipherMode_lookup,            \
> -                                   QCRYPTO_CIPHER_MODE__MAX,            \
>                                     "Cipher mode",                       \
>                                     errp)
>  
>  #define qcrypto_block_luks_hash_name_lookup(name, errp)                 \
>      qcrypto_block_luks_name_lookup(name,                                \
>                                     QCryptoHashAlgorithm_lookup,         \
> -                                   QCRYPTO_HASH_ALG__MAX,               \
>                                     "Hash algorithm",                    \
>                                     errp)
>  
>  #define qcrypto_block_luks_ivgen_name_lookup(name, errp)                \
>      qcrypto_block_luks_name_lookup(name,                                \
>                                     QCryptoIVGenAlgorithm_lookup,        \
> -                                   QCRYPTO_IVGEN_ALG__MAX,              \
>                                     "IV generator",                      \
>                                     errp)
>  
> -- 
> 2.7.5
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 12/16] qapi: Generate FOO_str() macro for QAPI enum FOO
  2017-08-24  8:46 ` [Qemu-devel] [PATCH 12/16] qapi: Generate FOO_str() macro for QAPI enum FOO Markus Armbruster
@ 2017-08-30 13:42   ` Marc-André Lureau
  0 siblings, 0 replies; 37+ messages in thread
From: Marc-André Lureau @ 2017-08-30 13:42 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, mdroth



----- Original Message -----
> The next commit will put it to use.  May look pointless now, but we're
> going to change the FOO_lookup's type, and then it'll help.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  block.c                      | 1 -
>  block/blkdebug.c             | 1 -
>  block/file-posix.c           | 1 -
>  block/file-win32.c           | 1 -
>  block/gluster.c              | 1 -
>  block/parallels.c            | 1 -
>  block/qcow2.c                | 1 -
>  block/quorum.c               | 1 -
>  blockdev.c                   | 1 -
>  crypto/block-luks.c          | 1 -
>  docs/devel/qapi-code-gen.txt | 3 +++
>  hmp.c                        | 1 -
>  include/qapi/util.h          | 1 +
>  migration/global_state.c     | 1 -
>  migration/migration.c        | 1 -
>  qapi/qapi-util.c             | 8 +++++++-
>  qapi/qapi-visit-core.c       | 1 -
>  qemu-img.c                   | 1 -
>  qemu-nbd.c                   | 1 -
>  scripts/qapi-event.py        | 1 +
>  scripts/qapi-types.py        | 4 ++++
>  scripts/qapi.py              | 3 +++
>  tests/test-qapi-util.c       | 1 -
>  tpm.c                        | 1 -
>  util/keyval.c                | 1 -
>  25 files changed, 19 insertions(+), 20 deletions(-)
> 
> diff --git a/block.c b/block.c
> index dd0efa2..2d12131 100644
> --- a/block.c
> +++ b/block.c
> @@ -42,7 +42,6 @@
>  #include "qapi-event.h"
>  #include "qemu/cutils.h"
>  #include "qemu/id.h"
> -#include "qapi/util.h"
>  
>  #ifdef CONFIG_BSD
>  #include <sys/ioctl.h>
> diff --git a/block/blkdebug.c b/block/blkdebug.c
> index f1bbee9..b370fce 100644
> --- a/block/blkdebug.c
> +++ b/block/blkdebug.c
> @@ -32,7 +32,6 @@
>  #include "qapi/qmp/qbool.h"
>  #include "qapi/qmp/qdict.h"
>  #include "qapi/qmp/qstring.h"
> -#include "qapi/util.h"
>  #include "sysemu/qtest.h"
>  
>  typedef struct BDRVBlkdebugState {
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 97e8a92..d81eccc 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -31,7 +31,6 @@
>  #include "block/thread-pool.h"
>  #include "qemu/iov.h"
>  #include "block/raw-aio.h"
> -#include "qapi/util.h"
>  #include "qapi/qmp/qstring.h"
>  
>  #if defined(__APPLE__) && (__MACH__)
> diff --git a/block/file-win32.c b/block/file-win32.c
> index 978d805..192ea81 100644
> --- a/block/file-win32.c
> +++ b/block/file-win32.c
> @@ -31,7 +31,6 @@
>  #include "block/thread-pool.h"
>  #include "qemu/iov.h"
>  #include "qapi/qmp/qstring.h"
> -#include "qapi/util.h"
>  #include <windows.h>
>  #include <winioctl.h>
>  
> diff --git a/block/gluster.c b/block/gluster.c
> index 8367e80..0614e0c 100644
> --- a/block/gluster.c
> +++ b/block/gluster.c
> @@ -12,7 +12,6 @@
>  #include "block/block_int.h"
>  #include "qapi/error.h"
>  #include "qapi/qmp/qerror.h"
> -#include "qapi/util.h"
>  #include "qemu/uri.h"
>  #include "qemu/error-report.h"
>  #include "qemu/cutils.h"
> diff --git a/block/parallels.c b/block/parallels.c
> index eb92366..d812210 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -35,7 +35,6 @@
>  #include "qemu/module.h"
>  #include "qemu/bswap.h"
>  #include "qemu/bitmap.h"
> -#include "qapi/util.h"
>  
>  /**************************************************************/
>  
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 7aaf248..41e067e 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -30,7 +30,6 @@
>  #include "qemu/error-report.h"
>  #include "qapi/qmp/qerror.h"
>  #include "qapi/qmp/qbool.h"
> -#include "qapi/util.h"
>  #include "qapi/qmp/types.h"
>  #include "qapi-event.h"
>  #include "trace.h"
> diff --git a/block/quorum.c b/block/quorum.c
> index cb66177..8d1c9f6 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -22,7 +22,6 @@
>  #include "qapi/qmp/qjson.h"
>  #include "qapi/qmp/qlist.h"
>  #include "qapi/qmp/qstring.h"
> -#include "qapi/util.h"
>  #include "qapi-event.h"
>  #include "crypto/hash.h"
>  
> diff --git a/blockdev.c b/blockdev.c
> index 722a61e..f90bc93 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -44,7 +44,6 @@
>  #include "qapi-visit.h"
>  #include "qapi/qmp/qerror.h"
>  #include "qapi/qobject-output-visitor.h"
> -#include "qapi/util.h"
>  #include "sysemu/sysemu.h"
>  #include "block/block_int.h"
>  #include "qmp-commands.h"
> diff --git a/crypto/block-luks.c b/crypto/block-luks.c
> index c3cacdb..84d189a 100644
> --- a/crypto/block-luks.c
> +++ b/crypto/block-luks.c
> @@ -20,7 +20,6 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> -#include "qapi/util.h"
>  #include "qemu/bswap.h"
>  
>  #include "crypto/block-luks.h"
> diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
> index ae05327..f04c63f 100644
> --- a/docs/devel/qapi-code-gen.txt
> +++ b/docs/devel/qapi-code-gen.txt
> @@ -1275,6 +1275,9 @@ Example:
>          EXAMPLE_QAPI_EVENT__MAX = 1,
>      } example_QAPIEvent;
>  
> +    #define example_QAPIEvent_str(val) \
> +        qapi_enum_lookup(example_QAPIEvent_lookup, (val))
> +
>      extern const char *const example_QAPIEvent_lookup[];
>  
>      #endif
> diff --git a/hmp.c b/hmp.c
> index 2b6e919..5d980ac 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -31,7 +31,6 @@
>  #include "qapi/qmp/qerror.h"
>  #include "qapi/string-input-visitor.h"
>  #include "qapi/string-output-visitor.h"
> -#include "qapi/util.h"
>  #include "qapi-visit.h"
>  #include "qom/object_interfaces.h"
>  #include "ui/console.h"
> diff --git a/include/qapi/util.h b/include/qapi/util.h
> index 4eb8a3f..5e50d0c 100644
> --- a/include/qapi/util.h
> +++ b/include/qapi/util.h
> @@ -11,6 +11,7 @@
>  #ifndef QAPI_UTIL_H
>  #define QAPI_UTIL_H
>  
> +const char *qapi_enum_lookup(const char *const lookup[], int val);
>  int qapi_enum_parse(const char * const lookup[], const char *buf,
>                      int def, Error **errp);
>  
> diff --git a/migration/global_state.c b/migration/global_state.c
> index 88c55f8..76cd3a1 100644
> --- a/migration/global_state.c
> +++ b/migration/global_state.c
> @@ -14,7 +14,6 @@
>  #include "qemu/cutils.h"
>  #include "qemu/error-report.h"
>  #include "qapi/error.h"
> -#include "qapi/util.h"
>  #include "migration.h"
>  #include "migration/global_state.h"
>  #include "migration/vmstate.h"
> diff --git a/migration/migration.c b/migration/migration.c
> index c3fe0ed..1a2b3eb 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -31,7 +31,6 @@
>  #include "migration/vmstate.h"
>  #include "block/block.h"
>  #include "qapi/qmp/qerror.h"
> -#include "qapi/util.h"
>  #include "qemu/rcu.h"
>  #include "block.h"
>  #include "postcopy-ram.h"
> diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
> index ee7594f..7af2f04 100644
> --- a/qapi/qapi-util.c
> +++ b/qapi/qapi-util.c
> @@ -13,7 +13,13 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "qemu-common.h"
> -#include "qapi/util.h"
> +
> +const char *qapi_enum_lookup(const char *const lookup[], int val)
> +{
> +    assert(val >= 0);
> +
> +    return lookup[val];
> +}
>  
>  int qapi_enum_parse(const char * const lookup[], const char *buf,
>                      int def, Error **errp)
> diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
> index ec83ff6..f285879 100644
> --- a/qapi/qapi-visit-core.c
> +++ b/qapi/qapi-visit-core.c
> @@ -14,7 +14,6 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> -#include "qapi/util.h"
>  #include "qemu-common.h"
>  #include "qapi/qmp/qobject.h"
>  #include "qapi/qmp/qerror.h"
> diff --git a/qemu-img.c b/qemu-img.c
> index 611ab7d..a72a2e3 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -26,7 +26,6 @@
>  
>  #include "qemu-version.h"
>  #include "qapi/error.h"
> -#include "qapi/util.h"
>  #include "qapi-visit.h"
>  #include "qapi/qobject-output-visitor.h"
>  #include "qapi/qmp/qerror.h"
> diff --git a/qemu-nbd.c b/qemu-nbd.c
> index 96e10d6..a97f3f4 100644
> --- a/qemu-nbd.c
> +++ b/qemu-nbd.c
> @@ -34,7 +34,6 @@
>  #include "qemu/log.h"
>  #include "qemu/systemd.h"
>  #include "block/snapshot.h"
> -#include "qapi/util.h"
>  #include "qapi/qmp/qstring.h"
>  #include "qom/object_interfaces.h"
>  #include "io/channel-socket.h"
> diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py
> index bcbef10..07b4b70 100644
> --- a/scripts/qapi-event.py
> +++ b/scripts/qapi-event.py
> @@ -217,6 +217,7 @@ fdef.write(mcgen('''
>  
>  fdecl.write(mcgen('''
>  #include "qapi/error.h"
> +#include "qapi/util.h"
>  #include "qapi/qmp/qdict.h"
>  #include "%(prefix)sqapi-types.h"
>  
> diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
> index b45e7b5..7e3051d 100644
> --- a/scripts/qapi-types.py
> +++ b/scripts/qapi-types.py
> @@ -292,6 +292,10 @@ fdef.write(mcgen('''
>  ''',
>                   prefix=prefix))
>  
> +fdecl.write(mcgen('''
> +#include "qapi/util.h"
> +'''))
> +
>  schema = QAPISchema(input_file)
>  gen = QAPISchemaGenTypeVisitor()
>  schema.visit(gen)
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index 8aa2775..1cd713d 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
> @@ -1894,6 +1894,9 @@ typedef enum %(c_name)s {
>  
>      ret += mcgen('''
>  
> +#define %(c_name)s_str(val) \\
> +    qapi_enum_lookup(%(c_name)s_lookup, (val))
> +
>  extern const char *const %(c_name)s_lookup[];
>  ''',
>                   c_name=c_name(name))
> diff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c
> index d72ee8c..7e1be1d 100644
> --- a/tests/test-qapi-util.c
> +++ b/tests/test-qapi-util.c
> @@ -12,7 +12,6 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> -#include "qapi/util.h"
>  #include "test-qapi-types.h"
>  
>  static void test_qapi_enum_parse(void)
> diff --git a/tpm.c b/tpm.c
> index 7635fc7..38f3eb8 100644
> --- a/tpm.c
> +++ b/tpm.c
> @@ -14,7 +14,6 @@
>  #include "qemu/osdep.h"
>  
>  #include "qapi/qmp/qerror.h"
> -#include "qapi/util.h"
>  #include "sysemu/tpm_backend.h"
>  #include "sysemu/tpm.h"
>  #include "qemu/config-file.h"
> diff --git a/util/keyval.c b/util/keyval.c
> index 7dbda62..7dfc75c 100644
> --- a/util/keyval.c
> +++ b/util/keyval.c
> @@ -82,7 +82,6 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "qapi/qmp/qstring.h"
> -#include "qapi/util.h"
>  #include "qemu/cutils.h"
>  #include "qemu/option.h"
>  
> --
> 2.7.5
> 
> 

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string
  2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
                   ` (16 preceding siblings ...)
  2017-08-24  9:22 ` [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string no-reply
@ 2017-09-01 12:43 ` Markus Armbruster
  17 siblings, 0 replies; 37+ messages in thread
From: Markus Armbruster @ 2017-09-01 12:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcandre.lureau, mdroth

Markus Armbruster <armbru@redhat.com> writes:

> The purpose of this work is to make holes in QAPI enumerations
> possible.
>
> Why holes?  Because we want to be able to suppress enumeration
> constants with #if.  Holes could be avoided, e.g. by letting the
> compiler assign the values.  Falls apart when the conditions are
> target-specific, because then target-specific code would get different
> values.
>
> Why are holes a problem?  The tables mapping enumeration constants to
> strings use a NULL sentinel.
>
> This is PATCH 06-13 of "[PATCH v2 00/54] qapi: add #if pre-processor
> conditions to generated code" reworked for reviewability.  Took a bit
> of time, but it was probably less work and certainly more fun than
> reviewing the old PATCH 06 and 12 (almost 300 hunks!) in sufficient
> depth would have been.

Applied to qapi-next.

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2017-09-01 12:43 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24  8:45 [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string Markus Armbruster
2017-08-24  8:45 ` [Qemu-devel] [PATCH 01/16] qapi: Update qapi-code-gen.txt examples to match current code Markus Armbruster
2017-08-24 10:43   ` Marc-André Lureau
2017-08-24 16:32   ` Eric Blake
2017-08-24 18:29     ` Markus Armbruster
2017-08-24  8:45 ` [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max Markus Armbruster
2017-08-24 10:45   ` Marc-André Lureau
2017-08-24 16:38   ` Eric Blake
2017-08-24 18:35     ` Markus Armbruster
2017-08-24 18:56       ` Eric Blake
2017-08-24 19:24         ` Markus Armbruster
2017-08-24  8:45 ` [Qemu-devel] [PATCH 03/16] tpm: Clean up driver registration & lookup Markus Armbruster
2017-08-24  8:45 ` [Qemu-devel] [PATCH 04/16] tpm: Clean up model " Markus Armbruster
2017-08-24 10:50   ` Marc-André Lureau
2017-08-24 18:35     ` Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 05/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_capability() Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 06/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_parameter() Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 07/16] block: Use qemu_enum_parse() in blkdebug_debug_breakpoint() Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 08/16] quorum: Use qapi_enum_parse() in quorum_open() Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup() Markus Armbruster
2017-08-24 10:53   ` Marc-André Lureau
2017-08-29 11:10   ` Daniel P. Berrange
2017-08-24  8:46 ` [Qemu-devel] [PATCH 10/16] qapi: Use qapi_enum_parse() in input_type_enum() Markus Armbruster
2017-08-24 11:30   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 11/16] qapi: Avoid unnecessary use of enum lookup table's sentinel Markus Armbruster
2017-08-24 11:34   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 12/16] qapi: Generate FOO_str() macro for QAPI enum FOO Markus Armbruster
2017-08-30 13:42   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 13/16] qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) Markus Armbruster
2017-08-24 11:52   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 14/16] qapi: Convert indirect uses of FOO_lookup[...] to qapi_enum_lookup() Markus Armbruster
2017-08-24 12:02   ` Marc-André Lureau
2017-08-24  8:46 ` [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO Markus Armbruster
2017-08-24  9:55   ` Markus Armbruster
2017-08-24  8:46 ` [Qemu-devel] [PATCH 16/16] qapi: drop the sentinel in enum array Markus Armbruster
2017-08-24  9:22 ` [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string no-reply
2017-09-01 12:43 ` Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.