Still the ocp-telemetry-decode used by print functions combined json code.
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
#include "ocp-fw-activation-history.h"
#include "ocp-telemetry-decode.h"
#include "ocp-hardware-component-log.h"
+#include "ocp-print.h"
#define CREATE_CMD
#include "ocp-nvme.h"
return status;
}
- switch (fmt) {
- case NORMAL:
- print_ocp_telemetry_normal(options);
- break;
- case JSON:
- print_ocp_telemetry_json(options);
- break;
- default:
- break;
- }
+ ocp_show_telemetry_log(options, fmt);
return 0;
}
#include "ocp-hardware-component-log.h"
#include "ocp-fw-activation-history.h"
#include "ocp-smart-extended-log.h"
+#include "ocp-telemetry-decode.h"
static void print_hwcomp_desc_json(struct hwcomp_desc_entry *e, struct json_object *r)
{
json_free_object(root);
}
+static void json_telemetry_log(struct ocp_telemetry_parse_options *options)
+{
+ print_ocp_telemetry_json(options);
+}
+
static struct ocp_print_ops json_print_ops = {
.hwcomp_log = json_hwcomp_log,
.fw_act_history = json_fw_activation_history,
.smart_extended_log = json_smart_extended_log,
+ .telemetry_log = json_telemetry_log,
};
struct ocp_print_ops *ocp_get_json_print_ops(nvme_print_flags_t flags)
#include "ocp-hardware-component-log.h"
#include "ocp-fw-activation-history.h"
#include "ocp-smart-extended-log.h"
+#include "ocp-telemetry-decode.h"
static void print_hwcomp_desc(struct hwcomp_desc_entry *e, bool list, int num)
{
printf("\n");
}
+static void stdout_telemetry_log(struct ocp_telemetry_parse_options *options)
+{
+#ifdef CONFIG_JSONC
+ print_ocp_telemetry_normal(options);
+#endif /* CONFIG_JSONC */
+}
+
static struct ocp_print_ops stdout_print_ops = {
.hwcomp_log = stdout_hwcomp_log,
.fw_act_history = stdout_fw_activation_history,
.smart_extended_log = stdout_smart_extended_log,
+ .telemetry_log = stdout_telemetry_log,
};
struct ocp_print_ops *ocp_get_stdout_print_ops(nvme_print_flags_t flags)
{
ocp_print(smart_extended_log, flags, data);
}
+
+void ocp_show_telemetry_log(struct ocp_telemetry_parse_options *options, nvme_print_flags_t flags)
+{
+ ocp_print(telemetry_log, flags, options);
+}
#include "ocp-hardware-component-log.h"
#include "ocp-fw-activation-history.h"
+#include "ocp-telemetry-decode.h"
struct ocp_print_ops {
void (*hwcomp_log)(struct hwcomp_log *log, __u32 id, bool list);
void (*fw_act_history)(const struct fw_activation_history *fw_history);
void (*smart_extended_log)(void *data);
+ void (*telemetry_log)(struct ocp_telemetry_parse_options *options);
nvme_print_flags_t flags;
};
void ocp_show_hwcomp_log(struct hwcomp_log *log, __u32 id, bool list, nvme_print_flags_t flags);
void ocp_fw_act_history(const struct fw_activation_history *fw_history, nvme_print_flags_t flags);
void ocp_smart_extended_log(void *data, nvme_print_flags_t flags);
+void ocp_show_telemetry_log(struct ocp_telemetry_parse_options *options, nvme_print_flags_t flags);
#endif /* OCP_PRINT_H */
*
* Authors: Jeff Lien <jeff.lien@wdc.com>,
*/
+#ifndef OCP_TELEMETRY_DECODE_H
+#define OCP_TELEMETRY_DECODE_H
#include "nvme.h"
#include "nvme-print.h"
void parse_media_wear_event(struct nvme_ocp_telemetry_event_descriptor *pevent_descriptor,
struct json_object *pevent_descriptor_obj, __u8 *pevent_specific_data,
struct json_object *pevent_fifos_object, FILE *fp);
+#endif /* OCP_TELEMETRY_DECODE_H */