nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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