From patchwork Wed Nov 18 08:53:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Blake X-Patchwork-Id: 545923 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B1C54140273 for ; Wed, 18 Nov 2015 20:12:56 +1100 (AEDT) Received: from localhost ([::1]:34707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyynO-0001zQ-Ex for incoming@patchwork.ozlabs.org; Wed, 18 Nov 2015 04:12:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyyUm-0001xV-7i for qemu-devel@nongnu.org; Wed, 18 Nov 2015 03:53:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZyyUi-0004EC-RH for qemu-devel@nongnu.org; Wed, 18 Nov 2015 03:53:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyyUf-00048d-Bq; Wed, 18 Nov 2015 03:53:33 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id E9EC179; Wed, 18 Nov 2015 08:53:32 +0000 (UTC) Received: from red.redhat.com (ovpn-113-208.phx2.redhat.com [10.3.113.208]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAI8rHHc020742; Wed, 18 Nov 2015 03:53:32 -0500 From: Eric Blake To: qemu-devel@nongnu.org Date: Wed, 18 Nov 2015 01:53:04 -0700 Message-Id: <1447836791-369-30-git-send-email-eblake@redhat.com> In-Reply-To: <1447836791-369-1-git-send-email-eblake@redhat.com> References: <1447836791-369-1-git-send-email-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Michael Roth , armbru@redhat.com, "open list:Block layer core" , Luiz Capitulino Subject: [Qemu-devel] [PATCH v12 29/36] qobject: Rename qtype_code to QType X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The name QType is more in line with our conventions for qapi types, and matches the fact that each enum member has a prefix of QTYPE_. Signed-off-by: Eric Blake --- v12: new patch split off of 21/28 --- block/qapi.c | 4 ++-- include/hw/qdev-core.h | 2 +- include/qapi/qmp/qobject.h | 8 ++++---- qobject/qdict.c | 3 +-- scripts/qapi.py | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/block/qapi.c b/block/qapi.c index d20262d..4eb48fc 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -590,7 +590,7 @@ static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation, int i = 0; for (entry = qlist_first(list); entry; entry = qlist_next(entry), i++) { - qtype_code type = qobject_type(entry->value); + QType type = qobject_type(entry->value); bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST); const char *format = composite ? "%*s[%i]:\n" : "%*s[%i]: "; @@ -608,7 +608,7 @@ static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation, const QDictEntry *entry; for (entry = qdict_first(dict); entry; entry = qdict_next(dict, entry)) { - qtype_code type = qobject_type(entry->value); + QType type = qobject_type(entry->value); bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST); const char *format = composite ? "%*s%s:\n" : "%*s%s: "; char key[strlen(entry->key) + 1]; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index e6dbde4..c66429a 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -239,7 +239,7 @@ struct Property { PropertyInfo *info; int offset; uint8_t bitnr; - qtype_code qtype; + QType qtype; int64_t defval; int arrayoffset; PropertyInfo *arrayinfo; diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h index 83ed70b..0558ff3 100644 --- a/include/qapi/qmp/qobject.h +++ b/include/qapi/qmp/qobject.h @@ -45,12 +45,12 @@ typedef enum { QTYPE_QFLOAT, QTYPE_QBOOL, QTYPE_MAX, -} qtype_code; +} QType; typedef struct QObject QObject; struct QObject { - qtype_code type; + QType type; size_t refcnt; void (*destroy)(QObject *); }; @@ -71,7 +71,7 @@ struct QObject { qobject_decref(obj ? QOBJECT(obj) : NULL) /* Initialize an object to default values */ -static inline void qobject_init(QObject *obj, qtype_code type, +static inline void qobject_init(QObject *obj, QType type, void (*destroy)(struct QObject *)) { assert(type); @@ -105,7 +105,7 @@ static inline void qobject_decref(QObject *obj) /** * qobject_type(): Return the QObject's type */ -static inline qtype_code qobject_type(const QObject *obj) +static inline QType qobject_type(const QObject *obj) { assert(obj->type); return obj->type; diff --git a/qobject/qdict.c b/qobject/qdict.c index cf62269..d5e6df1 100644 --- a/qobject/qdict.c +++ b/qobject/qdict.c @@ -179,8 +179,7 @@ size_t qdict_size(const QDict *qdict) /** * qdict_get_obj(): Get a QObject of a specific type */ -static QObject *qdict_get_obj(const QDict *qdict, const char *key, - qtype_code type) +static QObject *qdict_get_obj(const QDict *qdict, const char *key, QType type) { QObject *obj; diff --git a/scripts/qapi.py b/scripts/qapi.py index e41dbaf..7c0ef76 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -34,7 +34,7 @@ builtin_types = { 'uint32': 'QTYPE_QINT', 'uint64': 'QTYPE_QINT', 'size': 'QTYPE_QINT', - 'any': None, # any qtype_code possible, actually + 'any': None, # any QType possible, actually } # Whitelist of commands allowed to return a non-dictionary