[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL for-4.1 21/36] trace: Simplify how st_print_trace_fil
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL for-4.1 21/36] trace: Simplify how st_print_trace_file_status() prints |
Date: |
Thu, 18 Apr 2019 22:51:20 +0200 |
st_print_trace_file_status() takes an fprintf()-like callback and a
FILE * to pass to it.
Its only caller hmp_trace_file() passes monitor_fprintf() and the
current monitor cast to FILE *. monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf(). The
type-punning is ugly.
Drop the callback, and call qemu_printf() instead.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Message-Id: <address@hidden>
---
monitor.c | 2 +-
trace/simple.c | 7 ++++---
trace/simple.h | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/monitor.c b/monitor.c
index 10be8bdb86..a3e66b7159 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1056,7 +1056,7 @@ static void hmp_trace_file(Monitor *mon, const QDict
*qdict)
const char *arg = qdict_get_try_str(qdict, "arg");
if (!op) {
- st_print_trace_file_status((FILE *)mon, &monitor_fprintf);
+ st_print_trace_file_status();
} else if (!strcmp(op, "on")) {
st_set_trace_file_enabled(true);
} else if (!strcmp(op, "off")) {
diff --git a/trace/simple.c b/trace/simple.c
index ac904eca91..fc7106ec49 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -16,6 +16,7 @@
#include "trace/control.h"
#include "trace/simple.h"
#include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
/** Trace file header event ID, picked to avoid conflict with real event IDs */
#define HEADER_EVENT_ID (~(uint64_t)0)
@@ -363,10 +364,10 @@ void st_set_trace_file(const char *file)
st_set_trace_file_enabled(true);
}
-void st_print_trace_file_status(FILE *stream, int (*stream_printf)(FILE
*stream, const char *fmt, ...))
+void st_print_trace_file_status(void)
{
- stream_printf(stream, "Trace file \"%s\" %s.\n",
- trace_file_name, trace_fp ? "on" : "off");
+ qemu_printf("Trace file \"%s\" %s.\n",
+ trace_file_name, trace_fp ? "on" : "off");
}
void st_flush_trace_buffer(void)
diff --git a/trace/simple.h b/trace/simple.h
index 9931808c05..5771a0634f 100644
--- a/trace/simple.h
+++ b/trace/simple.h
@@ -11,7 +11,7 @@
#ifndef TRACE_SIMPLE_H
#define TRACE_SIMPLE_H
-void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf);
+void st_print_trace_file_status(void);
void st_set_trace_file_enabled(bool enable);
void st_set_trace_file(const char *file);
bool st_init(void);
--
2.17.2
- [Qemu-devel] [PULL for-4.1 11/36] vfio: Report warnings with warn_report(), not error_printf(), (continued)
- [Qemu-devel] [PULL for-4.1 11/36] vfio: Report warnings with warn_report(), not error_printf(), Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 20/36] include: Include fprintf-fn.h only where needed, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 19/36] monitor: Simplify how -device/device_add print help, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 30/36] target/i386: Simplify how x86_cpu_dump_local_apic_state() prints, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 34/36] monitor: Clean up how monitor_disas() funnels output to monitor, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 17/36] char: Make -chardev help print to stdout, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 28/36] target: Simplify how the TARGET_cpu_list() print, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 35/36] disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 18/36] char-pty: Print "char device redirected" message to stdout, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 09/36] pci: Report fatal errors with error_report(), not error_printf(), Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 21/36] trace: Simplify how st_print_trace_file_status() prints,
Markus Armbruster <=
- [Qemu-devel] [PULL for-4.1 10/36] hpet: Report warnings with warn_report(), not error_printf(), Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 15/36] qemu-print: New qemu_printf(), qemu_vprintf() etc., Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 05/36] qemu-img: Use error_vreport() in error_exit(), Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 26/36] block/qapi: Clean up how we print to monitor or stdout, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 23/36] tcg: Simplify how dump_exec_info() prints, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 25/36] qsp: Simplify how qsp_report() prints, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 24/36] tcg: Simplify how dump_drift_info() prints, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 16/36] blockdev: Make -drive format=help print to stdout, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 06/36] block/ssh: Do not report read/write/flush errors to the user, Markus Armbruster, 2019/04/18
- [Qemu-devel] [PULL for-4.1 27/36] memory: Clean up how mtree_info() prints, Markus Armbruster, 2019/04/18