Message ID | 1457954501-26528-5-git-send-email-den@openvz.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 14/03/2016 12:21, Denis V. Lunev wrote: > There is no particular reason to keep these functions in the header. > Suggested by Paolo. > > Signed-off-by: Denis V. Lunev <den@openvz.org> > CC: Stefan Hajnoczi <stefanha@redhat.com> > CC: Paolo Bonzini <pbonzini@redhat.com> > --- > include/qemu/log.h | 26 +++++--------------------- > util/log.c | 21 +++++++++++++++++++++ > 2 files changed, 26 insertions(+), 21 deletions(-) > > diff --git a/include/qemu/log.h b/include/qemu/log.h > index be20811..2c2c220 100644 > --- a/include/qemu/log.h > +++ b/include/qemu/log.h > @@ -73,27 +73,6 @@ void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...); > > /* Maintenance: */ > > -/* 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; > - } > - > - if (is_daemonized()) { > - dup2(STDOUT_FILENO, STDERR_FILENO); /* dup /dev/null to stderr */ > - } > -} > - > /* define log items */ > typedef struct QEMULogItem { > int mask; > @@ -126,4 +105,9 @@ 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); > + > #endif > diff --git a/util/log.c b/util/log.c > index a06aa14..df672cc 100644 > --- a/util/log.c > +++ b/util/log.c > @@ -99,6 +99,27 @@ void qemu_set_log_filename(const char *filename) > qemu_set_log(qemu_loglevel); > } > > +/* 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; > + } > + > + if (is_daemonized()) { > + dup2(STDOUT_FILENO, STDERR_FILENO); /* dup /dev/null to stderr */ > + } > +} > + > const QEMULogItem qemu_log_items[] = { > { CPU_LOG_TB_OUT_ASM, "out_asm", > "show generated host assembly code for each compiled TB" }, > Looks good, but it depends on patch 3. It's always better to put the obvious/uncontroversial patches first. Paolo
diff --git a/include/qemu/log.h b/include/qemu/log.h index be20811..2c2c220 100644 --- a/include/qemu/log.h +++ b/include/qemu/log.h @@ -73,27 +73,6 @@ void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...); /* Maintenance: */ -/* 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; - } - - if (is_daemonized()) { - dup2(STDOUT_FILENO, STDERR_FILENO); /* dup /dev/null to stderr */ - } -} - /* define log items */ typedef struct QEMULogItem { int mask; @@ -126,4 +105,9 @@ 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); + #endif diff --git a/util/log.c b/util/log.c index a06aa14..df672cc 100644 --- a/util/log.c +++ b/util/log.c @@ -99,6 +99,27 @@ void qemu_set_log_filename(const char *filename) qemu_set_log(qemu_loglevel); } +/* 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; + } + + if (is_daemonized()) { + dup2(STDOUT_FILENO, STDERR_FILENO); /* dup /dev/null to stderr */ + } +} + const QEMULogItem qemu_log_items[] = { { CPU_LOG_TB_OUT_ASM, "out_asm", "show generated host assembly code for each compiled TB" },
There is no particular reason to keep these functions in the header. Suggested by Paolo. Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Paolo Bonzini <pbonzini@redhat.com> --- include/qemu/log.h | 26 +++++--------------------- util/log.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 21 deletions(-)