All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: Change grub_efi_boolean_t from char to enum
@ 2023-08-14 21:38 Glenn Washburn
  2023-08-31 18:05 ` Daniel Kiper
  2023-08-31 18:36 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 7+ messages in thread
From: Glenn Washburn @ 2023-08-14 21:38 UTC (permalink / raw)
  To: grub-devel, Daniel Kiper, Ard Biesheuvel; +Cc: Glenn Washburn

This allows using GRUB_EFI_TRUE and GRUB_EFI_FALSE with proper type and
value checking. The UEFI 2.10 specification, in section 2.3.1, table 2.3,
says the size of the boolean is 1 byte and may only contain the values 0 or
1. In order to have the enum be 1-byte in size instead of the default
int-sized, add the packed attribute to the enum.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 include/grub/efi/api.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
index 5934db1c992b..be7c128dfb42 100644
--- a/include/grub/efi/api.h
+++ b/include/grub/efi/api.h
@@ -552,7 +552,13 @@ enum grub_efi_reset_type
 typedef enum grub_efi_reset_type grub_efi_reset_type_t;
 
 /* Types.  */
-typedef char grub_efi_boolean_t;
+enum GRUB_PACKED grub_efi_boolean
+  {
+    GRUB_EFI_FALSE,
+    GRUB_EFI_TRUE
+  };
+typedef enum grub_efi_boolean grub_efi_boolean_t;
+
 #if GRUB_CPU_SIZEOF_VOID_P == 8
 typedef grub_int64_t grub_efi_intn_t;
 typedef grub_uint64_t grub_efi_uintn_t;
-- 
2.34.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-09-04 19:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-14 21:38 [PATCH] efi: Change grub_efi_boolean_t from char to enum Glenn Washburn
2023-08-31 18:05 ` Daniel Kiper
2023-09-01  4:58   ` Glenn Washburn
2023-09-02 18:45     ` Daniel Kiper
2023-09-04 19:34       ` Glenn Washburn
2023-08-31 18:36 ` Vladimir 'phcoder' Serbinenko
2023-09-04 19:30   ` Glenn Washburn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.