From eb29ff04cae14f43590190e416db8008d718d376 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 22 Feb 2018 11:11:31 -0500 Subject: [PATCH] log: move qemu_log_close/qemu_log_flush from header to log.c There is no particular reason to keep these functions in the header. Suggested by Paolo. Backports commit 99affd1d5bd4e396ecda50e53dfbc5147fa1313d from qemu --- qemu/aarch64.h | 2 -- qemu/aarch64eb.h | 2 -- qemu/arm.h | 2 -- qemu/armeb.h | 2 -- qemu/header_gen.py | 2 -- qemu/include/qemu/log.h | 22 +++++----------------- qemu/m68k.h | 2 -- qemu/mips.h | 2 -- qemu/mips64.h | 2 -- qemu/mips64el.h | 2 -- qemu/mipsel.h | 2 -- qemu/powerpc.h | 2 -- qemu/qemu-log.c | 17 +++++++++++++++++ qemu/sparc.h | 2 -- qemu/sparc64.h | 2 -- qemu/x86_64.h | 2 -- 16 files changed, 22 insertions(+), 45 deletions(-) diff --git a/qemu/aarch64.h b/qemu/aarch64.h index 669a4f99..854e7315 100644 --- a/qemu/aarch64.h +++ b/qemu/aarch64.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_aarch64 #define qemu_init_vcpu qemu_init_vcpu_aarch64 #define qemu_ld_helpers qemu_ld_helpers_aarch64 -#define qemu_log_close qemu_log_close_aarch64 #define qemu_log_enabled qemu_log_enabled_aarch64 -#define qemu_log_flush qemu_log_flush_aarch64 #define qemu_loglevel_mask qemu_loglevel_mask_aarch64 #define qemu_log_vprintf qemu_log_vprintf_aarch64 #define qemu_oom_check qemu_oom_check_aarch64 diff --git a/qemu/aarch64eb.h b/qemu/aarch64eb.h index 8401886d..d07dff1c 100644 --- a/qemu/aarch64eb.h +++ b/qemu/aarch64eb.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_aarch64eb #define qemu_init_vcpu qemu_init_vcpu_aarch64eb #define qemu_ld_helpers qemu_ld_helpers_aarch64eb -#define qemu_log_close qemu_log_close_aarch64eb #define qemu_log_enabled qemu_log_enabled_aarch64eb -#define qemu_log_flush qemu_log_flush_aarch64eb #define qemu_loglevel_mask qemu_loglevel_mask_aarch64eb #define qemu_log_vprintf qemu_log_vprintf_aarch64eb #define qemu_oom_check qemu_oom_check_aarch64eb diff --git a/qemu/arm.h b/qemu/arm.h index 8719df6d..e1ef4b40 100644 --- a/qemu/arm.h +++ b/qemu/arm.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_arm #define qemu_init_vcpu qemu_init_vcpu_arm #define qemu_ld_helpers qemu_ld_helpers_arm -#define qemu_log_close qemu_log_close_arm #define qemu_log_enabled qemu_log_enabled_arm -#define qemu_log_flush qemu_log_flush_arm #define qemu_loglevel_mask qemu_loglevel_mask_arm #define qemu_log_vprintf qemu_log_vprintf_arm #define qemu_oom_check qemu_oom_check_arm diff --git a/qemu/armeb.h b/qemu/armeb.h index 4b521380..ae109f79 100644 --- a/qemu/armeb.h +++ b/qemu/armeb.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_armeb #define qemu_init_vcpu qemu_init_vcpu_armeb #define qemu_ld_helpers qemu_ld_helpers_armeb -#define qemu_log_close qemu_log_close_armeb #define qemu_log_enabled qemu_log_enabled_armeb -#define qemu_log_flush qemu_log_flush_armeb #define qemu_loglevel_mask qemu_loglevel_mask_armeb #define qemu_log_vprintf qemu_log_vprintf_armeb #define qemu_oom_check qemu_oom_check_armeb diff --git a/qemu/header_gen.py b/qemu/header_gen.py index 43ff0e2e..70b5fdfb 100644 --- a/qemu/header_gen.py +++ b/qemu/header_gen.py @@ -2439,9 +2439,7 @@ symbols = ( 'qemu_host_page_size', 'qemu_init_vcpu', 'qemu_ld_helpers', - 'qemu_log_close', 'qemu_log_enabled', - 'qemu_log_flush', 'qemu_loglevel_mask', 'qemu_log_vprintf', 'qemu_oom_check', diff --git a/qemu/include/qemu/log.h b/qemu/include/qemu/log.h index 1fae5feb..c9cce4fd 100644 --- a/qemu/include/qemu/log.h +++ b/qemu/include/qemu/log.h @@ -121,24 +121,12 @@ static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags) } } -/* fflush() the log file */ -static inline void qemu_log_flush(void) -{ - fflush(qemu_logfile); -} - -/* Close the log file */ -static inline void qemu_log_close(void) -{ - if (qemu_logfile) { - if (qemu_logfile != stderr) { - fclose(qemu_logfile); - } - qemu_logfile = NULL; - } -} - void qemu_set_dfilter_ranges(const char *ranges); bool qemu_log_in_addr_range(uint64_t addr); +/* fflush() the log file */ +void qemu_log_flush(void); +/* Close the log file */ +void qemu_log_close(void); + #endif diff --git a/qemu/m68k.h b/qemu/m68k.h index fcc2fe53..5774f03b 100644 --- a/qemu/m68k.h +++ b/qemu/m68k.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_m68k #define qemu_init_vcpu qemu_init_vcpu_m68k #define qemu_ld_helpers qemu_ld_helpers_m68k -#define qemu_log_close qemu_log_close_m68k #define qemu_log_enabled qemu_log_enabled_m68k -#define qemu_log_flush qemu_log_flush_m68k #define qemu_loglevel_mask qemu_loglevel_mask_m68k #define qemu_log_vprintf qemu_log_vprintf_m68k #define qemu_oom_check qemu_oom_check_m68k diff --git a/qemu/mips.h b/qemu/mips.h index 3c09ed00..dc3e308f 100644 --- a/qemu/mips.h +++ b/qemu/mips.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_mips #define qemu_init_vcpu qemu_init_vcpu_mips #define qemu_ld_helpers qemu_ld_helpers_mips -#define qemu_log_close qemu_log_close_mips #define qemu_log_enabled qemu_log_enabled_mips -#define qemu_log_flush qemu_log_flush_mips #define qemu_loglevel_mask qemu_loglevel_mask_mips #define qemu_log_vprintf qemu_log_vprintf_mips #define qemu_oom_check qemu_oom_check_mips diff --git a/qemu/mips64.h b/qemu/mips64.h index d0cf0986..73c7ce3f 100644 --- a/qemu/mips64.h +++ b/qemu/mips64.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_mips64 #define qemu_init_vcpu qemu_init_vcpu_mips64 #define qemu_ld_helpers qemu_ld_helpers_mips64 -#define qemu_log_close qemu_log_close_mips64 #define qemu_log_enabled qemu_log_enabled_mips64 -#define qemu_log_flush qemu_log_flush_mips64 #define qemu_loglevel_mask qemu_loglevel_mask_mips64 #define qemu_log_vprintf qemu_log_vprintf_mips64 #define qemu_oom_check qemu_oom_check_mips64 diff --git a/qemu/mips64el.h b/qemu/mips64el.h index cf3fc1e8..7c14e89c 100644 --- a/qemu/mips64el.h +++ b/qemu/mips64el.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_mips64el #define qemu_init_vcpu qemu_init_vcpu_mips64el #define qemu_ld_helpers qemu_ld_helpers_mips64el -#define qemu_log_close qemu_log_close_mips64el #define qemu_log_enabled qemu_log_enabled_mips64el -#define qemu_log_flush qemu_log_flush_mips64el #define qemu_loglevel_mask qemu_loglevel_mask_mips64el #define qemu_log_vprintf qemu_log_vprintf_mips64el #define qemu_oom_check qemu_oom_check_mips64el diff --git a/qemu/mipsel.h b/qemu/mipsel.h index 1af1082d..568a8665 100644 --- a/qemu/mipsel.h +++ b/qemu/mipsel.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_mipsel #define qemu_init_vcpu qemu_init_vcpu_mipsel #define qemu_ld_helpers qemu_ld_helpers_mipsel -#define qemu_log_close qemu_log_close_mipsel #define qemu_log_enabled qemu_log_enabled_mipsel -#define qemu_log_flush qemu_log_flush_mipsel #define qemu_loglevel_mask qemu_loglevel_mask_mipsel #define qemu_log_vprintf qemu_log_vprintf_mipsel #define qemu_oom_check qemu_oom_check_mipsel diff --git a/qemu/powerpc.h b/qemu/powerpc.h index ceb4c85d..f87fbad5 100644 --- a/qemu/powerpc.h +++ b/qemu/powerpc.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_powerpc #define qemu_init_vcpu qemu_init_vcpu_powerpc #define qemu_ld_helpers qemu_ld_helpers_powerpc -#define qemu_log_close qemu_log_close_powerpc #define qemu_log_enabled qemu_log_enabled_powerpc -#define qemu_log_flush qemu_log_flush_powerpc #define qemu_loglevel_mask qemu_loglevel_mask_powerpc #define qemu_log_vprintf qemu_log_vprintf_powerpc #define qemu_oom_check qemu_oom_check_powerpc diff --git a/qemu/qemu-log.c b/qemu/qemu-log.c index 4e9f38ee..960d9c3a 100644 --- a/qemu/qemu-log.c +++ b/qemu/qemu-log.c @@ -35,6 +35,23 @@ void qemu_log(const char *fmt, ...) va_end(ap); } +/* fflush() the log file */ +void qemu_log_flush(void) +{ + fflush(qemu_logfile); +} + +/* Close the log file */ +void qemu_log_close(void) +{ + if (qemu_logfile) { + if (qemu_logfile != stderr) { + fclose(qemu_logfile); + } + qemu_logfile = NULL; + } +} + /* Returns true if addr is in our debug filter or no filter defined */ bool qemu_log_in_addr_range(uint64_t addr) diff --git a/qemu/sparc.h b/qemu/sparc.h index 09f6d45f..7ec13025 100644 --- a/qemu/sparc.h +++ b/qemu/sparc.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_sparc #define qemu_init_vcpu qemu_init_vcpu_sparc #define qemu_ld_helpers qemu_ld_helpers_sparc -#define qemu_log_close qemu_log_close_sparc #define qemu_log_enabled qemu_log_enabled_sparc -#define qemu_log_flush qemu_log_flush_sparc #define qemu_loglevel_mask qemu_loglevel_mask_sparc #define qemu_log_vprintf qemu_log_vprintf_sparc #define qemu_oom_check qemu_oom_check_sparc diff --git a/qemu/sparc64.h b/qemu/sparc64.h index 79289573..3e0c33c0 100644 --- a/qemu/sparc64.h +++ b/qemu/sparc64.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_sparc64 #define qemu_init_vcpu qemu_init_vcpu_sparc64 #define qemu_ld_helpers qemu_ld_helpers_sparc64 -#define qemu_log_close qemu_log_close_sparc64 #define qemu_log_enabled qemu_log_enabled_sparc64 -#define qemu_log_flush qemu_log_flush_sparc64 #define qemu_loglevel_mask qemu_loglevel_mask_sparc64 #define qemu_log_vprintf qemu_log_vprintf_sparc64 #define qemu_oom_check qemu_oom_check_sparc64 diff --git a/qemu/x86_64.h b/qemu/x86_64.h index 60bd5af3..834dbb0d 100644 --- a/qemu/x86_64.h +++ b/qemu/x86_64.h @@ -2433,9 +2433,7 @@ #define qemu_host_page_size qemu_host_page_size_x86_64 #define qemu_init_vcpu qemu_init_vcpu_x86_64 #define qemu_ld_helpers qemu_ld_helpers_x86_64 -#define qemu_log_close qemu_log_close_x86_64 #define qemu_log_enabled qemu_log_enabled_x86_64 -#define qemu_log_flush qemu_log_flush_x86_64 #define qemu_loglevel_mask qemu_loglevel_mask_x86_64 #define qemu_log_vprintf qemu_log_vprintf_x86_64 #define qemu_oom_check qemu_oom_check_x86_64