From patchwork Tue Mar 12 14:13:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779743 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043962wrt; Tue, 12 Mar 2024 07:16:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUMJKKigt/XC86Os6UO2+dBkvM3vT56EeAu1XuD18sMnfvl4jxlcZyu+xBUiBoCzohcW/4Zmlq0VA/bRFf7wE+E X-Google-Smtp-Source: AGHT+IGw+EtI1qarLYAnYN+2jsrAK31zjLUsjEE/XBWxWCUjXC5AFSdwQr+BIW+I7SUFWotiYi4t X-Received: by 2002:ae9:f809:0:b0:788:7208:ea80 with SMTP id x9-20020ae9f809000000b007887208ea80mr4753170qkh.37.1710252999418; Tue, 12 Mar 2024 07:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252999; cv=none; d=google.com; s=arc-20160816; b=ihMIOCboBGGsFUKfKI66oa65aH0Ty/epZRfjBgR78G1D/3/sB+DSiTA3mQ7/L7legh k+Cg+MKBLIGvsxlpJmPJdTr1T9TUcS6XdD4Ui3HpoxHlN6/0jLQi/lG3aK5jqDCsKfSr Bp1ZUaUFqvMw+J6IiGzu04cjLtXBzkZCqNwIKlyQnmcdS5iaJQKilfuL84OLYRhk64gG MUnuPOG0XfBy5QwM8C2cyaJG1MRLtomgPF8N5sSwzroAywO3yKoTHOFyKAYfFH44UxJ6 tsY32Q9j5K4mYftRYp8uh0zSliZgdblWYu4KRm3uQupmpU5Q9jWwafVS36dNJLJEq6Fj 6Irw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EfKEUanZYxUIJ2dDav+OV0GW1QHkTACV4MMey+9QxoQ=; fh=7qHyDQX72txt1MtNSYHZ/YFp7+2Ya6YuqP0Hd6vdblA=; b=KonVnDwT7ZX8ngGpPH6a89XX6U0W8/1KYfRcDQNdbWG/Xhe8jSR9znIxsj5RSGgKwI QvlYOK5G0i7VV401mi8q6rgcU01ZtG303SB0N4/8lXPges2FCe26GiR1RhudtZNZlaAF zqAI6wetbWamFQXI/UnOAsLp/7cOwcY1qQwjBoRlEGzcFQ3P1sugIPXRgaQZ6/KRmNu2 746RUmVoejpkpYRjNFvBnQ4REdqARe3xISmegwZMui54gt1M71IcdcvAGTgy5q7lp1jD UKqp+Y7NIMKWZpI6IT6fRjWpdz7Bz/jZ+7WFcNRi2K7pTjw/MDCEHJchDn4BFOS9A/qA 0MvA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KBZcPeqb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f5-20020ae9ea05000000b00788748a69ddsi2832084qkg.87.2024.03.12.07.16.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:16:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KBZcPeqb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2tj-0000rz-FJ; Tue, 12 Mar 2024 10:14:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t9-0000Yt-QH for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:13:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t4-00029j-4s for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:13:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EfKEUanZYxUIJ2dDav+OV0GW1QHkTACV4MMey+9QxoQ=; b=KBZcPeqbQgKxS9NLP5LWZWL13dTrXrEEtdefiIru9qJh+z25RXXD3pptrujE32svn7aOme 6PdSFv5D1E73BDb08h8c6WFB0izSC3kqgvPjVX96OyBn9oZqHqkvX1nKwQJke6cHD6Wss6 J+rtUXrAAFnLHnIuk4nsB/PBcuB0m8I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-313-xZ7AfJZ3MSSzQ_lmlnR6Qw-1; Tue, 12 Mar 2024 10:13:44 -0400 X-MC-Unique: xZ7AfJZ3MSSzQ_lmlnR6Qw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 723BC8A1931; Tue, 12 Mar 2024 14:13:44 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4A65C40C6DB7; Tue, 12 Mar 2024 14:13:44 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 2BC3721E691E; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH 02/10] qapi: Inline and remove QERR_BUS_NO_HOTPLUG definition Date: Tue, 12 Mar 2024 15:13:35 +0100 Message-ID: <20240312141343.3168265-3-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using sed, and manual cleanup. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- include/qapi/qmp/qerror.h | 3 --- hw/ppc/spapr_pci.c | 5 ++--- system/qdev-monitor.c | 8 +++++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index 0c2689cf8a..06a1d2248e 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -17,9 +17,6 @@ * add new ones! */ -#define QERR_BUS_NO_HOTPLUG \ - "Bus '%s' does not support hotplugging" - #define QERR_DEVICE_HAS_NO_MEDIUM \ "Device '%s' has no medium" diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 25e0295d6f..72cfba419a 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -39,7 +39,6 @@ #include "trace.h" #include "qemu/error-report.h" #include "qemu/module.h" -#include "qapi/qmp/qerror.h" #include "hw/ppc/fdt.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_bus.h" @@ -1554,7 +1553,7 @@ static void spapr_pci_pre_plug(HotplugHandler *plug_handler, * we need to let them know it's not enabled */ if (plugged_dev->hotplugged) { - error_setg(errp, QERR_BUS_NO_HOTPLUG, + error_setg(errp, "Bus '%s' does not support hotplugging", phb->parent_obj.bus->qbus.name); return; } @@ -1675,7 +1674,7 @@ static void spapr_pci_unplug_request(HotplugHandler *plug_handler, SpaprDrc *drc = drc_from_dev(phb, pdev); if (!phb->dr_enabled) { - error_setg(errp, QERR_BUS_NO_HOTPLUG, + error_setg(errp, "Bus '%s' does not support hotplugging", phb->parent_obj.bus->qbus.name); return; } diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 09e07cab9b..842c142c79 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -661,7 +661,8 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts, if (qdev_should_hide_device(opts, from_json, errp)) { if (bus && !qbus_is_hotpluggable(bus)) { - error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); + error_setg(errp, "Bus '%s' does not support hotplugging", + bus->name); } return NULL; } else if (*errp) { @@ -669,7 +670,7 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts, } if (phase_check(PHASE_MACHINE_READY) && bus && !qbus_is_hotpluggable(bus)) { - error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); + error_setg(errp, "Bus '%s' does not support hotplugging", bus->name); return NULL; } @@ -911,7 +912,8 @@ void qdev_unplug(DeviceState *dev, Error **errp) } if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) { - error_setg(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name); + error_setg(errp, "Bus '%s' does not support hotplugging", + dev->parent_bus->name); return; } From patchwork Tue Mar 12 14:13:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779737 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043486wrt; Tue, 12 Mar 2024 07:15:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWBCs2VPv8KlVryG6296Kjvp9QuZP1qMe7K06un/LkJGdF0MPVxrP06zcqMAIMMI1KhMxquaP/pPR7z0MNr9WGZ X-Google-Smtp-Source: AGHT+IF8s+uCeaV5GMXlKbhF1CT9JanR7uhNYjytwJB8GhYHmySk+/STx2x5EF+0SrGnBs+mJJrb X-Received: by 2002:ae9:e203:0:b0:788:41fe:37c with SMTP id c3-20020ae9e203000000b0078841fe037cmr2121625qkc.42.1710252945839; Tue, 12 Mar 2024 07:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252945; cv=none; d=google.com; s=arc-20160816; b=Se/T56IdnKKqo10bdCgMZakGqNo9k8jNdYcAXERNFR8Ff+5bLFWnsT4OdS1+sLDANl 1Xv3/e9V1Vpf3DwfZ0rPMHQkGh4lQGr8dvHYBSO7jDWZ2SsEuKxzt3LEHDyxH7/oVq3V Oxdphq3MPp9CcUVHk6mCwyNQqTu46kK10zQABW5UBxnVaT3SZu+IIhHMbrSmAMPIXK1C zdmwayFciJMFoNWDV5yYBV8g2jr3nSRsaHswqfqgTqYIjU0/iG7HAabxaYN5hUfnc6yS hAeeo+1PSwt2PK1z6Uxu5J24/axiFIBtD48MLiD8A/Yh4Q55MgwwBaq3SgtCF+87jMJa amrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a1BAftT8z48Vt5DWdMlzg8ja8eBDK/wd67jBTXaOBwk=; fh=i4ioI8lUmTcl2WtN/8i487arEjQwzVsrUlEe7C7mKeY=; b=YhIs/iGTkfwuIxYC59XEnd10wasYi0aKVlMJ5SLCXh5DKXtiKDLYVwmJEP3O3DCtdb mYLwKLHOuXJRblWl79L63btaPb0GEnqj5yUfxc6ymhR+xcdCeHveM5b1LqCFkhGOzkpI b9kUJZUiez1G0myfLnX844yTOnjvgbOTAKeEHRYiOKN7lRszfnDp0nRFqOhaL1+VhPe2 Le3efNy9/tTElDhXAzNC19QTehH1F5t/rBK7C3VH8OeHNrJwwH4eq2iIL50+grIVPhwN 2YUd0tctoZDoIjyNv6JuSFPgk/Sbc+0JUeSSeHkXQ1irvScrv0hjNpHMfjGKAOEBCfjz 2RQQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Pfa/hsyi"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bs10-20020a05620a470a00b00785d8901d7esi8395154qkb.246.2024.03.12.07.15.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Pfa/hsyi"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2uM-0002TK-D0; Tue, 12 Mar 2024 10:15:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2tL-0000fJ-9G for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t8-0002Cd-4m for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252833; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a1BAftT8z48Vt5DWdMlzg8ja8eBDK/wd67jBTXaOBwk=; b=Pfa/hsyiv/7zJ3ev5U4xYMF+GuWn5Zbh6qzOo3fA0ZVR5FbXXbSF6FMhxvQPlEFFTwXVco sE3rhe0IrT1Lu34XoLZLM33dLxSEWkqArDCfKk4rvmqlNnJfLB4Bbn9I81ZspT9V1RVt6T Wyas0QrXwyaTaZ35WrTOv7yphqlnSa0= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-321-tCub1hvOM8WywVSZL0cnXA-1; Tue, 12 Mar 2024 10:13:46 -0400 X-MC-Unique: tCub1hvOM8WywVSZL0cnXA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 70C0B1C54038; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C5AD40C6CB1; Tue, 12 Mar 2024 14:13:44 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 2E8DB21E692E; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org Subject: [PATCH 03/10] qapi: Inline and remove QERR_DEVICE_HAS_NO_MEDIUM definition Date: Tue, 12 Mar 2024 15:13:36 +0100 Message-ID: <20240312141343.3168265-4-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using sed, and manual cleanup. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- include/qapi/qmp/qerror.h | 3 --- block/snapshot.c | 7 ++++--- blockdev.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index 06a1d2248e..daa889809b 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -17,9 +17,6 @@ * add new ones! */ -#define QERR_DEVICE_HAS_NO_MEDIUM \ - "Device '%s' has no medium" - #define QERR_DEVICE_NO_HOTPLUG \ "Device '%s' does not support hotplugging" diff --git a/block/snapshot.c b/block/snapshot.c index 8694fc0a3e..e2c18d3f8f 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -28,7 +28,6 @@ #include "block/qdict.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" -#include "qapi/qmp/qerror.h" #include "qapi/qmp/qstring.h" #include "qemu/option.h" #include "sysemu/block-backend.h" @@ -359,7 +358,8 @@ int bdrv_snapshot_delete(BlockDriverState *bs, GLOBAL_STATE_CODE(); if (!drv) { - error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs)); + error_setg(errp, "Device '%s' has no medium", + bdrv_get_device_name(bs)); return -ENOMEDIUM; } if (!snapshot_id && !name) { @@ -437,7 +437,8 @@ int bdrv_snapshot_load_tmp(BlockDriverState *bs, GRAPH_RDLOCK_GUARD_MAINLOOP(); if (!drv) { - error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs)); + error_setg(errp, "Device '%s' has no medium", + bdrv_get_device_name(bs)); return -ENOMEDIUM; } if (!snapshot_id && !name) { diff --git a/blockdev.c b/blockdev.c index d8fb3399f5..bd408e3e75 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1395,7 +1395,7 @@ static void external_snapshot_action(TransactionAction *action, bdrv_drained_begin(state->old_bs); if (!bdrv_is_inserted(state->old_bs)) { - error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); + error_setg(errp, "Device '%s' has no medium", device); return; } From patchwork Tue Mar 12 14:13:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779736 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043251wrt; Tue, 12 Mar 2024 07:15:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVl9v/7pEXyi7+t+k1NN2Tl3XCJqT0wMgfSHbkeGwUtAdTfyvXlHAv44hjL81x4wwj1EEe1qsIPkZx8n7OKu2i9 X-Google-Smtp-Source: AGHT+IGxI60pJpldlvYgXS75Rk/5w1MFlKXYQRlTzAUsKCsvFW2NH2Ij58ztUJmAD4ES+W3NcWXi X-Received: by 2002:a0c:f0d2:0:b0:690:77b9:a415 with SMTP id d18-20020a0cf0d2000000b0069077b9a415mr10704927qvl.50.1710252915127; Tue, 12 Mar 2024 07:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252915; cv=none; d=google.com; s=arc-20160816; b=jV7rUmcurBplIeWUGHvoJ9dkudOF9ehlK5Mqq2tU0bhNIF/xnZDA0MFMIfQberGRIz ZaWrpEBkKiLVr/hSRBTT1BB/9CYAYFdwa6O3viSWd4aIZgcKNofI0DGbYCIo1DhP1FZ+ nzqMV4GvLZ6A0axARkQCuDZQT0XG1/518X8iViii5yhVd4mDrl+KiIcfx+N2GEG6w6Gs f8vs/arTucj9cqQhaPx3R9Cfm2jX33jEoZ/J80mPfTNPdjL6DmGJ8EWMw4ZeDsGNekbk RCWmdofm93ifeUPITQdCHt8pac8yIwPfilOP0QfiHT4lnWVTLnMsZZBSYhBNYeHXpXF0 2cJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pOLH+strOaKKcjBOz7lvead/NQ2pWb64J4IWeJN+W4I=; fh=i4ioI8lUmTcl2WtN/8i487arEjQwzVsrUlEe7C7mKeY=; b=JPYDYB5Knhh7H0HQX0FXs+RaLK85rV0BvjjtulzaIipmlogx/LEA+jO80rraoTxp0u B1HdlARmGCu+OeFJF89A+rrbFKOSm+YAODcSWstX0rl20FWtihb8TvNpjlNKALrMItDS N+z0amV94AUl/3yGAA2Nk0SM50lOVjoicE0yIep3c6OtQhvKs7fSJ6+fIxvjKakte1cV MxUAWXb+ZT3HOw4s2qfb8Km+6anaeu3njyy03vOnIYLlgXp5BlTuyhdjfWpBlHVL2O5v q6Ku1EaqvknZjBssIJOGNeYGISlCT2s1V5BWDWYpkn9lJe8TjPTl9oF2vpzBJBTUC5oy 13OA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NNZN2TFE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ke12-20020a056214300c00b0068f6db785fcsi7523620qvb.468.2024.03.12.07.15.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:15:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NNZN2TFE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2tI-0000Zr-QU; Tue, 12 Mar 2024 10:14:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t8-0000WV-Gf for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:13:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t4-00029F-1l for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:13:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pOLH+strOaKKcjBOz7lvead/NQ2pWb64J4IWeJN+W4I=; b=NNZN2TFETXiLTkcigiV6bHiPMZ6XCfih7lfzUbiIBt6MoxDaXkNWu6ZiZ/o9nRBnjBoRvG dA/LNCGDybUMsfvRnI/sR5To9k1pep0Mw5DXtsAbVO4B65vNcJo+O7mdyHJ67gzC7b82c+ 7mTEwSi1HZXrbGV2kjZQgR5bJcCsqg4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-277-anzAephTMNyZJw6A3o3L9w-1; Tue, 12 Mar 2024 10:13:45 -0400 X-MC-Unique: anzAephTMNyZJw6A3o3L9w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 73B6D100DEBD; Tue, 12 Mar 2024 14:13:44 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C6371C05E1C; Tue, 12 Mar 2024 14:13:44 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3188421E6939; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org Subject: [PATCH 04/10] qapi: Inline and remove QERR_DEVICE_NO_HOTPLUG definition Date: Tue, 12 Mar 2024 15:13:37 +0100 Message-ID: <20240312141343.3168265-5-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using sed, and manual cleanup. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- include/qapi/qmp/qerror.h | 3 --- hw/core/qdev.c | 4 ++-- system/qdev-monitor.c | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index daa889809b..e93211085a 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -17,9 +17,6 @@ * add new ones! */ -#define QERR_DEVICE_NO_HOTPLUG \ - "Device '%s' does not support hotplugging" - #define QERR_INVALID_PARAMETER \ "Invalid parameter '%s'" diff --git a/hw/core/qdev.c b/hw/core/qdev.c index c68d0f7c51..00efaf1bd1 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -29,7 +29,6 @@ #include "qapi/error.h" #include "qapi/qapi-events-qdev.h" #include "qapi/qmp/qdict.h" -#include "qapi/qmp/qerror.h" #include "qapi/visitor.h" #include "qemu/error-report.h" #include "qemu/option.h" @@ -479,7 +478,8 @@ static void device_set_realized(Object *obj, bool value, Error **errp) static int unattached_count; if (dev->hotplugged && !dc->hotpluggable) { - error_setg(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj)); + error_setg(errp, "Device '%s' does not support hotplugging", + object_get_typename(obj)); return; } diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 842c142c79..e2eea7d96e 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -918,7 +918,7 @@ void qdev_unplug(DeviceState *dev, Error **errp) } if (!dc->hotpluggable) { - error_setg(errp, QERR_DEVICE_NO_HOTPLUG, + error_setg(errp, "Device '%s' does not support hotplugging", object_get_typename(OBJECT(dev))); return; } From patchwork Tue Mar 12 14:13:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779742 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043955wrt; Tue, 12 Mar 2024 07:16:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1YAfnu77KEwI/CMK2zMNsCTjqc9u1Une/0OpOAHoF56JAkA4O7YCHdw4o4t82fIrVFT8e8dHZoOa8r8LrLYl/ X-Google-Smtp-Source: AGHT+IGsDFTSCyjKmSBmqyHdRrEItCXrSo18ftqFaLaEHQJuz/P8eMMRTeLbHMeLXjn8NTF87qGk X-Received: by 2002:ae9:f807:0:b0:788:766f:4d70 with SMTP id x7-20020ae9f807000000b00788766f4d70mr5378043qkh.30.1710252998864; Tue, 12 Mar 2024 07:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252998; cv=none; d=google.com; s=arc-20160816; b=qHhZdEyqNW3uUAEs3StFhb6Wvr20pNy8HQyZnrrrgGN6dJPeRXc42qkOLxPUynW6Qz +lFYJJduoD9ssxR3OsP5TTQXo6GIGSim9lL52C0qCQJTjGcG1WJn944O+cyQmmiAkfRS 2Xz5+QBoJr8Y4nBCr0xySCyTyxFIjBg9Mu7dE8dUl4wKiXF43aEtJuABQhCvlWuhXmUg Akqfv6CGPVI1zeRK0qCAlK+E3GrtgHDbfaeOa69KwL/ck8Sf66N/iKJUwSrWTA53Iro1 jwWjyoR3mPPGEvz6EQZHOKpO2MbQ0zgL42rOgb27Zlq9Vp03DQmtFzitlUw1qjedT9tW /v7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FifKAvUbL64Bg1vJWQk8QWQL3zgV+zzzfE0KS8FRLG8=; fh=i4ioI8lUmTcl2WtN/8i487arEjQwzVsrUlEe7C7mKeY=; b=TNzTfCiYUWMk7oOtrtmPfH5lHI3NFY1/A5QRFw1yu+DqOPYxQ3XrgewOcGyIJnLyuW /+CA9sg0kwK/lKrpVAhyGl5wQU5i5hxLnDQl9qpVsvmKSqkNDeeiOijePUyvCbJjiGKB TWyC2/0JSmWQg+5lw32Fc/XmZBmj8Te82JsdAow8MWGdrK/suU+YwgSs19I1jl3YDlK4 eQWUoRa5AnrIa8jfyATCklwUxT0fOPq8JOutF//0lD9f66+0V88VbxQwVA62FtYrtape ILbyTQKqh7BJ0x+Hx8GEcWYNoeFlaHYBpcb5VxqpiO8qH0XIcqjK10brPo0NuXBkrO6M 9IfA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cw6ZPKSb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i17-20020a05620a249100b00788311d76c9si8328625qkn.499.2024.03.12.07.16.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:16:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Cw6ZPKSb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2tj-0000s0-Di; Tue, 12 Mar 2024 10:14:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2tH-0000cu-W3 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t5-0002Bb-Ok for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FifKAvUbL64Bg1vJWQk8QWQL3zgV+zzzfE0KS8FRLG8=; b=Cw6ZPKSbGU2po7HCy/KuwUP4qmYIKZvjh27WKHsZYv4jnGV6iHOYXD6yFF9GEq5x7tnMWo NBQrwGhrCs81fCD+NFIU44ixy+UxZkPd/q/Iw5+oGIu47bGTSEI5y72ReJ5VSYqnHQbjXP RiVPw1ArUEVq4yTTcX/ylkBt8z2/Pxk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-70-y9WNXmlgMti35wH4wkYUvw-1; Tue, 12 Mar 2024 10:13:46 -0400 X-MC-Unique: y9WNXmlgMti35wH4wkYUvw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BF37A3C0C898; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A3B340C6DAE; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3493221E6889; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org Subject: [PATCH 05/10] qapi: Inline and remove QERR_INVALID_PARAMETER definition Date: Tue, 12 Mar 2024 15:13:38 +0100 Message-ID: <20240312141343.3168265-6-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using: $ sed -i -e "s/QERR_INVALID_PARAMETER,/\"Invalid parameter '%s'\",/" \ $(git grep -lw QERR_INVALID_PARAMETER) Manually simplify qemu_opts_create(), and remove the macro definition in include/qapi/qmp/qerror.h. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- include/qapi/qmp/qerror.h | 3 --- qapi/opts-visitor.c | 2 +- util/qemu-option.c | 10 +++++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index e93211085a..63ab775dc5 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -17,9 +17,6 @@ * add new ones! */ -#define QERR_INVALID_PARAMETER \ - "Invalid parameter '%s'" - #define QERR_INVALID_PARAMETER_TYPE \ "Invalid parameter type for '%s', expected: %s" diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index 8f1efab8b9..3d1a28b419 100644 --- a/qapi/opts-visitor.c +++ b/qapi/opts-visitor.c @@ -184,7 +184,7 @@ opts_check_struct(Visitor *v, Error **errp) const QemuOpt *first; first = g_queue_peek_head(any); - error_setg(errp, QERR_INVALID_PARAMETER, first->name); + error_setg(errp, "Invalid parameter '%s'", first->name); return false; } return true; diff --git a/util/qemu-option.c b/util/qemu-option.c index eedd08929b..201f7a87f3 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -498,7 +498,7 @@ static bool opt_validate(QemuOpt *opt, Error **errp) desc = find_desc_by_name(list->desc, opt->name); if (!desc && !opts_accepts_any(list)) { - error_setg(errp, QERR_INVALID_PARAMETER, opt->name); + error_setg(errp, "Invalid parameter '%s'", opt->name); return false; } @@ -531,7 +531,7 @@ bool qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val, desc = find_desc_by_name(list->desc, name); if (!desc && !opts_accepts_any(list)) { - error_setg(errp, QERR_INVALID_PARAMETER, name); + error_setg(errp, "Invalid parameter '%s'", name); return false; } @@ -554,7 +554,7 @@ bool qemu_opt_set_number(QemuOpts *opts, const char *name, int64_t val, desc = find_desc_by_name(list->desc, name); if (!desc && !opts_accepts_any(list)) { - error_setg(errp, QERR_INVALID_PARAMETER, name); + error_setg(errp, "Invalid parameter '%s'", name); return false; } @@ -612,7 +612,7 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, if (list->merge_lists) { if (id) { - error_setg(errp, QERR_INVALID_PARAMETER, "id"); + error_setg(errp, "Invalid parameter 'id'"); return NULL; } opts = qemu_opts_find(list, NULL); @@ -1103,7 +1103,7 @@ bool qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp) QTAILQ_FOREACH(opt, &opts->head, next) { opt->desc = find_desc_by_name(desc, opt->name); if (!opt->desc) { - error_setg(errp, QERR_INVALID_PARAMETER, opt->name); + error_setg(errp, "Invalid parameter '%s'", opt->name); return false; } From patchwork Tue Mar 12 14:13:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779740 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043878wrt; Tue, 12 Mar 2024 07:16:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVhPU3t54RwNBPtAh3mDojqhy2ktIO3QrcNWvuvo4GBYKhLdlM4tlhlm1YDBmHYqEZVDuMGArGoyk2o+oTBR1c4 X-Google-Smtp-Source: AGHT+IEn/EDPXks1RjKt6E8DM8b63g9HmMJPf7xvFbHFk70R6LyZ3G1CJCBkVa9NS5n0Fsuievri X-Received: by 2002:a05:6808:a0b:b0:3c2:261c:7829 with SMTP id n11-20020a0568080a0b00b003c2261c7829mr3145948oij.52.1710252990592; Tue, 12 Mar 2024 07:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252990; cv=none; d=google.com; s=arc-20160816; b=i1hw/AZ4r1nLCxVRcnb533PASrUQwJsawe87Du0b+R2LpgvqN3/CwyK/tlfRceDING EjmnxGDEvYGcJqhIwBzEMFsTZz1LRc4Q0LxYNZ1fM28uL38GQHykrYqKKPkMVknwsw3s srGMNc9PMZ76a/MNaRU3msrkk5SsCg9XBffDN3CS5JyGHGOBGNva36qpaJu8UdZqh4LU 9N4+UB92aHlIrbqmDD6j03AqAQ429BPG1Db5yX9FOOKWAboyq8m/VBp67rrHhJ+Bl2Cv Eopd1Rz4uj8L9LuVzhhFrcAy2ru1O3U+jVfyOkT1ULn+fm3sOSGibEjJlQgVt80OMRO/ ygpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9OM00T1Pe8+CaWeDlAtTihcYEFsDDW+UhOBfAxqqzog=; fh=i4ioI8lUmTcl2WtN/8i487arEjQwzVsrUlEe7C7mKeY=; b=B5In+P3oQzGGtFjuljCl3V9qu+QU1XhUvZC4S4FgR0aP4K/6RfIBcRHJR7cCY+cxFk xKYyg5vKeEhj8z7c06/GEf1rq1AHrEwcjBvKb/pjKgszfsCRAbTgiwlqU68/N5l4YLX+ aRj0L0KijoFWAKVZTdNChG2SGy3inpGjGPgfpL32NrRVN2p/2QVZYSx4s/Hk9ZJThU6M ezxu1uK9efbzNYBAZkRRlNk+t+YQl3Sl0t2OVZmMDjAsW9TktJkeALcpsenu3zUxnxyi 2Bzg7pS6c0FcsWmRkAlxXjsAH6ohVocnBgAvLTXieJ3znOfqLGgfr0Gs2IWP0lB4mcDu FQQA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fJjP7bFH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o13-20020ac87c4d000000b0042e6a06d159si7519861qtv.715.2024.03.12.07.16.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:16:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fJjP7bFH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2tA-0000Z5-1C; Tue, 12 Mar 2024 10:13:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t7-0000VN-JM for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:13:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t3-00029u-Sb for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:13:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9OM00T1Pe8+CaWeDlAtTihcYEFsDDW+UhOBfAxqqzog=; b=fJjP7bFHas0AtQrkHx5UX51kQZgN1eWT+Uxi+aVVbqK7XEj4wOjrmjPrWW4RWOAYZZSeMr A+U93oAcrX/X4p8tTEkgWQfrN0zhgLDMTNknUQcl2s3tfmqLY0IO/Z5fDOOTqgZ6TEKNZJ hGewUBSm/xOFYCsFYbkFgxtg7MXJmKk= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-70-x9u-_q8AOoq7Ym154Pz92A-1; Tue, 12 Mar 2024 10:13:46 -0400 X-MC-Unique: x9u-_q8AOoq7Ym154Pz92A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DCB8A3814EB3; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A9351C060D0; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3802B21E688F; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org Subject: [PATCH 06/10] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value) Date: Tue, 12 Mar 2024 15:13:39 +0100 Message-ID: <20240312141343.3168265-7-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using the following coccinelle semantic patch: @match@ expression errp; expression param; constant value; @@ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value); @script:python strformat depends on match@ value << match.value; fixedfmt; // new var @@ fixedfmt = f'"Invalid parameter type for \'%s\', expected: {value[1:-1]}"' coccinelle.fixedfmt = cocci.make_ident(fixedfmt) @replace@ expression match.errp; expression match.param; constant match.value; identifier strformat.fixedfmt; @@ - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value); + error_setg(errp, fixedfmt, param); Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- qapi/qobject-input-visitor.c | 32 ++++++++++++++++---------------- qapi/string-input-visitor.c | 8 ++++---- qom/object.c | 12 ++++++++---- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c index 3e8aca6b15..f110a804b2 100644 --- a/qapi/qobject-input-visitor.c +++ b/qapi/qobject-input-visitor.c @@ -288,8 +288,8 @@ static bool qobject_input_start_struct(Visitor *v, const char *name, void **obj, return false; } if (qobject_type(qobj) != QTYPE_QDICT) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, - full_name(qiv, name), "object"); + error_setg(errp, "Invalid parameter type for '%s', expected: object", + full_name(qiv, name)); return false; } @@ -326,8 +326,8 @@ static bool qobject_input_start_list(Visitor *v, const char *name, return false; } if (qobject_type(qobj) != QTYPE_QLIST) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, - full_name(qiv, name), "array"); + error_setg(errp, "Invalid parameter type for '%s', expected: array", + full_name(qiv, name)); return false; } @@ -405,8 +405,8 @@ static bool qobject_input_type_int64(Visitor *v, const char *name, int64_t *obj, } qnum = qobject_to(QNum, qobj); if (!qnum || !qnum_get_try_int(qnum, obj)) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, - full_name(qiv, name), "integer"); + error_setg(errp, "Invalid parameter type for '%s', expected: integer", + full_name(qiv, name)); return false; } return true; @@ -494,8 +494,8 @@ static bool qobject_input_type_bool(Visitor *v, const char *name, bool *obj, } qbool = qobject_to(QBool, qobj); if (!qbool) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, - full_name(qiv, name), "boolean"); + error_setg(errp, "Invalid parameter type for '%s', expected: boolean", + full_name(qiv, name)); return false; } @@ -534,8 +534,8 @@ static bool qobject_input_type_str(Visitor *v, const char *name, char **obj, } qstr = qobject_to(QString, qobj); if (!qstr) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, - full_name(qiv, name), "string"); + error_setg(errp, "Invalid parameter type for '%s', expected: string", + full_name(qiv, name)); return false; } @@ -565,8 +565,8 @@ static bool qobject_input_type_number(Visitor *v, const char *name, double *obj, } qnum = qobject_to(QNum, qobj); if (!qnum) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, - full_name(qiv, name), "number"); + error_setg(errp, "Invalid parameter type for '%s', expected: number", + full_name(qiv, name)); return false; } @@ -587,8 +587,8 @@ static bool qobject_input_type_number_keyval(Visitor *v, const char *name, if (qemu_strtod_finite(str, NULL, &val)) { /* TODO report -ERANGE more nicely */ - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, - full_name(qiv, name), "number"); + error_setg(errp, "Invalid parameter type for '%s', expected: number", + full_name(qiv, name)); return false; } @@ -623,8 +623,8 @@ static bool qobject_input_type_null(Visitor *v, const char *name, } if (qobject_type(qobj) != QTYPE_QNULL) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, - full_name(qiv, name), "null"); + error_setg(errp, "Invalid parameter type for '%s', expected: null", + full_name(qiv, name)); return false; } *obj = qnull(); diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 197139c1c0..3f1b9e9b41 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -353,8 +353,8 @@ static bool parse_type_number(Visitor *v, const char *name, double *obj, assert(siv->lm == LM_NONE); if (qemu_strtod_finite(siv->string, NULL, &val)) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", - "number"); + error_setg(errp, "Invalid parameter type for '%s', expected: number", + name ? name : "null"); return false; } @@ -371,8 +371,8 @@ static bool parse_type_null(Visitor *v, const char *name, QNull **obj, *obj = NULL; if (siv->string[0]) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", - "null"); + error_setg(errp, "Invalid parameter type for '%s', expected: null", + name ? name : "null"); return false; } diff --git a/qom/object.c b/qom/object.c index d4a001cf41..3d96818f7d 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1495,7 +1495,8 @@ char *object_property_get_str(Object *obj, const char *name, } qstring = qobject_to(QString, ret); if (!qstring) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "string"); + error_setg(errp, "Invalid parameter type for '%s', expected: string", + name); retval = NULL; } else { retval = g_strdup(qstring_get_str(qstring)); @@ -1556,7 +1557,8 @@ bool object_property_get_bool(Object *obj, const char *name, } qbool = qobject_to(QBool, ret); if (!qbool) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "boolean"); + error_setg(errp, "Invalid parameter type for '%s', expected: boolean", + name); retval = false; } else { retval = qbool_get_bool(qbool); @@ -1589,7 +1591,8 @@ int64_t object_property_get_int(Object *obj, const char *name, qnum = qobject_to(QNum, ret); if (!qnum || !qnum_get_try_int(qnum, &retval)) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "int"); + error_setg(errp, "Invalid parameter type for '%s', expected: int", + name); retval = -1; } @@ -1663,7 +1666,8 @@ uint64_t object_property_get_uint(Object *obj, const char *name, } qnum = qobject_to(QNum, ret); if (!qnum || !qnum_get_try_uint(qnum, &retval)) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "uint"); + error_setg(errp, "Invalid parameter type for '%s', expected: uint", + name); retval = 0; } From patchwork Tue Mar 12 14:13:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779738 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043494wrt; Tue, 12 Mar 2024 07:15:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXz3bGw2Nv4sWBaPfNcLKlRszmRzKVN5H88OD9DSAxeEAkIVvETmHyVCdqiCSm/LWq9507ZJ61jUUOJqudZ1tn9 X-Google-Smtp-Source: AGHT+IHVUN/8cnZiSvKc+7A5FIkCykaSa+t6aK7EY3uI1mpwENK+WdZO39lOIGKki3pw534mtAzL X-Received: by 2002:a05:6214:1886:b0:690:b73c:8de8 with SMTP id cx6-20020a056214188600b00690b73c8de8mr13164410qvb.31.1710252946481; Tue, 12 Mar 2024 07:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252946; cv=none; d=google.com; s=arc-20160816; b=ibV5i/VCzpUyG3ii6X8vt8/qJk+r+lk8Ocnn1HJPs/WLwexxpIuv9OmgEP6zSA+A9H MPK8iAMybid1bMaTO6Toi0JGRqhMlkJ67ms+0iQWqgRfInvljWuG1nEs3lr6XG7LEhHb pXlRVrswYNla5xP2g91nQhmZ/IxFwghntn8LqDi3Yys5oLSMj4IOQ3QUrGR6d/kBlk12 SIUp+9eLTKbhIdrJdqewbdx2FdXjqTfJWD/XSVArqkGs0R3D6lHC9Lha6SnQN/j1jVUG wK8nMh4raK1rBYkg4KgYwq9KCl3XYagy3rs5TN/+U076b2YcxWrXIAzizKCmXnoZCGDK hD6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vq1eEcFrbjb0Qt2i2P9FwIaIMPJ4L5ayjl9JWacBAY4=; fh=i4ioI8lUmTcl2WtN/8i487arEjQwzVsrUlEe7C7mKeY=; b=v+GgLtR3i9dyWPC6HnAmGMQ1W0GSbbGZTehjRXHt8huKYTsVslIjm56+3odKhbl0yo 0xPQL7Vbc1eBcUmOX350gqjoK++GF/PF9WIenN+Sx5bYUZuqnudkp5VlBzn6qdEaQR/W e+oDofZSoze7/RYV3QWkzfweD913t8mS8CRfY8+PQIC8zy24duuLjeMCKQlJfVkS7acu 2S+l/RIyMMFXlyPlt6W9GcIDwl7BwLRoYGdut1mqojEpwAHhPZQO1xUQ0EUt13uqTBTF YvAB9XZWisrzw71X39lfDGBj50oogHA1Dxs1hsIoSQvpTaBCPCRlK+GaA5zItnKmif9v de5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="SAHSQSd/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id mf5-20020a0562145d8500b0068f756764cbsi7499104qvb.281.2024.03.12.07.15.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:15:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="SAHSQSd/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2tq-0001AI-G3; Tue, 12 Mar 2024 10:14:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2tG-0000ch-Mo for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t3-00029v-CV for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vq1eEcFrbjb0Qt2i2P9FwIaIMPJ4L5ayjl9JWacBAY4=; b=SAHSQSd/p+SrAnt4hlKDR8L3unMi0HmkSJbEBaRDYr/ZXYQyjSzPQWVV2zNovK5ajysFML xGjvCMQKPJ+C4ZxwvCuiyLxID1yfeE/S/8vaVONYMTTOe+LPW3pOht9wAlg1aO2gRMbUAV lmpsuB7hDFSjRpbaSSYjvWM89AS/48A= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-wHH_0IfqNmmxV31z09X2Gw-1; Tue, 12 Mar 2024 10:13:46 -0400 X-MC-Unique: wHH_0IfqNmmxV31z09X2Gw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C09683814EB5; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A3AEC01600; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3B58721E6891; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org Subject: [PATCH 07/10] qapi: Inline and remove QERR_INVALID_PARAMETER_TYPE definition Date: Tue, 12 Mar 2024 15:13:40 +0100 Message-ID: <20240312141343.3168265-8-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Manual changes (escaping the format in qapi/visit.py). Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- include/qapi/qmp/qerror.h | 3 --- qom/object.c | 4 ++-- scripts/qapi/visit.py | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index 63ab775dc5..b723830eff 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -17,9 +17,6 @@ * add new ones! */ -#define QERR_INVALID_PARAMETER_TYPE \ - "Invalid parameter type for '%s', expected: %s" - #define QERR_INVALID_PARAMETER_VALUE \ "Parameter '%s' expects %s" diff --git a/qom/object.c b/qom/object.c index 3d96818f7d..44ec8f6460 100644 --- a/qom/object.c +++ b/qom/object.c @@ -23,7 +23,6 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/forward-visitor.h" #include "qapi/qapi-builtin-visit.h" -#include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" #include "trace.h" @@ -1912,7 +1911,8 @@ static Object *object_resolve_link(Object *obj, const char *name, } else if (!target) { target = object_resolve_path(path, &ambiguous); if (target || ambiguous) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type); + error_setg(errp, "Invalid parameter type for '%s', expected: %s", + name, target_type); } else { error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found", path); diff --git a/scripts/qapi/visit.py b/scripts/qapi/visit.py index c56ea4d724..a21b7b1468 100644 --- a/scripts/qapi/visit.py +++ b/scripts/qapi/visit.py @@ -278,8 +278,8 @@ def gen_visit_alternate(name: str, variants: QAPISchemaVariants) -> str: abort(); default: assert(visit_is_input(v)); - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null", - "%(name)s"); + error_setg(errp, "Invalid parameter type for '%%s', expected: %(name)s", + name ? name : "null"); /* Avoid passing invalid *obj to qapi_free_%(c_name)s() */ g_free(*obj); *obj = NULL; @@ -356,7 +356,6 @@ def _begin_user_module(self, name: str) -> None: self._genc.preamble_add(mcgen(''' #include "qemu/osdep.h" #include "qapi/error.h" -#include "qapi/qmp/qerror.h" #include "%(visit)s.h" ''', visit=visit)) From patchwork Tue Mar 12 14:13:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779735 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043193wrt; Tue, 12 Mar 2024 07:15:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX8Pkfz8qkMBHGWEsoQETqwjAeOjvwV1NX8RLLpG881V9SuVF8pBtEQsopQWfaK8QS8GdxjtBY70ZwRgVZ6MaNS X-Google-Smtp-Source: AGHT+IHVmq1JW9mgUrHcjloXrRoZWtR6kycnp2pKvQYPO6fXElUJ4mOVZlzJ++8DkHImifos2Vbi X-Received: by 2002:a05:620a:5dca:b0:788:2e4c:9cf5 with SMTP id xy10-20020a05620a5dca00b007882e4c9cf5mr10371917qkn.54.1710252907856; Tue, 12 Mar 2024 07:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252907; cv=none; d=google.com; s=arc-20160816; b=Hgz7Gg/UkFdwEV8AXCoEAOYo+YEN0NsnRcdn7RZRSzrYLW7JCeXIvyFpDcUWvz4fZf G8i8wbq12gy0lTenlnlgdLtr0beQE/jIgOOZ72JCS52qRMUSY5LlzX9ituKZaveUoRro WEj6c/mHo/kr0c0PiHwF9p4GJSm3MYZGVViDqxs7j52PPRVu8cj7DZrrGIjSt5yWSQ+z 2S4/Iteg53suWRAt8i4I5BeuV4lqCRJFwUFsfGX+tXCNQAPNjBtfJ2FdanaZcxYQ+s8s NZyiL5REj61gZGzRQxKedfqMKFyS1hTOevQu1HunBfDkG7rJ69JoDwFyiRrIy+G68/Hs 8nvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hYHFCmgJJWnJymuPOM0Fiymm9aw+gWR/Ejg103QqNto=; fh=fAmwTs3MrViTQmBAE7SGmOjzlZKf5SCf6zHzWyrruUg=; b=Z99Z+7YQqo2O572rFzCykt+KfGgcIbWW2avvBskhICBKhMdDEr01JpsHt/e7FFQeD5 54XU27Hom/F5EBjpDqlaLZyq7eMb8PcLyU2tpq4ckx/zwVxwiHyg8b7ttuh2CEoh2LQ6 fzSpgM+NLPXok2UZujNx5BsQQ2d2Kqyulwgjjg+m716Yz6y2AKZwHm9ZktZDw2PjLeZB JqzUWtaHhv0D8BUY8s1q1ecH2yjCCYdlf76QHUg3BPQGwuN6hkAhogpZ7STL4JKL0O/F Q4x7lRBpWy8LsgG6VnyckbDWjgr2Z20qfShmm+dWDSvPHtr+oUBxalWePlpbt/lQbXSP 45Kw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fm2Hvbvr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id os18-20020a05620a811200b0078876151244si2565817qkn.441.2024.03.12.07.15.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:15:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fm2Hvbvr; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2tw-0001GF-KL; Tue, 12 Mar 2024 10:14:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2tK-0000fE-6b for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t6-0002Bn-3u for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hYHFCmgJJWnJymuPOM0Fiymm9aw+gWR/Ejg103QqNto=; b=Fm2Hvbvrv3Bm/jizPgXwZ98Xdofsm6Owb5i1a+j+8WZdcjxl4IJ4JTY/7K1ozhAAAglW92 yKP73+xupxV/TkavapJ58Wa241oMb6EQE/2iCX4aJmhn0o+rFvvqRR68/ygqNqCSOwNEzs o6B5nu1oaao90P02LAaKnStpaOrYJNQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-363-XI1gPPs_O9OCQJEbt6DXQw-1; Tue, 12 Mar 2024 10:13:46 -0400 X-MC-Unique: XI1gPPs_O9OCQJEbt6DXQw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE451100DE81; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99E133C85; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3E68021E68B2; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org, Juan Quintela Subject: [PATCH 08/10] qapi: Correct error message for 'vcpu_dirty_limit' parameter Date: Tue, 12 Mar 2024 15:13:41 +0100 Message-ID: <20240312141343.3168265-9-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé QERR_INVALID_PARAMETER_VALUE is defined as: #define QERR_INVALID_PARAMETER_VALUE \ "Parameter '%s' expects %s" The current error is formatted as: "Parameter 'vcpu_dirty_limit' expects is invalid, it must greater then 1 MB/s" Replace by: "Parameter 'vcpu_dirty_limit' is invalid, it must greater than 1 MB/s" Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- migration/options.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/migration/options.c b/migration/options.c index 40eb930940..c5115f1b5c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -1264,9 +1264,8 @@ bool migrate_params_check(MigrationParameters *params, Error **errp) if (params->has_vcpu_dirty_limit && (params->vcpu_dirty_limit < 1)) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - "vcpu_dirty_limit", - "is invalid, it must greater then 1 MB/s"); + error_setg(errp, "Parameter 'vcpu_dirty_limit' is invalid," + " it must greater than 1 MB/s"); return false; } From patchwork Tue Mar 12 14:13:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779739 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043876wrt; Tue, 12 Mar 2024 07:16:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVgNshK8FUi2g1ejz6AFZ9RHvOzbFZ360tMWa9EMxOEiqVqUvyqWVXPU/BTCZo6evmYO8Jeq/jvXLGQFjfm+Ucv X-Google-Smtp-Source: AGHT+IHpmzYAfLG63jGuN7WhQSEqnqaQxe0yKmIuCXUqsIxOGS2MRAVJf7EHLCAiNkPpQ2eg/e8H X-Received: by 2002:a05:620a:1476:b0:788:31c7:e09a with SMTP id j22-20020a05620a147600b0078831c7e09amr471804qkl.27.1710252990498; Tue, 12 Mar 2024 07:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252990; cv=none; d=google.com; s=arc-20160816; b=kwnljGEbjxaGRSTM/zhPLhPOrrsJZVOyUVDgWsaHuznR+wSkonTti2kA7mbtInCYf6 TW6JRYdO6RFb/zepJntvA78B/sKc60pWpzE1VVM/HevjV7xbB2HzIf85mrp3+iGf8vgw 895esyhnNa9a/rmjjvtWWEXyH/Qjrg1s/J97vbFOJHLwVWp6rn/1bAxqEBO53HMC89sB +dOFI8TK2aUN8TFTaSxr/aIXX11UQpXBYOHIVU+AjjJvz4oX0bVUkKCdbFz2TmWgP34Y GtbNe7f4Zdr6QhtUhXeKqKvYzvAAdHTGOu+fw5z1oOB6AQWM6wAULUpzU0nnOA0aYQ0D Y9Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NKE63curOgdTK2baXfnZucAY8e4SHkvymOxORcMj/Y8=; fh=fAmwTs3MrViTQmBAE7SGmOjzlZKf5SCf6zHzWyrruUg=; b=YWTkPqTPbwqYXA32qdXMSIbjsvukNNO9kdxuNVySSdMghm+4/55Ma1UozBsp4AENGb Ezkfw8QKr4Z8EaQA0anuKONECPeDqveg+usr1XQTaeCTw2dXJmPgS+4jBMEwuKAgjJjN ZR3BimpC6jI4s0kqMSdoRMPOXUfavVL2nOQZaE/3hcMZxld7XrjVLRDLGeHPmTjp3+Ws W5baNaZ4giUkEz66noAbAZH1YCTouO0/hNsWGIuwjZbxVQ9HhuwQAu7UdcHa7HdcLYFy 7ynxJwWbINMInL/KCJoIT1uk1TEfJ94p8rahkoDvMpkkH3Cv77owuPdiUhV5etOlzGEv chcw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N1IedIXd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id wg14-20020a05620a568e00b0078875a08f90si2664536qkn.78.2024.03.12.07.16.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:16:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N1IedIXd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2th-0000kf-7q; Tue, 12 Mar 2024 10:14:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2tH-0000cs-Te for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t5-0002BY-Mq for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:14:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NKE63curOgdTK2baXfnZucAY8e4SHkvymOxORcMj/Y8=; b=N1IedIXdOPZZfOXgzZbK8Eb/4dEFIJfnSo4AlirHemTV/3T1kA0pq5aKpNBq7crVTt6A9b DKOBOhIIn4rrSm8lzf8GNK9NbKA1KvHrb0Y/INxejWgR59JsLq2MVrZARv4T9vAHjNuNTX sJq51AZeSey0fZBrXOl0bY3rSXP7kTM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-70-iyVE-2UiPESFyclhYT29Ew-1; Tue, 12 Mar 2024 10:13:46 -0400 X-MC-Unique: iyVE-2UiPESFyclhYT29Ew-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BEA171C54048; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99D4110F53; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 415B721E68BD; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org, Juan Quintela Subject: [PATCH 09/10] qapi: Inline and remove QERR_MIGRATION_ACTIVE definition Date: Tue, 12 Mar 2024 15:13:42 +0100 Message-ID: <20240312141343.3168265-10-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Mechanical transformation using sed, manually removing the definition in include/qapi/qmp/qerror.h. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Juan Quintela Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- include/qapi/qmp/qerror.h | 3 --- migration/migration.c | 2 +- migration/options.c | 4 ++-- migration/savevm.c | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index b723830eff..385a4876d6 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -23,9 +23,6 @@ #define QERR_IO_ERROR \ "An IO error has occurred" -#define QERR_MIGRATION_ACTIVE \ - "There's a migration process in progress" - #define QERR_MISSING_PARAMETER \ "Parameter '%s' is missing" diff --git a/migration/migration.c b/migration/migration.c index a49fcd53ee..e4a68dfb62 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1961,7 +1961,7 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, } if (migration_is_running(s->state)) { - error_setg(errp, QERR_MIGRATION_ACTIVE); + error_setg(errp, "There's a migration process in progress"); return false; } diff --git a/migration/options.c b/migration/options.c index c5115f1b5c..5a446e8925 100644 --- a/migration/options.c +++ b/migration/options.c @@ -682,7 +682,7 @@ bool migrate_cap_set(int cap, bool value, Error **errp) bool new_caps[MIGRATION_CAPABILITY__MAX]; if (migration_is_running(s->state)) { - error_setg(errp, QERR_MIGRATION_ACTIVE); + error_setg(errp, "There's a migration process in progress"); return false; } @@ -726,7 +726,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, bool new_caps[MIGRATION_CAPABILITY__MAX]; if (migration_is_running(s->state) || migration_in_colo_state()) { - error_setg(errp, QERR_MIGRATION_ACTIVE); + error_setg(errp, "There's a migration process in progress"); return; } diff --git a/migration/savevm.c b/migration/savevm.c index dc1fb9c0d3..19ca297e15 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1706,7 +1706,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp) MigrationStatus status; if (migration_is_running(ms->state)) { - error_setg(errp, QERR_MIGRATION_ACTIVE); + error_setg(errp, "There's a migration process in progress"); return -EINVAL; } From patchwork Tue Mar 12 14:13:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 779741 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp2043891wrt; Tue, 12 Mar 2024 07:16:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfhnaCWjFpHaHgPSr62uXPlr3lCn3h9N0GT46wTbmtpSYDFYecbH6uqGunOQWw1EjfMUczhH0JMR85Xetq41KX X-Google-Smtp-Source: AGHT+IE+82xyT5VaiVGERCRn7tPKc1gzkb30XYzVE/0iUKPZKhohkX13Tx0GxP74uhIZVExRtnuQ X-Received: by 2002:a05:620a:5dc5:b0:788:6bda:bd3f with SMTP id xy5-20020a05620a5dc500b007886bdabd3fmr442650qkn.69.1710252992373; Tue, 12 Mar 2024 07:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710252992; cv=none; d=google.com; s=arc-20160816; b=gaXuDyiTSJo0YFQnQz/GgHSq1Ih73EKiceq7pFUV2QzvhWZit28lUgAHf3+D5++DdH 0LJRwdsp0+bTGTISA7+/OOgQT3z/9MRGi6ZmozHNVgl0KQsxRii3p9/UeBNm6686WR8J L6emOidBBRGJHR3pwYcvJ70oUcw2BzWLjkaPpCy8yfqhwCmjqFzPS7TOWIXdouZR54/o iVpqayeLT1wPcspBLOGEiUrsLdtiuLScom+ZZ1N8lbWDZ57J1zsbrNC+EfvdVlMdUYt7 UP6kksKKx4mPTYHL8gBfFx0iZLR2HJIgvRrcbq+crkJ6fUBXBGAJmdKRq1zSV9MdlWt3 E2zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HcFZDgD45EqkvdlOQUrgLpUdCGTxDcVOQaK1UoOzDnw=; fh=i4ioI8lUmTcl2WtN/8i487arEjQwzVsrUlEe7C7mKeY=; b=VX0YQpwkMibBW15mi6mYEwfRNYCyHMDO4ENGMgMm1lPUfGfFAYVr1CKLev4mUP5ID0 eC5SJI3DjvW/irfj2mPFjfY6eFTqBi/hU4KlBpt4OVFX+RiW8dpmZdl8iAjMZUNYhYYU vgamYCY7UuBiM094+jshwN9+Gh6xa6q6MAQyi7KA3bYIyJs2BjyPif2sLILhxosksrW8 MlP7SlY9CD2w3gfM/bDW3BSCpLMZL9/0jtecD5QPVRgWhkZNInvXgxp2I6/AA8FJLCe2 SguQyD/q1viCVaFM0qohs3DrqYaNNzlrObfN3dxaJeb++dNywynZAgR8lcPtuGa6iq2p T1eg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YgNE66kL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v19-20020a05620a441300b0078843ec7fecsi8364475qkp.749.2024.03.12.07.16.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 07:16:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YgNE66kL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk2tn-0000yD-Pi; Tue, 12 Mar 2024 10:14:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2tB-0000Zs-HX for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:13:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk2t4-0002Al-VQ for qemu-devel@nongnu.org; Tue, 12 Mar 2024 10:13:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710252829; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HcFZDgD45EqkvdlOQUrgLpUdCGTxDcVOQaK1UoOzDnw=; b=YgNE66kLQQfGiJBax9WKPyZqCEc5QFbtTKof0vzrQqTncmOFtNW9QonmcFQnEygAPEFjdG Dfi3khW4wsxGIGtUi0ju2z2XI8wqAYVTW4c5YewU4lqC5ONeIWpfn0ckiYd3CJPUHGHJBt Ag8AfG6o8ve5gQMvZe3aKuukXuACTIY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-363-Tlr0N80fPhWfhx4TGZQR6w-1; Tue, 12 Mar 2024 10:13:46 -0400 X-MC-Unique: Tlr0N80fPhWfhx4TGZQR6w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE0A38A3D20; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.138]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99E3F37F1; Tue, 12 Mar 2024 14:13:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4444521E681B; Tue, 12 Mar 2024 15:13:43 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-block@nongnu.org, philmd@linaro.org Subject: [PATCH 10/10] qapi: Inline and remove QERR_PROPERTY_VALUE_BAD definition Date: Tue, 12 Mar 2024 15:13:43 +0100 Message-ID: <20240312141343.3168265-11-armbru@redhat.com> In-Reply-To: <20240312141343.3168265-1-armbru@redhat.com> References: <20240312141343.3168265-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.687, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Address the comment added in commit 4629ed1e98 ("qerror: Finally unused, clean up"), from 2015: /* * These macros will go away, please don't use * in new code, and do not add new ones! */ Manual change. Remove the definition in include/qapi/qmp/qerror.h. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Markus Armbruster Reviewed-by: Zhao Liu --- include/qapi/qmp/qerror.h | 3 --- hw/core/qdev-properties.c | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index 385a4876d6..00b18e9082 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -26,9 +26,6 @@ #define QERR_MISSING_PARAMETER \ "Parameter '%s' is missing" -#define QERR_PROPERTY_VALUE_BAD \ - "Property '%s.%s' doesn't take value '%s'" - #define QERR_PROPERTY_VALUE_OUT_OF_RANGE \ "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 7d6fa726fd..86a583574d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -2,7 +2,6 @@ #include "hw/qdev-properties.h" #include "qapi/error.h" #include "qapi/qapi-types-misc.h" -#include "qapi/qmp/qerror.h" #include "qapi/qmp/qlist.h" #include "qemu/ctype.h" #include "qemu/error-report.h" @@ -792,7 +791,7 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj, break; default: case -EINVAL: - error_setg(errp, QERR_PROPERTY_VALUE_BAD, + error_setg(errp, "Property '%s.%s' doesn't take value '%s'", object_get_typename(obj), name, value); break; case -ENOENT: