Sometimes you know only know which debug logging conditionals you want to
turn off.  Now debug log messages can be excluded by specifying the
conditional in the $debug string with a prepended dash.  So say you want
all debug logging on except for btrfs and scripting, then set
debug=all,-btrfs,-scripting.

Signed-off-by: Glenn Washburn <developm...@efficientek.com>
---
 grub-core/kern/misc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index 11b8592c8..73563b59b 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -168,7 +168,19 @@ grub_debug_enabled (const char * condition)
   if (!debug)
     return 0;
 
-  if (grub_strword (debug, "all") || grub_strword (debug, condition))
+  if (grub_strword (debug, "all"))
+    {
+      if (debug[3] == '\0')
+          return 1;
+      const char *ptr = NULL;
+      ptr = grub_strstr (debug, condition);
+      if (ptr > debug && *(ptr-1) == '-'
+         && (*(ptr + grub_strlen (condition)) == '\0'
+             || grub_iswordseparator (*(ptr + grub_strlen (condition)))))
+       return 0;
+      return 1;
+    }
+  else if (grub_strword (debug, condition))
     return 1;
 
   return 0;
-- 
2.27.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to