diff options
author | Peter Schiffer <pschiffe@redhat.com> | 2013-04-10 17:48:05 +0200 |
---|---|---|
committer | Peter Schiffer <pschiffe@redhat.com> | 2013-04-10 18:00:05 +0200 |
commit | e396c654923edb1ad990246a48543324404241ab (patch) | |
tree | 15da2a9c99a32df813489ccf66fdc43923384706 /src/hardware/dmidecode.c | |
parent | 699a49933d2b2690888f719a447682d85c9942b0 (diff) | |
download | openlmi-providers-e396c654923edb1ad990246a48543324404241ab.tar.gz openlmi-providers-e396c654923edb1ad990246a48543324404241ab.tar.xz openlmi-providers-e396c654923edb1ad990246a48543324404241ab.zip |
Hardware: Added Processor Chip Provider
Added two new providers:
* LMI_ProcessorChipProvider
* LMI_ProcessorChipRealizesProvider
Other Changes:
* Added Association qualifier to the association classes in Hardware mof file
* Removed initialization for static strings used in snprintf() function
Diffstat (limited to 'src/hardware/dmidecode.c')
-rw-r--r-- | src/hardware/dmidecode.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/hardware/dmidecode.c b/src/hardware/dmidecode.c index 04988a9..348c7a2 100644 --- a/src/hardware/dmidecode.c +++ b/src/hardware/dmidecode.c @@ -49,6 +49,9 @@ void init_dmiprocessor_struct(DmiProcessor *cpu) cpu->l1_cache_handle = NULL; cpu->l2_cache_handle = NULL; cpu->l3_cache_handle = NULL; + cpu->manufacturer = NULL; + cpu->serial_number = NULL; + cpu->part_number = NULL; } /* @@ -120,6 +123,24 @@ short check_dmiprocessor_attributes(DmiProcessor *cpu) goto done; } } + if (!cpu->manufacturer) { + if (!(cpu->manufacturer = strdup(""))) { + ret = -12; + goto done; + } + } + if (!cpu->serial_number) { + if (!(cpu->serial_number = strdup(""))) { + ret = -13; + goto done; + } + } + if (!cpu->part_number) { + if (!(cpu->part_number = strdup(""))) { + ret = -14; + goto done; + } + } ret = 0; @@ -193,6 +214,13 @@ short dmi_get_processors(DmiProcessor **cpus, unsigned *cpus_nb) buf = NULL; continue; } + /* Manufacturer */ + buf = copy_string_part_after_delim(buffer[i], "Manufacturer: "); + if (buf) { + (*cpus)[curr_cpu].manufacturer = buf; + buf = NULL; + continue; + } /* Status */ buf = copy_string_part_after_delim(buffer[i], "Status: Populated, "); if (buf) { @@ -297,6 +325,20 @@ short dmi_get_processors(DmiProcessor **cpus, unsigned *cpus_nb) buf = NULL; continue; } + /* Serial Number */ + buf = copy_string_part_after_delim(buffer[i], "Serial Number: "); + if (buf) { + (*cpus)[curr_cpu].serial_number = buf; + buf = NULL; + continue; + } + /* Part Number */ + buf = copy_string_part_after_delim(buffer[i], "Part Number: "); + if (buf) { + (*cpus)[curr_cpu].part_number = buf; + buf = NULL; + continue; + } /* CPU Characteristics */ if (strstr(buffer[i], "Characteristics:") && !strstr(buffer[i], "Characteristics: ")) { @@ -390,6 +432,12 @@ void dmi_free_processors(DmiProcessor **cpus, unsigned *cpus_nb) (*cpus)[i].l2_cache_handle = NULL; free((*cpus)[i].l3_cache_handle); (*cpus)[i].l3_cache_handle = NULL; + free((*cpus)[i].manufacturer); + (*cpus)[i].manufacturer = NULL; + free((*cpus)[i].serial_number); + (*cpus)[i].serial_number = NULL; + free((*cpus)[i].part_number); + (*cpus)[i].part_number = NULL; } free (*cpus); } |