summaryrefslogtreecommitdiffstats
path: root/plugins/solidigm/solidigm-telemetry
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/solidigm/solidigm-telemetry')
-rw-r--r--plugins/solidigm/solidigm-telemetry/cod.c8
-rw-r--r--plugins/solidigm/solidigm-telemetry/config.c12
-rw-r--r--plugins/solidigm/solidigm-telemetry/config.h5
-rw-r--r--plugins/solidigm/solidigm-telemetry/data-area.c48
-rw-r--r--plugins/solidigm/solidigm-telemetry/header.c32
-rw-r--r--plugins/solidigm/solidigm-telemetry/telemetry-log.h6
6 files changed, 54 insertions, 57 deletions
diff --git a/plugins/solidigm/solidigm-telemetry/cod.c b/plugins/solidigm/solidigm-telemetry/cod.c
index 7accc53..be5685b 100644
--- a/plugins/solidigm/solidigm-telemetry/cod.c
+++ b/plugins/solidigm/solidigm-telemetry/cod.c
@@ -110,9 +110,9 @@ void solidigm_telemetry_log_cod_parse(struct telemetry_log *tl)
UNKNOWN = 0xFF,
};
- struct json_object *telemetry_header = NULL;
- struct json_object *COD_offset = NULL;
- struct json_object *reason_id = NULL;
+ json_object *telemetry_header = NULL;
+ json_object *COD_offset = NULL;
+ json_object *reason_id = NULL;
if (!json_object_object_get_ex(tl->root, "telemetryHeader", &telemetry_header))
return;
@@ -144,7 +144,7 @@ void solidigm_telemetry_log_cod_parse(struct telemetry_log *tl)
return;
}
- struct json_object *cod = json_create_object();
+ json_object *cod = json_create_object();
json_object_object_add(tl->root, "cod", cod);
for (int i =0 ; i < data->header.EntryCount; i++) {
diff --git a/plugins/solidigm/solidigm-telemetry/config.c b/plugins/solidigm/solidigm-telemetry/config.c
index 5111703..781d786 100644
--- a/plugins/solidigm/solidigm-telemetry/config.c
+++ b/plugins/solidigm/solidigm-telemetry/config.c
@@ -11,15 +11,15 @@
// max 16 bit unsigned integer nummber 65535
#define MAX_16BIT_NUM_AS_STRING_SIZE 6
-static bool config_get_by_version(const struct json_object *obj, int version_major,
- int version_minor, struct json_object **value)
+static bool config_get_by_version(const json_object *obj, int version_major,
+ int version_minor, json_object **value)
{
char str_key[MAX_16BIT_NUM_AS_STRING_SIZE];
char str_subkey[MAX_16BIT_NUM_AS_STRING_SIZE];
snprintf(str_key, sizeof(str_key), "%d", version_major);
snprintf(str_subkey, sizeof(str_subkey), "%d", version_minor);
- struct json_object *major_obj = NULL;
+ json_object *major_obj = NULL;
if (!json_object_object_get_ex(obj, str_key, &major_obj))
return false;
@@ -28,11 +28,11 @@ static bool config_get_by_version(const struct json_object *obj, int version_maj
return value != NULL;
}
-bool solidigm_config_get_by_token_version(const struct json_object *obj, int token_id,
+bool solidigm_config_get_by_token_version(const json_object *obj, int token_id,
int version_major, int version_minor,
- struct json_object **value)
+ json_object **value)
{
- struct json_object *token_obj = NULL;
+ json_object *token_obj = NULL;
char str_key[MAX_16BIT_NUM_AS_STRING_SIZE];
snprintf(str_key, sizeof(str_key), "%d", token_id);
diff --git a/plugins/solidigm/solidigm-telemetry/config.h b/plugins/solidigm/solidigm-telemetry/config.h
index 30e61ff..bea84fb 100644
--- a/plugins/solidigm/solidigm-telemetry/config.h
+++ b/plugins/solidigm/solidigm-telemetry/config.h
@@ -7,7 +7,4 @@
#include <stdbool.h>
#include "util/json.h"
-bool solidigm_config_get_by_token_version(const struct json_object *obj,
- int key, int subkey,
- int subsubkey,
- struct json_object **value);
+bool solidigm_config_get_by_token_version(const json_object *obj, int key, int subkey, int subsubkey, json_object **value);
diff --git a/plugins/solidigm/solidigm-telemetry/data-area.c b/plugins/solidigm/solidigm-telemetry/data-area.c
index 2f18ea2..7233e8f 100644
--- a/plugins/solidigm/solidigm-telemetry/data-area.c
+++ b/plugins/solidigm/solidigm-telemetry/data-area.c
@@ -17,7 +17,7 @@
static bool telemetry_log_get_value(const struct telemetry_log *tl,
uint32_t offset_bit, uint32_t size_bit,
- bool is_signed, struct json_object **val_obj)
+ bool is_signed, json_object **val_obj)
{
uint32_t offset_bit_from_byte;
uint32_t additional_size_byte;
@@ -77,16 +77,16 @@ static bool telemetry_log_get_value(const struct telemetry_log *tl,
}
static int telemetry_log_structure_parse(const struct telemetry_log *tl,
- struct json_object *struct_def,
+ json_object *struct_def,
size_t parent_offset_bit,
- struct json_object *output,
- struct json_object *metadata)
+ json_object *output,
+ json_object *metadata)
{
- struct json_object *obj_arraySizeArray = NULL;
- struct json_object *obj = NULL;
- struct json_object *obj_memberList;
- struct json_object *major_dimension;
- struct json_object *sub_output;
+ json_object *obj_arraySizeArray = NULL;
+ json_object *obj = NULL;
+ json_object *obj_memberList;
+ json_object *major_dimension;
+ json_object *sub_output;
bool is_enumeration = false;
bool has_member_list;
const char *type = "";
@@ -155,7 +155,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
uint32_t array_size_dimension[array_rank];
for (size_t i = 0; i < array_rank; i++) {
- struct json_object *dimension = json_object_array_get_idx(obj_arraySizeArray, i);
+ json_object *dimension = json_object_array_get_idx(obj_arraySizeArray, i);
array_size_dimension[i] = json_object_get_uint64(dimension);
major_dimension = dimension;
@@ -163,7 +163,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
if (array_rank > 1) {
uint32_t linear_pos_per_index = array_size_dimension[0];
uint32_t prev_index_offset_bit = 0;
- struct json_object *dimension_output;
+ json_object *dimension_output;
for (int i = 1; i < (array_rank - 1); i++)
linear_pos_per_index *= array_size_dimension[i];
@@ -182,7 +182,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
json_object_array_del_idx(obj_arraySizeArray, array_rank - 1, 1);
for (int i = 0 ; i < array_size_dimension[0]; i++) {
- struct json_object *sub_array = json_create_array();
+ json_object *sub_array = json_create_array();
size_t offset;
offset = parent_offset_bit + prev_index_offset_bit;
@@ -213,7 +213,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
for (uint32_t j = 0; j < array_size_dimension[0]; j++) {
if (is_enumeration || !has_member_list) {
bool is_signed = !strncmp(type, SIGNED_INT_PREFIX, sizeof(SIGNED_INT_PREFIX)-1);
- struct json_object *val_obj;
+ json_object *val_obj;
size_t offset;
offset = parent_offset_bit + offset_bit + linear_array_pos_bit;
@@ -230,7 +230,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
json_free_object(val_obj);
}
} else {
- struct json_object *sub_sub_output = json_create_object();
+ json_object *sub_sub_output = json_object_new_object();
int num_members;
if (array_size_dimension[0] > 1)
@@ -240,7 +240,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
num_members = json_object_array_length(obj_memberList);
for (int k = 0; k < num_members; k++) {
- struct json_object *member = json_object_array_get_idx(obj_memberList, k);
+ json_object *member = json_object_array_get_idx(obj_memberList, k);
size_t offset;
offset = parent_offset_bit + offset_bit + linear_array_pos_bit;
@@ -322,8 +322,8 @@ struct telemetry_object_header {
static void telemetry_log_data_area_toc_parse(const struct telemetry_log *tl,
enum nvme_telemetry_da da,
- struct json_object *toc_array,
- struct json_object *tele_obj_array)
+ json_object *toc_array,
+ json_object *tele_obj_array)
{
const struct telemetry_object_header *header;
@@ -339,8 +339,8 @@ static void telemetry_log_data_area_toc_parse(const struct telemetry_log *tl,
payload = (char *) tl->log;
for (int i = 0; i < toc->header.TableOfContentsCount; i++) {
- struct json_object *structure_definition = NULL;
- struct json_object *toc_item;
+ json_object *structure_definition = NULL;
+ json_object *toc_item;
uint32_t obj_offset;
bool has_struct;
@@ -379,15 +379,15 @@ static void telemetry_log_data_area_toc_parse(const struct telemetry_log *tl,
&structure_definition);
if (has_struct) {
- struct json_object *tele_obj_item = json_create_object();
+ json_object *tele_obj_item = json_create_object();
json_object_array_add(tele_obj_array, tele_obj_item);
json_object_get(toc_item);
json_object_add_value_object(tele_obj_item, "metadata", toc_item);
- struct json_object *parsed_struct = json_create_object();
+ json_object *parsed_struct = json_object_new_object();
json_object_add_value_object(tele_obj_item, "objectData", parsed_struct);
- struct json_object *obj_hasTelemObjHdr = NULL;
+ json_object *obj_hasTelemObjHdr = NULL;
uint32_t header_offset = sizeof(const struct telemetry_object_header);
uint32_t file_offset;
@@ -411,8 +411,8 @@ static void telemetry_log_data_area_toc_parse(const struct telemetry_log *tl,
int solidigm_telemetry_log_data_areas_parse(const struct telemetry_log *tl,
enum nvme_telemetry_da last_da)
{
- struct json_object *tele_obj_array = json_create_array();
- struct json_object *toc_array = json_create_array();
+ json_object *tele_obj_array = json_create_array();
+ json_object *toc_array = json_create_array();
json_object_add_value_array(tl->root, "tableOfContents", toc_array);
json_object_add_value_array(tl->root, "telemetryObjects", tele_obj_array);
diff --git a/plugins/solidigm/solidigm-telemetry/header.c b/plugins/solidigm/solidigm-telemetry/header.c
index d085c24..72b2d97 100644
--- a/plugins/solidigm/solidigm-telemetry/header.c
+++ b/plugins/solidigm/solidigm-telemetry/header.c
@@ -63,10 +63,10 @@ static_assert(sizeof(const struct reason_indentifier_1_2) ==
#pragma pack(pop, reason_indentifier)
static void telemetry_log_reason_id_parse1_0_ext(const struct telemetry_log *tl,
- struct json_object *reason_id)
+ json_object *reason_id)
{
const struct reason_indentifier_1_0 *ri;
- struct json_object *reserved;
+ json_object *reserved;
ri = (struct reason_indentifier_1_0 *) tl->log->rsnident;
json_object_object_add(reason_id, "FirmwareVersion", json_object_new_string_len(ri->FirmwareVersion, sizeof(ri->FirmwareVersion)));
@@ -76,16 +76,16 @@ static void telemetry_log_reason_id_parse1_0_ext(const struct telemetry_log *tl,
reserved = json_create_array();
json_object_add_value_array(reason_id, "Reserved", reserved);
for ( int i=0; i < sizeof(ri->Reserved); i++) {
- struct json_object *val = json_object_new_int(ri->Reserved[i]);
+ json_object *val = json_object_new_int(ri->Reserved[i]);
json_object_array_add(reserved, val);
}
}
static void telemetry_log_reason_id_parse1_1_ext(const struct telemetry_log *tl,
- struct json_object *reason_id)
+ json_object *reason_id)
{
const struct reason_indentifier_1_1 *ri;
- struct json_object *reserved;
+ json_object *reserved;
ri = (struct reason_indentifier_1_1 *) tl->log->rsnident;
json_object_object_add(reason_id, "FirmwareVersion", json_object_new_string_len(ri->FirmwareVersion, sizeof(ri->FirmwareVersion)));
@@ -98,17 +98,17 @@ static void telemetry_log_reason_id_parse1_1_ext(const struct telemetry_log *tl,
reserved = json_create_array();
json_object_add_value_array(reason_id, "Reserved", reserved);
for (int i = 0; i < sizeof(ri->Reserved); i++) {
- struct json_object *val = json_object_new_int(ri->Reserved[i]);
+ json_object *val = json_object_new_int(ri->Reserved[i]);
json_object_array_add(reserved, val);
}
}
static void telemetry_log_reason_id_parse1_2_ext(const struct telemetry_log *tl,
- struct json_object *reason_id)
+ json_object *reason_id)
{
const struct reason_indentifier_1_2 *ri;
- struct json_object *dp_reserved;
- struct json_object *reserved;
+ json_object *dp_reserved;
+ json_object *reserved;
ri = (struct reason_indentifier_1_2 *) tl->log->rsnident;
@@ -121,19 +121,19 @@ static void telemetry_log_reason_id_parse1_2_ext(const struct telemetry_log *tl,
reserved = json_create_array();
json_object_add_value_array(reason_id, "Reserved2", reserved);
for (int i = 0; i < sizeof(ri->Reserved2); i++) {
- struct json_object *val = json_object_new_int(ri->Reserved2[i]);
+ json_object *val = json_object_new_int(ri->Reserved2[i]);
json_object_array_add(reserved, val);
}
dp_reserved = json_create_array();
json_object_add_value_array(reason_id, "DualPortReserved", dp_reserved);
for (int i = 0; i < sizeof(ri->DualPortReserved); i++) {
- struct json_object *val = json_object_new_int(ri->DualPortReserved[i]);
+ json_object *val = json_object_new_int(ri->DualPortReserved[i]);
json_object_array_add(dp_reserved, val);
}
}
-static void solidigm_telemetry_log_reason_id_parse(const struct telemetry_log *tl, struct json_object *reason_id)
+static void solidigm_telemetry_log_reason_id_parse(const struct telemetry_log *tl, json_object *reason_id)
{
const struct reason_indentifier_1_0 *ri1_0 =
(struct reason_indentifier_1_0 *) tl->log->rsnident;
@@ -161,9 +161,9 @@ static void solidigm_telemetry_log_reason_id_parse(const struct telemetry_log *t
bool solidigm_telemetry_log_header_parse(const struct telemetry_log *tl)
{
const struct nvme_telemetry_log *log;
- struct json_object *ieee_oui_id;
- struct json_object *reason_id;
- struct json_object *header;
+ json_object *ieee_oui_id;
+ json_object *reason_id;
+ json_object *header;
if (tl->log_size < sizeof(const struct nvme_telemetry_log)) {
SOLIDIGM_LOG_WARNING("Telemetry log too short.");
@@ -180,7 +180,7 @@ bool solidigm_telemetry_log_header_parse(const struct telemetry_log *tl)
json_object_object_add(header, "ieeeOuiIdentifier", ieee_oui_id);
for (int i = 0; i < sizeof(log->ieee); i++) {
- struct json_object *val = json_object_new_int(log->ieee[i]);
+ json_object *val = json_object_new_int(log->ieee[i]);
json_object_array_add(ieee_oui_id, val);
}
diff --git a/plugins/solidigm/solidigm-telemetry/telemetry-log.h b/plugins/solidigm/solidigm-telemetry/telemetry-log.h
index e9eff73..ef4ec5d 100644
--- a/plugins/solidigm/solidigm-telemetry/telemetry-log.h
+++ b/plugins/solidigm/solidigm-telemetry/telemetry-log.h
@@ -24,8 +24,8 @@
struct telemetry_log {
struct nvme_telemetry_log *log;
size_t log_size;
- struct json_object *root;
- struct json_object *configuration;
+ json_object *root;
+ json_object *configuration;
};
-#endif /* _SOLIDIGM_TELEMETRY_LOG_H */
+#endif /* _SOLIDIGM_TELEMETRY_LOG_H */ \ No newline at end of file