qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

trace: Simplify how st_print_trace_file_status() prints

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 <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20190417191805.28198-3-armbru@redhat.com>

+6 -5
+1 -1
monitor.c
··· 1056 1056 const char *arg = qdict_get_try_str(qdict, "arg"); 1057 1057 1058 1058 if (!op) { 1059 - st_print_trace_file_status((FILE *)mon, &monitor_fprintf); 1059 + st_print_trace_file_status(); 1060 1060 } else if (!strcmp(op, "on")) { 1061 1061 st_set_trace_file_enabled(true); 1062 1062 } else if (!strcmp(op, "off")) {
+4 -3
trace/simple.c
··· 16 16 #include "trace/control.h" 17 17 #include "trace/simple.h" 18 18 #include "qemu/error-report.h" 19 + #include "qemu/qemu-print.h" 19 20 20 21 /** Trace file header event ID, picked to avoid conflict with real event IDs */ 21 22 #define HEADER_EVENT_ID (~(uint64_t)0) ··· 363 364 st_set_trace_file_enabled(true); 364 365 } 365 366 366 - void st_print_trace_file_status(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...)) 367 + void st_print_trace_file_status(void) 367 368 { 368 - stream_printf(stream, "Trace file \"%s\" %s.\n", 369 - trace_file_name, trace_fp ? "on" : "off"); 369 + qemu_printf("Trace file \"%s\" %s.\n", 370 + trace_file_name, trace_fp ? "on" : "off"); 370 371 } 371 372 372 373 void st_flush_trace_buffer(void)
+1 -1
trace/simple.h
··· 11 11 #ifndef TRACE_SIMPLE_H 12 12 #define TRACE_SIMPLE_H 13 13 14 - void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf); 14 + void st_print_trace_file_status(void); 15 15 void st_set_trace_file_enabled(bool enable); 16 16 void st_set_trace_file(const char *file); 17 17 bool st_init(void);