type safety for bool shared am: a262bd3d1e am: 39c602b991
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2775542
Change-Id: Id6817ae0fb098270e370eeef53d79adff8e756d1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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;