Blame SOURCES/0067-Add-PRIxGRUB_EFI_STATUS-and-use-it.patch

5593c8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
5593c8
From: Peter Jones <pjones@redhat.com>
5593c8
Date: Thu, 1 Jun 2017 10:07:50 -0400
5593c8
Subject: [PATCH] Add PRIxGRUB_EFI_STATUS and use it.
5593c8
5593c8
This avoids syntax checkers getting confused about if it's llx or lx.
5593c8
5593c8
Signed-off-by: Peter Jones <pjones@redhat.com>
5593c8
---
5593c8
 grub-core/loader/efi/chainloader.c | 3 ++-
5593c8
 include/grub/efi/api.h             | 9 +++++++++
5593c8
 2 files changed, 11 insertions(+), 1 deletion(-)
5593c8
5593c8
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
d3c3ab
index ba3d2930197..47f5aa14817 100644
5593c8
--- a/grub-core/loader/efi/chainloader.c
5593c8
+++ b/grub-core/loader/efi/chainloader.c
5593c8
@@ -806,7 +806,8 @@ handle_image (void *data, grub_efi_uint32_t datasize)
5593c8
   efi_status = efi_call_2 (entry_point, grub_efi_image_handle,
5593c8
 			   grub_efi_system_table);
5593c8
 
5593c8
-  grub_dprintf ("chain", "entry_point returned %ld\n", efi_status);
5593c8
+  grub_dprintf ("chain", "entry_point returned 0x%"PRIxGRUB_EFI_STATUS"\n",
5593c8
+		efi_status);
5593c8
   grub_memcpy (li, &li_bak, sizeof (grub_efi_loaded_image_t));
5593c8
   efi_status = grub_efi_free_pool (buffer);
5593c8
 
5593c8
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
d3c3ab
index 117469450d3..99628801478 100644
5593c8
--- a/include/grub/efi/api.h
5593c8
+++ b/include/grub/efi/api.h
5593c8
@@ -546,7 +546,16 @@ typedef grub_uint64_t grub_efi_uint64_t;
5593c8
 typedef grub_uint8_t grub_efi_char8_t;
5593c8
 typedef grub_uint16_t grub_efi_char16_t;
5593c8
 
5593c8
+
5593c8
 typedef grub_efi_uintn_t grub_efi_status_t;
5593c8
+/* Make grub_efi_status_t reasonably printable. */
5593c8
+#if GRUB_CPU_SIZEOF_VOID_P == 8
5593c8
+#define PRIxGRUB_EFI_STATUS "lx"
5593c8
+#define PRIdGRUB_EFI_STATUS "ld"
5593c8
+#else
5593c8
+#define PRIxGRUB_EFI_STATUS "llx"
5593c8
+#define PRIdGRUB_EFI_STATUS "lld"
5593c8
+#endif
5593c8
 
5593c8
 #define GRUB_EFI_ERROR_CODE(value)	\
5593c8
   ((((grub_efi_status_t) 1) << (sizeof (grub_efi_status_t) * 8 - 1)) | (value))