[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
- [dmidecode] [PATCH 00/11] dmidecode: Output through helper functions, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 01/11] dmidecode: Add helper function pr_comment, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 03/11] dmidecode: Protect dmidecode.h against double inclusion, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 02/11] dmidecode: Add helper function pr_info, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 04/11] dmidecode: Add helper function pr_handle,
Jean Delvare <=
- [dmidecode] [PATCH 05/11] dmidecode: Add helper function pr_handle_name, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 06/11] dmidecode: Add helper function pr_attr, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 07/11] dmidecode: Add helper functions pr_list_start/item/end, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 08/11] dmidecode: Add helper function pr_subattr, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 09/11] dmidecode: Use the print helpers in dump mode too, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 10/11] dmidecode: Add helper function for separators, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 11/11] dmidecode: Add helper function for structure errors, Jean Delvare, 2020/03/24