nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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