/* This TPM PCR is where most Linux infrastructure extends the initrd binary images into, and so do we. */
#define TPM_PCR_INDEX_INITRD 4
-#define OFFSETOF(x,y) __builtin_offsetof(x,y)
+#define offsetof(type, member) __builtin_offsetof(type, member)
#define UINTN_MAX (~(UINTN)0)
#define INTN_MAX ((INTN)(UINTN_MAX>>1))
EFI_STATUS efivar_get_boolean_u8(const EFI_GUID *vendor, const CHAR16 *name, BOOLEAN *ret);
CHAR8 *strchra(const CHAR8 *s, CHAR8 c);
-CHAR16 *stra_to_path(const CHAR8 *stra);
-CHAR16 *stra_to_str(const CHAR8 *stra);
+CHAR16 *xstra_to_path(const CHAR8 *stra);
+CHAR16 *xstra_to_str(const CHAR8 *stra);
EFI_STATUS file_read(EFI_FILE_HANDLE dir, const CHAR16 *name, UINTN off, UINTN size, CHAR8 **content, UINTN *content_size);
-static inline void FreePoolp(void *p) {
+static inline void free_poolp(void *p) {
void *q = *(void**) p;
if (!q)
FreePool(q);
}
-#define _cleanup_freepool_ _cleanup_(FreePoolp)
+#define _cleanup_freepool_ _cleanup_(free_poolp)
-static inline void FileHandleClosep(EFI_FILE_HANDLE *handle) {
+static inline void file_handle_closep(EFI_FILE_HANDLE *handle) {
if (!*handle)
return;
err; \
})
-void *memmem_safe(const void *haystack, UINTN haystack_len, const void *needle, UINTN needle_len);
-
-static inline void *mempmem_safe(const void *haystack, UINTN haystack_len, const void *needle, UINTN needle_len) {
- CHAR8 *p = memmem_safe(haystack, haystack_len, needle, needle_len);
- return p ? p + needle_len : NULL;
-}
-
void print_at(UINTN x, UINTN y, UINTN attr, const CHAR16 *str);
void clear_screen(UINTN attr);
EFI_STATUS readdir_harder(EFI_FILE_HANDLE handle, EFI_FILE_INFO **buffer, UINTN *buffer_size);
UINTN strnlena(const CHAR8 *p, UINTN maxlen);
-CHAR8 *strndup8(const CHAR8 *p, UINTN sz);
+CHAR8 *xstrndup8(const CHAR8 *p, UINTN sz);
+INTN strncasecmpa(const CHAR8 *a, const CHAR8 *b, UINTN maxlen);
+static inline BOOLEAN strncaseeqa(const CHAR8 *a, const CHAR8 *b, UINTN maxlen) {
+ return strncasecmpa(a, b, maxlen) == 0;
+}
BOOLEAN is_ascii(const CHAR16 *f);
}
UINT64 get_os_indications_supported(void);
+
+#ifdef EFI_DEBUG
+void debug_break(void);
+extern UINT8 _text, _data;
+/* Report the relocated position of text and data sections so that a debugger
+ * can attach to us. See debug-sd-boot.sh for how this can be done. */
+# define debug_hook(identity) Print(identity L"@0x%x,0x%x\n", &_text, &_data)
+#else
+# define debug_hook(identity)
+#endif