瀏覽代碼

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>
Dave Tucker 3 年之前
父節點
當前提交
23d1920854
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      xtask/src/codegen/aya.rs

+ 9 - 1
xtask/src/codegen/aya.rs

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