From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529682219414320.94208250417705; Fri, 22 Jun 2018 08:43:39 -0700 (PDT) Received: from localhost ([::1]:34807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWODq-0000yf-PQ for importer@patchew.org; Fri, 22 Jun 2018 11:43:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000pv-D5 for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO36-0000K3-Fv for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59540 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO36-0000Jk-CO for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 014EA4023336 for ; Fri, 22 Jun 2018 15:32:32 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5D3011166E1; Fri, 22 Jun 2018 15:32:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B74C21138529; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:19 +0200 Message-Id: <20180622153228.23594-2-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 22 Jun 2018 15:32:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 22 Jun 2018 15:32:32 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 01/10] qapi/visit: remove useless prefix argument X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20180321115211.17937-2-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/visit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 5d72d8936c..3c5ea1289e 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -293,7 +293,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisit= or): #include "qapi/qmp/qerror.h" #include "%(visit)s.h" ''', - visit=3Dvisit, prefix=3Dself._prefix= )) + visit=3Dvisit)) self._genh.preamble_add(mcgen(''' #include "qapi/qapi-builtin-visit.h" #include "%(types)s.h" --=20 2.17.1 From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529681875605392.3494352664469; Fri, 22 Jun 2018 08:37:55 -0700 (PDT) Received: from localhost ([::1]:34774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO8I-0004of-QS for importer@patchew.org; Fri, 22 Jun 2018 11:37:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000pq-BV for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO35-0000Ht-3j for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54609 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO34-0000H9-Vt for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C845A2C7F for ; Fri, 22 Jun 2018 15:32:30 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5CA02156700; Fri, 22 Jun 2018 15:32:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B81901132F3C; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:20 +0200 Message-Id: <20180622153228.23594-3-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 22 Jun 2018 15:32:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 22 Jun 2018 15:32:30 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 02/10] qapi/events: generate event enum in main module X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau The event generator produces an enum, and put it in the last visited module. It fits better in the main module, since it's the set of all visited events, from all modules. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20180321115211.17937-3-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- scripts/qapi/events.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index 4426861ff1..5657524688 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -180,8 +180,9 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisit= or): types=3Dtypes)) =20 def visit_end(self): - self._genh.add(gen_enum(self._enum_name, self._event_names)) - self._genc.add(gen_enum_lookup(self._enum_name, self._event_names)) + (genc, genh) =3D self._module[self._main_module] + genh.add(gen_enum(self._enum_name, self._event_names)) + genc.add(gen_enum_lookup(self._enum_name, self._event_names)) =20 def visit_event(self, name, info, arg_type, boxed): self._genh.add(gen_event_send_decl(name, arg_type, boxed)) --=20 2.17.1 From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529681838710640.0013828978344; Fri, 22 Jun 2018 08:37:18 -0700 (PDT) Received: from localhost ([::1]:34772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO7S-0004Cw-Ec for importer@patchew.org; Fri, 22 Jun 2018 11:37:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000po-An for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO35-0000ID-5u for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54608 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO34-0000HA-VN for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1761FA2C73 for ; Fri, 22 Jun 2018 15:32:30 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5C912027EA0; Fri, 22 Jun 2018 15:32:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id BC00F1132D69; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:21 +0200 Message-Id: <20180622153228.23594-4-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 22 Jun 2018 15:32:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 22 Jun 2018 15:32:30 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 03/10] qdict: Make qdict_flatten() shallow-clone-friendly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Max Reitz In its current form, qdict_flatten() removes all entries from nested QDicts that are moved to the root QDict. It is completely sufficient to remove all old entries from the root QDict, however. If the nested dicts have a refcount of 1, this will automatically delete them, too. And if they have a greater refcount, we probably do not want to modify them in the first place. The latter observation means that it was currently (in general) impossible to qdict_flatten() a shallowly cloned dict because that would empty nested QDicts in the original dict as well. This patch changes this, so you can now use qdict_flatten(qdict_shallow_clone(dict)) to get a flattened copy without disturbing the original. Signed-off-by: Max Reitz Message-Id: <20180611205203.2624-7-mreitz@redhat.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- qobject/block-qdict.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/qobject/block-qdict.c b/qobject/block-qdict.c index df833083a7..36129e7379 100644 --- a/qobject/block-qdict.c +++ b/qobject/block-qdict.c @@ -114,19 +114,30 @@ static void qdict_flatten_qdict(QDict *qdict, QDict *= target, const char *prefix) =20 /* * Flatten non-empty QDict and QList recursively into @target, - * copy other objects to @target + * copy other objects to @target. + * On the root level (if @qdict =3D=3D @target), remove flattened + * nested QDicts and QLists from @qdict. + * + * (Note that we do not need to remove entries from nested + * dicts or lists. Their reference count is decremented on + * the root level, so there are no leaks. In fact, if they + * have a reference count greater than one, we are probably + * well advised not to modify them altogether.) */ if (dict_val && qdict_size(dict_val)) { qdict_flatten_qdict(dict_val, target, new_key ? new_key : entry->key); - qdict_del(qdict, entry->key); + if (target =3D=3D qdict) { + qdict_del(qdict, entry->key); + } } else if (list_val && !qlist_empty(list_val)) { qdict_flatten_qlist(list_val, target, new_key ? new_key : entry->key); - qdict_del(qdict, entry->key); + if (target =3D=3D qdict) { + qdict_del(qdict, entry->key); + } } else if (target !=3D qdict) { qdict_put_obj(target, new_key, qobject_ref(value)); - qdict_del(qdict, entry->key); } =20 g_free(new_key); --=20 2.17.1 From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529682117490236.26294866658623; Fri, 22 Jun 2018 08:41:57 -0700 (PDT) Received: from localhost ([::1]:34799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWOCC-0008FS-Ne for importer@patchew.org; Fri, 22 Jun 2018 11:41:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000pn-BI for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO35-0000Hy-48 for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56216 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO34-0000H8-W2 for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 155C3406E81E for ; Fri, 22 Jun 2018 15:32:30 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5AE81C71D; Fri, 22 Jun 2018 15:32:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id BF6741132D6A; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:22 +0200 Message-Id: <20180622153228.23594-5-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 22 Jun 2018 15:32:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 22 Jun 2018 15:32:30 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 04/10] tests: Add QDict clone-flatten test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Max Reitz This new test verifies that qdict_flatten() does not modify a shallow clone of the given QDict. Reviewed-by: Eric Blake Signed-off-by: Max Reitz Message-Id: <20180611205203.2624-8-mreitz@redhat.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- tests/check-block-qdict.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/check-block-qdict.c b/tests/check-block-qdict.c index 1d20fccbd4..478807f839 100644 --- a/tests/check-block-qdict.c +++ b/tests/check-block-qdict.c @@ -125,6 +125,38 @@ static void qdict_flatten_test(void) qobject_unref(root); } =20 +static void qdict_clone_flatten_test(void) +{ + QDict *dict1 =3D qdict_new(); + QDict *dict2 =3D qdict_new(); + QDict *cloned_dict1; + + /* + * Test that we can clone and flatten + * { "a": { "b": 42 } } + * without modifying the clone. + */ + + qdict_put_int(dict2, "b", 42); + qdict_put(dict1, "a", dict2); + + cloned_dict1 =3D qdict_clone_shallow(dict1); + + qdict_flatten(dict1); + + g_assert(qdict_size(dict1) =3D=3D 1); + g_assert(qdict_get_int(dict1, "a.b") =3D=3D 42); + + g_assert(qdict_size(cloned_dict1) =3D=3D 1); + g_assert(qdict_get_qdict(cloned_dict1, "a") =3D=3D dict2); + + g_assert(qdict_size(dict2) =3D=3D 1); + g_assert(qdict_get_int(dict2, "b") =3D=3D 42); + + qobject_unref(dict1); + qobject_unref(cloned_dict1); +} + static void qdict_array_split_test(void) { QDict *test_dict =3D qdict_new(); @@ -674,6 +706,7 @@ int main(int argc, char **argv) =20 g_test_add_func("/public/defaults", qdict_defaults_test); g_test_add_func("/public/flatten", qdict_flatten_test); + g_test_add_func("/public/clone_flatten", qdict_clone_flatten_test); g_test_add_func("/public/array_split", qdict_array_split_test); g_test_add_func("/public/array_entries", qdict_array_entries_test); g_test_add_func("/public/join", qdict_join_test); --=20 2.17.1 From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529681845156764.6173370004582; Fri, 22 Jun 2018 08:37:25 -0700 (PDT) Received: from localhost ([::1]:34773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO7j-0004O8-BA for importer@patchew.org; Fri, 22 Jun 2018 11:37:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000pr-BX for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO35-0000JM-TP for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44120 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO35-0000IW-MI for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A2D9401C87C; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07CCB2156700; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C2DB31132D6B; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:23 +0200 Message-Id: <20180622153228.23594-6-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 05/10] qapi: allow empty branches in flat unions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anton Nefedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anton Nefedov It often happens that just a few discriminator values imply extra data in a flat union. Existing checks did not make possible to leave other values uncovered. Such cases had to be worked around by either stating a dummy (empty) type or introducing another (subset) discriminator enumeration. Both options create redundant entities in qapi files for little profit. With this patch it is not necessary anymore to add designated union fields for every possible value of a discriminator enumeration. Signed-off-by: Anton Nefedov Message-Id: <1529311206-76847-2-git-send-email-anton.nefedov@virtuozzo.com> Reviewed-by: Markus Armbruster Signed-off-by: Markus Armbruster --- docs/devel/qapi-code-gen.txt | 8 +++++--- scripts/qapi/common.py | 15 ++++++++------- scripts/qapi/types.py | 2 ++ scripts/qapi/visit.py | 19 ++++++++++++++----- tests/Makefile.include | 1 - .../flat-union-incomplete-branch.err | 1 - .../flat-union-incomplete-branch.exit | 1 - .../flat-union-incomplete-branch.json | 9 --------- .../flat-union-incomplete-branch.out | 0 tests/qapi-schema/qapi-schema-test.json | 6 ++++-- tests/qapi-schema/qapi-schema-test.out | 3 ++- 11 files changed, 35 insertions(+), 30 deletions(-) delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.err delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.exit delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.json delete mode 100644 tests/qapi-schema/flat-union-incomplete-branch.out diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index 1366228b2a..88a70e4d45 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -496,9 +496,11 @@ Resulting in these JSON objects: =20 Notice that in a flat union, the discriminator name is controlled by the user, but because it must map to a base member with enum type, the -code generator can ensure that branches exist for all values of the -enum (although the order of the keys need not match the declaration of -the enum). In the resulting generated C data types, a flat union is +code generator ensures that branches match the existing values of the +enum. The order of the keys need not match the declaration of the enum. +The keys need not cover all possible enum values. Omitted enum values +are still valid branches that add no additional members to the data type. +In the resulting generated C data types, a flat union is represented as a struct with the base members included directly, and then a union of structures for each branch of the struct. =20 diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 2462fc0291..4b53f08627 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -779,13 +779,6 @@ def check_union(expr, info): "enum '%s'" % (key, enum_define['enum'])) =20 - # If discriminator is user-defined, ensure all values are covered - if enum_define: - for value in enum_define['data']: - if value not in members.keys(): - raise QAPISemError(info, "Union '%s' data missing '%s' bra= nch" - % (name, value)) - =20 def check_alternate(expr, info): name =3D expr['alternate'] @@ -1357,6 +1350,14 @@ class QAPISchemaObjectTypeVariants(object): self.tag_member =3D seen[c_name(self._tag_name)] assert self._tag_name =3D=3D self.tag_member.name assert isinstance(self.tag_member.type, QAPISchemaEnumType) + if self._tag_name: # flat union + # branches that are not explicitly covered get an empty type + cases =3D set([v.name for v in self.variants]) + for val in self.tag_member.type.values: + if val.name not in cases: + v =3D QAPISchemaObjectTypeVariant(val.name, 'q_empty') + v.set_owner(self.tag_member.owner) + self.variants.append(v) for v in self.variants: v.check(schema) # Union names must match enum values; alternate names are diff --git a/scripts/qapi/types.py b/scripts/qapi/types.py index 64d9c0fb37..a599352e59 100644 --- a/scripts/qapi/types.py +++ b/scripts/qapi/types.py @@ -125,6 +125,8 @@ def gen_variants(variants): c_name=3Dc_name(variants.tag_member.name)) =20 for var in variants.variants: + if var.type.name =3D=3D 'q_empty': + continue ret +=3D mcgen(''' %(c_type)s %(c_name)s; ''', diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index 3c5ea1289e..bdcafb64ee 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -81,15 +81,24 @@ void visit_type_%(c_name)s_members(Visitor *v, %(c_name= )s *obj, Error **errp) c_name=3Dc_name(variants.tag_member.name)) =20 for var in variants.variants: - ret +=3D mcgen(''' + case_str =3D c_enum_const(variants.tag_member.type.name, + var.name, + variants.tag_member.type.prefix) + if var.type.name =3D=3D 'q_empty': + # valid variant and nothing to do + ret +=3D mcgen(''' + case %(case)s: + break; +''', + case=3Dcase_str) + else: + ret +=3D mcgen(''' case %(case)s: visit_type_%(c_type)s_members(v, &obj->u.%(c_name)s, &err); break; ''', - case=3Dc_enum_const(variants.tag_member.type.name, - var.name, - variants.tag_member.type.prefix= ), - c_type=3Dvar.type.c_name(), c_name=3Dc_name(var.n= ame)) + case=3Dcase_str, + c_type=3Dvar.type.c_name(), c_name=3Dc_name(v= ar.name)) =20 ret +=3D mcgen(''' default: diff --git a/tests/Makefile.include b/tests/Makefile.include index 7c48cfe14e..8b45f01d25 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -499,7 +499,6 @@ qapi-schema +=3D flat-union-base-any.json qapi-schema +=3D flat-union-base-union.json qapi-schema +=3D flat-union-clash-member.json qapi-schema +=3D flat-union-empty.json -qapi-schema +=3D flat-union-incomplete-branch.json qapi-schema +=3D flat-union-inline.json qapi-schema +=3D flat-union-int-branch.json qapi-schema +=3D flat-union-invalid-branch-key.json diff --git a/tests/qapi-schema/flat-union-incomplete-branch.err b/tests/qap= i-schema/flat-union-incomplete-branch.err deleted file mode 100644 index e826bf0789..0000000000 --- a/tests/qapi-schema/flat-union-incomplete-branch.err +++ /dev/null @@ -1 +0,0 @@ -tests/qapi-schema/flat-union-incomplete-branch.json:6: Union 'TestUnion' d= ata missing 'value2' branch diff --git a/tests/qapi-schema/flat-union-incomplete-branch.exit b/tests/qa= pi-schema/flat-union-incomplete-branch.exit deleted file mode 100644 index d00491fd7e..0000000000 --- a/tests/qapi-schema/flat-union-incomplete-branch.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests/qapi-schema/flat-union-incomplete-branch.json b/tests/qa= pi-schema/flat-union-incomplete-branch.json deleted file mode 100644 index 25a411bc83..0000000000 --- a/tests/qapi-schema/flat-union-incomplete-branch.json +++ /dev/null @@ -1,9 +0,0 @@ -# we require all branches of the union to be covered -{ 'enum': 'TestEnum', - 'data': [ 'value1', 'value2' ] } -{ 'struct': 'TestTypeA', - 'data': { 'string': 'str' } } -{ 'union': 'TestUnion', - 'base': { 'type': 'TestEnum' }, - 'discriminator': 'type', - 'data': { 'value1': 'TestTypeA' } } diff --git a/tests/qapi-schema/flat-union-incomplete-branch.out b/tests/qap= i-schema/flat-union-incomplete-branch.out deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qa= pi-schema-test.json index 46c7282945..7b59817f04 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -39,7 +39,7 @@ '*enum1': 'EnumOne' } } # intentional forward reference =20 { 'enum': 'EnumOne', - 'data': [ 'value1', 'value2', 'value3' ] } + 'data': [ 'value1', 'value2', 'value3', 'value4' ] } =20 { 'struct': 'UserDefZero', 'data': { 'integer': 'int' } } @@ -76,7 +76,9 @@ 'discriminator': 'enum1', 'data': { 'value1' : 'UserDefA', 'value2' : 'UserDefB', - 'value3' : 'UserDefB' } } + 'value3' : 'UserDefB' + # 'value4' defaults to empty + } } =20 { 'struct': 'UserDefUnionBase', 'base': 'UserDefZero', diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qap= i-schema-test.out index 542a19c407..0dbcdafa3c 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -23,7 +23,7 @@ object UserDefOne base UserDefZero member string: str optional=3DFalse member enum1: EnumOne optional=3DTrue -enum EnumOne ['value1', 'value2', 'value3'] +enum EnumOne ['value1', 'value2', 'value3', 'value4'] object UserDefZero member integer: int optional=3DFalse object UserDefTwoDictDict @@ -52,6 +52,7 @@ object UserDefFlatUnion case value1: UserDefA case value2: UserDefB case value3: UserDefB + case value4: q_empty object UserDefUnionBase base UserDefZero member string: str optional=3DFalse --=20 2.17.1 From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529682012998504.80872625543304; Fri, 22 Jun 2018 08:40:12 -0700 (PDT) Received: from localhost ([::1]:34785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWOAW-0006aX-7z for importer@patchew.org; Fri, 22 Jun 2018 11:40:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000pp-BT for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO35-0000JE-SP for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38364 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO35-0000IV-Mp for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48C9E68802; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07D842026D6C; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C66F41132D6C; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:24 +0200 Message-Id: <20180622153228.23594-7-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 06/10] qapi: remove empty flat union branches and types X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anton Nefedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anton Nefedov Flat unions may now have uncovered branches, so it is possible to get rid of empty types defined for that purpose only. Signed-off-by: Anton Nefedov Reviewed-by: Markus Armbruster Message-Id: <1529311206-76847-3-git-send-email-anton.nefedov@virtuozzo.com> Signed-off-by: Markus Armbruster --- block/qcow2.c | 1 - cpus.c | 2 -- qapi/block-core.json | 52 +++----------------------------------------- qapi/crypto.json | 13 +---------- qapi/misc.json | 46 ++------------------------------------- qapi/net.json | 12 ---------- qapi/ui.json | 19 +--------------- 7 files changed, 7 insertions(+), 138 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 945132f692..a3a3aa2a97 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -4166,7 +4166,6 @@ static ImageInfoSpecific *qcow2_get_specific_info(Blo= ckDriverState *bs) switch (encrypt_info->format) { case Q_CRYPTO_BLOCK_FORMAT_QCOW: qencrypt->format =3D BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_AES; - qencrypt->u.aes =3D encrypt_info->u.qcow; break; case Q_CRYPTO_BLOCK_FORMAT_LUKS: qencrypt->format =3D BLOCKDEV_QCOW2_ENCRYPTION_FORMAT_LUKS; diff --git a/cpus.c b/cpus.c index d1f16296de..19c5d37108 100644 --- a/cpus.c +++ b/cpus.c @@ -2273,8 +2273,6 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp) info->value->target =3D target; if (target =3D=3D SYS_EMU_TARGET_S390X) { cpustate_to_cpuinfo_s390(&info->value->u.s390x, cpu); - } else { - /* do nothing for @CpuInfoOther */ } =20 if (!cur_item) { diff --git a/qapi/block-core.json b/qapi/block-core.json index cc3ede0630..577ce5e999 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -52,8 +52,7 @@ { 'union': 'ImageInfoSpecificQCow2Encryption', 'base': 'ImageInfoSpecificQCow2EncryptionBase', 'discriminator': 'format', - 'data': { 'aes': 'QCryptoBlockInfoQCow', - 'luks': 'QCryptoBlockInfoLUKS' } } + 'data': { 'luks': 'QCryptoBlockInfoLUKS' } } =20 ## # @ImageInfoSpecificQCow2: @@ -2877,16 +2876,6 @@ 'data': { 'type': 'SshHostKeyCheckHashType', 'hash': 'str' }} =20 -## -# @SshHostKeyDummy: -# -# For those union branches that don't need additional fields. -# -# Since: 2.12 -## -{ 'struct': 'SshHostKeyDummy', - 'data': {} } - ## # @SshHostKeyCheck: # @@ -2895,9 +2884,7 @@ { 'union': 'SshHostKeyCheck', 'base': { 'mode': 'SshHostKeyCheckMode' }, 'discriminator': 'mode', - 'data': { 'none': 'SshHostKeyDummy', - 'hash': 'SshHostKeyHash', - 'known_hosts': 'SshHostKeyDummy' } } + 'data': { 'hash': 'SshHostKeyHash' } } =20 ## # @BlockdevOptionsSsh: @@ -4075,15 +4062,6 @@ '*subformat': 'BlockdevVpcSubformat', '*force-size': 'bool' } } =20 -## -# @BlockdevCreateNotSupported: -# -# This is used for all drivers that don't support creating images. -# -# Since: 2.12 -## -{ 'struct': 'BlockdevCreateNotSupported', 'data': {}} - ## # @BlockdevCreateOptions: # @@ -4098,44 +4076,20 @@ 'driver': 'BlockdevDriver' }, 'discriminator': 'driver', 'data': { - 'blkdebug': 'BlockdevCreateNotSupported', - 'blkverify': 'BlockdevCreateNotSupported', - 'bochs': 'BlockdevCreateNotSupported', - 'cloop': 'BlockdevCreateNotSupported', - 'copy-on-read': 'BlockdevCreateNotSupported', - 'dmg': 'BlockdevCreateNotSupported', 'file': 'BlockdevCreateOptionsFile', - 'ftp': 'BlockdevCreateNotSupported', - 'ftps': 'BlockdevCreateNotSupported', 'gluster': 'BlockdevCreateOptionsGluster', - 'host_cdrom': 'BlockdevCreateNotSupported', - 'host_device': 'BlockdevCreateNotSupported', - 'http': 'BlockdevCreateNotSupported', - 'https': 'BlockdevCreateNotSupported', - 'iscsi': 'BlockdevCreateNotSupported', 'luks': 'BlockdevCreateOptionsLUKS', - 'nbd': 'BlockdevCreateNotSupported', 'nfs': 'BlockdevCreateOptionsNfs', - 'null-aio': 'BlockdevCreateNotSupported', - 'null-co': 'BlockdevCreateNotSupported', - 'nvme': 'BlockdevCreateNotSupported', 'parallels': 'BlockdevCreateOptionsParallels', 'qcow': 'BlockdevCreateOptionsQcow', 'qcow2': 'BlockdevCreateOptionsQcow2', 'qed': 'BlockdevCreateOptionsQed', - 'quorum': 'BlockdevCreateNotSupported', - 'raw': 'BlockdevCreateNotSupported', 'rbd': 'BlockdevCreateOptionsRbd', - 'replication': 'BlockdevCreateNotSupported', 'sheepdog': 'BlockdevCreateOptionsSheepdog', 'ssh': 'BlockdevCreateOptionsSsh', - 'throttle': 'BlockdevCreateNotSupported', 'vdi': 'BlockdevCreateOptionsVdi', 'vhdx': 'BlockdevCreateOptionsVhdx', - 'vmdk': 'BlockdevCreateNotSupported', - 'vpc': 'BlockdevCreateOptionsVpc', - 'vvfat': 'BlockdevCreateNotSupported', - 'vxhs': 'BlockdevCreateNotSupported' + 'vpc': 'BlockdevCreateOptionsVpc' } } =20 ## diff --git a/qapi/crypto.json b/qapi/crypto.json index 288bc056ef..a51b434412 100644 --- a/qapi/crypto.json +++ b/qapi/crypto.json @@ -297,16 +297,6 @@ 'uuid': 'str', 'slots': [ 'QCryptoBlockInfoLUKSSlot' ] }} =20 -## -# @QCryptoBlockInfoQCow: -# -# Information about the QCow block encryption options -# -# Since: 2.7 -## -{ 'struct': 'QCryptoBlockInfoQCow', - 'data': { }} - =20 ## # @QCryptoBlockInfo: @@ -318,5 +308,4 @@ { 'union': 'QCryptoBlockInfo', 'base': 'QCryptoBlockInfoBase', 'discriminator': 'format', - 'data': { 'qcow': 'QCryptoBlockInfoQCow', - 'luks': 'QCryptoBlockInfoLUKS' } } + 'data': { 'luks': 'QCryptoBlockInfoLUKS' } } diff --git a/qapi/misc.json b/qapi/misc.json index fa86831ec3..c6bc18a859 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -396,8 +396,7 @@ 'mips': 'CpuInfoMIPS', 'tricore': 'CpuInfoTricore', 's390': 'CpuInfoS390', - 'riscv': 'CpuInfoRISCV', - 'other': 'CpuInfoOther' } } + 'riscv': 'CpuInfoRISCV' } } =20 ## # @CpuInfoX86: @@ -467,16 +466,6 @@ ## { 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } } =20 -## -# @CpuInfoOther: -# -# No additional information is available about the virtual CPU -# -# Since: 2.6 -# -## -{ 'struct': 'CpuInfoOther', 'data': { } } - ## # @CpuS390State: # @@ -578,38 +567,7 @@ 'arch' : 'CpuInfoArch', 'target' : 'SysEmuTarget' }, 'discriminator' : 'target', - 'data' : { 'aarch64' : 'CpuInfoOther', - 'alpha' : 'CpuInfoOther', - 'arm' : 'CpuInfoOther', - 'cris' : 'CpuInfoOther', - 'hppa' : 'CpuInfoOther', - 'i386' : 'CpuInfoOther', - 'lm32' : 'CpuInfoOther', - 'm68k' : 'CpuInfoOther', - 'microblaze' : 'CpuInfoOther', - 'microblazeel' : 'CpuInfoOther', - 'mips' : 'CpuInfoOther', - 'mips64' : 'CpuInfoOther', - 'mips64el' : 'CpuInfoOther', - 'mipsel' : 'CpuInfoOther', - 'moxie' : 'CpuInfoOther', - 'nios2' : 'CpuInfoOther', - 'or1k' : 'CpuInfoOther', - 'ppc' : 'CpuInfoOther', - 'ppc64' : 'CpuInfoOther', - 'ppcemb' : 'CpuInfoOther', - 'riscv32' : 'CpuInfoOther', - 'riscv64' : 'CpuInfoOther', - 's390x' : 'CpuInfoS390', - 'sh4' : 'CpuInfoOther', - 'sh4eb' : 'CpuInfoOther', - 'sparc' : 'CpuInfoOther', - 'sparc64' : 'CpuInfoOther', - 'tricore' : 'CpuInfoOther', - 'unicore32' : 'CpuInfoOther', - 'x86_64' : 'CpuInfoOther', - 'xtensa' : 'CpuInfoOther', - 'xtensaeb' : 'CpuInfoOther' } } + 'data' : { 's390x' : 'CpuInfoS390' } } =20 ## # @query-cpus-fast: diff --git a/qapi/net.json b/qapi/net.json index 6b7d93cb59..c86f351161 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -88,16 +88,6 @@ ## { 'command': 'netdev_del', 'data': {'id': 'str'} } =20 -## -# @NetdevNoneOptions: -# -# Use it alone to have zero network devices. -# -# Since: 1.2 -## -{ 'struct': 'NetdevNoneOptions', - 'data': { } } - ## # @NetLegacyNicOptions: # @@ -477,7 +467,6 @@ 'base': { 'id': 'str', 'type': 'NetClientDriver' }, 'discriminator': 'type', 'data': { - 'none': 'NetdevNoneOptions', 'nic': 'NetLegacyNicOptions', 'user': 'NetdevUserOptions', 'tap': 'NetdevTapOptions', @@ -530,7 +519,6 @@ 'base': { 'type': 'NetLegacyOptionsType' }, 'discriminator': 'type', 'data': { - 'none': 'NetdevNoneOptions', 'nic': 'NetLegacyNicOptions', 'user': 'NetdevUserOptions', 'tap': 'NetdevTapOptions', diff --git a/qapi/ui.json b/qapi/ui.json index fc18a05f0f..f48d2a0afb 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -995,17 +995,6 @@ 'events' : [ 'InputEvent' ] } } =20 =20 -## -# @DisplayNoOpts: -# -# Empty struct for displays without config options. -# -# Since: 2.12 -# -## -{ 'struct' : 'DisplayNoOpts', - 'data' : { } } - ## # @DisplayGTK: # @@ -1068,10 +1057,4 @@ '*window-close' : 'bool', '*gl' : 'DisplayGLMode' }, 'discriminator' : 'type', - 'data' : { 'default' : 'DisplayNoOpts', - 'none' : 'DisplayNoOpts', - 'gtk' : 'DisplayGTK', - 'sdl' : 'DisplayNoOpts', - 'egl-headless' : 'DisplayNoOpts', - 'curses' : 'DisplayNoOpts', - 'cocoa' : 'DisplayNoOpts' } } + 'data' : { 'gtk' : 'DisplayGTK' } } --=20 2.17.1 From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529682354492211.25904703568278; Fri, 22 Jun 2018 08:45:54 -0700 (PDT) Received: from localhost ([::1]:34825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWOG1-0002SQ-P2 for importer@patchew.org; Fri, 22 Jun 2018 11:45:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000pj-9q for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO35-0000J0-OO for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59536 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO35-0000IJ-JG for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2AA8D4023336 for ; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07CE81C71D for ; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C9B8D1132D72; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:25 +0200 Message-Id: <20180622153228.23594-8-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 07/10] qapi: Open files with encoding='utf-8' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Python 2 happily reads UTF-8 files in text mode, but Python 3 requires either UTF-8 locale or an explicit encoding passed to open(). Commit d4e5ec877ca fixed this by setting the en_US.UTF-8 locale. Falls apart when the locale isn't be available. Matthias Maier and Arfrever Frehtes Taifersar Arahesis proposed to use binary mode instead, with manual conversion from bytes to str. Works, but opening with an explicit encoding is simpler, so do that. Since Python 2's open() doesn't support the encoding parameter, we need to suppress it with a version check. Reported-by: Arfrever Frehtes Taifersar Arahesis Reported-by: Matthias Maier Signed-off-by: Markus Armbruster Message-Id: <20180618175958.29073-2-armbru@redhat.com> Reviewed-by: Eduardo Habkost Reviewed-by: Eric Blake --- scripts/qapi/common.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 4b53f08627..8b6708dbf1 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -16,6 +16,7 @@ import errno import os import re import string +import sys from collections import OrderedDict =20 builtin_types =3D { @@ -340,7 +341,10 @@ class QAPISchemaParser(object): return None =20 try: - fobj =3D open(incl_fname, 'r') + if sys.version_info[0] >=3D 3: + fobj =3D open(incl_fname, 'r', encoding=3D'utf-8') + else: + fobj =3D open(incl_fname, 'r') except IOError as e: raise QAPISemError(info, '%s: %s' % (e.strerror, incl_fname)) return QAPISchemaParser(fobj, previously_included, info) @@ -1493,7 +1497,11 @@ class QAPISchemaEvent(QAPISchemaEntity): class QAPISchema(object): def __init__(self, fname): self._fname =3D fname - parser =3D QAPISchemaParser(open(fname, 'r')) + if sys.version_info[0] >=3D 3: + f =3D open(fname, 'r', encoding=3D'utf-8') + else: + f =3D open(fname, 'r') + parser =3D QAPISchemaParser(f) exprs =3D check_exprs(parser.exprs) self.docs =3D parser.docs self._entity_list =3D [] @@ -2007,7 +2015,10 @@ class QAPIGen(object): if e.errno !=3D errno.EEXIST: raise fd =3D os.open(pathname, os.O_RDWR | os.O_CREAT, 0o666) - f =3D os.fdopen(fd, 'r+') + if sys.version_info[0] >=3D 3: + f =3D open(fd, 'r+', encoding=3D'utf-8') + else: + f =3D os.fdopen(fd, 'r+') text =3D (self._top(fname) + self._preamble + self._body + self._bottom(fname)) oldtext =3D f.read(len(text) + 1) --=20 2.17.1 From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529681679053272.90788123043467; Fri, 22 Jun 2018 08:34:39 -0700 (PDT) Received: from localhost ([::1]:34758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO58-0002Ek-CV for importer@patchew.org; Fri, 22 Jun 2018 11:34:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000ph-9F for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO36-0000JZ-0N for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54614 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO35-0000Id-Pw for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6AE64A2C73; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B04C1C722; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id CD4021132D73; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:26 +0200 Message-Id: <20180622153228.23594-9-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 08/10] Revert commit d4e5ec877ca X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthias Maier , Arfrever Frehtes Taifersar Arahesis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matthias Maier This commit removes the PYTHON_UTF8 workaround. The problem with setting LC_ALL=3D LANG=3DC LC_CTYPE=3Den_US.UTF-8 is that the en_US.UTF-8 locale might not be available. In this case setting above locales results in build errors even though another UTF-8 locale was originally set [1]. The only stable way of fixing the encoding problem is by specifying the encoding in Python, like the previous commit does. [1] https://bugs.gentoo.org/657766 Signed-off-by: Arfrever Frehtes Taifersar Arahesis Signed-off-by: Matthias Maier Message-Id: <20180618175958.29073-3-armbru@redhat.com> Reviewed-by: Eduardo Habkost Reviewed-by: Eric Blake [Commit message tweaked] Signed-off-by: Markus Armbruster --- Makefile | 6 ++---- tests/Makefile.include | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index e46f2b625a..7ed9cc4a21 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,6 @@ ifneq ($(wildcard config-host.mak),) all: include config-host.mak =20 -PYTHON_UTF8 =3D LC_ALL=3D LANG=3DC LC_CTYPE=3Den_US.UTF-8 $(PYTHON) - git-submodule-update: =20 .PHONY: git-submodule-update @@ -576,7 +574,7 @@ qga/qapi-generated/qga-qapi-commands.h qga/qapi-generat= ed/qga-qapi-commands.c \ qga/qapi-generated/qga-qapi-doc.texi: \ qga/qapi-generated/qapi-gen-timestamp ; qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(= qapi-py) - $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ -o qga/qapi-generated -p "qga-" $<, \ "GEN","$(@:%-timestamp=3D%)") @>$@ @@ -676,7 +674,7 @@ qapi/qapi-introspect.h qapi/qapi-introspect.c \ qapi/qapi-doc.texi: \ qapi-gen-timestamp ; qapi-gen-timestamp: $(qapi-modules) $(qapi-py) - $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ -o "qapi" -b $<, \ "GEN","$(@:%-timestamp=3D%)") @>$@ diff --git a/tests/Makefile.include b/tests/Makefile.include index 8b45f01d25..e8bb2d8f66 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -678,13 +678,13 @@ tests/test-qapi-events.c tests/test-qapi-events.h \ tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \ tests/test-qapi-gen-timestamp ; tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-t= est.json $(qapi-py) - $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ -o tests -p "test-" $<, \ "GEN","$(@:%-timestamp=3D%)") @>$@ =20 tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-go= od.json $(qapi-py) - $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \ + $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \ -o tests/qapi-schema -p "doc-good-" $<, \ "GEN","$@") @mv tests/qapi-schema/doc-good-qapi-doc.texi $@ @@ -978,7 +978,7 @@ check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-q= uick.sh qemu-img$(EXESUF) .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y)) $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/= %.json $(call quiet-command, PYTHONPATH=3D$(SRC_PATH)/scripts \ - $(PYTHON_UTF8) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \ + $(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \ $^ >$*.test.out 2>$*.test.err; \ echo $$? >$*.test.exit, \ "TEST","$*.out") --=20 2.17.1 From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529682291027571.6523814491396; Fri, 22 Jun 2018 08:44:51 -0700 (PDT) Received: from localhost ([::1]:34817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWOEv-0001nJ-Nz for importer@patchew.org; Fri, 22 Jun 2018 11:44:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000pg-8w for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO35-0000It-Nt for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38362 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO35-0000IN-Ic for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DB8D68801 for ; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 095462027EA0 for ; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D0B191132D75; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:27 +0200 Message-Id: <20180622153228.23594-10-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 09/10] qapi/introspect: Eliminate pointless variable in .visit_end() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit 1a9a507b2e3 "qapi-introspect: Hide type names" added local variable @jsons to improve sorting, but also removed the sorting. It was part of a big series that went to v8, and it made sense until v2 or so... Commit 7d0f982bfbb replaced @jsons by @qlits, preserving the uselessness. Get rid of it. Signed-off-by: Markus Armbruster Message-Id: <20180620124742.16979-1-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau --- scripts/qapi/introspect.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py index 5b6c72c7b2..6ad198ae5b 100644 --- a/scripts/qapi/introspect.py +++ b/scripts/qapi/introspect.py @@ -75,13 +75,10 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolith= icCVisitor): =20 def visit_end(self): # visit the types that are actually used - qlits =3D self._qlits - self._qlits =3D [] for typ in self._used_types: typ.visit(self) # generate C # TODO can generate awfully long lines - qlits.extend(self._qlits) name =3D c_name(self._prefix, protect=3DFalse) + 'qmp_schema_qlit' self._genh.add(mcgen(''' #include "qapi/qmp/qlit.h" @@ -93,7 +90,7 @@ extern const QLitObject %(c_name)s; const QLitObject %(c_name)s =3D %(c_string)s; ''', c_name=3Dc_name(name), - c_string=3Dto_qlit(qlits))) + c_string=3Dto_qlit(self._qlits))) self._schema =3D None self._qlits =3D [] self._used_types =3D [] --=20 2.17.1 From nobody Tue Apr 30 04:53:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529681983896350.41831179834435; Fri, 22 Jun 2018 08:39:43 -0700 (PDT) Received: from localhost ([::1]:34784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWOA1-00069p-4m for importer@patchew.org; Fri, 22 Jun 2018 11:39:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fWO38-0000pu-D2 for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fWO35-0000In-Mf for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59538 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fWO35-0000IQ-IZ for qemu-devel@nongnu.org; Fri, 22 Jun 2018 11:32:31 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 32F38402333A for ; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0FD3111166E8 for ; Fri, 22 Jun 2018 15:32:31 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D42911132D83; Fri, 22 Jun 2018 17:32:28 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 22 Jun 2018 17:32:28 +0200 Message-Id: <20180622153228.23594-11-armbru@redhat.com> In-Reply-To: <20180622153228.23594-1-armbru@redhat.com> References: <20180622153228.23594-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 22 Jun 2018 15:32:31 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 10/10] MAINTAINERS: Update QAPI stanza for commit fb0bc835e56 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Commit fb0bc835e56 moved code from scripts/qapi-*.py to scripts/qapi/*.py. It neglected to update MAINTAINERS: scripts/qapi* matches only the former, not the latter. Do that now. Signed-off-by: Markus Armbruster Message-Id: <20180620124827.17106-1-armbru@redhat.com> Reviewed-by: Eric Blake --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index f222bf8b16..8270863f3f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1623,7 +1623,8 @@ F: tests/test-*-visitor.c F: tests/test-qapi-*.c F: tests/test-qmp-*.c F: tests/test-visitor-serialization.c -F: scripts/qapi* +F: scripts/qapi-gen.py +F: scripts/qapi/* F: docs/devel/qapi* T: git git://repo.or.cz/qemu/armbru.git qapi-next =20 --=20 2.17.1