tools/testing/selftests/bpf/progs/test_core_reloc_enumval.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/test_core_reloc_enumval.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/test_core_reloc_enumval.c- Extension
.c- Size
- 1837 bytes
- Lines
- 73
- 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/bpf.hstdint.hstdbool.hbpf/bpf_helpers.hbpf/bpf_core_read.h
Detected Declarations
struct core_reloc_enumval_outputenum named_enumfunction test_core_enumval
Annotated Snippet
struct core_reloc_enumval_output {
bool named_val1_exists;
bool named_val2_exists;
bool named_val3_exists;
bool anon_val1_exists;
bool anon_val2_exists;
bool anon_val3_exists;
int named_val1;
int named_val2;
int anon_val1;
int anon_val2;
};
SEC("raw_tracepoint/sys_enter")
int test_core_enumval(void *ctx)
{
#if __has_builtin(__builtin_preserve_enum_value)
struct core_reloc_enumval_output *out = (void *)&data.out;
enum named_enum named = 0;
anon_enum anon = 0;
out->named_val1_exists = bpf_core_enum_value_exists(named, NAMED_ENUM_VAL1);
out->named_val2_exists = bpf_core_enum_value_exists(enum named_enum, NAMED_ENUM_VAL2);
out->named_val3_exists = bpf_core_enum_value_exists(enum named_enum, NAMED_ENUM_VAL3);
out->anon_val1_exists = bpf_core_enum_value_exists(anon, ANON_ENUM_VAL1);
out->anon_val2_exists = bpf_core_enum_value_exists(anon_enum, ANON_ENUM_VAL2);
out->anon_val3_exists = bpf_core_enum_value_exists(anon_enum, ANON_ENUM_VAL3);
out->named_val1 = bpf_core_enum_value(named, NAMED_ENUM_VAL1);
out->named_val2 = bpf_core_enum_value(named, NAMED_ENUM_VAL2);
/* NAMED_ENUM_VAL3 value is optional */
out->anon_val1 = bpf_core_enum_value(anon, ANON_ENUM_VAL1);
out->anon_val2 = bpf_core_enum_value(anon, ANON_ENUM_VAL2);
/* ANON_ENUM_VAL3 value is optional */
#else
data.skip = true;
#endif
return 0;
}
Annotation
- Immediate include surface: `linux/bpf.h`, `stdint.h`, `stdbool.h`, `bpf/bpf_helpers.h`, `bpf/bpf_core_read.h`.
- Detected declarations: `struct core_reloc_enumval_output`, `enum named_enum`, `function test_core_enumval`.
- 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.