From c9dcce4f30a331721d82c72d334eec36d48c12d2 Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Tue, 22 Dec 2020 16:25:38 +0800 Subject: [PATCH] Revert "libs/libc/dumpbuffer: add support to dump the buffer to file descriptor." This reverts commit 080b38095574aeade5c7f8184aeffe1c74d0b737. --- include/debug.h | 12 --------- libs/libc/misc/lib_dumpbuffer.c | 23 ---------------- libs/libc/misc/lib_dumpvbuffer.c | 45 +++++--------------------------- 3 files changed, 6 insertions(+), 74 deletions(-) diff --git a/include/debug.h b/include/debug.h index cb184a6b5bc..4bac17cf1c9 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1021,23 +1021,11 @@ extern "C" void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, unsigned int buflen); -/* Dump a buffer of data to a specified file descriptor. */ - -void lib_writebuffer(int fd, FAR const char *msg, - FAR const uint8_t *buffer, unsigned int buflen); - /* Do a pretty buffer dump from multiple buffers. */ void lib_dumpvbuffer(FAR const char *msg, FAR const struct iovec *iov, int iovcnt); -/* Do a pretty buffer dump from multiple buffers - * to a specified file descriptor. - */ - -void lib_writevbuffer(int fd, FAR const char *msg, - FAR const struct iovec *iov, int iovcnt); - /* The system logging interfaces are normally accessed via the macros * provided above. If the cross-compiler's C pre-processor supports a * variable number of macro arguments, then those macros below will map all diff --git a/libs/libc/misc/lib_dumpbuffer.c b/libs/libc/misc/lib_dumpbuffer.c index 100d24a511e..db1705fbb01 100644 --- a/libs/libc/misc/lib_dumpbuffer.c +++ b/libs/libc/misc/lib_dumpbuffer.c @@ -54,26 +54,3 @@ void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, lib_dumpvbuffer(msg, &buf, 1); } - -/**************************************************************************** - * Name: lib_writebuffer - * - * Description: - * Do a pretty buffer dump to a specified file descriptor. - * - * A fairly large on-stack buffer is used for the case where timestamps are - * applied to each line. - * - ****************************************************************************/ - -void lib_writebuffer(int fd, FAR const char *msg, - FAR const uint8_t *buffer, unsigned int buflen) -{ - struct iovec buf = - { - .iov_base = (FAR char *)buffer, - .iov_len = buflen, - }; - - lib_writevbuffer(fd, msg, &buf, 1); -} diff --git a/libs/libc/misc/lib_dumpvbuffer.c b/libs/libc/misc/lib_dumpvbuffer.c index 3405d39df01..d9e10a1f0a6 100644 --- a/libs/libc/misc/lib_dumpvbuffer.c +++ b/libs/libc/misc/lib_dumpvbuffer.c @@ -26,7 +26,6 @@ #include #include -#include #include /**************************************************************************** @@ -71,19 +70,18 @@ static char lib_nibble(unsigned char nibble) ****************************************************************************/ /**************************************************************************** - * Name: lib_writevbuffer + * Name: lib_dumpvbuffer * * Description: - * Do a pretty buffer dump from multiple buffers to a specified file - * descriptor. + * Do a pretty buffer dump from multiple buffers. * * A fairly large on-stack buffer is used for the case where timestamps are * applied to each line. * ****************************************************************************/ -void lib_writevbuffer(int fd, FAR const char *msg, - FAR const struct iovec *iov, int iovcnt) +void lib_dumpvbuffer(FAR const char *msg, FAR const struct iovec *iov, + int iovcnt) { FAR const struct iovec *piov = iov; FAR const uint8_t *iov_buf; @@ -98,14 +96,7 @@ void lib_writevbuffer(int fd, FAR const char *msg, if (msg) { - if (fd > 0) - { - dprintf(fd, "%s (%p):\n", msg, iov->iov_base); - } - else - { - syslog(LOG_INFO, "%s (%p):\n", msg, iov->iov_base); - } + syslog(LOG_INFO, "%s (%p):\n", msg, iov->iov_base); } for (i = 0; i < iovcnt; i++) @@ -179,30 +170,6 @@ void lib_writevbuffer(int fd, FAR const char *msg, *ptr++ = ' '; /* Plus 1 byte */ } - if (fd > 0) - { - dprintf(fd, "%04x %s\n", i, line); - } - else - { - syslog(LOG_INFO, "%04x %s\n", i, line); - } + syslog(LOG_INFO, "%04x %s\n", i, line); } } - -/**************************************************************************** - * Name: lib_dumpvbuffer - * - * Description: - * Do a pretty buffer dump from multiple buffers. - * - * A fairly large on-stack buffer is used for the case where timestamps are - * applied to each line. - * - ****************************************************************************/ - -void lib_dumpvbuffer(FAR const char *msg, FAR const struct iovec *iov, - int iovcnt) -{ - lib_writevbuffer(-1, msg, iov, iovcnt); -}