obj_add_int(error, "parm_error_location",
le16_to_cpu(err_log[i].parm_error_location));
obj_add_uint64(error, "lba", le64_to_cpu(err_log[i].lba));
- obj_add_uint(error, "NSID", le32_to_cpu(err_log[i].nsid));
+ obj_add_uint(error, "nsid", le32_to_cpu(err_log[i].nsid));
obj_add_int(error, "vs", err_log[i].vs);
obj_add_int(error, "trtype", err_log[i].trtype);
obj_add_uint64(error, "cs", le64_to_cpu(err_log[i].cs));
obj_add_int(rc, "cntlid", le16_to_cpu(status->regctl_ds[i].cntlid));
obj_add_int(rc, "rcsts", status->regctl_ds[i].rcsts);
- obj_add_uint64(rc, "Host ID", le64_to_cpu(status->regctl_ds[i].hostid));
+ obj_add_uint64(rc, "hostid", le64_to_cpu(status->regctl_ds[i].hostid));
obj_add_uint64(rc, "rkey", le64_to_cpu(status->regctl_ds[i].rkey));
array_add_obj(rcs, rc);
for (j = 0; j < 16; j++)
sprintf(hostid + j * 2, "%02x", status->regctl_eds[i].hostid[j]);
- obj_add_str(rc, "Host ID", hostid);
+ obj_add_str(rc, "hostid", hostid);
array_add_obj(rcs, rc);
}
}
if (human()) {
struct json_object *crt = json_create_object();
- obj_add_int(crt, "Value", smart->critical_warning);
+ obj_add_int(crt, "value", smart->critical_warning);
obj_add_int(crt, "available_spare", smart->critical_warning & 1);
obj_add_int(crt, "temp_threshold", (smart->critical_warning & 2) >> 1);
obj_add_int(crt, "reliability_degraded", (smart->critical_warning & 4) >> 2);
obj_add_int(r, "critical_warning", smart->critical_warning);
}
- obj_add_int(r, "Temperature", temperature);
+ obj_add_int(r, "temperature", temperature);
obj_add_int(r, "avail_spare", smart->avail_spare);
obj_add_int(r, "spare_thresh", smart->spare_thresh);
obj_add_int(r, "percent_used", smart->percent_used);
obj_add_uint(desc, "grpid", le32_to_cpu(ana_desc->grpid));
obj_add_uint(desc, "nnsids", le32_to_cpu(ana_desc->nnsids));
obj_add_uint64(desc, "chgcnt", le64_to_cpu(ana_desc->chgcnt));
- obj_add_str(desc, "State", nvme_ana_state_to_string(ana_desc->state));
+ obj_add_str(desc, "state", nvme_ana_state_to_string(ana_desc->state));
ns_list = json_create_array();
for (j = 0; j < le32_to_cpu(ana_desc->nnsids); j++) {
nsid = json_create_object();
- obj_add_uint(nsid, "NSID", le32_to_cpu(ana_desc->nsids[j]));
+ obj_add_uint(nsid, "nsid", le32_to_cpu(ana_desc->nsids[j]));
array_add_obj(ns_list, nsid);
}
obj_add_array(desc, "NSIDS", ns_list);
static void json_registers_unknown(int offset, uint64_t value64, struct json_object *r)
{
obj_add_uint_02x(r, "unknown property", offset);
- obj_add_str(r, "Name", nvme_register_to_string(offset));
- obj_add_prix64(r, "Value", value64);
+ obj_add_str(r, "name", nvme_register_to_string(offset));
+ obj_add_prix64(r, "value", value64);
}
static void json_single_property_human(int offset, uint64_t value64, struct json_object *r)
sprintf(json_str, "0x%02x", offset);
obj_add_str(r, "property", json_str);
- obj_add_str(r, "Name", nvme_register_to_string(offset));
+ obj_add_str(r, "name", nvme_register_to_string(offset));
if (nvme_is_64bit_reg(offset))
sprintf(json_str, "%"PRIx64"", value64);
else
sprintf(json_str, "%x", value32);
- obj_add_str(r, "Value", json_str);
+ obj_add_str(r, "value", json_str);
}
json_print(r);
struct json_object *r = json_create_object();
obj_add_uint(r, "nvmset_id", le16_to_cpu(nvmset_id));
- obj_add_uint(r, "Status", plpns_log->status);
+ obj_add_uint(r, "status", plpns_log->status);
obj_add_uint(r, "event_type", le16_to_cpu(plpns_log->event_type));
obj_add_uint64(r, "dtwin_reads_typical", le64_to_cpu(plpns_log->dtwin_rt));
obj_add_uint64(r, "dtwin_writes_typical", le64_to_cpu(plpns_log->dtwin_wt));
for (int i = 0; i < num_iter; i++) {
valid_attrs = json_create_object();
- obj_add_uint(valid_attrs, "Entry", le16_to_cpu(pea_log->entries[i]));
+ obj_add_uint(valid_attrs, "entry", le16_to_cpu(pea_log->entries[i]));
array_add_obj(valid, valid_attrs);
}
__s32 temp;
obj_add_int(valid_attrs, "critical_warning", smart_event->critical_warning);
- obj_add_int(valid_attrs, "Temperature", temperature);
+ obj_add_int(valid_attrs, "temperature", temperature);
obj_add_int(valid_attrs, "avail_spare", smart_event->avail_spare);
obj_add_int(valid_attrs, "spare_thresh", smart_event->spare_thresh);
obj_add_int(valid_attrs, "percent_used", smart_event->percent_used);
obj_add_uint(valid_attrs, "nmic", ns_event->nmic);
obj_add_uint(valid_attrs, "ana_grp_id", le32_to_cpu(ns_event->ana_grp_id));
obj_add_uint(valid_attrs, "nvmset_id", le16_to_cpu(ns_event->nvmset_id));
- obj_add_uint(valid_attrs, "NSID", le32_to_cpu(ns_event->nsid));
+ obj_add_uint(valid_attrs, "nsid", le32_to_cpu(ns_event->nsid));
}
static void json_pel_format_start(void *pevent_log_info, __u32 offset,
{
struct nvme_format_nvm_start_event *format_start_event = pevent_log_info + offset;
- obj_add_uint(valid_attrs, "NSID", le32_to_cpu(format_start_event->nsid));
+ obj_add_uint(valid_attrs, "nsid", le32_to_cpu(format_start_event->nsid));
obj_add_uint(valid_attrs, "fna", format_start_event->fna);
obj_add_uint(valid_attrs, "format_nvm_cdw10",
le32_to_cpu(format_start_event->format_nvm_cdw10));
{
struct nvme_format_nvm_compln_event *format_cmpln_event = pevent_log_info + offset;
- obj_add_uint(valid_attrs, "NSID", le32_to_cpu(format_cmpln_event->nsid));
+ obj_add_uint(valid_attrs, "nsid", le32_to_cpu(format_cmpln_event->nsid));
obj_add_uint(valid_attrs, "smallest_fpi", format_cmpln_event->smallest_fpi);
obj_add_uint(valid_attrs, "format_nvm_status", format_cmpln_event->format_nvm_status);
obj_add_uint(valid_attrs, "compln_info", le16_to_cpu(format_cmpln_event->compln_info));
struct nvme_thermal_exc_event *thermal_exc_event = pevent_log_info + offset;
obj_add_uint(valid_attrs, "over_temp", thermal_exc_event->over_temp);
- obj_add_uint(valid_attrs, "Threshold", thermal_exc_event->threshold);
+ obj_add_uint(valid_attrs, "threshold", thermal_exc_event->threshold);
}
static void json_pevent_entry(void *pevent_log_info, __u8 action, __u32 size, const char *devname,
for (int i = 0; i < log_entries; i++) {
valid_attrs = json_create_object();
- obj_add_uint(valid_attrs, "Entry", le16_to_cpu(endurance_log->entries[i]));
+ obj_add_uint(valid_attrs, "entry", le16_to_cpu(endurance_log->entries[i]));
array_add_obj(valid, valid_attrs);
}
sprintf(json_str, "0x%08x", le32_to_cpu(e->nlb));
obj_add_str(lsde, "NLB", json_str);
sprintf(json_str, "0x%02x", e->status);
- obj_add_str(lsde, "Status", json_str);
+ obj_add_str(lsde, "status", json_str);
}
json_print(r);
{
struct json_object *r = json_create_object();
- obj_add_uint64(r, "Count", le64_to_cpu(resv->lpc));
+ obj_add_uint64(r, "count", le64_to_cpu(resv->lpc));
obj_add_uint(r, "rn_log_type", resv->rnlpt);
obj_add_uint(r, "num_logs", resv->nalp);
obj_add_uint(r, "NSID", le32_to_cpu(resv->nsid));
struct nvme_boot_partition *hdr = bp_log;
struct json_object *r = json_create_object();
- obj_add_uint(r, "Count", hdr->lid);
+ obj_add_uint(r, "count", hdr->lid);
obj_add_uint(r, "abpid", (le32_to_cpu(hdr->bpinfo) >> 31) & 0x1);
obj_add_uint(r, "bpsz", le32_to_cpu(hdr->bpinfo) & 0x7fff);
struct json_object *obj_event = json_create_object();
- obj_add_uint(obj_event, "Type", event->type);
+ obj_add_uint(obj_event, "type", event->type);
obj_add_uint(obj_event, "fdpef", event->flags);
obj_add_uint(obj_event, "pid", le16_to_cpu(event->pid));
obj_add_uint64(obj_event, "timestamp", le64_to_cpu(*(uint64_t *)&event->ts));
- obj_add_uint(obj_event, "NSID", le32_to_cpu(event->nsid));
+ obj_add_uint(obj_event, "nsid", le32_to_cpu(event->nsid));
if (event->type == NVME_FDP_EVENT_REALLOC) {
struct nvme_fdp_event_realloc *mr;
obj_add_str(host_attrs, "HostNQN", nvme_host_get_hostnqn(h));
hostid = nvme_host_get_hostid(h);
if (hostid)
- obj_add_str(host_attrs, "Host ID", hostid);
+ obj_add_str(host_attrs, "HostID", hostid);
subsystems = json_create_array();
nvme_for_each_subsystem(h, s) {
subsystem_attrs = json_create_object();
for (i = 0; i < 1024; i++) {
if (ns_list->ns[i]) {
valid_attrs = json_create_object();
- obj_add_uint(valid_attrs, "NSID", le32_to_cpu(ns_list->ns[i]));
+ obj_add_uint(valid_attrs, "nsid", le32_to_cpu(ns_list->ns[i]));
array_add_obj(valid, valid_attrs);
}
}
obj_add_uint64(zone, "slba", le64_to_cpu(desc->zslba));
obj_add_uint64(zone, "wp", le64_to_cpu(desc->wp));
obj_add_uint64(zone, "cap", le64_to_cpu(desc->zcap));
- obj_add_str(zone, "State", nvme_zone_state_to_string(desc->zs >> 4));
- obj_add_str(zone, "Type", nvme_zone_type_to_string(desc->zt));
+ obj_add_str(zone, "state", nvme_zone_state_to_string(desc->zs >> 4));
+ obj_add_str(zone, "type", nvme_zone_type_to_string(desc->zt));
obj_add_uint(zone, "attrs", desc->za);
obj_add_uint(zone, "attrs_info", desc->zai);
obj_add_int(lbare, "LBA range", i);
- obj_add_uint_nx(lbare, "Type", lbrt->entry[i].type);
+ obj_add_uint_nx(lbare, "type", lbrt->entry[i].type);
obj_add_str(lbare, "type description",
nvme_feature_lba_type_to_string(lbrt->entry[i].type));
apste = json_create_object();
array_add_obj(apsta, apste);
sprintf(json_str, "%2d", i);
- obj_add_str(apste, "Entry", json_str);
+ obj_add_str(apste, "entry", json_str);
value = le64_to_cpu(apst->apst_entry[i]);
sprintf(json_str, "%u ms", (__u32)NVME_GET(value, APST_ENTRY_ITPT));
obj_add_str(apste, "Idle Time Prior to Transition (ITPT)", json_str);
struct json_object *r;
char json_str[STR_LEN];
- sprintf(json_str, "Feature: %#0*x", fid ? 4 : 2, fid);
+ sprintf(json_str, "feature: %#0*x", fid ? 4 : 2, fid);
r = obj_create(json_str);
- obj_add_str(r, "Name", nvme_feature_to_string(fid));
+ obj_add_str(r, "name", nvme_feature_to_string(fid));
sprintf(json_str, "%#0*x", result ? 10 : 8, result);
obj_add_str(r, nvme_select_to_string(sel), json_str);
char json_str[STR_LEN];
struct json_object *data = json_create_array();
- sprintf(json_str, "Data: buf=%p len=%d width=%d group=%d", buf, len, width, group);
+ sprintf(json_str, "data: buf=%p len=%d width=%d group=%d", buf, len, width, group);
d_json(buf, len, width, group, data);
obj_add_array(r, json_str, data);
struct json_object *r = json_create_object();
obj_add_uint(r, "cntlid", le16_to_cpu(caps->cntlid));
- obj_add_uint(r, "Port ID", le16_to_cpu(caps->portid));
+ obj_add_uint(r, "portid", le16_to_cpu(caps->portid));
obj_add_uint(r, "crt", caps->crt);
obj_add_uint(r, "vqfrt", le32_to_cpu(caps->vqfrt));
obj_add_str(hss, "HostNQN", nvme_host_get_hostnqn(h));
hostid = nvme_host_get_hostid(h);
if (hostid)
- obj_add_str(hss, "Host ID", hostid);
+ obj_add_str(hss, "HostID", hostid);
nvme_for_each_subsystem(h , s) {
struct json_object *jss = json_create_object();
struct json_object *jpaths = json_create_array();
obj_add_str(jctrl, "Controller", nvme_ctrl_get_name(c));
- obj_add_str(jctrl, "Serial number", nvme_ctrl_get_serial(c));
- obj_add_str(jctrl, "Model number", nvme_ctrl_get_model(c));
+ obj_add_str(jctrl, "SerialNumber", nvme_ctrl_get_serial(c));
+ obj_add_str(jctrl, "ModelNumber", nvme_ctrl_get_model(c));
obj_add_str(jctrl, "Firmware", nvme_ctrl_get_firmware(c));
obj_add_str(jctrl, "Transport", nvme_ctrl_get_transport(c));
obj_add_str(jctrl, "Address", nvme_ctrl_get_address(c));
uint64_t nsze = nvme_ns_get_lba_count(n) * lba;
uint64_t nuse = nvme_ns_get_lba_util(n) * lba;
- obj_add_str(jns, "Namespace", nvme_ns_get_name(n));
+ obj_add_str(jns, "NameSpace", nvme_ns_get_name(n));
obj_add_str(jns, "Generic", nvme_ns_get_generic_name(n));
obj_add_int(jns, "NSID", nvme_ns_get_nsid(n));
obj_add_uint64(jns, "UsedBytes", nuse);
uint64_t nsze = nvme_ns_get_lba_count(n) * lba;
uint64_t nuse = nvme_ns_get_lba_util(n) * lba;
- obj_add_str(jns, "Namespace", nvme_ns_get_name(n));
+ obj_add_str(jns, "NameSpace", nvme_ns_get_name(n));
obj_add_str(jns, "Generic", nvme_ns_get_generic_name(n));
obj_add_int(jns, "NSID", nvme_ns_get_nsid(n));
obj_add_uint64(jns, "UsedBytes", nuse);
nvme_dev_full_path(n, devname, sizeof(devname));
nvme_generic_full_path(n, genname, sizeof(genname));
- obj_add_int(r, "Namespace", nvme_ns_get_nsid(n));
+ obj_add_int(r, "NameSpace", nvme_ns_get_nsid(n));
obj_add_str(r, "DevicePath", devname);
obj_add_str(r, "GenericPath", genname);
obj_add_str(r, "Firmware", nvme_ns_get_firmware(n));
- obj_add_str(r, "Model number", nvme_ns_get_model(n));
- obj_add_str(r, "Serial number", nvme_ns_get_serial(n));
+ obj_add_str(r, "ModelNumber", nvme_ns_get_model(n));
+ obj_add_str(r, "SerialNumber", nvme_ns_get_serial(n));
obj_add_uint64(r, "UsedBytes", nuse);
obj_add_uint64(r, "MaximumLBA", nvme_ns_get_lba_count(n));
obj_add_uint64(r, "PhysicalSize", nsze);
obj_add_str(host_attrs, "HostNQN", nvme_host_get_hostnqn(h));
hostid = nvme_host_get_hostid(h);
if (hostid)
- obj_add_str(host_attrs, "Host ID", hostid);
+ obj_add_str(host_attrs, "HostID", hostid);
subsystems = json_create_array();
nvme_for_each_subsystem(h, s) {
subsystem_attrs = json_create_object();
} else if (buf) {
data = json_create_array();
d_json((unsigned char *)buf, len, 16, 1, data);
- obj_add_array(r, "Data", data);
+ obj_add_array(r, "data", data);
}
json_print(r);
obj_add_str(entry, "adrfam", nvmf_adrfam_str(e->adrfam));
obj_add_str(entry, "subtype", nvmf_subtype_str(e->subtype));
obj_add_str(entry,"treq", nvmf_treq_str(e->treq));
- obj_add_uint(entry, "Port ID", le16_to_cpu(e->portid));
+ obj_add_uint(entry, "portid", le16_to_cpu(e->portid));
obj_add_str(entry, "trsvcid", e->trsvcid);
obj_add_str(entry, "subnqn", e->subnqn);
obj_add_str(entry, "traddr", e->traddr);
{
struct json_object *r = json_create_object();
- obj_add_str(r, "Device", nvme_ctrl_get_name(c));
+ obj_add_str(r, "device", nvme_ctrl_get_name(c));
json_print(r);
}
int val;
int type;
- sprintf(json_str, "Status: %d", status);
+ sprintf(json_str, "status: %d", status);
r = obj_create(json_str);
if (status < 0) {
- obj_add_str(r, "Error", nvme_strerror(errno));
+ obj_add_str(r, "error", nvme_strerror(errno));
json_print(r);
return;
}
switch (type) {
case NVME_STATUS_TYPE_NVME:
- obj_add_str(r, "Error", nvme_status_to_string(val, false));
- obj_add_str(r, "Type", "nvme");
+ obj_add_str(r, "error", nvme_status_to_string(val, false));
+ obj_add_str(r, "type", "nvme");
break;
case NVME_STATUS_TYPE_MI:
- obj_add_str(r, "Error", nvme_mi_status_to_string(val));
- obj_add_str(r, "Type", "nvme-mi");
+ obj_add_str(r, "error", nvme_mi_status_to_string(val));
+ obj_add_str(r, "type", "nvme-mi");
break;
default:
- obj_add_str(r, "Type", "Unknown");
+ obj_add_str(r, "type", "Unknown");
break;
}
free(value);
if (status < 0) {
- obj_add_str(r, "Error", nvme_strerror(errno));
+ obj_add_str(r, "error", nvme_strerror(errno));
json_print(r);
return;
}
switch (type) {
case NVME_STATUS_TYPE_NVME:
- obj_add_str(r, "Status", nvme_status_to_string(val, false));
- obj_add_str(r, "Type", "nvme");
+ obj_add_str(r, "status", nvme_status_to_string(val, false));
+ obj_add_str(r, "type", "nvme");
break;
case NVME_STATUS_TYPE_MI:
- obj_add_str(r, "Status", nvme_mi_status_to_string(val));
- obj_add_str(r, "Type", "nvme-mi");
+ obj_add_str(r, "status", nvme_mi_status_to_string(val));
+ obj_add_str(r, "type", "nvme-mi");
break;
default:
- obj_add_str(r, "Type", "Unknown");
+ obj_add_str(r, "type", "Unknown");
break;
}
- obj_add_int(r, "Value", val);
+ obj_add_int(r, "value", val);
json_print(r);
}
if (vasprintf(&value, msg, ap) < 0)
value = NULL;
- obj_add_str(r, error ? "Error" : "Result", value ? value : "Could not allocate string");
+ obj_add_str(r, error ? "error" : "result", value ? value : "Could not allocate string");
free(value);
error = NULL;
if (error)
- obj_add_str(r, "Error", error);
+ obj_add_str(r, "error", error);
else
- obj_add_str(r, "Error", "Could not allocate string");
+ obj_add_str(r, "error", "Could not allocate string");
json_output_object(r);