lib/tests/list-private-test.c
Source file repositories/reference/linux-study-clean/lib/tests/list-private-test.c
File Facts
- System
- Linux kernel
- Corpus path
lib/tests/list-private-test.c- Extension
.c- Size
- 2483 bytes
- Lines
- 77
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: implementation source
- Status
- source implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list_private.hkunit/test.h
Detected Declarations
struct list_test_structfunction list_private_compile_testfunction list_private_for_each_entry
Annotated Snippet
struct list_test_struct {
int data;
struct list_head __private list;
};
static void list_private_compile_test(struct kunit *test)
{
struct list_test_struct entry;
struct list_test_struct *pos, *n;
LIST_HEAD(head);
INIT_LIST_HEAD(&ACCESS_PRIVATE(&entry, list));
list_add(&ACCESS_PRIVATE(&entry, list), &head);
pos = &entry;
pos = list_private_entry(&ACCESS_PRIVATE(&entry, list), struct list_test_struct, list);
pos = list_private_first_entry(&head, struct list_test_struct, list);
pos = list_private_last_entry(&head, struct list_test_struct, list);
pos = list_private_next_entry(pos, list);
pos = list_private_prev_entry(pos, list);
pos = list_private_next_entry_circular(pos, &head, list);
pos = list_private_prev_entry_circular(pos, &head, list);
if (list_private_entry_is_head(pos, &head, list))
return;
list_private_for_each_entry(pos, &head, list) { }
list_private_for_each_entry_reverse(pos, &head, list) { }
list_private_for_each_entry_continue(pos, &head, list) { }
list_private_for_each_entry_continue_reverse(pos, &head, list) { }
list_private_for_each_entry_from(pos, &head, list) { }
list_private_for_each_entry_from_reverse(pos, &head, list) { }
list_private_for_each_entry_safe(pos, n, &head, list)
list_private_safe_reset_next(pos, n, list);
list_private_for_each_entry_safe_continue(pos, n, &head, list) { }
list_private_for_each_entry_safe_from(pos, n, &head, list) { }
list_private_for_each_entry_safe_reverse(pos, n, &head, list) { }
}
static struct kunit_case list_private_test_cases[] = {
KUNIT_CASE(list_private_compile_test),
{},
};
static struct kunit_suite list_private_test_module = {
.name = "list-private-kunit-test",
.test_cases = list_private_test_cases,
};
kunit_test_suite(list_private_test_module);
MODULE_DESCRIPTION("KUnit compilation test for private list primitives");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/list_private.h`, `kunit/test.h`.
- Detected declarations: `struct list_test_struct`, `function list_private_compile_test`, `function list_private_for_each_entry`.
- Atlas domain: Kernel Services / lib.
- 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.