1 Star 0 Fork 5.3K

Srtian / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
hdf_dlist-h.md 10.14 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

hdf_dlist.h

Overview

Related Modules:

DriverUtils

Description:

Declares doubly linked list structures and interfaces.

This file provides interfaces such as inserting a node from the head or tail of a doubly linked list, checking whether a doubly linked list is empty, traversing a doubly linked list, and merging doubly linked lists.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

DListHead

Describes a doubly linked list.

Macros

Macro Name and Value

Description

CONTAINER_OF(ptr, type, member)   (type *)((char *)(ptr) - (char *)&((type *)0)->member)

Obtains the address of a structure variable from its member address.

DLIST_FIRST_ENTRY(ptr, type, member)   CONTAINER_OF((ptr)->next, type, member)

Obtains the first node of a doubly linked list.

DLIST_LAST_ENTRY(ptr, type, member)   CONTAINER_OF((ptr)->prev, type, member)

Obtains the last node of a doubly linked list.

DLIST_FOR_EACH_ENTRY(pos, head, type, member)

Traverses all nodes in a doubly linked list.

DLIST_FOR_EACH_ENTRY_SAFE(pos, tmp, head, type, member)

Traverses all nodes in a doubly linked list. This function is used to delete the nodes pointed to by pos during traversal.

Functions

Function Name

Description

DListHeadInit (struct DListHead *head)

static void 

Initializes a doubly linked list.

DListIsEmpty (const struct DListHead *head)

static bool 

Checks whether a doubly linked list is empty.

DListRemove (struct DListHead *entry)

static void 

Removes a node from a doubly linked list.

DListInsertHead (struct DListHead *entry, struct DListHead *head)

static void 

Inserts a node from the head of a doubly linked list.

DListInsertTail (struct DListHead *entry, struct DListHead *head)

static void 

Inserts a node from the tail of a doubly linked list.

DListMerge (struct DListHead *list, struct DListHead *head)

static void 

Merges two linked lists by adding the list specified by list to the head of the list specified by head and initializes the merged list.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/srtian96/docs.git
git@gitee.com:srtian96/docs.git
srtian96
docs
docs
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891