dmidecode-devel
[Top][All Lists]
Advanced

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

[dmidecode] [PATCH 4/4] Add --no-sysfs option to disable use of sysfs


From: Roy Franz
Subject: [dmidecode] [PATCH 4/4] Add --no-sysfs option to disable use of sysfs
Date: Fri, 17 Apr 2015 11:36:33 -0700

This option forces any SMBIOS information in sysfs to be ignored, resulting
in dmidecode using /dev/mem for SMBIOS access.  This is likely most useful
for debugging.

Signed-off-by: Roy Franz <address@hidden>
---
 dmidecode.c     | 3 ++-
 dmiopt.c        | 4 ++++
 dmiopt.h        | 1 +
 man/dmidecode.8 | 4 ++++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/dmidecode.c b/dmidecode.c
index 448d5b4..e596785 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4674,7 +4674,8 @@ int main(int argc, char * const argv[])
         * contain one of several types of entry points, so read enough for
         * the largest one, then determine what type it contains.
         */
-       if ((buf = read_file(0x20, SYS_ENTRY_FILE)) != NULL)
+       if (!(opt.flags & FLAG_NO_SYSFS)
+           && (buf = read_file(0x20, SYS_ENTRY_FILE)) != NULL)
        {
                if (!(opt.flags & FLAG_QUIET))
                        printf("Getting SMBIOS data from sysfs.\n");
diff --git a/dmiopt.c b/dmiopt.c
index 1c56a0e..91df017 100644
--- a/dmiopt.c
+++ b/dmiopt.c
@@ -226,6 +226,7 @@ int parse_command_line(int argc, char * const argv[])
                { "dump-bin", required_argument, NULL, 'B' },
                { "from-dump", required_argument, NULL, 'F' },
                { "version", no_argument, NULL, 'V' },
+               { "no-sysfs", no_argument, NULL, 'S' },
                { 0, 0, 0, 0 }
        };
 
@@ -265,6 +266,9 @@ int parse_command_line(int argc, char * const argv[])
                        case 'V':
                                opt.flags |= FLAG_VERSION;
                                break;
+                       case 'S':
+                               opt.flags |= FLAG_NO_SYSFS;
+                               break;
                        case '?':
                                switch (optopt)
                                {
diff --git a/dmiopt.h b/dmiopt.h
index b7f2533..5f3103c 100644
--- a/dmiopt.h
+++ b/dmiopt.h
@@ -42,6 +42,7 @@ extern struct opt opt;
 #define FLAG_QUIET              (1 << 3)
 #define FLAG_DUMP_BIN           (1 << 4)
 #define FLAG_FROM_DUMP          (1 << 5)
+#define FLAG_NO_SYSFS           (1 << 6)
 
 int parse_command_line(int argc, char * const argv[]);
 void print_help(void);
diff --git a/man/dmidecode.8 b/man/dmidecode.8
index e2e95ea..05b32fd 100644
--- a/man/dmidecode.8
+++ b/man/dmidecode.8
@@ -130,6 +130,10 @@ later.
 Read the DMI data from a binary file previously generated using 
 \fB--dump-bin\fR.
 .TP
+.BR "  " "  " "--no-sysfs"
+Do not attempt to read DMI data from sysfs files. This is mainly useful for
+debugging.
+.TP
 .BR "-h" ", " "--help"
 Display usage information and exit
 .TP
-- 
1.9.1




reply via email to

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