diff options
author | Nima Talebi <nima@autonomy.net.au> | 2009-06-05 01:42:07 +1000 |
---|---|---|
committer | Nima Talebi <nima@autonomy.net.au> | 2009-06-05 01:42:07 +1000 |
commit | 2cf4f28f6fc671478003b31c03b93e070eee9942 (patch) | |
tree | b9d956cc1241852d88b03c3af54ae6cd99733b76 | |
parent | adc4191973b177f557d9a851d558d09cde841efe (diff) | |
download | python-dmidecode-2cf4f28f6fc671478003b31c03b93e070eee9942.tar.gz python-dmidecode-2cf4f28f6fc671478003b31c03b93e070eee9942.tar.xz python-dmidecode-2cf4f28f6fc671478003b31c03b93e070eee9942.zip |
Further removal of deprecated functions
Removed the `dmi_table_string' function, and `const struct
string_keyword *string' from the `options' struct. Also modified
the function calls that are now free of this, namely, `legacy_decode'
and `smbios_decode'.
-rw-r--r-- | src/dmidecode.c | 65 | ||||
-rw-r--r-- | src/dmidecode.h | 5 | ||||
-rw-r--r-- | src/dmidecodemodule.c | 10 | ||||
-rw-r--r-- | src/dmihelper.h | 1 |
4 files changed, 14 insertions, 67 deletions
diff --git a/src/dmidecode.c b/src/dmidecode.c index 974d6e3..fbc151a 100644 --- a/src/dmidecode.c +++ b/src/dmidecode.c @@ -4832,53 +4832,6 @@ void to_dmi_header(struct dmi_header *h, u8 * data) h->data = data; } -xmlNode *dmi_table_string(const struct string_keyword *opt_string, xmlNode *prnt_n, - const struct dmi_header *h, const u8 *data, u16 ver) -{ - int key; - u8 offset = opt_string->offset; - xmlNode *handle_n = NULL, *dmi_n = NULL; - - if(offset >= h->length) - return NULL; - - handle_n = xmlNewChild(prnt_n, NULL, (xmlChar *) "DMItable", NULL); - assert( handle_n != NULL ); - - //. TODO: These should have more meaningful dictionary names - key = (opt_string->type << 8) | offset; - - switch (key) { - case 0x108: - dmi_system_uuid(handle_n, data + offset, ver); - dmixml_AddAttribute(handle_n, "DMItype", "0x108"); - break; - - case 0x305: - dmi_chassis_type(handle_n, data[offset]); - dmixml_AddAttribute(handle_n, "DMItype", "0x305"); - // FIXME: Missing break? - - case 0x406: - dmi_processor_family(handle_n, h); - dmixml_AddAttribute(handle_n, "DMItype", "0x406"); - break; - - case 0x416: - dmi_n = dmixml_AddTextChild(handle_n, "ProcessorFrequency", "%s", - dmi_processor_frequency((u8 *) data + offset)); - dmixml_AddAttribute(dmi_n, "DMItype", "0x416"); - dmi_n = NULL; - break; - - default: - dmi_n = dmixml_AddTextChild(handle_n, "Unknown", "%s", dmi_string(h, data[offset])); - dmixml_AddAttribute(dmi_n, "DMItype", "0x%03x", key); - } - - return handle_n; -} - /* static void dmi_table_dump(options *opt, u32 base, u16 len, const char *devmem) { @@ -5014,8 +4967,7 @@ int dump(const char *dumpfile) return ret == 0 ? found : ret; } -static void dmi_table(u8 *type, const struct string_keyword *opt_string, - u32 base, u16 len, u16 num, u16 ver, const char *devmem, xmlNode *xmlnode) +static void dmi_table(u8 *type, u32 base, u16 len, u16 num, u16 ver, const char *devmem, xmlNode *xmlnode) { u8 *buf; u8 *data; @@ -5054,8 +5006,7 @@ static void dmi_table(u8 *type, const struct string_keyword *opt_string, int display; to_dmi_header(&h, data); - display = ((type == NULL || type[h.type]) // FIXME: Is this check correct? - && !opt_string); + display = (type == NULL || type[h.type]) // FIXME: Is this check correct? /* ** If a short entry is found (less than 4 bytes), not only it @@ -5101,8 +5052,6 @@ static void dmi_table(u8 *type, const struct string_keyword *opt_string, handle_n = dmi_decode(xmlnode, &h, ver); } else fprintf(stderr, "<TRUNCATED>"); - } else if(opt_string != NULL && opt_string->type == h.type) { - handle_n = dmi_table_string(opt_string, xmlnode, &h, data, ver); } if( handle_n != NULL ) { dmixml_AddAttribute(handle_n, "handle", "0x%04x", h.handle); @@ -5176,8 +5125,7 @@ xmlNode *smbios_decode_get_version(u8 * buf, const char *devmem) return data_n; } -int smbios_decode(u8 *type, const struct string_keyword *opt_string, - u8 *buf, const char *devmem, xmlNode *xmlnode) +int smbios_decode(u8 *type, u8 *buf, const char *devmem, xmlNode *xmlnode) { int check = _smbios_decode_check(buf); @@ -5193,7 +5141,7 @@ int smbios_decode(u8 *type, const struct string_keyword *opt_string, break; } //printf(">>%d @ %d, %d<<\n", DWORD(buf+0x18), WORD(buf+0x16), WORD(buf+0x1C)); - dmi_table(type, opt_string, DWORD(buf + 0x18), WORD(buf + 0x16), WORD(buf + 0x1C), ver, devmem, + dmi_table(type, DWORD(buf + 0x18), WORD(buf + 0x16), WORD(buf + 0x1C), ver, devmem, xmlnode); } return check; @@ -5232,13 +5180,12 @@ xmlNode *legacy_decode_get_version(u8 * buf, const char *devmem) return data_n; } -int legacy_decode(u8 *type, const struct string_keyword *opt_string, - u8 *buf, const char *devmem, xmlNode *xmlnode) +int legacy_decode(u8 *type, u8 *buf, const char *devmem, xmlNode *xmlnode) { int check = _legacy_decode_check(buf); if(check == 1) - dmi_table(type, opt_string, DWORD(buf + 0x08), WORD(buf + 0x06), WORD(buf + 0x0C), + dmi_table(type, DWORD(buf + 0x08), WORD(buf + 0x06), WORD(buf + 0x0C), ((buf[0x0E] & 0xF0) << 4) + (buf[0x0E] & 0x0F), devmem, xmlnode); return check; } diff --git a/src/dmidecode.h b/src/dmidecode.h index 571c381..cd6b8a6 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -33,10 +33,11 @@ void dmi_dump(xmlNode *node, struct dmi_header * h); xmlNode *dmi_decode(xmlNode *parent_n, struct dmi_header * h, u16 ver); int address_from_efi(size_t * address); void to_dmi_header(struct dmi_header *h, u8 * data); + xmlNode *smbios_decode_get_version(u8 * buf, const char *devmem); -int smbios_decode(u8 *type, const struct string_keyword *opt_string, u8 *buf, const char *devmem, xmlNode *xmlnode); xmlNode *legacy_decode_get_version(u8 * buf, const char *devmem); -int legacy_decode(u8 *type, const struct string_keyword *opt_string, u8 *buf, const char *devmem, xmlNode *xmlnode); +int smbios_decode(u8 *type, u8 *buf, const char *devmem, xmlNode *xmlnode); +int legacy_decode(u8 *type, u8 *buf, const char *devmem, xmlNode *xmlnode); const char *dmi_string(const struct dmi_header *dm, u8 s); void dmi_system_uuid(xmlNode *node, const u8 * p, u16 ver); diff --git a/src/dmidecodemodule.c b/src/dmidecodemodule.c index ab4561b..e551d67 100644 --- a/src/dmidecodemodule.c +++ b/src/dmidecodemodule.c @@ -211,10 +211,10 @@ int dmidecode_get_xml(options *opt, xmlNode* dmixml_n) // printf("Reading SMBIOS/DMI data from file %s.\n", dumpfile); if((buf = mem_chunk(0, 0x20, opt->dumpfile)) != NULL) { if(memcmp(buf, "_SM_", 4) == 0) { - if(smbios_decode(opt->type, opt->string, buf, opt->dumpfile, dmixml_n)) + if(smbios_decode(opt->type, buf, opt->dumpfile, dmixml_n)) found++; } else if(memcmp(buf, "_DMI_", 5) == 0) { - if(legacy_decode(opt->type, opt->string, buf, opt->dumpfile, dmixml_n)) + if(legacy_decode(opt->type, buf, opt->dumpfile, dmixml_n)) found++; } } else { @@ -228,12 +228,12 @@ int dmidecode_get_xml(options *opt, xmlNode* dmixml_n) if((buf = mem_chunk(0xF0000, 0x10000, opt->devmem)) != NULL) { for(fp = 0; fp <= 0xFFF0; fp += 16) { if(memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0) { - if(smbios_decode(opt->type, opt->string, buf + fp, opt->devmem, dmixml_n)) { + if(smbios_decode(opt->type, buf + fp, opt->devmem, dmixml_n)) { found++; fp += 16; } } else if(memcmp(buf + fp, "_DMI_", 5) == 0) { - if(legacy_decode(opt->type, opt->string, buf + fp, opt->devmem, dmixml_n)) + if(legacy_decode(opt->type, buf + fp, opt->devmem, dmixml_n)) found++; } } @@ -244,7 +244,7 @@ int dmidecode_get_xml(options *opt, xmlNode* dmixml_n) } else { if((buf = mem_chunk(fp, 0x20, opt->devmem)) == NULL) ret = 1; - else if(smbios_decode(opt->type, opt->string, buf, opt->devmem, dmixml_n)) + else if(smbios_decode(opt->type, buf, opt->devmem, dmixml_n)) found++; // TODO: dmixml_AddAttribute(dmixml_n, "efi_address", "0x%08x", efiAddress); } diff --git a/src/dmihelper.h b/src/dmihelper.h index e888639..ccf840d 100644 --- a/src/dmihelper.h +++ b/src/dmihelper.h @@ -91,7 +91,6 @@ typedef struct _options { const char *devmem; unsigned int flags; u8 *type; - const struct string_keyword *string; xmlDoc *mappingxml; char *python_xml_map; xmlNode *dmiversion_n; |