type safety for bool optional

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6f10395ca6f1c73f3513031f561fdf1b1dedf451
diff --git a/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h b/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h
index 323b0d6..eea7dd2 100644
--- a/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h
+++ b/staticlibs/native/bpf_headers/include/bpf/bpf_helpers.h
@@ -364,7 +364,7 @@
         .gid = (prog_gid),                                                               \
         .min_kver = (min_kv),                                                            \
         .max_kver = (max_kv),                                                            \
-        .optional = (opt),                                                               \
+        .optional = (opt).optional,                                                      \
         .bpfloader_min_ver = (min_loader),                                               \
         .bpfloader_max_ver = (max_loader),                                               \
         .selinux_context = (selinux),                                                    \
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 0a7439c..615a570 100644
--- a/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h
+++ b/staticlibs/native/bpf_headers/include/bpf/bpf_map_def.h
@@ -120,9 +120,10 @@
 #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;
-static const bool OPTIONAL = true;
+// for programs:
+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;