dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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