util/log: add CONFIG_DISABLE_QEMU_LOG macro

Using CONFIG_DISABLE_QEMU_LOG macro to control
qemu_log function.

Signed-off-by: Yan Wang <wangyan122@huawei.com>
Signed-off-by: imxcc <xingchaochao@huawei.com>
(cherry picked from commit 0cea596fd445015a851dbd2bfe634644ae30883a)
This commit is contained in:
Chen Qun 2022-02-11 18:20:59 +08:00 committed by yezengruan
parent 325dad94cd
commit a12280840f

View File

@ -0,0 +1,41 @@
From 05462305ec8b9ce5b414ede1e7e680b16d1a08ad Mon Sep 17 00:00:00 2001
From: Yan Wang <wangyan122@huawei.com>
Date: Fri, 11 Feb 2022 18:20:59 +0800
Subject: [PATCH] util/log: add CONFIG_DISABLE_QEMU_LOG macro
Using CONFIG_DISABLE_QEMU_LOG macro to control
qemu_log function.
Signed-off-by: Yan Wang <wangyan122@huawei.com>
---
util/log.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/util/log.c b/util/log.c
index 2ee1500bee..ed3029fe5c 100644
--- a/util/log.c
+++ b/util/log.c
@@ -34,6 +34,12 @@ int qemu_loglevel;
static int log_append = 0;
static GArray *debug_regions;
+#ifdef CONFIG_DISABLE_QEMU_LOG
+int qemu_log(const char *fmt, ...)
+{
+ return 0;
+}
+#else
/* Return the number of characters emitted. */
int qemu_log(const char *fmt, ...)
{
@@ -56,6 +62,7 @@ int qemu_log(const char *fmt, ...)
rcu_read_unlock();
return ret;
}
+#endif
static void __attribute__((__constructor__)) qemu_logfile_init(void)
{
--
2.27.0