nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0113-Add-more-dprintf-and-nerf-dprintf-in-script.c.patch

8e15ce
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8e15ce
From: Peter Jones <pjones@redhat.com>
8e15ce
Date: Tue, 11 Sep 2018 15:58:29 -0400
8e15ce
Subject: [PATCH] Add more dprintf, and nerf dprintf in script.c
8e15ce
8e15ce
Signed-off-by: Peter Jones <pjones@redhat.com>
8e15ce
---
8e15ce
 grub-core/disk/diskfilter.c  | 3 +++
8e15ce
 grub-core/disk/efi/efidisk.c | 1 +
8e15ce
 grub-core/kern/device.c      | 1 +
8e15ce
 grub-core/script/script.c    | 5 +++++
8e15ce
 4 files changed, 10 insertions(+)
8e15ce
8e15ce
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
8e15ce
index 0320115662f..7cdffe3ebd5 100644
8e15ce
--- a/grub-core/disk/diskfilter.c
8e15ce
+++ b/grub-core/disk/diskfilter.c
8e15ce
@@ -188,6 +188,8 @@ scan_disk (const char *name, int accept_diskfilter)
8e15ce
   grub_disk_t disk;
8e15ce
   static int scan_depth = 0;
8e15ce
 
8e15ce
+  grub_dprintf ("diskfilter", "scanning %s\n", name);
8e15ce
+
8e15ce
   if (!accept_diskfilter && is_valid_diskfilter_name (name))
8e15ce
     return 0;
8e15ce
 
8e15ce
@@ -1212,6 +1214,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
8e15ce
 	   the same.  */
8e15ce
 	if (pv->disk && grub_disk_native_sectors (disk) >= pv->part_size)
8e15ce
 	  return GRUB_ERR_NONE;
8e15ce
+	grub_dprintf ("diskfilter", "checking %s\n", disk->name);
8e15ce
 	pv->disk = grub_disk_open (disk->name);
8e15ce
 	if (!pv->disk)
8e15ce
 	  return grub_errno;
8e15ce
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
8e15ce
index f077b5f5535..fe8ba6e6c93 100644
8e15ce
--- a/grub-core/disk/efi/efidisk.c
8e15ce
+++ b/grub-core/disk/efi/efidisk.c
8e15ce
@@ -855,6 +855,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
8e15ce
 	  return 0;
8e15ce
 	}
8e15ce
 
8e15ce
+      grub_dprintf ("efidisk", "getting disk for %s\n", device_name);
8e15ce
       parent = grub_disk_open (device_name);
8e15ce
       grub_free (dup_dp);
8e15ce
 
8e15ce
diff --git a/grub-core/kern/device.c b/grub-core/kern/device.c
8e15ce
index 73b8ecc0c09..f58b58c89d5 100644
8e15ce
--- a/grub-core/kern/device.c
8e15ce
+++ b/grub-core/kern/device.c
8e15ce
@@ -34,6 +34,7 @@ grub_device_open (const char *name)
8e15ce
 {
8e15ce
   grub_device_t dev = 0;
8e15ce
 
8e15ce
+  grub_dprintf ("device", "opening device %s\n", name);
8e15ce
   if (! name)
8e15ce
     {
8e15ce
       name = grub_env_get ("root");
8e15ce
diff --git a/grub-core/script/script.c b/grub-core/script/script.c
8e15ce
index ec4d4337c66..844e8343ca7 100644
8e15ce
--- a/grub-core/script/script.c
8e15ce
+++ b/grub-core/script/script.c
8e15ce
@@ -22,6 +22,11 @@
8e15ce
 #include <grub/parser.h>
8e15ce
 #include <grub/mm.h>
8e15ce
 
8e15ce
+#ifdef grub_dprintf
8e15ce
+#undef grub_dprintf
8e15ce
+#endif
8e15ce
+#define grub_dprintf(no, fmt, ...)
8e15ce
+
8e15ce
 /* It is not possible to deallocate the memory when a syntax error was
8e15ce
    found.  Because of that it is required to keep track of all memory
8e15ce
    allocations.  The memory is freed in case of an error, or assigned