nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0065-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch

8e15ce
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8e15ce
From: Peter Jones <pjones@redhat.com>
8e15ce
Date: Sun, 28 Jun 2015 13:09:58 -0400
8e15ce
Subject: [PATCH] Add grub_qdprintf() - grub_dprintf() without the file+line
8e15ce
 number.
8e15ce
8e15ce
This just makes copy+paste of our debug loading info easier.
8e15ce
8e15ce
Signed-off-by: Peter Jones <pjones@redhat.com>
8e15ce
---
8e15ce
 grub-core/kern/misc.c | 18 ++++++++++++++++++
8e15ce
 include/grub/misc.h   |  2 ++
8e15ce
 2 files changed, 20 insertions(+)
8e15ce
8e15ce
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
b35c50
index a432a6be54..9a2fae6398 100644
8e15ce
--- a/grub-core/kern/misc.c
8e15ce
+++ b/grub-core/kern/misc.c
8e15ce
@@ -191,6 +191,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition,
8e15ce
     }
8e15ce
 }
8e15ce
 
8e15ce
+void
8e15ce
+grub_qdprintf (const char *condition, const char *fmt, ...)
8e15ce
+{
8e15ce
+  va_list args;
8e15ce
+  const char *debug = grub_env_get ("debug");
8e15ce
+
8e15ce
+  if (! debug)
8e15ce
+    return;
8e15ce
+
8e15ce
+  if (grub_strword (debug, "all") || grub_strword (debug, condition))
8e15ce
+    {
8e15ce
+      va_start (args, fmt);
8e15ce
+      grub_vprintf (fmt, args);
8e15ce
+      va_end (args);
8e15ce
+      grub_refresh ();
8e15ce
+    }
8e15ce
+}
8e15ce
+
8e15ce
 #define PREALLOC_SIZE 255
8e15ce
 
8e15ce
 int
8e15ce
diff --git a/include/grub/misc.h b/include/grub/misc.h
b35c50
index fd18e6320b..3adc4036e3 100644
8e15ce
--- a/include/grub/misc.h
8e15ce
+++ b/include/grub/misc.h
8e15ce
@@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,
8e15ce
                                      const int line,
8e15ce
                                      const char *condition,
8e15ce
                                      const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5)));
8e15ce
+void EXPORT_FUNC(grub_qdprintf) (const char *condition,
8e15ce
+				 const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 2, 3)));
8e15ce
 int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
8e15ce
 int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...)
8e15ce
      __attribute__ ((format (GNU_PRINTF, 3, 4)));