Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/qemu/message.h | 11 +----------
util/error-report.c | 9 +++++----
util/log.c | 2 +-
util/message.c | 7 +------
4 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/include/qemu/message.h b/include/qemu/message.h
index 6dbb068ca9..68b08f0ea7 100644
--- a/include/qemu/message.h
+++ b/include/qemu/message.h
@@ -28,25 +28,16 @@ void qmessage_set_format(int flags);
*/
void qmessage_set_workload_name(const char *name);
-enum QMessageContextFlags {
- QMESSAGE_CONTEXT_SKIP_MONITOR = (1 << 0),
-};
-
/**
* qmessage_context:
- * @flags: the message formatting control flags
*
* Format a message prefix with the information
* previously selected by a call to
* qmessage_set_format.
*
- * If @flags contains QMESSAGE_CONTEXT_SKIP_MONITOR
- * an empty string will be returned if running in
- * the context of a HMP command
- *
* Returns: a formatted message prefix, or empty string;
* to be freed by the caller.
*/
-char *qmessage_context(int flags);
+char *qmessage_context(void);
#endif /* QEMU_MESSAGE_H */
diff --git a/util/error-report.c b/util/error-report.c
index 2e58ee1c50..fa34019dad 100644
--- a/util/error-report.c
+++ b/util/error-report.c
@@ -172,10 +172,11 @@ static void print_loc(void)
G_GNUC_PRINTF(2, 0)
static void vreport(report_type type, const char *fmt, va_list ap)
{
- g_autofree gchar *context = qmessage_context(QMESSAGE_CONTEXT_SKIP_MONITOR);
-
- if (context != NULL) {
- error_printf("%s", context);
+ if (!monitor_cur()) {
+ g_autofree gchar *context = qmessage_context();
+ if (context) {
+ error_printf("%s", context);
+ }
}
print_loc();
diff --git a/util/log.c b/util/log.c
index 4b5953dcc7..b129634708 100644
--- a/util/log.c
+++ b/util/log.c
@@ -161,7 +161,7 @@ void qemu_log(const char *fmt, ...)
* acquiring the mutex
*/
g_autofree const char *context =
- incomplete ? NULL : qmessage_context(0);
+ incomplete ? NULL : qmessage_context();
f = qemu_log_trylock();
if (f) {
diff --git a/util/message.c b/util/message.c
index 6d3580b7be..8deba3940c 100644
--- a/util/message.c
+++ b/util/message.c
@@ -20,17 +20,12 @@ void qmessage_set_workload_name(const char *name)
}
-char *qmessage_context(int flags)
+char *qmessage_context(void)
{
g_autofree char *timestr = NULL;
const char *wknamestr = NULL;
const char *pgnamestr = NULL;
- if ((flags & QMESSAGE_CONTEXT_SKIP_MONITOR) &&
- monitor_cur()) {
- return NULL;
- }
-
if (message_format & QMESSAGE_FORMAT_TIMESTAMP) {
g_autoptr(GDateTime) dt = g_date_time_new_now_utc();
timestr = g_date_time_format_iso8601(dt);
--
2.43.0