Blame SOURCES/0059-Put-some-EFI-device-paths-into-the-debug-log.patch

d5c737
From effecb5ce0baf2fae011dd61e45852cd2fb1ec19 Mon Sep 17 00:00:00 2001
d5c737
From: Peter Jones <pjones@redhat.com>
d5c737
Date: Tue, 15 Oct 2019 16:58:19 -0400
d5c737
Subject: [PATCH 59/63] Put some EFI device paths into the debug log
d5c737
d5c737
Signed-off-by: Peter Jones <pjones@redhat.com>
d5c737
---
d5c737
 src/linux.c | 41 +++++++++++++++++++++++++++++++++++++++++
d5c737
 1 file changed, 41 insertions(+)
d5c737
d5c737
diff --git a/src/linux.c b/src/linux.c
d5c737
index 7dd8d4cd858..9d8480a94a9 100644
d5c737
--- a/src/linux.c
d5c737
+++ b/src/linux.c
d5c737
@@ -336,6 +336,44 @@ device_free(struct device *dev)
d5c737
 	free(dev);
d5c737
 }
d5c737
 
d5c737
+static void
d5c737
+print_dev_dp_node(struct device *dev, struct dev_probe *probe)
d5c737
+{
d5c737
+	ssize_t dpsz;
d5c737
+	uint8_t *dp;
d5c737
+	ssize_t bufsz;
d5c737
+	uint8_t *buf;
d5c737
+
d5c737
+	dpsz = probe->create(dev, NULL, 0, 0);
d5c737
+	if (dpsz <= 0)
d5c737
+		return;
d5c737
+
d5c737
+	dp = alloca(dpsz + 4);
d5c737
+	if (!dp)
d5c737
+		return;
d5c737
+
d5c737
+	dpsz = probe->create(dev, dp, dpsz, 0);
d5c737
+	if (dpsz <= 0)
d5c737
+		return;
d5c737
+
d5c737
+	efidp_make_end_entire(dp + dpsz, 4);
d5c737
+	bufsz = efidp_format_device_path(NULL, 0,
d5c737
+					 (const_efidp)dp, dpsz + 4);
d5c737
+	if (bufsz <= 0)
d5c737
+		return;
d5c737
+
d5c737
+	buf = alloca(bufsz);
d5c737
+	if (!buf)
d5c737
+		return;
d5c737
+
d5c737
+	bufsz = efidp_format_device_path(buf, bufsz,
d5c737
+			(const_efidp)dp, dpsz + 4);
d5c737
+	if (bufsz <= 0)
d5c737
+		return;
d5c737
+
d5c737
+	debug("Device path node is %s", buf);
d5c737
+}
d5c737
+
d5c737
 struct device HIDDEN
d5c737
 *device_get(int fd, int partition)
d5c737
 {
d5c737
@@ -512,6 +550,9 @@ struct device HIDDEN
d5c737
 	                    probe->flags & DEV_ABBREV_ONLY)
d5c737
 	                        needs_root = false;
d5c737
 
d5c737
+			if (probe->create)
d5c737
+				print_dev_dp_node(dev, probe);
d5c737
+
d5c737
 	                dev->probes[n++] = dev_probes[i];
d5c737
 	                current += pos;
d5c737
 			if (current[0] == '\0')
d5c737
-- 
d5c737
2.26.2
d5c737