Blame SOURCES/0268-misc-make-grub_boot_time-also-call-grub_dprintf-boot.patch

1c6ba0
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
1c6ba0
From: Peter Jones <pjones@redhat.com>
1c6ba0
Date: Thu, 24 Mar 2022 14:40:01 -0400
1c6ba0
Subject: [PATCH] misc: make grub_boot_time() also call
1c6ba0
 grub_dprintf("boot",...)
1c6ba0
1c6ba0
Currently grub_boot_time() includes valuable debugging messages, but if
1c6ba0
you build without BOOT_TIME_STATS enabled, they are silently and
1c6ba0
confusingly compiled away.
1c6ba0
1c6ba0
This patch changes grub_boot_time() to also log when "boot" is enabled
1c6ba0
in DEBUG, regardless of BOOT_TIME_STATS.
1c6ba0
1c6ba0
Signed-off-by: Peter Jones <pjones@redhat.com>
1c6ba0
(cherry picked from commit 4fd282de00df05ce289467861deb7a0e186cfbd7)
1c6ba0
---
1c6ba0
 grub-core/kern/misc.c | 3 ++-
1c6ba0
 include/grub/misc.h   | 2 +-
1c6ba0
 2 files changed, 3 insertions(+), 2 deletions(-)
1c6ba0
1c6ba0
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
1c6ba0
index a186ad3dd4..cb45461402 100644
1c6ba0
--- a/grub-core/kern/misc.c
1c6ba0
+++ b/grub-core/kern/misc.c
1c6ba0
@@ -1334,7 +1334,8 @@ grub_real_boot_time (const char *file,
1c6ba0
   n->next = 0;
1c6ba0
 
1c6ba0
   va_start (args, fmt);
1c6ba0
-  n->msg = grub_xvasprintf (fmt, args);    
1c6ba0
+  n->msg = grub_xvasprintf (fmt, args);
1c6ba0
+  grub_dprintf ("boot", "%s\n", n->msg);
1c6ba0
   va_end (args);
1c6ba0
 
1c6ba0
   *boot_time_last = n;
1c6ba0
diff --git a/include/grub/misc.h b/include/grub/misc.h
1c6ba0
index cf84aec1db..faae0ae860 100644
1c6ba0
--- a/include/grub/misc.h
1c6ba0
+++ b/include/grub/misc.h
1c6ba0
@@ -503,7 +503,7 @@ void EXPORT_FUNC(grub_real_boot_time) (const char *file,
1c6ba0
 				       const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 3, 4)));
1c6ba0
 #define grub_boot_time(...) grub_real_boot_time(GRUB_FILE, __LINE__, __VA_ARGS__)
1c6ba0
 #else
1c6ba0
-#define grub_boot_time(...)
1c6ba0
+#define grub_boot_time(fmt, ...) grub_dprintf("boot", fmt "\n", ##__VA_ARGS__)
1c6ba0
 #endif
1c6ba0
 
1c6ba0
 #define _grub_min(a, b, _a, _b)						      \