From nobody Sun Sep 28 17:12:45 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1757942806; cv=none; d=zohomail.com; s=zohoarc; b=HEmsv0Nc9r+hX6/6tnFGzuRAiNrDmhvdHQYFLQD0ssK/LFEAqaCbe9/P7Lk2xhocfHha/dNYA1Jy6a/1roHMb8rW4uf5PRdimHoRpIjIyEa9cffndRiQhIKfxFhRKep7DoFNyBUeYwz0jbekpJoihtH7ULmh+TzDcGhhVpax4jM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757942806; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Bsj2a9jOX7m78cJ8iWjmy3wV+irNgid7QKDe6IJBGGY=; b=lpq1RVdDJeBXnu9qLBaqMgj9uzZ9ngrt0mmn1VJNRfzbsx3wxb08aGXF7fjZCyGLm8ct/UDmUUDvCkWcHXPLP1z4v2o6lp5LMKHDTVeFYkeoyPZIMv5V0VD3L+CFDWq9/BB+JXcdpHeYZ4Bx/Et8vI8KV8vEI94AlK504Oq3zhM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757942806219399.25351358695127; Mon, 15 Sep 2025 06:26:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uy9AQ-0001jl-UU; Mon, 15 Sep 2025 09:22:51 -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 1uy9AL-0001gb-EF; Mon, 15 Sep 2025 09:22:45 -0400 Received: from forwardcorp1d.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uy9A8-0006y3-Jo; Mon, 15 Sep 2025 09:22:45 -0400 Received: from mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:cf2d:0:640:140f:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 95097807C0; Mon, 15 Sep 2025 16:22:20 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:130::1:7]) by mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id GMPC4o1FuGk0-QSQ7UMxK; Mon, 15 Sep 2025 16:22:20 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1757942540; bh=Bsj2a9jOX7m78cJ8iWjmy3wV+irNgid7QKDe6IJBGGY=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=gY3jsz2kk7ZiSLHE7eVO0Qx27xsBA0OtrNO2jtekoG+/4Qh00eoQHrBkeEIb99JEp O4ycfXqXPfayb3Pg8pJ1Gek6JNMT002YYEZZBjZfTHnyJqYgs4htW0Gd69b/BpdIiB +epIt/xlZIBZ7nGZulxah9ll3iLB6UT7rEIurpRc= Authentication-Results: mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: berrange@redhat.com Cc: qemu-devel@nongnu.org, peterx@redhat.com, qemu-block@nongnu.org, vsementsov@yandex-team.ru, leiyang@redhat.com, marcandre.lureau@redhat.com, Markus Armbruster , Michael Roth Subject: [PATCH v3 04/13] util/error: add &error_reporter Date: Mon, 15 Sep 2025 16:22:01 +0300 Message-ID: <20250915132211.135095-5-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250915132211.135095-1-vsementsov@yandex-team.ru> References: <20250915132211.135095-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1d.mail.yandex.net 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_VALIDITY_CERTIFIED_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1757942807195116600 Content-Type: text/plain; charset="utf-8" Add a pair to &error_warn helper, to reduce the pattern like Error *local_err =3D NULL; ... if (!foo(..., &local_err)) { error_report_err(local_err); return false; } to simply if (!foo(..., &error_reporter)) { return false; } Of course, for new interfaces, it's better to always support and handle errp argument. But when have to rework the old ones, it's not always feasible to convert everything to support/handle errp. The new helper is used in following commits. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/qapi/error.h | 6 ++++++ util/error.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/include/qapi/error.h b/include/qapi/error.h index 41e3816380..cea95f5c36 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -539,6 +539,12 @@ G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(ErrorPropagator, erro= r_propagator_cleanup); */ extern Error *error_warn; =20 +/* + * Special error destination to report on error. + * See error_setg() and error_propagate() for details. + */ +extern Error *error_reporter; + /* * Special error destination to abort on error. * See error_setg() and error_propagate() for details. diff --git a/util/error.c b/util/error.c index daea2142f3..5160435c86 100644 --- a/util/error.c +++ b/util/error.c @@ -20,6 +20,7 @@ Error *error_abort; Error *error_fatal; Error *error_warn; +Error *error_reporter; =20 static void error_handle(Error **errp, Error *err) { @@ -43,6 +44,8 @@ static void error_handle(Error **errp, Error *err) } if (errp =3D=3D &error_warn) { warn_report_err(err); + } else if (errp =3D=3D &error_reporter) { + error_report_err(err); } else if (errp && !*errp) { *errp =3D err; } else { --=20 2.48.1