diff options
| author | Matt Bobrowski <mattbobrowski@google.com> | 2026-06-03 23:18:22 +0300 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-06-04 19:45:36 +0300 |
| commit | fbd6dc50d9aedc594ec3196211a190170a275ab6 (patch) | |
| tree | 79bae7cc33032d3d2cc942611b7fde08d375790e /include | |
| parent | 5b88319e4775ee1924d5b709084b25f72e6fe78d (diff) | |
| download | linux-fbd6dc50d9aedc594ec3196211a190170a275ab6.tar.xz | |
bpf: clean up btf_scan_decl_tags()
Refactor the newly introduced btf_scan_decl_tags() to improve
readability and maintainability. The current implementation uses a
manual if-else chain and a magic number offset to strip the "arg:"
prefix from declaration tags.
Replace the if-else logic with a table-driven approach using a static
const array. This separates the tag data from the scanning logic, making
the helper more extensible for future tags. Additionally, replace the
magic number '4' with a sizeof-based calculation on the prefix string to
ensure the offset remains synchronized with the search key.
Finally, optimize the loop by moving the is_global check to the top of
the block. This allows the verifier to fail-fast on static subprograms
without performing unnecessary BTF string and type lookups.
Signed-off-by: Matt Bobrowski <mattbobrowski@google.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/r/20260603201822.770596-1-mattbobrowski@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
