BPF: Implement build time feature flag for libbpf
For trunk stable development, we use a build time feature flag for the libbpf functionality to be added to bpfloader. For now, simply stub it out. This approach will allow merging and testing of libbpf functionality without changing the binaries produced with the feature disabled going forward. Bug: 359646531 Test: manual/treehugger Change-Id: I230e81b5f23b49a17f3731e0c40e184cde1c49c1 Signed-off-by: Neill Kapron <nkapron@google.com>
This commit is contained in:
parent
7ff8310ea2
commit
01249cb13d
2 changed files with 16 additions and 0 deletions
|
|
@ -113,6 +113,10 @@ cc_test {
|
|||
|
||||
rust_binary {
|
||||
name: "bpfloader",
|
||||
cfgs: select(release_flag("RELEASE_BPF_ENABLE_LIBBPF"), {
|
||||
true: ["enable_libbpf"],
|
||||
default: [],
|
||||
}),
|
||||
srcs: [
|
||||
"bpfloader.rs",
|
||||
],
|
||||
|
|
|
|||
|
|
@ -16,7 +16,19 @@
|
|||
|
||||
//! BPF loader for system and vendor applications
|
||||
|
||||
#[cfg(enable_libbpf)]
|
||||
fn load_libbpf_progs() {
|
||||
// Libbpf loader functionality here.
|
||||
}
|
||||
|
||||
#[cfg(not(enable_libbpf))]
|
||||
fn load_libbpf_progs() {
|
||||
// Empty stub for feature flag disabled case
|
||||
}
|
||||
|
||||
fn main() {
|
||||
load_libbpf_progs();
|
||||
|
||||
// SAFETY: Linking in the existing legacy bpfloader functionality.
|
||||
// Any of the four following bindgen functions can abort() or exit()
|
||||
// on failure and execNetBpfLoadDone() execve()'s.
|
||||
|
|
|
|||
Loading…
Reference in a new issue