tools/include/linux/list.h
Source file repositories/reference/linux-study-clean/tools/include/linux/list.h
File Facts
- System
- Linux kernel
- Corpus path
tools/include/linux/list.h- Extension
.h- Size
- 23288 bytes
- Lines
- 794
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/poison.hlinux/kernel.hlinux/compiler.h
Detected Declarations
function functionsfunction __list_addfunction list_addfunction list_add_tailfunction __list_delfunction __list_del_entryfunction list_delfunction list_replacefunction list_replace_initfunction list_del_initfunction list_movefunction list_move_tailfunction list_is_firstfunction list_is_lastfunction list_emptyfunction memberfunction list_rotate_leftfunction list_is_singularfunction __list_cut_positionfunction list_cut_positionfunction __list_splicefunction list_splicefunction list_splice_tailfunction list_splice_initfunction list_splice_tail_initfunction concurrentlyfunction hlist_unhashedfunction hlist_emptyfunction __hlist_delfunction hlist_delfunction hlist_del_initfunction hlist_add_headfunction hlist_add_beforefunction hlist_add_behindfunction hlist_add_fakefunction hlist_fakefunction hlist_move_listfunction list_del_range
Annotated Snippet
#ifndef __TOOLS_LINUX_LIST_H
#define __TOOLS_LINUX_LIST_H
#include <linux/types.h>
#include <linux/poison.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
/*
* Simple doubly linked list implementation.
*
* Some of the internal functions ("__xxx") are useful when
* manipulating whole lists rather than single entries, as
* sometimes we already know the next/prev entries and we can
* generate better code by using them directly rather than
* using the generic single-entry routines.
*/
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}
/*
* Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
#ifndef CONFIG_DEBUG_LIST
static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
#else
extern void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next);
#endif
/**
* list_add - add a new entry
* @new: new entry to be added
* @head: list head to add it after
*
* Insert a new entry after the specified head.
* This is good for implementing stacks.
*/
static inline void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
/**
* list_add_tail - add a new entry
* @new: new entry to be added
* @head: list head to add it before
*
* Insert a new entry before the specified head.
* This is useful for implementing queues.
*/
static inline void list_add_tail(struct list_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static inline void __list_del(struct list_head * prev, struct list_head * next)
{
next->prev = prev;
WRITE_ONCE(prev->next, next);
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/poison.h`, `linux/kernel.h`, `linux/compiler.h`.
- Detected declarations: `function functions`, `function __list_add`, `function list_add`, `function list_add_tail`, `function __list_del`, `function __list_del_entry`, `function list_del`, `function list_replace`, `function list_replace_init`, `function list_del_init`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.