OSDN Git Service

scripts/bpf_doc.py: update logic to not assume sequential enum values
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 6 Oct 2022 04:24:52 +0000 (21:24 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 6 Oct 2022 15:19:30 +0000 (08:19 -0700)
commitce3e44a09dce74ca68fa56c23333378d936969b0
tree178a34cb6db8de0afb364f28f39c027566e83df1
parent8a76145a2ec2a81dfe34d7ac42e8c242f095e8c8
scripts/bpf_doc.py: update logic to not assume sequential enum values

Relax bpf_doc.py's expectation of all BPF_FUNC_xxx enumerators having
sequential values increasing by one. Instead, only make sure that
relative order of BPF helper descriptions in comments matches
enumerators definitions order.

Also additionally make sure that helper IDs are not duplicated.

And also make sure that for cases when we have multiple descriptions for
the same BPF helper (e.g., for bpf_get_socket_cookie()), all such
descriptions are grouped together.

Such checks should capture all the same (and more) issues in upstream
UAPI headers, but also handle backported kernels correctly.

Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20221006042452.2089843-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
scripts/bpf_doc.py