type safety for bool ignore_on_{eng,user,userdebug} am: 6dec6e9374
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2775544 Change-Id: I085db833bc4b59ec0730f0010edb1e7c894b2f9f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
dadf98a50e
@@ -191,7 +191,9 @@ static void (*bpf_ringbuf_submit_unsafe)(const void* data, __u64 flags) = (void*
|
||||
#define BPF_ASSERT_LOADER_VERSION(min_loader, ignore_eng, ignore_user, ignore_userdebug) \
|
||||
_Static_assert( \
|
||||
(min_loader) >= BPFLOADER_IGNORED_ON_VERSION || \
|
||||
!((ignore_eng) || (ignore_user) || (ignore_userdebug)), \
|
||||
!((ignore_eng).ignore_on_eng || \
|
||||
(ignore_user).ignore_on_user || \
|
||||
(ignore_userdebug).ignore_on_userdebug), \
|
||||
"bpfloader min version must be >= 0.33 in order to use ignored_on");
|
||||
|
||||
#define DEFINE_BPF_MAP_BASE(the_map, TYPE, keysize, valuesize, num_entries, \
|
||||
@@ -214,9 +216,9 @@ static void (*bpf_ringbuf_submit_unsafe)(const void* data, __u64 flags) = (void*
|
||||
.selinux_context = (selinux), \
|
||||
.pin_subdir = (pindir), \
|
||||
.shared = (share).shared, \
|
||||
.ignore_on_eng = (ignore_eng), \
|
||||
.ignore_on_user = (ignore_user), \
|
||||
.ignore_on_userdebug = (ignore_userdebug), \
|
||||
.ignore_on_eng = (ignore_eng).ignore_on_eng, \
|
||||
.ignore_on_user = (ignore_user).ignore_on_user, \
|
||||
.ignore_on_userdebug = (ignore_userdebug).ignore_on_userdebug, \
|
||||
}; \
|
||||
BPF_ASSERT_LOADER_VERSION(minloader, ignore_eng, ignore_user, ignore_userdebug);
|
||||
|
||||
@@ -369,9 +371,9 @@ static long (*bpf_get_current_comm)(void* buf, uint32_t buf_size) = (void*) BPF_
|
||||
.bpfloader_max_ver = (max_loader), \
|
||||
.selinux_context = (selinux), \
|
||||
.pin_subdir = (pindir), \
|
||||
.ignore_on_eng = (ignore_eng), \
|
||||
.ignore_on_user = (ignore_user), \
|
||||
.ignore_on_userdebug = (ignore_userdebug), \
|
||||
.ignore_on_eng = (ignore_eng).ignore_on_eng, \
|
||||
.ignore_on_user = (ignore_user).ignore_on_user, \
|
||||
.ignore_on_userdebug = (ignore_userdebug).ignore_on_userdebug, \
|
||||
}; \
|
||||
SECTION(SECTION_NAME) \
|
||||
int the_prog
|
||||
|
||||
@@ -125,13 +125,18 @@ struct optional_bool { bool optional; };
|
||||
#define MANDATORY ((struct optional_bool){ .optional = false })
|
||||
#define OPTIONAL ((struct optional_bool){ .optional = true })
|
||||
|
||||
// constants for passing in to ignore_on_eng / ignore_on_user / ignore_on_userdebug
|
||||
static const bool LOAD_ON_ENG = false;
|
||||
static const bool LOAD_ON_USER = false;
|
||||
static const bool LOAD_ON_USERDEBUG = false;
|
||||
static const bool IGNORE_ON_ENG = true;
|
||||
static const bool IGNORE_ON_USER = true;
|
||||
static const bool IGNORE_ON_USERDEBUG = true;
|
||||
// for both maps and programs:
|
||||
struct ignore_on_eng_bool { bool ignore_on_eng; };
|
||||
#define LOAD_ON_ENG ((struct ignore_on_eng_bool){ .ignore_on_eng = false })
|
||||
#define IGNORE_ON_ENG ((struct ignore_on_eng_bool){ .ignore_on_eng = true })
|
||||
|
||||
struct ignore_on_user_bool { bool ignore_on_user; };
|
||||
#define LOAD_ON_USER ((struct ignore_on_user_bool){ .ignore_on_user = false })
|
||||
#define IGNORE_ON_USER ((struct ignore_on_user_bool){ .ignore_on_user = true })
|
||||
|
||||
struct ignore_on_userdebug_bool { bool ignore_on_userdebug; };
|
||||
#define LOAD_ON_USERDEBUG ((struct ignore_on_userdebug_bool){ .ignore_on_userdebug = false })
|
||||
#define IGNORE_ON_USERDEBUG ((struct ignore_on_userdebug_bool){ .ignore_on_userdebug = true })
|
||||
|
||||
|
||||
// Length of strings (incl. selinux_context and pin_subdir)
|
||||
|
||||
Reference in New Issue
Block a user