1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 /* This defines a number of basic types that are one thing in userspace and another in the UEFI environment,
5  * but mostly the same in concept and behaviour.
6  *
7  * Note: if the definition of these types/values has slightly different semantics in userspace and in the
8  * UEFI environment then please prefix its name with "sd_" to make clear these types have special semantics,
9  * and *we* defined them. Otherwise, if the types are effectively 100% identical in behaviour in userspace
10  * and UEFI environment you can omit the prefix. (Examples: sd_char is 8 bit in userspace and 16 bit in UEFI
11  * space hence it should have the sd_ prefix; but size_t in userspace and UINTN in UEFI environment are 100%
12  * defined the same way ultimately, hence it's OK to just define size_t as alias to UINTN in UEFI
13  * environment, so that size_t can be used everywhere, without any "sd_" prefix.)
14  *
15  * Note: we generally prefer the userspace names of types and concepts. i.e. if in doubt please name types
16  * after the userspace vocabulary, and let's keep UEFI vocabulary specific to the UEFI build environment. */
17 
18 #ifdef SD_BOOT
19 #include <efi.h>
20 
21 typedef BOOLEAN sd_bool;
22 typedef CHAR16  sd_char;
23 typedef INTN    sd_int;
24 typedef UINTN   size_t;
25 
26 #define sd_true  TRUE
27 #define sd_false FALSE
28 #else
29 #include <stdbool.h>
30 #include <stdint.h>
31 
32 typedef bool    sd_bool;
33 typedef char    sd_char;
34 typedef int     sd_int;
35 
36 #define sd_true  true
37 #define sd_false false
38 
39 #endif
40