From patchwork Thu Oct 5 04:50:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 729702 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a4e:0:b0:31d:da82:a3b4 with SMTP id v14csp694861wrs; Wed, 4 Oct 2023 21:52:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEltt9bL/JNtWtiObQjYlRF5Wa0nRRdZ5GfEz0CbDLYcjFGAn6bOCadXtXLvr/g1BENZzK X-Received: by 2002:a05:620a:4793:b0:773:c792:bdda with SMTP id dt19-20020a05620a479300b00773c792bddamr4745176qkb.53.1696481559093; Wed, 04 Oct 2023 21:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696481559; cv=none; d=google.com; s=arc-20160816; b=XI3YyPv76jIgFjtbHdqD6TRoV0n8yxhufOf7v3OkSRzJ0zveoYE8UTvbCYj91FB7gK JyJ+2bD/027NbKa5Mg3kMohcA3bq17WNfFqmj5mDcLK+NFaSoREdqQm4c7mketYxEk8u TxexDDuOOsU+lg1hmI6vIEPDl63LAHfT/LR6lz2+3H6bR8XulwtBjNOB8ENzOdZs6f/q a/hvwPsdx4NisPnHD/5qYqBJnt9tvUy5ZlejEDvKPbN3VaLtgZW2s0w7dc1ff7kdZw55 sFzKYTn+Lr9hev6lfHga536zhIX8DRM+IVfl1M3ZOASb5EUh7ofLd4V/9pdRr2BWGU2m F/5A== 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=i0f/S9sk5n4iTXtNvEpxFckitQTJsYOjTpjl0/I1BCA=; fh=Z7Pv+eyhTL5wOgIfxY9/3/BHWOZWo37vnRD3FWoic8E=; b=ueOc2qAaFEHYn2ZUyFTgSriiu0slKEF1dz431qXjOhXWQRWLa71OAic+ipxGZHwDXx LwlDQl3s8U1kxAYV7bXEggkgGEhXo3Dih02CZ3edr5rC+QsbmraqcJCHhQl9BcgrlBF6 1UB5/MmftA1JRU9TmoWez/WiR8G0n0dedkj3rna8KvkODpM2on5O3VvF0vhe42fOwc1a EE0IMg+fOHGMoWkl3L9I4MdrzvooL6yZAedNEKsDpGiJ6mu9Kr4NkOh1Ir8h8ZySybvL VrkzM4EHtCbKVKJN6uIOORXEIESxmkfq9r5V6GDVYer1SjlKItIJz643V9Bt4p1hFSQy 6izg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="reKEUX/E"; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ql13-20020a05620a890d00b00773a23eb2a8si406932qkn.671.2023.10.04.21.52.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Oct 2023 21:52: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=@linaro.org header.s=google header.b="reKEUX/E"; 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=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qoGKa-0005Ya-4T; Thu, 05 Oct 2023 00:51:24 -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 1qoGKX-0005Ww-PC for qemu-devel@nongnu.org; Thu, 05 Oct 2023 00:51:21 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qoGKU-0005X8-S8 for qemu-devel@nongnu.org; Thu, 05 Oct 2023 00:51:21 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-405524e6769so3034865e9.1 for ; Wed, 04 Oct 2023 21:51:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696481477; x=1697086277; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i0f/S9sk5n4iTXtNvEpxFckitQTJsYOjTpjl0/I1BCA=; b=reKEUX/E5S9dXFUpMCzT1K/QIvP9KkZ5kyXP6w9VMwXm/jsRSZYWyRBnglh4q8LF9P Kh30Y197bawa6rHG7npdnA0zJz6Jfc2tRy4mwKjESgIim0vGG6J/yJLAd2vEHI4VReIl pT4No/0bqeXV+ltRjd4hEki/o+8Nlre+Z9+JGpdWkcddiVhzEqBi35+eut55BK/83mvR h9syXsb2htdzDSIhTAY855lt5CZ3G/IaxVoDAc+GjDvyd6fn4l14/ra8OHnJeVlZVc9z 5GBUVFlHgLrMtkgTuORCUQ37DnEbQA2eOmCP/c2vJUgGsoOJkNkqd/rerEB8SaMneFz0 2jDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696481477; x=1697086277; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i0f/S9sk5n4iTXtNvEpxFckitQTJsYOjTpjl0/I1BCA=; b=jnOodSxwK67zBGvs7KvoKZsK3dObcMu+f9DV8smU95QYhiDJ8z3+IZqwxYvdbZGq5e i85mUrTbyIVhBy44Zvjnc3sGQ3A9e5bcO8yEejgEUaR7Pk4lCVCX8ep09HYToTMwwf15 UmNGR1/h6p0CK0E+1GkO8FQIco5WviftHhF2AtczdXYzpPV2TxQR014qLRS7nxMMTmnl S8IAgLWm+9B0BGHlSlalnqyOy8ukM5RzQ4Axomv962CgtUO+WSJu8p3q54DxRWK/VeUs G3DeYZADNzSarAQ+GjeC0uICl5/bxyPzA3+BR8B4rGV6wjRxrz/BXtHZDC/mzQydNP/C wr8A== X-Gm-Message-State: AOJu0YxyMJkhEvG3KItQLS9u8YT830FYytPjM+VCiROJ+sjCXwohcd62 EXubSYP07fAfZVeutUjj8uXGDW/L2oJdLGx79Do= X-Received: by 2002:a1c:7505:0:b0:405:3f06:d2ef with SMTP id o5-20020a1c7505000000b004053f06d2efmr174242wmc.4.1696481477187; Wed, 04 Oct 2023 21:51:17 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-211-120.dsl.sta.abo.bbox.fr. [176.171.211.120]) by smtp.gmail.com with ESMTPSA id y4-20020a05600c364400b0040472ad9a3dsm623215wmq.14.2023.10.04.21.51.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Oct 2023 21:51:16 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-block@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Marc?= =?utf-8?q?-Andr=C3=A9_Lureau?= , Michael Roth , Konstantin Kostiuk , Gerd Hoffmann Subject: [PATCH v2 05/22] qapi: Inline QERR_INVALID_PARAMETER definition (constant parameter) Date: Thu, 5 Oct 2023 06:50:22 +0200 Message-ID: <20231005045041.52649-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231005045041.52649-1-philmd@linaro.org> References: <20231005045041.52649-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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 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 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; constant param; @@ error_setg(errp, QERR_INVALID_PARAMETER, param); @script:python strformat depends on match@ param << match.param; fixedfmt; // new var @@ fixedfmt = f'"Invalid parameter \'{param[1:-1]}\'"' # Format skipping '"'. coccinelle.fixedfmt = cocci.make_ident(fixedfmt) @replace@ expression match.errp; constant match.param; identifier strformat.fixedfmt; @@ - error_setg(errp, QERR_INVALID_PARAMETER, param); + error_setg(errp, fixedfmt); Signed-off-by: Philippe Mathieu-Daudé --- dump/dump.c | 6 +++--- qga/commands.c | 2 +- ui/ui-qmp-cmds.c | 2 +- util/qemu-option.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index d4ef713cd0..e173f1f14c 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -1810,7 +1810,7 @@ static void dump_init(DumpState *s, int fd, bool has_format, s->fd = fd; if (has_filter && !length) { - error_setg(errp, QERR_INVALID_PARAMETER, "length"); + error_setg(errp, "Invalid parameter 'length'"); goto cleanup; } s->filter_area_begin = begin; @@ -1841,7 +1841,7 @@ static void dump_init(DumpState *s, int fd, bool has_format, /* Is the filter filtering everything? */ if (validate_start_block(s) == -1) { - error_setg(errp, QERR_INVALID_PARAMETER, "begin"); + error_setg(errp, "Invalid parameter 'begin'"); goto cleanup; } @@ -2145,7 +2145,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, } if (fd == -1) { - error_setg(errp, QERR_INVALID_PARAMETER, "protocol"); + error_setg(errp, "Invalid parameter 'protocol'"); return; } diff --git a/qga/commands.c b/qga/commands.c index 09c683e263..871210ab0b 100644 --- a/qga/commands.c +++ b/qga/commands.c @@ -154,7 +154,7 @@ GuestExecStatus *qmp_guest_exec_status(int64_t pid, Error **errp) gei = guest_exec_info_find(pid); if (gei == NULL) { - error_setg(errp, QERR_INVALID_PARAMETER, "pid"); + error_setg(errp, "Invalid parameter 'pid'"); return NULL; } diff --git a/ui/ui-qmp-cmds.c b/ui/ui-qmp-cmds.c index debc07d678..41ca0100e7 100644 --- a/ui/ui-qmp-cmds.c +++ b/ui/ui-qmp-cmds.c @@ -44,7 +44,7 @@ void qmp_set_password(SetPasswordOptions *opts, Error **errp) assert(opts->protocol == DISPLAY_PROTOCOL_VNC); if (opts->connected != SET_PASSWORD_ACTION_KEEP) { /* vnc supports "connected=keep" only */ - error_setg(errp, QERR_INVALID_PARAMETER, "connected"); + error_setg(errp, "Invalid parameter 'connected'"); return; } /* diff --git a/util/qemu-option.c b/util/qemu-option.c index eedd08929b..fb391a7904 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -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);