Drop circular dependency in log.c and lib/output_buffer.c
authorTomohiro Kusumi <tkusumi@tuxera.com>
Tue, 23 May 2017 18:44:47 +0000 (21:44 +0300)
committerJens Axboe <axboe@fb.com>
Wed, 24 May 2017 02:02:42 +0000 (20:02 -0600)
commit3dc3aa41ad79da5724c5eb4bbeb7aa4fcbe085fa
tree9b1b06f0158fc006778f2af53c5ac6b246c0edb1
parent1ed84d86e0e357fd525c91ee41c0a56d4a71ef85
Drop circular dependency in log.c and lib/output_buffer.c

Two files log.c and lib/output_buffer.c have dependency on each other,
i.e. log.c is using buf_output_add() in lib/output_buffer.c, while
lib/output_buffer.c is using log_info_buf() in log.c.

This commit removes this dependency from lib/output_buffer.c by
dropping log_info_buf() call from a library function buf_output_flush(),
and then as a result rename buf_output_flush() to buf_output_clear()
since it's no longer flusing anything. log_info_buf() is now called
independently by __show_run_stats() which was the only caller of
buf_output_flush().

log_info_buf() returning 0 on !len is necessary to keep this commit
without making functional difference. dprint()/log_info() basically
never pass NULL or "" to log_info_buf(), but __show_run_stats() would
pass NULL with length 0 for unused output modes which then needs to
be avoided as a special case.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
lib/output_buffer.c
lib/output_buffer.h
log.c
stat.c