dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dmidecode] [PATCH 04/11] dmidecode: Add helper function pr_handle


From: Jean Delvare
Subject: [dmidecode] [PATCH 04/11] dmidecode: Add helper function pr_handle
Date: Tue, 24 Mar 2020 17:38:42 +0100

Print the handle information through a helper function pr_handle.

Signed-off-by: Jean Delvare <address@hidden>
---
 dmidecode.c |    3 +--
 dmioutput.c |    6 ++++++
 dmioutput.h |    3 +++
 3 files changed, 10 insertions(+), 2 deletions(-)

--- dmidecode.orig/dmioutput.c  2020-03-24 14:59:37.025653547 +0100
+++ dmidecode/dmioutput.c       2020-03-24 15:00:09.831053059 +0100
@@ -43,3 +43,9 @@ void pr_info(const char *format, ...)
        va_end(args);
        printf("\n");
 }
+
+void pr_handle(const struct dmi_header *h)
+{
+       printf("Handle 0x%04X, DMI type %d, %d bytes\n",
+              h->handle, h->type, h->length);
+}
--- dmidecode.orig/dmioutput.h  2020-03-24 14:59:37.025653547 +0100
+++ dmidecode/dmioutput.h       2020-03-24 15:00:09.831053059 +0100
@@ -19,5 +19,8 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
+#include "dmidecode.h"
+
 void pr_comment(const char *format, ...);
 void pr_info(const char *format, ...);
+void pr_handle(const struct dmi_header *h);
--- dmidecode.orig/dmidecode.c  2020-03-24 14:59:37.025653547 +0100
+++ dmidecode/dmidecode.c       2020-03-24 15:00:09.831053059 +0100
@@ -5212,8 +5212,7 @@ static void dmi_table_decode(u8 *buf, u3
 
                if (display
                 && (!(opt.flags & FLAG_QUIET) || (opt.flags & FLAG_DUMP)))
-                       printf("Handle 0x%04X, DMI type %d, %d bytes\n",
-                               h.handle, h.type, h.length);
+                       pr_handle(&h);
 
                /* Look for the next handle */
                next = data + h.length;

-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]