dmidecode-devel
[Top][All Lists]
Advanced

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

[dmidecode] [PATCH] dmidecode: add --compat-uuid param


From: Yang Yanchao
Subject: [dmidecode] [PATCH] dmidecode: add --compat-uuid param
Date: Sat, 29 Jan 2022 15:00:23 +0800

add compat-uuid param to obtaim 2.6 SMBIOS specification compataible uuid

Signed-off-by: guoxiaoqi <guoxiaoqi2@huawei.com>
Signed-off-by: Yang Yanchao <yangyanchao6@huawei.com>
---
 dmidecode.c | 2 +-
 dmiopt.c    | 5 +++++
 dmiopt.h    | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/dmidecode.c b/dmidecode.c
index a3e9d6c..35c19c2 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -447,7 +447,7 @@ static void dmi_system_uuid(const u8 *p, u16 ver)
         * network byte order, so I am reluctant to apply the byte-swapping
         * for older versions.
         */
-       if (ver >= 0x0206)
+       if (ver >= 0x0206 && !(opt.flags & FLAG_COMPAT_UUID))
        {
                if (print_cb)
                        print_cb(attr,
diff --git a/dmiopt.c b/dmiopt.c
index 2f285f3..dede0f9 100644
--- a/dmiopt.c
+++ b/dmiopt.c
@@ -276,6 +276,7 @@ int parse_command_line(int argc, char * const argv[])
                { "oem-string", required_argument, NULL, 'O' },
                { "no-sysfs", no_argument, NULL, 'S' },
                { "version", no_argument, NULL, 'V' },
+               { "compat-uuid", no_argument, NULL, 'C' },
                { NULL, 0, NULL, 0 }
        };
 
@@ -328,6 +329,9 @@ int parse_command_line(int argc, char * const argv[])
                        case 'V':
                                opt.flags |= FLAG_VERSION;
                                break;
+                       case 'C':
+                               opt.flags |= FLAG_COMPAT_UUID;
+                               break;
                        case '?':
                                switch (optopt)
                                {
@@ -375,6 +379,7 @@ void print_help(void)
                "     --dump-bin FILE    Dump the DMI data to a binary file\n"
                "     --from-dump FILE   Read the DMI data from a binary file\n"
                "     --no-sysfs         Do not attempt to read DMI data from 
sysfs files\n"
+               "     --compat-uuid      use compat uuid format with 2.6 SMBIOS 
specification\n"
                "     --oem-string N     Only display the value of the given 
OEM string\n"
                " -V, --version          Display the version and exit\n";
 
diff --git a/dmiopt.h b/dmiopt.h
index 2374637..4ada9ac 100644
--- a/dmiopt.h
+++ b/dmiopt.h
@@ -46,6 +46,7 @@ extern struct opt opt;
 #define FLAG_DUMP_BIN           (1 << 4)
 #define FLAG_FROM_DUMP          (1 << 5)
 #define FLAG_NO_SYSFS           (1 << 6)
+#define FLAG_COMPAT_UUID        (1 << 7)
 
 int parse_command_line(int argc, char * const argv[]);
 void print_help(void);
-- 
1.8.3.1




reply via email to

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