diff options
| author | Emil Tsalapatis <emil@etsalapatis.com> | 2026-04-26 22:03:31 +0300 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-04-27 04:12:21 +0300 |
| commit | 1fb8e9b32e19f7fa444863a251a5310c54585172 (patch) | |
| tree | 5e0b0bd01c2494aecaa10492e7b46d371a39ba32 /include/linux/debugobjects.h | |
| parent | fbb5ba99e273843ae8d8bfcc6e2b700c8f5d933a (diff) | |
| download | linux-1fb8e9b32e19f7fa444863a251a5310c54585172.tar.xz | |
selftests/bpf: Add ifdef guard for WRITE_ONCE macro in bpf_atomic.h
The WRITE_ONCE macro is identically defined both in bpf_atomic.h
and in bpf_arena_common.h. However, the bpf_atomic.h definition has no
ifdef guard. If bpf_atomic.h is included after bpf_arena.common.h,
compilation fails because of the duplicate definition.
Guard the definiton in bpf_atomic.h with and ifdef to let programs
include the two headers in any order. Duplicating the definition is
the simplest solution out of all the alternatives:
- Keeping one of the two existing definitions is not possible because
both BPF atomics and arena programs need the macro, and the two features
are independent. Using one should not require the header for the other.
- Factoring out the definition into a new header that only includes it
is more churn than just duplicating it.
- Factoring out the definition into bpf_experimental.h requires all
users of WRITE_ONCE to include the header. However, the arena library
introduced in subsequent commits must be self-contained, while
bpf_experimental.h is in the base selftests/bpf directory.
Both headers are moved to the arena library in a subsequent patch.
Signed-off-by: Emil Tsalapatis <emil@etsalapatis.com>
Reviewed-by: Matt Bobrowski <mattbobrowski@google.com>
Link: https://lore.kernel.org/r/20260426190338.4615-2-emil@etsalapatis.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux/debugobjects.h')
0 files changed, 0 insertions, 0 deletions
