nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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