mm/iob:support iob queue concat to another iob queue

add interface support to merge iob queues, providing support for
subsequent features.

Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
This commit is contained in:
wenquan1
2025-09-25 15:06:56 +08:00
committed by Xiang Xiao
parent a8cec9a034
commit 8f9f31fb69
2 changed files with 54 additions and 0 deletions
+13
View File
@@ -405,6 +405,19 @@ int iob_add_queue(FAR struct iob_s *iob, FAR struct iob_queue_s *iobq);
int iob_tryadd_queue(FAR struct iob_s *iob, FAR struct iob_queue_s *iobq);
#endif /* CONFIG_IOB_NCHAINS > 0 */
/****************************************************************************
* Name: iob_concat_queue
*
* Description:
* Concatenate iob_s queue src to dest
*
****************************************************************************/
#if CONFIG_IOB_NCHAINS > 0
int iob_concat_queue(FAR struct iob_queue_s *dest,
FAR struct iob_queue_s *src);
#endif /* CONFIG_IOB_NCHAINS > 0 */
/****************************************************************************
* Name: iob_remove_queue
*
+41
View File
@@ -131,4 +131,45 @@ int iob_tryadd_queue(FAR struct iob_s *iob, FAR struct iob_queue_s *iobq)
return iob_add_queue_internal(iob, iobq, qentry);
}
/****************************************************************************
* Name: iob_concat_queue
*
* Description:
* Concatenate iob_s queue src to dest
*
****************************************************************************/
int iob_concat_queue(FAR struct iob_queue_s *dest,
FAR struct iob_queue_s *src)
{
FAR struct iob_qentry_s *qentry;
FAR struct iob_qentry_s *tailq;
/* Detach the list from the queue head so first for safety (should be safe
* anyway).
*/
qentry = src->qh_head;
tailq = src->qh_tail;
src->qh_head = NULL;
src->qh_tail = NULL;
if (qentry)
{
if (!dest->qh_head)
{
dest->qh_head = qentry;
dest->qh_tail = tailq;
}
else
{
DEBUGASSERT(dest->qh_tail);
dest->qh_tail->qe_flink = qentry;
dest->qh_tail = tailq;
}
}
return 0;
}
#endif /* CONFIG_IOB_NCHAINS > 0 */