Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftest/bpf: Replace magic constants by macros

Replace magic constants in a BTF structure initialization code by
proper macros, as is done in other similar selftests.

Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20241213130934.1087929-8-aspsk@isovalent.com

authored by

Anton Protopopov and committed by
Andrii Nakryiko
d677a10f 1c593d74

+3 -3
+3 -3
tools/testing/selftests/bpf/progs/syscall.c
··· 76 76 .magic = BTF_MAGIC, 77 77 .version = BTF_VERSION, 78 78 .hdr_len = sizeof(struct btf_header), 79 - .type_len = sizeof(__u32) * 8, 80 - .str_off = sizeof(__u32) * 8, 81 - .str_len = sizeof(__u32), 79 + .type_len = sizeof(raw_btf.types), 80 + .str_off = offsetof(struct btf_blob, str) - offsetof(struct btf_blob, types), 81 + .str_len = sizeof(raw_btf.str), 82 82 }, 83 83 .types = { 84 84 /* long */