aya-tool: extract common helper

reviewable/pr805/r6
Tamir Duberstein 2 weeks ago
parent 1355a2094f
commit be6370c7cd

@ -1,23 +1,22 @@
use bindgen::{Builder, EnumVariation}; use bindgen::{Builder, EnumVariation};
pub fn user_builder() -> Builder { fn common_builder() -> Builder {
bindgen::builder() bindgen::builder()
.use_core() .use_core()
.layout_tests(false) .layout_tests(false)
.generate_comments(false) .generate_comments(false)
.prepend_enum_name(false) .prepend_enum_name(false)
.default_enum_style(EnumVariation::Rust { }
non_exhaustive: false,
}) pub fn user_builder() -> Builder {
common_builder().default_enum_style(EnumVariation::Rust {
non_exhaustive: false,
})
} }
pub fn bpf_builder() -> Builder { pub fn bpf_builder() -> Builder {
bindgen::builder() common_builder()
.use_core()
.ctypes_prefix("::aya_ebpf::cty") .ctypes_prefix("::aya_ebpf::cty")
.layout_tests(false)
.generate_comments(false)
.clang_arg("-Wno-unknown-attributes") .clang_arg("-Wno-unknown-attributes")
.default_enum_style(EnumVariation::ModuleConsts) .default_enum_style(EnumVariation::ModuleConsts)
.prepend_enum_name(false)
} }

Loading…
Cancel
Save