type safety for bool optional

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

View File

@@ -364,7 +364,7 @@ static long (*bpf_get_current_comm)(void* buf, uint32_t buf_size) = (void*) BPF_
.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), \

View File

@@ -120,9 +120,10 @@ 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;
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;