This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit c0ce2083adcb3bb434cb6dc9b3aa98043f29ef17
Author: dulibo1 <[email protected]>
AuthorDate: Mon Mar 25 17:18:45 2024 +0800

    ramlog:flush should reset the tail of the reader
    
    Signed-off-by: dulibo1 <[email protected]>
---
 drivers/syslog/ramlog.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c
index ba9b3ff849..dfb0b7c1d5 100644
--- a/drivers/syslog/ramlog.c
+++ b/drivers/syslog/ramlog.c
@@ -234,6 +234,21 @@ static void ramlog_pollnotify(FAR struct ramlog_dev_s 
*priv)
     }
 }
 
+/****************************************************************************
+ * Name: ramlog_flush
+ ****************************************************************************/
+
+static void ramlog_bufferflush(FAR struct ramlog_dev_s *priv)
+{
+  FAR struct ramlog_user_s *upriv;
+
+  priv->rl_header->rl_head = 0;
+  list_for_every_entry(&priv->rl_list, upriv, struct ramlog_user_s, rl_node)
+    {
+      upriv->rl_tail = 0;
+    }
+}
+
 /****************************************************************************
  * Name: ramlog_copybuf
  ****************************************************************************/
@@ -535,7 +550,7 @@ static int ramlog_file_ioctl(FAR struct file *filep, int 
cmd,
         upriv->rl_threashold = (uint32_t)arg;
         break;
       case BIOC_FLUSH:
-        priv->rl_header->rl_head = 0;
+        ramlog_bufferflush(priv);
         break;
       default:
         ret = -ENOTTY;

Reply via email to