codegen: add bindings for btf structs

This adds `bpf_btf_info` which can be used to get BPF information via a
syscall. It also adds `btf_line_info` and `btf_func_info` which are
required to parse the line and func info sections of BTF

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/144/head
Dave Tucker 3 years ago committed by Alessandro Decina
parent facb01f34b
commit 23d1920854

@ -65,6 +65,9 @@ fn codegen_bindings(opts: &Options) -> Result<(), anyhow::Error> {
"bpf_prog_type", "bpf_prog_type",
"bpf_attach_type", "bpf_attach_type",
"bpf_prog_info", "bpf_prog_info",
"bpf_btf_info",
"bpf_func_info",
"bpf_line_info",
// BTF // BTF
"btf_header", "btf_header",
"btf_ext_info", "btf_ext_info",
@ -76,6 +79,7 @@ fn codegen_bindings(opts: &Options) -> Result<(), anyhow::Error> {
"btf_param", "btf_param",
"btf_var", "btf_var",
"btf_var_secinfo", "btf_var_secinfo",
"btf_func_linkage",
// PERF // PERF
"perf_event_attr", "perf_event_attr",
"perf_sw_ids", "perf_sw_ids",
@ -114,6 +118,7 @@ fn codegen_bindings(opts: &Options) -> Result<(), anyhow::Error> {
// BTF // BTF
"BTF_INT_.*", "BTF_INT_.*",
"BTF_KIND_.*", "BTF_KIND_.*",
"BTF_VAR_.*",
// PERF // PERF
"PERF_FLAG_.*", "PERF_FLAG_.*",
"PERF_EVENT_.*", "PERF_EVENT_.*",
@ -179,7 +184,10 @@ fn codegen_bindings(opts: &Options) -> Result<(), anyhow::Error> {
bindgen = bindgen.allowlist_type(x); bindgen = bindgen.allowlist_type(x);
} }
for x in &vars { for x in &vars {
bindgen = bindgen.allowlist_var(x).constified_enum("BTF_KIND_.*"); bindgen = bindgen
.allowlist_var(x)
.constified_enum("BTF_KIND_.*")
.constified_enum("BTF_VAR_.*");
} }
for x in &types { for x in &types {

Loading…
Cancel
Save