nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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