Skip to content

Commit d677a10

Browse files
aspskanakryiko
authored andcommitted
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 <[email protected]> Signed-off-by: Anton Protopopov <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 1c593d7 commit d677a10

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/testing/selftests/bpf/progs/syscall.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ static int btf_load(void)
7676
.magic = BTF_MAGIC,
7777
.version = BTF_VERSION,
7878
.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),
8282
},
8383
.types = {
8484
/* long */

0 commit comments

Comments
 (0)