This patch introduces a '-i' option to the 'help' command to allow the
user
to conveniently display the DMI (Desktop Management Interface) table,
if available. For example:
crash> help -i
dmi_ident[1]: LENOVO
dmi_ident[2]: GIET75WW (2.25 )
dmi_ident[3]: 06/24/2014
dmi_ident[4]: LENOVO
dmi_ident[5]: 20AMS22U0C
dmi_ident[6]: ThinkPad X240
dmi_ident[7]: PC00CDZE
dmi_ident[8]: 01338439-0853-CB11-8EBB-CE1D1FC1CBC0
dmi_ident[9]: LENOVO
dmi_ident[10]: 20AMS22U0C
dmi_ident[11]: Not Defined
dmi_ident[12]: L1HF47E00T3
dmi_ident[13]: Not Available
dmi_ident[14]: LENOVO
dmi_ident[15]: 10
dmi_ident[16]: Not Available
dmi_ident[17]: PC00CDZE
dmi_ident[18]: No Asset Information
crash>
Suggested-by: Buland Singh <bsingh(a)redhat.com>
Signed-off-by: Aaron Tomlin <atomlin(a)redhat.com>
---
help.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/help.c b/help.c
index 883ddd0..fb1d518 100644
--- a/help.c
+++ b/help.c
@@ -32,6 +32,7 @@ static char *output_info[];
static char *input_info[];
static char *README[];
static void dump_registers(void);
+static void dump_dmi_info(void);
#define GPLv2 2
#define GPLv3 3
@@ -523,7 +524,7 @@ cmd_help(void)
oflag = 0;
while ((c = getopt(argcnt, args,
- "efNDdmM:ngcaBbHhkKsvVoptTzLxOr")) != EOF) {
+ "efNDdmM:ngcaBbHhkKsvVoptTzLxOri")) != EOF) {
switch(c)
{
case 'e':
@@ -638,6 +639,7 @@ cmd_help(void)
fprintf(fp, " -f - filesys table\n");
fprintf(fp, " -h - hash_table data\n");
fprintf(fp, " -H - hash_table data (verbose)\n");
+ fprintf(fp, " -i - dump dmi_ident data\n");
fprintf(fp, " -k - kernel_table\n");
fprintf(fp, " -K - kernel_table (verbose)\n");
fprintf(fp, " -L - LKCD page cache environment\n");
@@ -663,6 +665,10 @@ cmd_help(void)
dump_registers();
return;
+ case 'i':
+ dump_dmi_info();
+ return;
+
default:
argerrs++;
break;
@@ -707,6 +713,32 @@ dump_registers(void)
ACTIVE() ? "a live system" : "this dumpfile type");
}
+static void
+dump_dmi_info(void)
+{
+ int i, len;
+ ulong dmi_ident_p, vaddr;
+ char buf[BUFSIZE];
+
+ if (!kernel_symbol_exists("dmi_ident")) {
+ error(INFO, "dmi_ident does not exist in this kernel\n");
+ }
+
+ dmi_ident_p = symbol_value("dmi_ident");
+ len = get_array_length("dmi_ident", NULL, 0);
+
+ for (i = 0; i < len; i++) {
+ readmem(dmi_ident_p + (sizeof(void *) * i),
+ KVADDR, &vaddr, sizeof(void *),
+ "dmi_ident", FAULT_ON_ERROR);
+
+ if (!vaddr)
+ continue;
+ read_string(vaddr, buf, BUFSIZE-1);
+ fprintf(fp, " dmi_ident[%d]: %s\n", i, buf);
+ }
+}
+
/*
* Format and display the help menu.
*/
@@ -991,6 +1023,7 @@ char *help_help[] = {
" -f - filesys table",
" -h - hash_table data",
" -H - hash_table data (verbose)",
+" -i - dump dmi_ident data",
" -k - kernel_table",
" -K - kernel_table (verbose)",
" -L - LKCD page cache environment",
--
2.4.3