From patchwork Wed Oct 4 17:31:40 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: 1843553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=PmqwI1mT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S128P3zZKz20Zl for ; Thu, 5 Oct 2023 04:42:45 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo5jx-0003VB-3p; Wed, 04 Oct 2023 13:32:53 -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 1qo5jv-0003RJ-MO for qemu-ppc@nongnu.org; Wed, 04 Oct 2023 13:32:52 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qo5jh-0000zv-D1 for qemu-ppc@nongnu.org; Wed, 04 Oct 2023 13:32:51 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40566f89f6eso361385e9.3 for ; Wed, 04 Oct 2023 10:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696440756; x=1697045556; 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=PmqwI1mTj7JMI2SxH81d4YYnLWp5gevd4JSRKqgkEmuJAr3oBEUXQnduWReC14Wvhp iWML/SAKHzI4H+YxidQM0MMBjo9ti/nuk2csQSNwvSofFKr16VRTQHC9LdlmobptxNiA coFD6jynmjbhOqN5vRm/D/LbHpJ1COYPZUBNncYaP5X62uBJ4DIALCKhfjo3Ys2fl0f0 iMz2tjGhI+5RvA3bc1aPv4BcUVXQcM5ryu+uobH8EYqrDTgUxhepXskfhffUVHJVKaPW +dWzaCqlZx5mua+un7N0UceFS6fcKFS6PwXkGj3reyeX/cKLjymsHH/QEh9s91ZOT0ZK u0Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696440756; x=1697045556; 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=BoLJumjEJitByRIuB3V1K5WfVny9nxtcnghLsuHdsDZO53NZC34Tx1ImjRf5/BDi8q MOvLWwxsja7F0/V9d6W0PhXa7KkSFJTRKoKQaLLJfQd4KyFm+fFZrSlOupBoADITaL02 2P4t4BeOr7qNlZy827QJO/AmUrALWMk1IiZ6PCapU4+yEbg4No5KXTayrLppdHeIxeI5 FRxoInQnQDxvSUKU+8G8+9kLCNcDROdCNG7OH9rDmIHSRyAkxRd+r+jUJb/auTOfGVpM qa4FViMEXQ/CL+5G6Z8VwCkGpinorEHZHBmjH+ytqdrIoeOQg6nXAo+XS6+0Zow8i9Te wg+g== X-Gm-Message-State: AOJu0Yxf3G2QgS36uL22ID8kYfHiWeKqDQB3uwQhWqn3x275LNEwzDNr iT+mTRhdxA9qDSp92ukWQXNu9R7cMZGg5OvhiN4= X-Google-Smtp-Source: AGHT+IEyJRF13iyLbNh6DMzMUU/xyLRb/9FWN5daRf86NmsoNelUul76wjR8GQLPMWAtW6Oyc61i+w== X-Received: by 2002:adf:efd1:0:b0:31f:fc96:9af1 with SMTP id i17-20020adfefd1000000b0031ffc969af1mr2729111wrp.59.1696440756089; Wed, 04 Oct 2023 10:32:36 -0700 (PDT) Received: from m1x-phil.lan (5ep85-h01-176-173-163-52.dslam.bbox.fr. [176.173.163.52]) by smtp.gmail.com with ESMTPSA id j6-20020adfff86000000b0031423a8f4f7sm4508086wrr.56.2023.10.04.10.32.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Oct 2023 10:32:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Cc: qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@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 05/21] qapi: Inline QERR_INVALID_PARAMETER definition (constant parameter) Date: Wed, 4 Oct 2023 19:31:40 +0200 Message-ID: <20231004173158.42591-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231004173158.42591-1-philmd@linaro.org> References: <20231004173158.42591-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-ppc@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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.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);