Make key types based on id
This commit separates out the libcper json output by section name.
Previously, each section was
i.e., for e.g., add "Nvidia" for the NVIDIA section
```
"sections": [
{
"Nvidia":{
"socket": 0
}
}
]
```
instead of
```
"sections": [
{
"socket": 0
}
]
```
This allows disambiguating between multiple fields with different types
and removes collisions between the field names.
Change-Id: I4e257f1e04fc5fbf2798955d3a5d93214c81f0fc
Signed-off-by: Karthik Rajagopalan <krajagopalan@nvidia.com>
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/ir-parse.c b/ir-parse.c
index 517de45..2aadc81 100644
--- a/ir-parse.c
+++ b/ir-parse.c
@@ -156,13 +156,17 @@
void ir_section_to_cper(json_object *section,
EFI_ERROR_SECTION_DESCRIPTOR *descriptor, FILE *out)
{
+ json_object *ir = NULL;
+
//Find the correct section type, and parse.
int section_converted = 0;
for (size_t i = 0; i < section_definitions_len; i++) {
if (guid_equal(section_definitions[i].Guid,
&descriptor->SectionType) &&
section_definitions[i].ToCPER != NULL) {
- section_definitions[i].ToCPER(section, out);
+ ir = json_object_object_get(
+ section, section_definitions[i].ShortName);
+ section_definitions[i].ToCPER(ir, out);
section_converted = 1;
break;
}
@@ -170,7 +174,8 @@
//If unknown GUID, so read as a base64 unknown section.
if (!section_converted) {
- json_object *encoded = json_object_object_get(section, "data");
+ ir = json_object_object_get(section, "Unknown");
+ json_object *encoded = json_object_object_get(ir, "data");
int32_t decoded_len = 0;