将prev和next之间的list_head从链表中删除:
static
inline
void
__list_del(
struct
list_head
*
prev,
struct
list_head
*
next)
{
next->prev = prev;
prev->next = next;
}
+--prev next--+
| |
| list_head list_head | list_head
| |---------------| |---------------| | |---------------|
+->|list_head *next|--->|list_head *next|-+->|list_head *next|
|---------------| |---------------| |---------------|
|list_head *prev|<---|list_head *prev|<---|list_head *prev|
|---------------| |---------------| |---------------|
+--------------------+
| |
list_head | list_head | list_head
|---------------| | |---------------| | |---------------|
|list_head *next|-+ |list_head *next|-+->|list_head *next|
|---------------| |---------------| |---------------|
|list_head *prev|<-+-|list_head *prev| +--|list_head *prev|
|---------------| | |---------------| | |---------------|
| |
+-------------------+
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/0196c3df5ea9e936f21e9932cca91014.gif)
+--prev next--+
| |
| list_head list_head | list_head
| |---------------| |---------------| | |---------------|
+->|list_head *next|--->|list_head *next|-+->|list_head *next|
|---------------| |---------------| |---------------|
|list_head *prev|<---|list_head *prev|<---|list_head *prev|
|---------------| |---------------| |---------------|
+--------------------+
| |
list_head | list_head | list_head
|---------------| | |---------------| | |---------------|
|list_head *next|-+ |list_head *next|-+->|list_head *next|
|---------------| |---------------| |---------------|
|list_head *prev|<-+-|list_head *prev| +--|list_head *prev|
|---------------| | |---------------| | |---------------|
| |
+-------------------+