qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: dgilbert@redhat.com
Subject: [Qemu-devel] [PATCH 02/17] trace: Simplify how st_print_trace_file_status() prints
Date: Thu, 11 Apr 2019 17:25:05 +0200	[thread overview]
Message-ID: <20190411152520.10061-3-armbru@redhat.com> (raw)
In-Reply-To: <20190411152520.10061-1-armbru@redhat.com>

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>
---
 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

  parent reply	other threads:[~2019-04-11 15:25 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 15:25 [Qemu-devel] [PATCH 00/17] Clean up and simplify around fprintf_function Markus Armbruster
2019-04-11 15:25 ` Markus Armbruster
2019-04-11 15:25 ` [Qemu-devel] [PATCH 01/17] include: Include fprintf-fn.h only where needed Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 16:53   ` Dr. David Alan Gilbert
2019-04-12 16:53     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` Markus Armbruster [this message]
2019-04-11 15:25   ` [Qemu-devel] [PATCH 02/17] trace: Simplify how st_print_trace_file_status() prints Markus Armbruster
2019-04-12 16:55   ` Dr. David Alan Gilbert
2019-04-12 16:55     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 03/17] tcg: Simplify how dump_opcount_info() prints Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 16:58   ` Dr. David Alan Gilbert
2019-04-12 16:58     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 04/17] tcg: Simplify how dump_exec_info() prints Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 17:09   ` Dr. David Alan Gilbert
2019-04-12 17:09     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 05/17] tcg: Simplify how dump_drift_info() prints Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 17:18   ` Dr. David Alan Gilbert
2019-04-12 17:18     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 06/17] qsp: Simplify how qsp_report() prints Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 17:25   ` Dr. David Alan Gilbert
2019-04-12 17:25     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 07/17] block/qapi: Clean up how we print to monitor or stdout Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 17:59   ` Dr. David Alan Gilbert
2019-04-12 17:59     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 08/17] memory: Clean up how mtree_info() prints Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 17:44   ` Dr. David Alan Gilbert
2019-04-12 17:44     ` Dr. David Alan Gilbert
2019-04-12 18:25     ` Markus Armbruster
2019-04-12 18:25       ` Markus Armbruster
2019-04-11 15:25 ` [Qemu-devel] [PATCH 09/17] target: Simplify how the TARGET_cpu_list() print Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-15 15:43   ` Dr. David Alan Gilbert
2019-04-15 15:43     ` Dr. David Alan Gilbert
2019-04-16  6:14     ` Markus Armbruster
2019-04-16  6:14       ` Markus Armbruster
2019-04-16  8:20       ` Dr. David Alan Gilbert
2019-04-16  8:20         ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 10/17] target: Clean up how the dump_mmu() print Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-15 15:53   ` Dr. David Alan Gilbert
2019-04-15 15:53     ` Dr. David Alan Gilbert
2019-04-16  6:23     ` Markus Armbruster
2019-04-16  6:23       ` Markus Armbruster
2019-04-11 15:25 ` [Qemu-devel] [PATCH 11/17] target/i386: Simplify how x86_cpu_dump_local_apic_state() prints Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 17:49   ` Dr. David Alan Gilbert
2019-04-12 17:49     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 12/17] qom/cpu: Simplify how CPUClass::dump_statistics() prints Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 17:50   ` Dr. David Alan Gilbert
2019-04-12 17:50     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 13/17] qemu-print: New qemu_fprintf(), qemu_vfprintf() Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 17:53   ` Dr. David Alan Gilbert
2019-04-12 17:53     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 14/17] qom/cpu: Simplify how CPUClass:cpu_dump_state() prints Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-15 16:47   ` Dr. David Alan Gilbert
2019-04-15 16:47     ` Dr. David Alan Gilbert
2019-04-16  6:32     ` Markus Armbruster
2019-04-16  6:32       ` Markus Armbruster
2019-04-11 15:25 ` [Qemu-devel] [PATCH 15/17] monitor: Clean up how monitor_disas() funnels output to monitor Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 18:01   ` Dr. David Alan Gilbert
2019-04-12 18:01     ` Dr. David Alan Gilbert
2019-04-11 15:25 ` [Qemu-devel] [PATCH 16/17] disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-11 15:25 ` [Qemu-devel] [PATCH 17/17] include: Move fprintf_function to disas/ Markus Armbruster
2019-04-11 15:25   ` Markus Armbruster
2019-04-12 18:39   ` Dr. David Alan Gilbert
2019-04-12 18:39     ` Dr. David Alan Gilbert
2019-04-13  4:59     ` Markus Armbruster
2019-04-13  4:59       ` Markus Armbruster
2019-04-11 15:49 ` [Qemu-devel] [PATCH 00/17] Clean up and simplify around fprintf_function no-reply
2019-04-11 15:49   ` no-reply

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=20190411152520.10061-3-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).