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

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