qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"John Snow" <jsnow@redhat.com>,
	"Xie Yongji" <xieyongji@bytedance.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH v3 04/16] error-report: introduce overridable error_is_detailed()
Date: Wed, 10 Aug 2022 16:48:45 +0400	[thread overview]
Message-ID: <20220810124857.1360211-5-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20220810124857.1360211-1-marcandre.lureau@redhat.com>

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Remove the direct dependency from error-report to monitor code.
This will allow to move error-report to a subproject.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Warner Losh <imp@bsdimp.com>
---
 include/qemu/error-report.h | 2 ++
 softmmu/vl.c                | 5 +++++
 stubs/error-is-detailed.c   | 7 +++++++
 util/error-report.c         | 3 +--
 stubs/meson.build           | 1 +
 5 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 stubs/error-is-detailed.c

diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h
index 3ae2357fda..6ab25d4583 100644
--- a/include/qemu/error-report.h
+++ b/include/qemu/error-report.h
@@ -30,6 +30,8 @@ void loc_set_none(void);
 void loc_set_cmdline(char **argv, int idx, int cnt);
 void loc_set_file(const char *fname, int lno);
 
+bool error_is_detailed(void);
+
 int error_vprintf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
 int error_printf(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
 
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 706bd7cff7..069ea50bed 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2603,6 +2603,11 @@ void qmp_x_exit_preconfig(Error **errp)
     }
 }
 
+bool error_is_detailed(void)
+{
+    return !monitor_cur();
+}
+
 void qemu_init(int argc, char **argv, char **envp)
 {
     QemuOpts *opts;
diff --git a/stubs/error-is-detailed.c b/stubs/error-is-detailed.c
new file mode 100644
index 0000000000..c47cd23693
--- /dev/null
+++ b/stubs/error-is-detailed.c
@@ -0,0 +1,7 @@
+#include "qemu/osdep.h"
+#include "qemu/error-report.h"
+
+bool error_is_detailed(void)
+{
+    return TRUE;
+}
diff --git a/util/error-report.c b/util/error-report.c
index c43227a975..4d1d66fc06 100644
--- a/util/error-report.c
+++ b/util/error-report.c
@@ -11,7 +11,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "monitor/monitor.h"
 #include "qemu/error-report.h"
 
 /*
@@ -195,7 +194,7 @@ real_time_iso8601(void)
  */
 static void vreport(report_type type, const char *fmt, va_list ap)
 {
-    bool detailed = !monitor_cur();
+    bool detailed = error_is_detailed();
     gchar *timestr;
 
     if (message_with_timestamp && detailed) {
diff --git a/stubs/meson.build b/stubs/meson.build
index d8f3fd5c44..0f3a782824 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -9,6 +9,7 @@ stub_ss.add(files('cpus-get-virtual-clock.c'))
 stub_ss.add(files('qemu-timer-notify-cb.c'))
 stub_ss.add(files('icount.c'))
 stub_ss.add(files('dump.c'))
+stub_ss.add(files('error-is-detailed.c'))
 stub_ss.add(files('error-printf.c'))
 stub_ss.add(files('fdset.c'))
 stub_ss.add(files('gdbstub.c'))
-- 
2.37.1



  parent reply	other threads:[~2022-08-10 12:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10 12:48 [PATCH v3 00/16] Preliminary patches for subproject split marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 01/16] error-report: misc comment fix marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 02/16] error-report: introduce "detailed" variable marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 03/16] error-report: simplify print_loc() marcandre.lureau
2022-08-10 12:48 ` marcandre.lureau [this message]
2022-08-10 12:48 ` [PATCH v3 05/16] stubs: remove needless error_vprintf_unless_qmp() marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 06/16] qapi: move QEMU-specific dispatch code in monitor marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 07/16] qapi: remove QEMU-specific monitor dependency from dispatch marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 08/16] scripts/qapi-gen: add -i option marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 09/16] scripts/qapi: add required system includes to visitor marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 10/16] util: move 256-by-128 division helpers to int128 marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 11/16] qemu-common: introduce a common subproject marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 12/16] qemu-common: move scripts/qapi marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 13/16] qemu-common: move glib-compat.h marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 14/16] qemu-common: move error-report marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 15/16] mtest2make.py: teach suite name that are just "PROJECT" marcandre.lureau
2022-08-10 12:48 ` [PATCH v3 16/16] qemu-common: add error-report test marcandre.lureau

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=20220810124857.1360211-5-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=xieyongji@bytedance.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).