Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message May 25, 2017 Library code

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit c78e8496d438982157657711fbff8bedb621c1c9:

log: ensure we don't truncate the final '\0' in the log (2017-05-23 21:51:59 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 8dd0eca30caeda7f62df4d09748286592956fcc5:

lib/output_buffer: harden buf_output_free() and kill buf_output_clear() (2017-05-24 10:21:27 -0600)

----------------------------------------------------------------
Jens Axboe (2):
log: unify the logging handlers
lib/output_buffer: harden buf_output_free() and kill buf_output_clear()

 lib/output_buffer.c |  9 +-----
 lib/output_buffer.h |  1 -
 log.c               | 91 ++++++++++++++++++++---------------------------------
 stat.c              |  2 +-
 4 files changed, 36 insertions(+), 67 deletions(-)

---

Diff of recent changes:

lib/output_buffer.c +1 -8
index 313536d..f6c304b 100644
@@ -17,6 +17,7 @@ void buf_output_init(struct buf_output *out)
 void buf_output_free(struct buf_output *out)
 {
 	free(out->buf);
+	buf_output_init(out);
 }
 
 size_t buf_output_add(struct buf_output *out, const char *buf, size_t len)
@@ -39,11 +40,3 @@ size_t buf_output_add(struct buf_output *out, const char *buf, size_t len)
 	out->buflen += len;
 	return len;
 }
-
-void buf_output_clear(struct buf_output *out)
-{
-	if (out->buflen) {
-		memset(out->buf, 0, out->max_buflen);
-		out->buflen = 0;
-	}
-}
lib/output_buffer.h +0 -1
index 15ee005..a235af2 100644
@@ -12,6 +12,5 @@ struct buf_output {
 void buf_output_init(struct buf_output *out);
 void buf_output_free(struct buf_output *out);
 size_t buf_output_add(struct buf_output *out, const char *buf, size_t len);
-void buf_output_clear(struct buf_output *out);
 
 #endif
log.c +34 -57

136 lines not on this page · raw message

stat.c +1 -1
index 1f124a8..e433c6d 100644
@@ -1826,8 +1826,8 @@ void __show_run_stats(void)
 
 	for (i = 0; i < FIO_OUTPUT_NR; i++) {
 		struct buf_output *out = &output[i];
+
 		log_info_buf(out->buf, out->buflen);
-		buf_output_clear(out);
 		buf_output_free(out);
 	}