grub2/0119-Add-grub_debug_enabled.patch
Javier Martinez Canillas 1f092caba7
Drop two efinet patches that were causing issues and a bunch of other fixes
Add comments and revert logic changes in 01_fallback_counting
Remove quotes when reading ID value from /etc/os-release
  Related: rhbz#1650706
blscfg: expand grub_users before passing to grub_normal_add_menu_entry()
  Resolves: rhbz#1650706
Drop buggy downstream patch "efinet: retransmit if our device is busy"
  Resolves: rhbz#1649048
Make the menu entry users option argument to be optional
  Related: rhbz#1652434
10_linux_bls: add missing menu entries options
  Resolves: rhbz#1652434
Drop "Be more aggro about actually using the *configured* network device."
  Resolves: rhbz#1654388
Fix menu entry selection based on title
  Resolves: rhbz#1654936

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-12-01 03:28:36 +01:00

61 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 30 Nov 2017 15:11:39 -0500
Subject: [PATCH] Add grub_debug_enabled()
---
grub-core/kern/misc.c | 21 ++++++++++++++++-----
include/grub/misc.h | 1 +
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 636f97e1ba1..e758ab3416d 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -159,17 +159,28 @@ int grub_err_printf (const char *fmt, ...)
__attribute__ ((alias("grub_printf")));
#endif
+int
+grub_debug_enabled (const char * condition)
+{
+ const char *debug;
+
+ debug = grub_env_get ("debug");
+ if (!debug)
+ return 0;
+
+ if (grub_strword (debug, "all") || grub_strword (debug, condition))
+ return 1;
+
+ return 0;
+}
+
void
grub_real_dprintf (const char *file, const int line, const char *condition,
const char *fmt, ...)
{
va_list args;
- const char *debug = grub_env_get ("debug");
- if (! debug)
- return;
-
- if (grub_strword (debug, "all") || grub_strword (debug, condition))
+ if (grub_debug_enabled (condition))
{
grub_printf ("%s:%d: ", file, line);
va_start (args, fmt);
diff --git a/include/grub/misc.h b/include/grub/misc.h
index cbfae75a1b4..f7473c154f0 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -367,6 +367,7 @@ grub_puts (const char *s)
}
int EXPORT_FUNC(grub_puts_) (const char *s);
+int EXPORT_FUNC(grub_debug_enabled) (const char *condition);
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
const int line,
const char *condition,