From nobody Thu May 2 12:34:23 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499875929332603.7124441635264; Wed, 12 Jul 2017 09:12:09 -0700 (PDT) Received: from localhost ([::1]:54524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVKFC-000329-0q for importer@patchew.org; Wed, 12 Jul 2017 12:12:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVKCq-0001Qz-OF for qemu-devel@nongnu.org; Wed, 12 Jul 2017 12:09:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVKCp-0003BX-SW for qemu-devel@nongnu.org; Wed, 12 Jul 2017 12:09:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60334) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVKCp-0003AV-M8 for qemu-devel@nongnu.org; Wed, 12 Jul 2017 12:09:39 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C1F480B22 for ; Wed, 12 Jul 2017 16:09:38 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5887860466; Wed, 12 Jul 2017 16:09:38 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id BDE571138647; Wed, 12 Jul 2017 18:09:36 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8C1F480B22 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8C1F480B22 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 12 Jul 2017 18:09:34 +0200 Message-Id: <1499875776-12688-2-git-send-email-armbru@redhat.com> In-Reply-To: <1499875776-12688-1-git-send-email-armbru@redhat.com> References: <1499875776-12688-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 12 Jul 2017 16:09:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/3] qobject: Catch another straggler for use of qdict_put_str() 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" From: Eric Blake Dan's addition of key-secret improvements in commit 29cf9336 was developed prior to the addition of QDict scalar insertion macros, but merged after the general cleanup in commit 46f5ac20. Patch created mechanically by rerunning: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-file scripts/cocci-macro-file.h --dir . --in-place Signed-off-by: Eric Blake Reviewed-by: Alberto Garcia Message-Id: <20170624181008.25497-2-eblake@redhat.com> Reviewed-by: Max Reitz Reviewed-by: Stefan Hajnoczi Signed-off-by: Markus Armbruster --- qemu-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c index f7ffb79..02900ce 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -355,7 +355,7 @@ static int img_add_key_secrets(void *opaque, QDict *options =3D opaque; =20 if (g_str_has_suffix(name, "key-secret")) { - qdict_put(options, name, qstring_from_str(value)); + qdict_put_str(options, name, value); } =20 return 0; --=20 2.7.5 From nobody Thu May 2 12:34:23 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499875888857422.5526899280196; Wed, 12 Jul 2017 09:11:28 -0700 (PDT) Received: from localhost ([::1]:54522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVKEX-0002Tz-Lj for importer@patchew.org; Wed, 12 Jul 2017 12:11:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVKCq-0001R6-UI for qemu-devel@nongnu.org; Wed, 12 Jul 2017 12:09:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVKCp-0003Be-So for qemu-devel@nongnu.org; Wed, 12 Jul 2017 12:09:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60336) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVKCp-0003AZ-M4 for qemu-devel@nongnu.org; Wed, 12 Jul 2017 12:09:39 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 96D208046E for ; Wed, 12 Jul 2017 16:09:38 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5EB4E60DD7; Wed, 12 Jul 2017 16:09:38 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C071D1138648; Wed, 12 Jul 2017 18:09:36 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 96D208046E Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 96D208046E From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 12 Jul 2017 18:09:35 +0200 Message-Id: <1499875776-12688-3-git-send-email-armbru@redhat.com> In-Reply-To: <1499875776-12688-1-git-send-email-armbru@redhat.com> References: <1499875776-12688-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 12 Jul 2017 16:09:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/3] qobject: Update coccinelle script to catch Q{INC, DEC}REF 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" From: Eric Blake The recent commit b097efc0 used qobject_decref(QOBJECT(E)), even though we already have QDECREF(E) for that purpose. We can update our coccinelle script to catch any future relapses; with that in place, the rest of the patch is generated with: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-file scripts/cocci-macro-file.h --dir . --in-place Signed-off-by: Eric Blake Message-Id: <20170624181008.25497-3-eblake@redhat.com> Reviewed-by: Stefan Hajnoczi Signed-off-by: Markus Armbruster --- monitor.c | 2 +- scripts/coccinelle/qobject.cocci | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/monitor.c b/monitor.c index d8ac20f..61b7982 100644 --- a/monitor.c +++ b/monitor.c @@ -3842,7 +3842,7 @@ static void handle_qmp_command(JSONMessageParser *par= ser, GQueue *tokens) =20 req_json =3D qobject_to_json(req); trace_handle_qmp_command(mon, qstring_get_str(req_json)); - qobject_decref(QOBJECT(req_json)); + QDECREF(req_json); =20 rsp =3D qmp_dispatch(cur_mon->qmp.commands, req); =20 diff --git a/scripts/coccinelle/qobject.cocci b/scripts/coccinelle/qobject.= cocci index c3253de..c518caf 100644 --- a/scripts/coccinelle/qobject.cocci +++ b/scripts/coccinelle/qobject.cocci @@ -3,6 +3,12 @@ expression Obj, Key, E; @@ ( +- qobject_incref(QOBJECT(E)); ++ QINCREF(E); +| +- qobject_decref(QOBJECT(E)); ++ QDECREF(E); +| - qdict_put_obj(Obj, Key, QOBJECT(E)); + qdict_put(Obj, Key, E); | --=20 2.7.5 From nobody Thu May 2 12:34:23 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499876042503887.4688044461842; Wed, 12 Jul 2017 09:14:02 -0700 (PDT) Received: from localhost ([::1]:54535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVKH0-0004es-3q for importer@patchew.org; Wed, 12 Jul 2017 12:13:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVKCu-0001T2-7j for qemu-devel@nongnu.org; Wed, 12 Jul 2017 12:09:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVKCr-0003DR-H6 for qemu-devel@nongnu.org; Wed, 12 Jul 2017 12:09:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59198) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVKCr-0003CV-7o for qemu-devel@nongnu.org; Wed, 12 Jul 2017 12:09:41 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 585EE3345AF for ; Wed, 12 Jul 2017 16:09:40 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C7135D9C8; Wed, 12 Jul 2017 16:09:38 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C4052113864A; Wed, 12 Jul 2017 18:09:36 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 585EE3345AF Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 585EE3345AF From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 12 Jul 2017 18:09:36 +0200 Message-Id: <1499875776-12688-4-git-send-email-armbru@redhat.com> In-Reply-To: <1499875776-12688-1-git-send-email-armbru@redhat.com> References: <1499875776-12688-1-git-send-email-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 12 Jul 2017 16:09:40 +0000 (UTC) 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: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/3] scripts: use build_ prefix for string not piped through cgen() 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 gen_ prefix is awkward. Generated C should go through cgen() exactly once (see commit 1f9a7a1). The common way to get this wrong is passing a foo=3Dgen_foo() keyword argument to mcgen(). I'd like us to adopt a naming convention where gen_ means "something that's been piped through cgen(), and thus must not be passed to cgen() or mcgen()". Requires renaming gen_params(), gen_marshal_proto() and gen_event_send_proto(). Suggested-by: Markus Armbruster Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20170601124143.10915-1-marcandre.lureau@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Markus Armbruster --- scripts/qapi-commands.py | 8 ++++---- scripts/qapi-event.py | 12 ++++++------ scripts/qapi.py | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 1943de4..974d0a4 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -21,7 +21,7 @@ def gen_command_decl(name, arg_type, boxed, ret_type): ''', c_type=3D(ret_type and ret_type.c_type()) or 'void', c_name=3Dc_name(name), - params=3Dgen_params(arg_type, boxed, 'Error **errp')) + params=3Dbuild_params(arg_type, boxed, 'Error **errp')) =20 =20 def gen_call(name, arg_type, boxed, ret_type): @@ -82,7 +82,7 @@ static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_= in, QObject **ret_out, c_type=3Dret_type.c_type(), c_name=3Dret_type.c_name()) =20 =20 -def gen_marshal_proto(name): +def build_marshal_proto(name): return ('void qmp_marshal_%s(QDict *args, QObject **ret, Error **errp)' % c_name(name)) =20 @@ -91,7 +91,7 @@ def gen_marshal_decl(name): return mcgen(''' %(proto)s; ''', - proto=3Dgen_marshal_proto(name)) + proto=3Dbuild_marshal_proto(name)) =20 =20 def gen_marshal(name, arg_type, boxed, ret_type): @@ -103,7 +103,7 @@ def gen_marshal(name, arg_type, boxed, ret_type): { Error *err =3D NULL; ''', - proto=3Dgen_marshal_proto(name)) + proto=3Dbuild_marshal_proto(name)) =20 if ret_type: ret +=3D mcgen(''' diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py index 0485e39..bcbef10 100644 --- a/scripts/qapi-event.py +++ b/scripts/qapi-event.py @@ -14,10 +14,10 @@ from qapi import * =20 =20 -def gen_event_send_proto(name, arg_type, boxed): +def build_event_send_proto(name, arg_type, boxed): return 'void qapi_event_send_%(c_name)s(%(param)s)' % { 'c_name': c_name(name.lower()), - 'param': gen_params(arg_type, boxed, 'Error **errp')} + 'param': build_params(arg_type, boxed, 'Error **errp')} =20 =20 def gen_event_send_decl(name, arg_type, boxed): @@ -25,10 +25,10 @@ def gen_event_send_decl(name, arg_type, boxed): =20 %(proto)s; ''', - proto=3Dgen_event_send_proto(name, arg_type, boxed)) + proto=3Dbuild_event_send_proto(name, arg_type, boxed)) =20 =20 -# Declare and initialize an object 'qapi' using parameters from gen_params= () +# Declare and initialize an object 'qapi' using parameters from build_para= ms() def gen_param_var(typ): assert not typ.variants ret =3D mcgen(''' @@ -42,7 +42,7 @@ def gen_param_var(typ): if memb.optional: ret +=3D 'has_' + c_name(memb.name) + sep if memb.type.name =3D=3D 'str': - # Cast away const added in gen_params() + # Cast away const added in build_params() ret +=3D '(char *)' ret +=3D c_name(memb.name) ret +=3D mcgen(''' @@ -72,7 +72,7 @@ def gen_event_send(name, arg_type, boxed): Error *err =3D NULL; QMPEventFuncEmit emit; ''', - proto=3Dgen_event_send_proto(name, arg_type, boxed)) + proto=3Dbuild_event_send_proto(name, arg_type, boxed)) =20 if arg_type and not arg_type.is_empty(): ret +=3D mcgen(''' diff --git a/scripts/qapi.py b/scripts/qapi.py index 0de809f..84e2eb4 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1897,7 +1897,7 @@ extern const char *const %(c_name)s_lookup[]; return ret =20 =20 -def gen_params(arg_type, boxed, extra): +def build_params(arg_type, boxed, extra): if not arg_type: assert not boxed return extra --=20 2.7.5