ramlog:flush should reset the tail of the reader

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
This commit is contained in:
dulibo1 2024-03-25 17:18:45 +08:00 committed by Xiang Xiao
parent c055fc2f85
commit b29d103ad3

View file

@ -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;