nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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