]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Teach btf_dumper to emit stand-alone anonymous enum definitions
authorAndrii Nakryiko <andriin@fb.com>
Wed, 25 Sep 2019 20:37:45 +0000 (13:37 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 26 Sep 2019 12:38:29 +0000 (14:38 +0200)
commit875f883b1c50e2e350845d90c5e8eaed0bd078db
tree24023d8202f40bf30143a2956bcdfdd62d7e5159
parent71f1bf15933618c0d176d205b63acb8617a2b6a3
libbpf: Teach btf_dumper to emit stand-alone anonymous enum definitions

BTF-to-C converter previously skipped anonymous enums in an assumption
that those are embedded in struct's field definitions. This is not
always the case and a lot of kernel constants are defined as part of
anonymous enums. This change fixes the logic by eagerly marking all
types as either referenced by any other type or not. This is enough to
distinguish two classes of anonymous enums and emit previously omitted
enum definitions.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20190925203745.3173184-1-andriin@fb.com
tools/lib/bpf/btf_dump.c