include/linux/list_private.h
Source file repositories/reference/linux-study-clean/include/linux/list_private.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/list_private.h- Extension
.h- Size
- 10050 bytes
- Lines
- 257
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compiler.hlinux/list.h
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#ifndef _LINUX_LIST_PRIVATE_H
#define _LINUX_LIST_PRIVATE_H
/**
* DOC: Private List Primitives
*
* Provides a set of list primitives identical in function to those in
* ``<linux/list.h>``, but designed for cases where the embedded
* ``&struct list_head`` is private member.
*/
#include <linux/compiler.h>
#include <linux/list.h>
#define __list_private_offset(type, member) \
((size_t)(&ACCESS_PRIVATE(((type *)0), member)))
/**
* list_private_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the identifier passed to ACCESS_PRIVATE.
*/
#define list_private_entry(ptr, type, member) ({ \
const struct list_head *__mptr = (ptr); \
(type *)((char *)__mptr - __list_private_offset(type, member)); \
})
/**
* list_private_first_entry - get the first element from a list
* @ptr: the list head to take the element from.
* @type: the type of the struct this is embedded in.
* @member: the identifier passed to ACCESS_PRIVATE.
*/
#define list_private_first_entry(ptr, type, member) \
list_private_entry((ptr)->next, type, member)
/**
* list_private_last_entry - get the last element from a list
* @ptr: the list head to take the element from.
* @type: the type of the struct this is embedded in.
* @member: the identifier passed to ACCESS_PRIVATE.
*/
#define list_private_last_entry(ptr, type, member) \
list_private_entry((ptr)->prev, type, member)
/**
* list_private_next_entry - get the next element in list
* @pos: the type * to cursor
* @member: the name of the list_head within the struct.
*/
#define list_private_next_entry(pos, member) \
list_private_entry(ACCESS_PRIVATE(pos, member).next, typeof(*(pos)), member)
/**
* list_private_next_entry_circular - get the next element in list
* @pos: the type * to cursor.
* @head: the list head to take the element from.
* @member: the name of the list_head within the struct.
*
* Wraparound if pos is the last element (return the first element).
* Note, that list is expected to be not empty.
*/
#define list_private_next_entry_circular(pos, head, member) \
(list_is_last(&ACCESS_PRIVATE(pos, member), head) ? \
list_private_first_entry(head, typeof(*(pos)), member) : \
list_private_next_entry(pos, member))
/**
* list_private_prev_entry - get the prev element in list
* @pos: the type * to cursor
* @member: the name of the list_head within the struct.
*/
#define list_private_prev_entry(pos, member) \
list_private_entry(ACCESS_PRIVATE(pos, member).prev, typeof(*(pos)), member)
/**
* list_private_prev_entry_circular - get the prev element in list
* @pos: the type * to cursor.
* @head: the list head to take the element from.
* @member: the name of the list_head within the struct.
*
* Wraparound if pos is the first element (return the last element).
* Note, that list is expected to be not empty.
*/
#define list_private_prev_entry_circular(pos, head, member) \
(list_is_first(&ACCESS_PRIVATE(pos, member), head) ? \
list_private_last_entry(head, typeof(*(pos)), member) : \
list_private_prev_entry(pos, member))
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/list.h`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.