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
This commit is contained in:
Ryan Zuklie 2022-12-15 16:11:37 -08:00
commit 8531cfe5dd

View file

@ -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