更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
Doubly linked list
Doubly linked list 的协作图:

结构体

struct  LOS_DL_LIST
 

类型定义

typedef struct LOS_DL_LIST LOS_DL_LIST
 

函数

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit (LOS_DL_LIST *list)
 
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListAdd (LOS_DL_LIST *list, LOS_DL_LIST *node)
 Insert a new node to a doubly linked list. 更多...
 
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListTailInsert (LOS_DL_LIST *list, LOS_DL_LIST *node)
 Insert a node to the tail of a doubly linked list. 更多...
 
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListHeadInsert (LOS_DL_LIST *list, LOS_DL_LIST *node)
 Insert a node to the head of a doubly linked list. 更多...
 
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelete (LOS_DL_LIST *node)
 
LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty (LOS_DL_LIST *list)
 Identify whether a specified doubly linked list is empty. | 判断链表是否为空 更多...
 
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListAddList (LOS_DL_LIST *oldList, LOS_DL_LIST *newList)
 Insert a new list to a doubly linked list. 更多...
 
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListTailInsertList (LOS_DL_LIST *oldList, LOS_DL_LIST *newList)
 Insert a doubly list to the tail of a doubly linked list. 更多...
 
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListHeadInsertList (LOS_DL_LIST *oldList, LOS_DL_LIST *newList)
 Insert a doubly list to the head of a doubly linked list. 更多...
 
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelInit (LOS_DL_LIST *list)
 Delete initialize a doubly linked list. | 将指定节点从链表中删除,并使用该节点初始化链表 更多...
 

详细描述

类型定义说明

◆ LOS_DL_LIST

typedef struct LOS_DL_LIST LOS_DL_LIST

Structure of a node in a doubly linked list. | 双向链表,内核最重要结构体

函数说明

◆ LOS_ListAdd()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListAdd ( LOS_DL_LIST list,
LOS_DL_LIST node 
)

Insert a new node to a doubly linked list.

Description:
This API is used to insert a new node to a doubly linked list. | 将指定节点插入到双向链表头端
注意
  • The parameters passed in should be ensured to be legal pointers.
参数
list[IN] Doubly linked list where the new node is inserted.
node[IN] New node to be inserted.
返回值
None
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见
LOS_ListDelete

在文件 los_list.h217 行定义.

218{
219 node->pstNext = list->pstNext;
220 node->pstPrev = list;
221 list->pstNext->pstPrev = node;
222 list->pstNext = node;
223}
struct LOS_DL_LIST * pstPrev
Definition: los_list.h:83
struct LOS_DL_LIST * pstNext
Definition: los_list.h:84
这是这个函数的调用关系图:

◆ LOS_ListAddList()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListAddList ( LOS_DL_LIST oldList,
LOS_DL_LIST newList 
)

Insert a new list to a doubly linked list.

Description:
This API is used to insert a new list to a doubly linked list.
注意
  • The parameters passed in should be ensured to be legal pointers.
参数
oldList[IN] Doubly linked list where the new list is inserted.
newList[IN] New list to be inserted.
返回值
None
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见
LOS_ListDelete

在文件 los_list.h345 行定义.

346{
347 LOS_DL_LIST *oldListHead = oldList->pstNext;
348 LOS_DL_LIST *oldListTail = oldList;
349 LOS_DL_LIST *newListHead = newList;
350 LOS_DL_LIST *newListTail = newList->pstPrev;
351
352 oldListTail->pstNext = newListHead;
353 newListHead->pstPrev = oldListTail;
354 oldListHead->pstPrev = newListTail;
355 newListTail->pstNext = oldListHead;
356}
这是这个函数的调用关系图:

◆ LOS_ListDelete()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelete ( LOS_DL_LIST node)
Description:
  • This API is used to delete a specified node from a doubly linked list. | 将指定节点从链表中删除
注意
  • The parameter passed in should be ensured to be a legal pointer.
参数
node[IN] Node to be deleted.
返回值
None.
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见
LOS_ListAdd

在文件 los_list.h292 行定义.

293{
294 node->pstNext->pstPrev = node->pstPrev;
295 node->pstPrev->pstNext = node->pstNext;
296 node->pstNext = NULL;
297 node->pstPrev = NULL;
298}

◆ LOS_ListDelInit()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelInit ( LOS_DL_LIST list)

Delete initialize a doubly linked list. | 将指定节点从链表中删除,并使用该节点初始化链表

Description:
This API is used to delete initialize a doubly linked list.
注意
  • The parameter passed in should be ensured to be s legal pointer.
参数
list[IN] Doubly linked list.
返回值
None.
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见

在文件 los_list.h525 行定义.

526{
527 list->pstNext->pstPrev = list->pstPrev;
528 list->pstPrev->pstNext = list->pstNext;
529 LOS_ListInit(list);
530}
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit(LOS_DL_LIST *list)
Definition: los_list.h:104
函数调用图:
这是这个函数的调用关系图:

◆ LOS_ListEmpty()

LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty ( LOS_DL_LIST list)

Identify whether a specified doubly linked list is empty. | 判断链表是否为空

Description:
  • This API is used to return whether a doubly linked list is empty.
注意
  • The parameter passed in should be ensured to be a legal pointer.
参数
list[IN] Doubly linked list.
返回值
TRUEThe doubly linked list is empty.
FALSEThe doubly linked list is not empty.
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见

在文件 los_list.h321 行定义.

322{
323 return (BOOL)(list->pstNext == list);
324}
size_t BOOL
Definition: los_typedef.h:88

◆ LOS_ListHeadInsert()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListHeadInsert ( LOS_DL_LIST list,
LOS_DL_LIST node 
)

Insert a node to the head of a doubly linked list.

Description:
This API is used to insert a new node to the head of a doubly linked list. | 将指定节点插入到双向链表头端
注意
  • The parameters passed in should be ensured to be legal pointers.
参数
list[IN] Doubly linked list where the new node is inserted.
node[IN] New node to be inserted.
返回值
None.
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见
LOS_ListAdd | LOS_ListTailInsert

在文件 los_list.h268 行定义.

269{
270 LOS_ListAdd(list, node);
271}
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListAdd(LOS_DL_LIST *list, LOS_DL_LIST *node)
Insert a new node to a doubly linked list.
Definition: los_list.h:217
函数调用图:
这是这个函数的调用关系图:

◆ LOS_ListHeadInsertList()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListHeadInsertList ( LOS_DL_LIST oldList,
LOS_DL_LIST newList 
)

Insert a doubly list to the head of a doubly linked list.

Description:
This API is used to insert a new doubly list to the head of a doubly linked list.
注意
  • The parameters passed in should be ensured to be legal pointers.
参数
oldList[IN] Doubly linked list where the new list is inserted.
newList[IN] New list to be inserted.
返回值
None.
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见
LOS_ListAddList | LOS_ListTailInsertList

在文件 los_list.h401 行定义.

402{
403 LOS_ListAddList(oldList, newList);
404}
LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListAddList(LOS_DL_LIST *oldList, LOS_DL_LIST *newList)
Insert a new list to a doubly linked list.
Definition: los_list.h:345
函数调用图:

◆ LOS_ListInit()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit ( LOS_DL_LIST list)
Description:
This API is used to initialize a doubly linked list. | 将指定节点初始化为双向链表节点
注意
  • The parameter passed in should be ensured to be a legal pointer.
参数
list[IN] Node in a doubly linked list.
返回值
None.
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见

在文件 los_list.h104 行定义.

105{
106 list->pstNext = list;
107 list->pstPrev = list;
108}

◆ LOS_ListTailInsert()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListTailInsert ( LOS_DL_LIST list,
LOS_DL_LIST node 
)

Insert a node to the tail of a doubly linked list.

Description:
This API is used to insert a new node to the tail of a doubly linked list. | 将指定节点插入到双向链表尾端
注意
  • The parameters passed in should be ensured to be legal pointers.
参数
list[IN] Doubly linked list where the new node is inserted.
node[IN] New node to be inserted.
返回值
None.
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见
LOS_ListAdd | LOS_ListHeadInsert

在文件 los_list.h244 行定义.

245{
246 LOS_ListAdd(list->pstPrev, node);
247}
函数调用图:

◆ LOS_ListTailInsertList()

LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListTailInsertList ( LOS_DL_LIST oldList,
LOS_DL_LIST newList 
)

Insert a doubly list to the tail of a doubly linked list.

Description:
This API is used to insert a new doubly list to the tail of a doubly linked list.
注意
  • The parameters passed in should be ensured to be legal pointers.
参数
oldList[IN] Doubly linked list where the new list is inserted.
newList[IN] New list to be inserted.
返回值
None.
Dependency:
  • los_list.h: the header file that contains the API declaration.
参见
LOS_ListAddList | LOS_ListHeadInsertList

在文件 los_list.h377 行定义.

378{
379 LOS_ListAddList(oldList->pstPrev, newList);
380}
函数调用图:
这是这个函数的调用关系图: