Blame SOURCES/0012-dmidecode-Add-helper-function-pr_handle.patch

f877e3
From d37eed24b07da16719ce969f119b4c636e0e2d96 Mon Sep 17 00:00:00 2001
f877e3
From: Jean Delvare <jdelvare@suse.de>
f877e3
Date: Wed, 1 Apr 2020 09:51:57 +0200
f877e3
Subject: [PATCH 12/23] dmidecode: Add helper function pr_handle
f877e3
f877e3
Print the handle information through a helper function pr_handle.
f877e3
f877e3
Signed-off-by: Jean Delvare <jdelvare@suse.de>
f877e3
---
f877e3
 dmidecode.c | 3 +--
f877e3
 dmioutput.c | 6 ++++++
f877e3
 dmioutput.h | 3 +++
f877e3
 3 files changed, 10 insertions(+), 2 deletions(-)
f877e3
f877e3
diff --git a/dmidecode.c b/dmidecode.c
f877e3
index e3f6e300efc2..8ba8d078614e 100644
f877e3
--- a/dmidecode.c
f877e3
+++ b/dmidecode.c
f877e3
@@ -5212,8 +5212,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
f877e3
 
f877e3
 		if (display
f877e3
 		 && (!(opt.flags & FLAG_QUIET) || (opt.flags & FLAG_DUMP)))
f877e3
-			printf("Handle 0x%04X, DMI type %d, %d bytes\n",
f877e3
-				h.handle, h.type, h.length);
f877e3
+			pr_handle(&h);
f877e3
 
f877e3
 		/* Look for the next handle */
f877e3
 		next = data + h.length;
f877e3
diff --git a/dmioutput.c b/dmioutput.c
f877e3
index e702f114bb4a..ad3b0398c446 100644
f877e3
--- a/dmioutput.c
f877e3
+++ b/dmioutput.c
f877e3
@@ -43,3 +43,9 @@ void pr_info(const char *format, ...)
f877e3
 	va_end(args);
f877e3
 	printf("\n");
f877e3
 }
f877e3
+
f877e3
+void pr_handle(const struct dmi_header *h)
f877e3
+{
f877e3
+	printf("Handle 0x%04X, DMI type %d, %d bytes\n",
f877e3
+	       h->handle, h->type, h->length);
f877e3
+}
f877e3
diff --git a/dmioutput.h b/dmioutput.h
f877e3
index 0dd8f0811934..6ef60f0ee3cd 100644
f877e3
--- a/dmioutput.h
f877e3
+++ b/dmioutput.h
f877e3
@@ -19,5 +19,8 @@
f877e3
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
f877e3
  */
f877e3
 
f877e3
+#include "dmidecode.h"
f877e3
+
f877e3
 void pr_comment(const char *format, ...);
f877e3
 void pr_info(const char *format, ...);
f877e3
+void pr_handle(const struct dmi_header *h);
f877e3
-- 
f877e3
2.17.1
f877e3