tools/testing/selftests/bpf/bpf_legacy.h

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/bpf_legacy.h

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/bpf_legacy.h
Extension
.h
Size
895 bytes
Lines
24
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.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef __BPF_LEGACY__
#define __BPF_LEGACY__

#if __GNUC__ && !__clang__
/* Functions to emit BPF_LD_ABS and BPF_LD_IND instructions.  We
 * provide the "standard" names as synonyms of the corresponding GCC
 * builtins. Note how the SKB argument is ignored.
 */
#define load_byte(skb, off) __builtin_bpf_load_byte(off)
#define load_half(skb, off) __builtin_bpf_load_half(off)
#define load_word(skb, off) __builtin_bpf_load_word(off)
#else
/* llvm builtin functions that eBPF C program may use to
 * emit BPF_LD_ABS and BPF_LD_IND instructions
 */
unsigned long long load_byte(void *skb, unsigned long long off) asm("llvm.bpf.load.byte");
unsigned long long load_half(void *skb, unsigned long long off) asm("llvm.bpf.load.half");
unsigned long long load_word(void *skb, unsigned long long off) asm("llvm.bpf.load.word");
#endif

#endif

Annotation

Implementation Notes