From 805dced32cbb2eef1f2b639100faef3bb0482e29 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Wed, 1 Apr 2009 16:10:55 +0200 Subject: Added indenting tool for C code and reindented *.[ch] files --- src/dmidecode.h | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index 7e99faa..066363f 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -1,3 +1,4 @@ + /* * This file is part of the dmidecode project. * @@ -20,26 +21,26 @@ #include struct dmi_header { - u8 type; - u8 length; - u16 handle; - u8 *data; + u8 type; + u8 length; + u16 handle; + u8 *data; }; PyObject *dmi_dump(struct dmi_header *h); -PyObject* dmi_decode(struct dmi_header *h, u16 ver); -int address_from_efi(size_t *address); -void to_dmi_header(struct dmi_header *h, u8 *data); -int smbios_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); -int smbios_decode(u8 *buf, const char *devmem, PyObject* pydata); -int legacy_decode_set_version(u8 *buf, const char *devmem, PyObject** pydata); -int legacy_decode(u8 *buf, const char *devmem, PyObject* pydata); +PyObject *dmi_decode(struct dmi_header *h, u16 ver); +int address_from_efi(size_t * address); +void to_dmi_header(struct dmi_header *h, u8 * data); +int smbios_decode_set_version(u8 * buf, const char *devmem, PyObject ** pydata); +int smbios_decode(u8 * buf, const char *devmem, PyObject * pydata); +int legacy_decode_set_version(u8 * buf, const char *devmem, PyObject ** pydata); +int legacy_decode(u8 * buf, const char *devmem, PyObject * pydata); const char *dmi_string(const struct dmi_header *dm, u8 s); -const char *dmi_system_uuid(u8 *p); -PyObject *dmi_system_uuid_py(const u8 *p, u16 ver); +const char *dmi_system_uuid(u8 * p); +PyObject *dmi_system_uuid_py(const u8 * p, u16 ver); const char *dmi_chassis_type(u8 code); -int dmi_processor_frequency(const u8 *p); +int dmi_processor_frequency(const u8 * p); int dump(const char *dumpfile); -int dumpling(u8 *buf, const char *devmem, u8 mode); +int dumpling(u8 * buf, const char *devmem, u8 mode); -- cgit From 0cdb1cbffae8237635b991993ee4467e2753dafa Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Tue, 7 Apr 2009 09:27:47 +0200 Subject: Checked in a work in progress - Python dict -> XML Does not compile yet --- src/dmidecode.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index 066363f..b8c70fa 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -28,18 +28,18 @@ struct dmi_header { }; PyObject *dmi_dump(struct dmi_header *h); -PyObject *dmi_decode(struct dmi_header *h, u16 ver); +void dmi_decode(xmlNode *handle_n, struct dmi_header * h, u16 ver); int address_from_efi(size_t * address); void to_dmi_header(struct dmi_header *h, u8 * data); int smbios_decode_set_version(u8 * buf, const char *devmem, PyObject ** pydata); -int smbios_decode(u8 * buf, const char *devmem, PyObject * pydata); +int smbios_decode(u8 * buf, const char *devmem, xmlNode *xmlnode); int legacy_decode_set_version(u8 * buf, const char *devmem, PyObject ** pydata); int legacy_decode(u8 * buf, const char *devmem, PyObject * pydata); const char *dmi_string(const struct dmi_header *dm, u8 s); -const char *dmi_system_uuid(u8 * p); +void dmi_system_uuid(xmlNode *node, const u8 * p, u16 ver); PyObject *dmi_system_uuid_py(const u8 * p, u16 ver); -const char *dmi_chassis_type(u8 code); +void dmi_chassis_type(xmlNode *node, u8 code); int dmi_processor_frequency(const u8 * p); int dump(const char *dumpfile); -- cgit From 612445e94781f14af65490b52c898b9eaa5f5e85 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Wed, 8 Apr 2009 19:02:03 +0200 Subject: Ported most functions to XML interface Still do not compile --- src/dmidecode.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index b8c70fa..9f6738d 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -18,7 +18,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include +#include struct dmi_header { u8 type; @@ -27,18 +29,17 @@ struct dmi_header { u8 *data; }; -PyObject *dmi_dump(struct dmi_header *h); +void dmi_dump(xmlNode *node, struct dmi_header * h); void dmi_decode(xmlNode *handle_n, struct dmi_header * h, u16 ver); int address_from_efi(size_t * address); void to_dmi_header(struct dmi_header *h, u8 * data); int smbios_decode_set_version(u8 * buf, const char *devmem, PyObject ** pydata); int smbios_decode(u8 * buf, const char *devmem, xmlNode *xmlnode); int legacy_decode_set_version(u8 * buf, const char *devmem, PyObject ** pydata); -int legacy_decode(u8 * buf, const char *devmem, PyObject * pydata); +int legacy_decode(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); -PyObject *dmi_system_uuid_py(const u8 * p, u16 ver); void dmi_chassis_type(xmlNode *node, u8 code); int dmi_processor_frequency(const u8 * p); -- cgit From 95b156e3d8a6b82bddb5516735e82355f5dee50a Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Thu, 9 Apr 2009 12:12:56 +0200 Subject: Removed all Python dependencies in dmidecode.[ch] --- src/dmidecode.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index 9f6738d..bbc8eca 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -19,7 +19,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include struct dmi_header { @@ -33,9 +32,9 @@ void dmi_dump(xmlNode *node, struct dmi_header * h); void dmi_decode(xmlNode *handle_n, struct dmi_header * h, u16 ver); int address_from_efi(size_t * address); void to_dmi_header(struct dmi_header *h, u8 * data); -int smbios_decode_set_version(u8 * buf, const char *devmem, PyObject ** pydata); +int smbios_decode_set_version(u8 * buf, const char *devmem, xmlNode *node); int smbios_decode(u8 * buf, const char *devmem, xmlNode *xmlnode); -int legacy_decode_set_version(u8 * buf, const char *devmem, PyObject ** pydata); +int legacy_decode_set_version(u8 * buf, const char *devmem, xmlNode *node); int legacy_decode(u8 * buf, const char *devmem, xmlNode *xmlnode); const char *dmi_string(const struct dmi_header *dm, u8 s); -- cgit From 38c943db697b13e5f9be020a0729f58b7366e932 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Fri, 10 Apr 2009 13:52:47 +0200 Subject: Cleaned up the XML data --- src/dmidecode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index bbc8eca..ef13ce3 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -29,7 +29,7 @@ struct dmi_header { }; void dmi_dump(xmlNode *node, struct dmi_header * h); -void dmi_decode(xmlNode *handle_n, struct dmi_header * h, u16 ver); +xmlNode *dmi_decode(struct dmi_header * h, u16 ver); int address_from_efi(size_t * address); void to_dmi_header(struct dmi_header *h, u8 * data); int smbios_decode_set_version(u8 * buf, const char *devmem, xmlNode *node); -- cgit From 27b3d2281f4b7677e908ef2505bd649305b5ac78 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Thu, 30 Apr 2009 18:24:49 +0200 Subject: Began completing the rewrite of needed dmidecodemodule changes --- src/dmidecode.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index ef13ce3..04d8f04 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -29,12 +29,12 @@ struct dmi_header { }; void dmi_dump(xmlNode *node, struct dmi_header * h); -xmlNode *dmi_decode(struct dmi_header * h, u16 ver); +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); -int smbios_decode_set_version(u8 * buf, const char *devmem, xmlNode *node); +xmlNode *smbios_decode_set_version(u8 * buf, const char *devmem); int smbios_decode(u8 * buf, const char *devmem, xmlNode *xmlnode); -int legacy_decode_set_version(u8 * buf, const char *devmem, xmlNode *node); +xmlNode *legacy_decode_set_version(u8 * buf, const char *devmem); int legacy_decode(u8 * buf, const char *devmem, xmlNode *xmlnode); const char *dmi_string(const struct dmi_header *dm, u8 s); -- cgit From 788272fc9a0c027ecfec16ed3e746558cf988c92 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Wed, 3 Jun 2009 11:56:23 +0200 Subject: Renamed *_set_version() functions to a more proper *_get_version() function names Also changed dmiMAP_ParseMappingXML(...) to dmiMAP_ParseMappingXML_GroupName(...). In the dmidecode_get(...) function. This is just a quick fix for making it compile. It's also needed to implement usage of dmiMAP_ParseMappingXML_TypeID(...) as well. --- src/dmidecode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index 04d8f04..135c264 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -32,9 +32,9 @@ 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_set_version(u8 * buf, const char *devmem); +xmlNode *smbios_decode_get_version(u8 * buf, const char *devmem); int smbios_decode(u8 * buf, const char *devmem, xmlNode *xmlnode); -xmlNode *legacy_decode_set_version(u8 * buf, const char *devmem); +xmlNode *legacy_decode_get_version(u8 * buf, const char *devmem); int legacy_decode(u8 * buf, const char *devmem, xmlNode *xmlnode); const char *dmi_string(const struct dmi_header *dm, u8 s); -- cgit From a05daf8fde753404511e9f247ab4e9ac9a75bf1a Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Wed, 3 Jun 2009 20:40:47 +0200 Subject: Rewrote bigger parts to avoid global variables as much as possible --- src/dmidecode.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index 135c264..c199b7a 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -20,6 +20,7 @@ */ #include +#include "dmihelper.h" struct dmi_header { u8 type; @@ -28,14 +29,14 @@ struct dmi_header { u8 *data; }; -void dmi_dump(xmlNode *node, struct dmi_header * h); -xmlNode *dmi_decode(xmlNode *parent_n, struct dmi_header * h, u16 ver); +void dmi_dump(options *, xmlNode *node, struct dmi_header * h); +xmlNode *dmi_decode(options *, 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 * buf, const char *devmem, xmlNode *xmlnode); +int smbios_decode(options *, u8 * buf, const char *devmem, xmlNode *xmlnode); xmlNode *legacy_decode_get_version(u8 * buf, const char *devmem); -int legacy_decode(u8 * buf, const char *devmem, xmlNode *xmlnode); +int legacy_decode(options *, 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); -- cgit From adc4191973b177f557d9a851d558d09cde841efe Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Thu, 4 Jun 2009 15:21:21 +0200 Subject: Avoid passing the option struct to dmidecode.c functions --- src/dmidecode.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index c199b7a..571c381 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -29,14 +29,14 @@ struct dmi_header { u8 *data; }; -void dmi_dump(options *, xmlNode *node, struct dmi_header * h); -xmlNode *dmi_decode(options *, xmlNode *parent_n, struct dmi_header * h, u16 ver); +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(options *, u8 * buf, const char *devmem, xmlNode *xmlnode); +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(options *, u8 * buf, const char *devmem, xmlNode *xmlnode); +int legacy_decode(u8 *type, const struct string_keyword *opt_string, 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); -- cgit From 2cf4f28f6fc671478003b31c03b93e070eee9942 Mon Sep 17 00:00:00 2001 From: Nima Talebi Date: Fri, 5 Jun 2009 01:42:07 +1000 Subject: 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'. --- src/dmidecode.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/dmidecode.h') 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); -- cgit From bfbac44bd8c0fcddcdcfade6a15313560c9cc6eb Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Tue, 9 Jun 2009 16:48:15 +0200 Subject: Big rewrite again, simplified the usage of opt->type Instead of building up an u8 array with 255 cells where we only use one cell at the time now, just pass the type id value as an int the whole way through. --- src/dmidecode.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index cd6b8a6..f0cb1ab 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -36,8 +36,8 @@ void to_dmi_header(struct dmi_header *h, u8 * data); xmlNode *smbios_decode_get_version(u8 * buf, const char *devmem); xmlNode *legacy_decode_get_version(u8 * buf, const char *devmem); -int smbios_decode(u8 *type, u8 *buf, const char *devmem, xmlNode *xmlnode); -int legacy_decode(u8 *type, u8 *buf, const char *devmem, xmlNode *xmlnode); +int smbios_decode(int type, u8 *buf, const char *devmem, xmlNode *xmlnode); +int legacy_decode(int 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); -- cgit From 9864a51dafd953c497210b6f11e49bb299080dc8 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Thu, 11 Jun 2009 10:50:31 +0200 Subject: Fixed crashes and unexpected behaviour on unknown DMI/SMBIOS types Also provide more useful information, both on unsupported types and types not found on the hardware --- src/dmidecode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index f0cb1ab..81cd249 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -30,7 +30,7 @@ struct dmi_header { }; void dmi_dump(xmlNode *node, struct dmi_header * h); -xmlNode *dmi_decode(xmlNode *parent_n, struct dmi_header * h, u16 ver); +xmlNode *dmi_decode(xmlNode *parent_n, dmi_codes_major *dmiMajor, struct dmi_header * h, u16 ver); int address_from_efi(size_t * address); void to_dmi_header(struct dmi_header *h, u8 * data); -- cgit From 3849ca0a4abf5eb661758e1341a6e595d3013c2c Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Thu, 18 Jun 2009 14:53:29 +0200 Subject: Splitted out SMBIOS/DMI dump functions from dmidecode.c to separate files --- src/dmidecode.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/dmidecode.h') diff --git a/src/dmidecode.h b/src/dmidecode.h index 81cd249..10412c6 100644 --- a/src/dmidecode.h +++ b/src/dmidecode.h @@ -31,7 +31,6 @@ struct dmi_header { void dmi_dump(xmlNode *node, struct dmi_header * h); xmlNode *dmi_decode(xmlNode *parent_n, dmi_codes_major *dmiMajor, 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); @@ -43,6 +42,3 @@ const char *dmi_string(const struct dmi_header *dm, u8 s); void dmi_system_uuid(xmlNode *node, const u8 * p, u16 ver); void dmi_chassis_type(xmlNode *node, u8 code); int dmi_processor_frequency(const u8 * p); - -int dump(const char *dumpfile); -int dumpling(u8 * buf, const char *devmem, u8 mode); -- cgit