Skip to contentSkip to conversation

rte_log: remove unnecessary stubs

PATCH Applied Stephen Hemminger 2 participants 2 messages Dec 9, 2014 – Jan 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rte_log: remove unnecessary stubs

The read/seek/close stub functions are unnecessary on the log stream. Per glibc fopencookie man page:

cookie_read_function_t *read
If *read is a null pointer, then reads from the custom stream always return end of file.

cookie_seek_function_t *seek
If *seek is a null pointer, then it is not possible to perform seek operations on the stream.

cookie_close_function_t *close
If *close is NULL, then no special action is performed when the stream is closed.

lib/librte_eal/linuxapp/eal/eal_log.c +0 -50
@@ -83,33 +83,8 @@ console_log_write(__attribute__((unused)
 	return ret;
 }
 
-static ssize_t
-console_log_read(__attribute__((unused)) void *c,
-		 __attribute__((unused)) char *buf,
-		 __attribute__((unused)) size_t size)
-{
-	return 0;
-}
-
-static int
-console_log_seek(__attribute__((unused)) void *c,
-		 __attribute__((unused)) off64_t *offset,
-		 __attribute__((unused)) int whence)
-{
-	return -1;
-}
-
-static int
-console_log_close(__attribute__((unused)) void *c)
-{
-	return 0;
-}
-
 static cookie_io_functions_t console_log_func = {
-	.read  = console_log_read,
 	.write = console_log_write,
-	.seek  = console_log_seek,
-	.close = console_log_close
 };
 
 /*
@@ -150,33 +125,8 @@ early_log_write(__attribute__((unused))
 	return ret;
 }
 
-static ssize_t
-early_log_read(__attribute__((unused)) void *c,
-	       __attribute__((unused)) char *buf,
-	       __attribute__((unused)) size_t size)
-{
-	return 0;
-}
-
-static int
-early_log_seek(__attribute__((unused)) void *c,
-	       __attribute__((unused)) off64_t *offset,
-	       __attribute__((unused)) int whence)
-{
-	return -1;
-}
-
-static int
-early_log_close(__attribute__((unused)) void *c)
-{
-	return 0;
-}
-
 static cookie_io_functions_t early_log_func = {
-	.read  = early_log_read,
 	.write = early_log_write,
-	.seek  = early_log_seek,
-	.close = early_log_close
 };
 static FILE *early_log_stream;
 
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 11 lines

The read/seek/close stub functions are unnecessary on the log stream. Per glibc fopencookie man page:

cookie_read_function_t *read
If *read is a null pointer, then reads from the custom stream always return end of file.

cookie_seek_function_t *seek
If *seek is a null pointer, then it is not possible to perform seek operations on the stream.

Quoted 5 lines

cookie_close_function_t *close
If *close is NULL, then no special action is performed when the stream is closed.

Applied

Thanks

Signature · 1 line
Thomas