]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
util/log: Remove qemu_log_flush
authorRichard Henderson <richard.henderson@linaro.org>
Sun, 17 Apr 2022 18:29:59 +0000 (11:29 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 20 Apr 2022 17:51:11 +0000 (10:51 -0700)
All uses flush output immediately before or after qemu_log_unlock.
Instead of a separate call, move the flush into qemu_log_unlock.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220417183019.755276-20-richard.henderson@linaro.org>

accel/tcg/translate-all.c
cpu.c
hw/net/can/can_sja1000.c
hw/xen/xen_pvdev.c
include/qemu/log.h
net/can/can_socketcan.c
tcg/tcg.c
util/log.c

index 6230f3c022f4ff36b2d9e595266db2ad4fda7d58..291034cb093211fdacd4b61b08d8ffd1fefc2e7e 100644 (file)
@@ -1594,7 +1594,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
                 }
             }
             fprintf(logfile, "\n");
-            qemu_log_flush();
             qemu_log_unlock(logfile);
         }
     }
diff --git a/cpu.c b/cpu.c
index ded4173d4096c96b5cea38f6546020d5d90598e2..7076ec123ad336ecb2b865147c1a6644e4e2739d 100644 (file)
--- a/cpu.c
+++ b/cpu.c
@@ -405,7 +405,6 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...)
             vfprintf(logfile, fmt, ap2);
             fprintf(logfile, "\n");
             cpu_dump_state(cpu, logfile, CPU_DUMP_FPU | CPU_DUMP_CCOP);
-            qemu_log_flush();
             qemu_log_unlock(logfile);
         }
         qemu_log_close();
index 23d634af6f1b41c0e6288dd7ea8f268b73809501..e0f76d3eb38feb65fb69517ba78ff572f77894c4 100644 (file)
@@ -261,7 +261,6 @@ static void can_display_msg(const char *prefix, const qemu_can_frame *msg)
             fprintf(logfile, " %02X", msg->data[i]);
         }
         fprintf(logfile, "\n");
-        qemu_log_flush();
         qemu_log_unlock(logfile);
     }
 }
index 0423c611585762455265f22dfa7a203c439e40e6..037152f06350b19dcd06e39cca1fe8b496698fa4 100644 (file)
@@ -230,7 +230,6 @@ void xen_pv_printf(struct XenLegacyDevice *xendev, int msg_level,
         xen_pv_output_msg(xendev, stderr, fmt, args);
         va_end(args);
     }
-    qemu_log_flush();
 }
 
 void xen_pv_evtchn_event(void *opaque)
index 3a1f3a60203f3cc5fc8d4d1a3b910d7fb0077663..75973111bb33b1af29405c234e06e40791056966 100644 (file)
@@ -121,8 +121,6 @@ int qemu_str_to_log_mask(const char *str);
  */
 void qemu_print_log_usage(FILE *f);
 
-/* fflush() the log file */
-void qemu_log_flush(void);
 /* Close the log file */
 void qemu_log_close(void);
 
index a6388563c310c8c33eaecaa7133380d55f98c726..c1a1ad05636bf79affb4c39552a455c4f7864db5 100644 (file)
@@ -89,7 +89,6 @@ static void can_host_socketcan_display_msg(struct qemu_can_frame *msg)
             fprintf(logfile, " %02X", msg->data[i]);
         }
         fprintf(logfile, "\n");
-        qemu_log_flush();
         qemu_log_unlock(logfile);
     }
 }
index 79a5e2816f48a95b1ea073fe69a5cae3c1aa82f5..13c16c2bd077fbd71a8515fd2e06c04a91666243 100644 (file)
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -783,7 +783,6 @@ void tcg_prologue_init(TCGContext *s)
                 disas(logfile, s->code_gen_ptr, prologue_size);
             }
             fprintf(logfile, "\n");
-            qemu_log_flush();
             qemu_log_unlock(logfile);
         }
     }
index 2bd4dfba1bcd244c616f45b98319e220edd887a6..cab0642a7f147ae83dbc80855d7856f2cae47ff1 100644 (file)
@@ -54,6 +54,7 @@ FILE *qemu_log_trylock(void)
 void qemu_log_unlock(FILE *fd)
 {
     if (fd) {
+        fflush(fd);
         qemu_funlockfile(fd);
         rcu_read_unlock();
     }
@@ -269,19 +270,6 @@ out:
     g_strfreev(ranges);
 }
 
-/* fflush() the log file */
-void qemu_log_flush(void)
-{
-    QemuLogFile *logfile;
-
-    rcu_read_lock();
-    logfile = qatomic_rcu_read(&qemu_logfile);
-    if (logfile) {
-        fflush(logfile->fd);
-    }
-    rcu_read_unlock();
-}
-
 /* Close the log file */
 void qemu_log_close(void)
 {