From 8531cfe5dda13fcb56ffbebbb4e39d9b6940fcef Mon Sep 17 00:00:00 2001 From: Ryan Zuklie Date: Thu, 15 Dec 2022 16:11:37 -0800 Subject: [PATCH] Add option to skip map/prog based on build type This feature allows skipping a program or map based on the type of the build. This allows things like userdebug-only programs. Bug: 246985031 Test: added test program and watched it skipped on userdebug Change-Id: I5cd9725ad8f133c98c86e6ba620a266313055157 --- .../bpf_headers/include/bpf/bpf_map_def.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h b/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h index 02caf07e93..f17cf3ac1a 100644 --- a/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h +++ b/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h @@ -174,7 +174,14 @@ struct bpf_map_def { char pin_subdir[BPF_PIN_SUBDIR_CHAR_ARRAY_SIZE]; bool shared; // use empty string as 'file' component of pin path - allows cross .o map sharing - char pad0[3]; // manually pad up to 4 byte alignment, may be used for extensions in the future + + // The following 3 ignore_on_* fields were added in version 0.32 (U). These are ignored in + // older bpfloader versions, and zero in programs compiled before 0.32. + bool ignore_on_eng:1; + bool ignore_on_user:1; + bool ignore_on_userdebug:1; + + char pad0[2]; // manually pad up to 4 byte alignment, may be used for extensions in the future unsigned int uid; // uid_t }; @@ -196,7 +203,14 @@ struct bpf_prog_def { unsigned int max_kver; bool optional; // program section (ie. function) may fail to load, continue onto next func. - char pad0[3]; + + // The following 3 ignore_on_* fields were added in version 0.32 (U). These are ignored in + // older bpfloader versions, and zero in programs compiled before 0.32. + bool ignore_on_eng:1; + bool ignore_on_user:1; + bool ignore_on_userdebug:1; + + char pad0[2]; // manually pad up to 4 byte alignment, may be used for extensions in the future // The following fields were added in version 0.1 unsigned int bpfloader_min_ver; // if missing, defaults to 0, ie. v0.0