]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Switch BPF UAPI #define constants used from BPF program side to enums
authorAndrii Nakryiko <andriin@fb.com>
Tue, 3 Mar 2020 00:32:31 +0000 (16:32 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 4 Mar 2020 16:00:05 +0000 (17:00 +0100)
commit01e7cbad6889142881c6bea79727a698fb573d7b
treea8d1ec71196488587623275fe0e3cda509fde599
parenteed1e76f64504b410fb40d5e8e679f71b98840dc
bpf: Switch BPF UAPI #define constants used from BPF program side to enums

Switch BPF UAPI constants, previously defined as #define macro, to anonymous
enum values. This preserves constants values and behavior in expressions, but
has added advantaged of being captured as part of DWARF and, subsequently, BTF
type info. Which, in turn, greatly improves usefulness of generated vmlinux.h
for BPF applications, as it will not require BPF users to copy/paste various
flags and constants, which are frequently used with BPF helpers. Only those
constants that are used/useful from BPF program side are converted.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200303003233.3496043-2-andriin@fb.com
include/uapi/linux/bpf.h
tools/include/uapi/linux/bpf.h