From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>, Wei Liu <wl@xen.org>,
Julien Grall <julien@xen.org>,
Anthony PERARD <anthony.perard@citrix.com>,
Julien Grall <jgrall@amazon.com>
Subject: [PATCH v3 14/17] tools/xenstore: make log macro globally available
Date: Tue, 17 Jan 2023 10:11:21 +0100 [thread overview]
Message-ID: <20230117091124.22170-15-jgross@suse.com> (raw)
In-Reply-To: <20230117091124.22170-1-jgross@suse.com>
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 <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
---
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_core.c
index f27209dec8..d55ce632d8 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -88,20 +88,6 @@ TDB_CONTEXT *tdb_ctx = NULL;
static const char *sockmsg_string(enum xsd_sockmsg_type type);
-#define log(...) \
- do { \
- char *s = 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 = 1000;
int quota_nb_watch_per_domain = 128;
int quota_max_entry_size = 2048; /* 2K */
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.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__ ((format (printf, 1, 2)));
void reopen_log(void);
void close_log(void);
+#define log(...) \
+ do { \
+ int _saved_errno = errno; \
+ char *s = 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 = _saved_errno; \
+ } while (0)
+
extern int orig_argc;
extern char **orig_argv;
--
2.35.3
next prev parent reply other threads:[~2023-01-17 9:12 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 9:11 [PATCH v3 00/17] tools/xenstore: do some cleanup and fixes Juergen Gross
2023-01-17 9:11 ` [PATCH v3 01/17] tools/xenstore: let talloc_free() preserve errno Juergen Gross
2023-01-17 13:56 ` Julien Grall
2023-01-17 9:11 ` [PATCH v3 02/17] tools/xenstore: remove all watches when a domain has stopped Juergen Gross
2023-01-17 9:11 ` [PATCH v3 03/17] tools/xenstore: add hashlist for finding struct domain by domid Juergen Gross
2023-01-17 9:11 ` [PATCH v3 04/17] tools/xenstore: introduce dummy nodes for special watch paths Juergen Gross
2023-01-17 14:02 ` Julien Grall
2023-01-17 15:50 ` Juergen Gross
2023-01-17 9:11 ` [PATCH v3 05/17] tools/xenstore: replace watch->relative_path with a prefix length Juergen Gross
2023-01-17 14:04 ` Julien Grall
2023-01-17 9:11 ` [PATCH v3 06/17] tools/xenstore: move changed domain handling Juergen Gross
2023-01-17 14:06 ` Julien Grall
2023-01-17 9:11 ` [PATCH v3 07/17] tools/xenstore: change per-domain node accounting interface Juergen Gross
2023-01-18 7:31 ` Juergen Gross
2023-01-17 9:11 ` [PATCH v3 08/17] tools/xenstore: don't allow creating too many nodes in a transaction Juergen Gross
2023-01-17 14:08 ` Julien Grall
2023-01-17 15:51 ` Juergen Gross
2023-01-17 9:11 ` [PATCH v3 09/17] tools/xenstore: replace literal domid 0 with dom0_domid Juergen Gross
2023-01-17 9:11 ` [PATCH v3 10/17] tools/xenstore: make domain_is_unprivileged() an inline function Juergen Gross
2023-01-17 9:11 ` [PATCH v3 11/17] tools/xenstore: let chk_domain_generation() return a bool Juergen Gross
2023-01-17 9:11 ` [PATCH v3 12/17] tools/xenstore: don't let hashtable_remove() return the removed value Juergen Gross
2023-01-17 22:03 ` Julien Grall
2023-01-18 6:17 ` Juergen Gross
2023-01-18 9:27 ` Julien Grall
2023-01-17 9:11 ` [PATCH v3 13/17] tools/xenstore: switch hashtable to use the talloc framework Juergen Gross
2023-01-18 9:30 ` Julien Grall
2023-01-17 9:11 ` Juergen Gross [this message]
2023-01-17 9:11 ` [PATCH v3 15/17] tools/xenstore: introduce trace classes Juergen Gross
2023-01-17 22:15 ` Julien Grall
2023-01-18 6:18 ` Juergen Gross
2023-01-17 9:11 ` [PATCH v3 16/17] tools/xenstore: let check_store() check the accounting data Juergen Gross
2023-01-17 22:36 ` Julien Grall
2023-01-18 6:23 ` Juergen Gross
2023-01-18 9:35 ` Julien Grall
2023-01-18 9:37 ` Juergen Gross
2023-01-17 9:11 ` [PATCH v3 17/17] tools/xenstore: make output of "xenstore-control help" more pretty Juergen Gross
2023-01-17 22:39 ` Julien Grall
2023-01-17 9:37 ` [PATCH v3 00/17] tools/xenstore: do some cleanup and fixes Jan Beulich
2023-01-17 9:50 ` Juergen Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230117091124.22170-15-jgross@suse.com \
--to=jgross@suse.com \
--cc=anthony.perard@citrix.com \
--cc=jgrall@amazon.com \
--cc=julien@xen.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.