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

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