From nobody Tue May 7 01:19:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1639051811; cv=none; d=zohomail.com; s=zohoarc; b=mj3N88YVaEU3tvz864CZb3CZXj3+0Z0hnuNhmd5Eif30BfEzYnvKOqIHnngKOOssZM9xMVXXT8B8VM8luAhFdyPVSL4ngq9VQEkrNaatUNTPYnQ2fR6jqoacaYOIOQFDqOT8L3x4JIzgTrSv3yMyDihU+ekwMoe0azzJEzH3ZqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639051811; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=HeM2KyDN2ballrXXSN7JrvcKdnc3fj0bhhAax0fif/I=; b=RJfWUXScY1rhZhMAAxTjfph4gHaZjwy6hQfZZPKiLLAK+lc2Risceys4QMmKFAQ8dNfzJNqCnQ21WHELgPygIWh2PyJ3UmpPq+vOgMnT+uZeTRRXvh+lkDVNh9JyvR9ZR2MKlfj5vB8QBcjbqAv/dHLYDmfO0AZiLNm3QAalLiU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639051811915486.7557386503149; Thu, 9 Dec 2021 04:10:11 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242988.420219 (Exim 4.92) (envelope-from ) id 1mvIF6-00080e-Cp; Thu, 09 Dec 2021 12:09:44 +0000 Received: by outflank-mailman (output) from mailman id 242988.420219; Thu, 09 Dec 2021 12:09:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mvIF6-00080X-9n; Thu, 09 Dec 2021 12:09:44 +0000 Received: by outflank-mailman (input) for mailman id 242988; Thu, 09 Dec 2021 12:09:42 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mvIF4-00080R-Nm for xen-devel@lists.xenproject.org; Thu, 09 Dec 2021 12:09:42 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e395a771-58e8-11ec-a831-37629979565c; Thu, 09 Dec 2021 13:09:41 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 51F261F37F; Thu, 9 Dec 2021 12:09:41 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F358413FBE; Thu, 9 Dec 2021 12:09:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rhHpOQTysWEFXAAAMHmgww (envelope-from ); Thu, 09 Dec 2021 12:09:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e395a771-58e8-11ec-a831-37629979565c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1639051781; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=HeM2KyDN2ballrXXSN7JrvcKdnc3fj0bhhAax0fif/I=; b=qXK8giJBjcuBcEtl2PUj5my+fgPkCQ0ReO34odAQUfD0j5AROEMHha6hT+ozelz97wC0MA /BQopoQeHhgNyJ5eB0wgYA6xH8UHbXZjctG6Q5jh/LKkZy4dkVqhBQ+7sXCYeLSaIn9tDm E7a2CbOy1wpIezrbUbGqMUjeZ+ON3kg= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: anthony.perard@citrix.com, Juergen Gross , Wei Liu Subject: [PATCH] tools/libs/ctrl: Save errno only once in *PRINTF() and *ERROR() Date: Thu, 9 Dec 2021 13:09:39 +0100 Message-Id: <20211209120939.513-1-jgross@suse.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1639051813712100001 Content-Type: text/plain; charset="utf-8" All *PRINTF() and *ERROR() macros are based on xc_reportv() which is saving and restoring errno in order to not modify it. There is no need to save and restore in those macros, too. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- tools/libs/ctrl/xc_private.h | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/tools/libs/ctrl/xc_private.h b/tools/libs/ctrl/xc_private.h index 2e483590e6..a3fe475c75 100644 --- a/tools/libs/ctrl/xc_private.h +++ b/tools/libs/ctrl/xc_private.h @@ -122,28 +122,18 @@ void xc_report_progress_step(xc_interface *xch, =20 /* anamorphic macros: struct xc_interface *xch must be in scope */ =20 -#define IPRINTF(_f, _a...) do { int IPRINTF_errno =3D errno; \ - xc_report(xch, xch->error_handler, XTL_INFO,0, _f , ## _a); \ - errno =3D IPRINTF_errno; \ - } while (0) -#define DPRINTF(_f, _a...) do { int DPRINTF_errno =3D errno; \ - xc_report(xch, xch->error_handler, XTL_DETAIL,0, _f , ## _a); \ - errno =3D DPRINTF_errno; \ - } while (0) -#define DBGPRINTF(_f, _a...) do { int DBGPRINTF_errno =3D errno; \ - xc_report(xch, xch->error_handler, XTL_DEBUG,0, _f , ## _a); \ - errno =3D DBGPRINTF_errno; \ - } while (0) - -#define ERROR(_m, _a...) do { int ERROR_errno =3D errno; \ - xc_report_error(xch,XC_INTERNAL_ERROR,_m , ## _a ); \ - errno =3D ERROR_errno; \ - } while (0) -#define PERROR(_m, _a...) do { int PERROR_errno =3D errno; \ +#define IPRINTF(_f, _a...) \ + xc_report(xch, xch->error_handler, XTL_INFO,0, _f , ## _a) +#define DPRINTF(_f, _a...) \ + xc_report(xch, xch->error_handler, XTL_DETAIL,0, _f , ## _a) +#define DBGPRINTF(_f, _a...) \ + xc_report(xch, xch->error_handler, XTL_DEBUG,0, _f , ## _a) + +#define ERROR(_m, _a...) \ + xc_report_error(xch,XC_INTERNAL_ERROR,_m , ## _a ) +#define PERROR(_m, _a...) \ xc_report_error(xch,XC_INTERNAL_ERROR,_m " (%d =3D %s)", \ - ## _a , errno, xc_strerror(xch, errno)); \ - errno =3D PERROR_errno; \ - } while (0) + ## _a , errno, xc_strerror(xch, errno)) =20 /* * HYPERCALL ARGUMENT BUFFERS --=20 2.26.2