From nobody Thu Nov 28 12:55:21 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=1670947545; cv=none; d=zohomail.com; s=zohoarc; b=hFF5sqQNy4mGXwDs3ht5Pc543k4E7Pph2dosUHFxHT/O98ZC8aNczl5jY3t9wzs7QhLCB/sVuXZF1mKUO0mRscl6c+4Hxa0UauaInODPrSwLhEbXVDy4X6wDO0JJ/CiOEAxeQVykcHhYfTfH3bRJY4f2eae4pfcOdtEWziqwgLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670947545; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=okx7qxg8bFtkyLH12eZ25h2C7wGOfWUBp/Y3Edy1SaY=; b=E7qF3QaNk43Bz4MYg6VoX9z0PU3cruRzCw1rWB/kDPZHoxpD04k5PZRzUfQFmzRltIoWAuw1rQmAkXJ1ObEvxqHwegFhbutk9wNSq+dsOUANrXd9n5UZorNOgKiRp8L2SpOXNDFPiB2zvgcY6L/RKjRtbswdjCsinI4Z0UkBZgs= 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 1670947545610665.8312825233974; Tue, 13 Dec 2022 08:05:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.460770.718803 (Exim 4.92) (envelope-from ) id 1p57mF-0006NU-Ro; Tue, 13 Dec 2022 16:05:07 +0000 Received: by outflank-mailman (output) from mailman id 460770.718803; Tue, 13 Dec 2022 16:05:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p57mF-0006LD-Co; Tue, 13 Dec 2022 16:05:07 +0000 Received: by outflank-mailman (input) for mailman id 460770; Tue, 13 Dec 2022 16:05:06 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p57jW-0001dt-4h for xen-devel@lists.xenproject.org; Tue, 13 Dec 2022 16:02:18 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 84442e7e-7aff-11ed-91b6-6bf2151ebd3b; Tue, 13 Dec 2022 17:02:17 +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-out1.suse.de (Postfix) with ESMTPS id 384F622A34; Tue, 13 Dec 2022 16:02:17 +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 0B6A0138EE; Tue, 13 Dec 2022 16:02:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Ip56AQmimGNIKgAAMHmgww (envelope-from ); Tue, 13 Dec 2022 16:02:17 +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: 84442e7e-7aff-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1670947337; 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: in-reply-to:in-reply-to:references:references; bh=okx7qxg8bFtkyLH12eZ25h2C7wGOfWUBp/Y3Edy1SaY=; b=RaNYIjUBi6HZ8E9257o+IbFLis69cz97V83G93v48zzHI4LeY6Pbadoogvgc8DBOa8OtkW rr2oh6aVCBt85zLSNLh2bx5jBtqH1SFcJWQg8Z7NRoOuS9zY5voB0hJImvCpFUW1YolPaB /sf4hIATk+MLnA23GOTaUQM0av6LBWg= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD , Julien Grall Subject: [PATCH v2 16/19] tools/xenstore: make log macro globally available Date: Tue, 13 Dec 2022 17:00:42 +0100 Message-Id: <20221213160045.28170-17-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221213160045.28170-1-jgross@suse.com> References: <20221213160045.28170-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1670947547285100006 Content-Type: text/plain; charset="utf-8" Move the definition of the log() macro to xenstored_core.h in order to make it usable from other source files, too. While at it preserve errno from being modified. Signed-off-by: Juergen Gross Reviewed-by: Julien Grall --- tools/xenstore/xenstored_core.c | 14 -------------- tools/xenstore/xenstored_core.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_cor= e.c index 60433265ed..48c2793aeb 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -88,20 +88,6 @@ TDB_CONTEXT *tdb_ctx =3D NULL; =20 static const char *sockmsg_string(enum xsd_sockmsg_type type); =20 -#define log(...) \ - do { \ - char *s =3D talloc_asprintf(NULL, __VA_ARGS__); \ - if (s) { \ - trace("%s\n", s); \ - syslog(LOG_ERR, "%s\n", s); \ - talloc_free(s); \ - } else { \ - trace("talloc failure during logging\n"); \ - syslog(LOG_ERR, "talloc failure during logging\n"); \ - } \ - } while (0) - - int quota_nb_entry_per_domain =3D 1000; int quota_nb_watch_per_domain =3D 128; int quota_max_entry_size =3D 2048; /* 2K */ diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_cor= e.h index 3c4e27d0dd..3b96ecd018 100644 --- a/tools/xenstore/xenstored_core.h +++ b/tools/xenstore/xenstored_core.h @@ -267,6 +267,21 @@ void trace(const char *fmt, ...) __attribute__ ((forma= t (printf, 1, 2))); void reopen_log(void); void close_log(void); =20 +#define log(...) \ + do { \ + int _saved_errno =3D errno; \ + char *s =3D talloc_asprintf(NULL, __VA_ARGS__); \ + if (s) { \ + trace("%s\n", s); \ + syslog(LOG_ERR, "%s\n", s); \ + talloc_free(s); \ + } else { \ + trace("talloc failure during logging\n"); \ + syslog(LOG_ERR, "talloc failure during logging\n"); \ + } \ + errno =3D _saved_errno; \ + } while (0) + extern int orig_argc; extern char **orig_argv; =20 --=20 2.35.3