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

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