type safety for bool shared

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4883eab734f47522fec718f0709475f7e6dd0a53
This commit is contained in:
Maciej Żenczykowski
2023-10-06 14:36:01 -07:00
parent 3cb494fd28
commit a262bd3d1e
2 changed files with 5 additions and 4 deletions

View File

@@ -213,7 +213,7 @@ static void (*bpf_ringbuf_submit_unsafe)(const void* data, __u64 flags) = (void*
.max_kver = (maxkver), \ .max_kver = (maxkver), \
.selinux_context = (selinux), \ .selinux_context = (selinux), \
.pin_subdir = (pindir), \ .pin_subdir = (pindir), \
.shared = (share), \ .shared = (share).shared, \
.ignore_on_eng = (ignore_eng), \ .ignore_on_eng = (ignore_eng), \
.ignore_on_user = (ignore_user), \ .ignore_on_user = (ignore_user), \
.ignore_on_userdebug = (ignore_userdebug), \ .ignore_on_userdebug = (ignore_userdebug), \

View File

@@ -115,9 +115,10 @@ _Static_assert(__alignof__(unsigned long long) == 8, "__alignof__ unsigned long
//_Static_assert(_Alignof(unsigned long long) == 8, "_Alignof unsigned long long != 8"); //_Static_assert(_Alignof(unsigned long long) == 8, "_Alignof unsigned long long != 8");
// constants for passing in to 'bool shared' (for maps) // for maps:
static const bool PRIVATE = false; struct shared_bool { bool shared; };
static const bool SHARED = true; #define PRIVATE ((struct shared_bool){ .shared = false })
#define SHARED ((struct shared_bool){ .shared = true })
// constants for passing in to 'bool optional' (for programs) // constants for passing in to 'bool optional' (for programs)
static const bool MANDATORY = false; static const bool MANDATORY = false;