nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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