type safety for bool shared
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4883eab734f47522fec718f0709475f7e6dd0a53
diff --git a/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h b/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h
index 9583e80..323b0d6 100644
--- a/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h
+++ b/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h
@@ -213,7 +213,7 @@
.max_kver = (maxkver), \
.selinux_context = (selinux), \
.pin_subdir = (pindir), \
- .shared = (share), \
+ .shared = (share).shared, \
.ignore_on_eng = (ignore_eng), \
.ignore_on_user = (ignore_user), \
.ignore_on_userdebug = (ignore_userdebug), \
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 7474346..0a7439c 100644
--- a/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h
+++ b/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h
@@ -115,9 +115,10 @@
//_Static_assert(_Alignof(unsigned long long) == 8, "_Alignof unsigned long long != 8");
-// constants for passing in to 'bool shared' (for maps)
-static const bool PRIVATE = false;
-static const bool SHARED = true;
+// for maps:
+struct shared_bool { bool shared; };
+#define PRIVATE ((struct shared_bool){ .shared = false })
+#define SHARED ((struct shared_bool){ .shared = true })
// constants for passing in to 'bool optional' (for programs)
static const bool MANDATORY = false;