Skip to content

Commit b334365

Browse files
committed
dmidecode: Add --no-sysfs option to disable use of sysfs
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. Contributed by Roy Franz.
1 parent b0f6dae commit b334365

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
entire binary file into a buffer.
55
* dmidecode.c: Add passing of flags parameter to dmi_table.
66
* dmidecode.c: Add reading of SMBIOS tables from sysfs.
7+
* dmidecode.c, dmiopt.c, dmiopt.h: Add --no-sysfs option to disable
8+
use of sysfs.
9+
* dmidecode.8: Document the changes above.
710

811
2015-04-20 Jean Delvare <[email protected]>
912

dmidecode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4677,7 +4677,8 @@ int main(int argc, char * const argv[])
46774677
* contain one of several types of entry points, so read enough for
46784678
* the largest one, then determine what type it contains.
46794679
*/
4680-
if ((buf = read_file(0x20, SYS_ENTRY_FILE)) != NULL)
4680+
if (!(opt.flags & FLAG_NO_SYSFS)
4681+
&& (buf = read_file(0x20, SYS_ENTRY_FILE)) != NULL)
46814682
{
46824683
if (!(opt.flags & FLAG_QUIET))
46834684
printf("Getting SMBIOS data from sysfs.\n");

dmiopt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ int parse_command_line(int argc, char * const argv[])
225225
{ "dump", no_argument, NULL, 'u' },
226226
{ "dump-bin", required_argument, NULL, 'B' },
227227
{ "from-dump", required_argument, NULL, 'F' },
228+
{ "no-sysfs", no_argument, NULL, 'S' },
228229
{ "version", no_argument, NULL, 'V' },
229230
{ 0, 0, 0, 0 }
230231
};
@@ -262,6 +263,9 @@ int parse_command_line(int argc, char * const argv[])
262263
case 'u':
263264
opt.flags |= FLAG_DUMP;
264265
break;
266+
case 'S':
267+
opt.flags |= FLAG_NO_SYSFS;
268+
break;
265269
case 'V':
266270
opt.flags |= FLAG_VERSION;
267271
break;

dmiopt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ extern struct opt opt;
4242
#define FLAG_QUIET (1 << 3)
4343
#define FLAG_DUMP_BIN (1 << 4)
4444
#define FLAG_FROM_DUMP (1 << 5)
45+
#define FLAG_NO_SYSFS (1 << 6)
4546

4647
int parse_command_line(int argc, char * const argv[]);
4748
void print_help(void);

man/dmidecode.8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ later.
130130
Read the DMI data from a binary file previously generated using
131131
\fB--dump-bin\fR.
132132
.TP
133+
.BR " " " " "--no-sysfs"
134+
Do not attempt to read DMI data from sysfs files. This is mainly useful for
135+
debugging.
136+
.TP
133137
.BR "-h" ", " "--help"
134138
Display usage information and exit
135139
.TP

0 commit comments

Comments
 (0)