static const uint8_t zero_uuid[16] = { 0 };
static struct print_ops json_print_ops;
-static const char *address_str = "Address";
-static const char *controller_str = "Controller";
-static const char *count_str = "Count";
-static const char *data_str = "Data";
-static const char *device_str = "Device";
-static const char *disabled_str = "Disabled";
-static const char *element_str = "Element";
-static const char *enabled_str = "Enabled";
-static const char *endry_str = "Entry";
-static const char *enforced_str = "Enforced";
-static const char *error_str = "Error";
-static const char *false_str = "False";
-static const char *feature_str = "Feature";
-static const char *firmware_str = "Firmware";
-static const char *generic_str = "Generic";
-static const char *host_id_str = "Host ID";
-static const char *invalid_str = "Invalid";
-static const char *length_str = "Length";
-static const char *may_str = "May";
-static const char *model_number_str = "Model number";
-static const char *name_str = "Name";
-static const char *namespace_str = "Namespace";
-static const char *no_str = "No";
-static const char *not_enabled_str = "Not enabled";
-static const char *not_enforced_str = "Not enforced";
-static const char *not_ready_str = "Not ready";
-static const char *not_supported_str = "Not supported";
-static const char *not_valid_str = "Not valid";
-static const char *nsid_str = "NSID";
-static const char *operation_str = "Operation";
-static const char *path_str = "Path";
-static const char *port_id_str = "Port ID";
-static const char *ready_str = "Ready";
-static const char *reserved_str = "Reserved";
-static const char *result_str = "Result";
-static const char *revision_str = "Revision";
-static const char *serial_number_str = "Serial number";
-static const char *shall_str = "Shall";
-static const char *slot_str = "Slot";
-static const char *state_str = "State";
-static const char *status_str = "Status";
-static const char *subsystem_str = "Subsystem";
-static const char *supported_str = "Supported";
-static const char *temperature_str = "Temperature";
-static const char *threshold_str = "Threshold";
-static const char *transport_str = "Transport";
-static const char *true_str = "True";
-static const char *type_str = "Type";
-static const char *unknow_str = "Unknown";
-static const char *value_str = "Value";
-static const char *version_str = "Version";
-static const char *yes_str = "Yes";
-
static void obj_add_uint_x(struct json_object *o, const char *k, __u32 v)
{
char str[STR_LEN];
value = NULL;
if (value)
- obj_add_str(o, result_str, value);
+ obj_add_str(o, "Result", value);
else
- obj_add_str(o, result_str, "Could not allocate string");
+ obj_add_str(o, "Result", "Could not allocate string");
free(value);
}
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_str, 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_str, le64_to_cpu(status->regctl_ds[i].hostid));
+ obj_add_uint64(rc, "Host ID", 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_str, hostid);
+ obj_add_str(rc, "Host ID", hostid);
array_add_obj(rcs, rc);
}
}
if (human) {
struct json_object *crt = json_create_object();
- obj_add_int(crt, value_str, 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);
root_add_int("critical_warning", smart->critical_warning);
}
- root_add_int(temperature_str, temperature);
+ root_add_int("Temperature", temperature);
root_add_int("avail_spare", smart->avail_spare);
root_add_int("spare_thresh", smart->spare_thresh);
root_add_int("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_str, 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_str, 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);
if (result & 0x4)
array_add_str(feature, "changeable");
- root_add_array(feature_str, feature);
+ root_add_array("Feature", feature);
json_print(root);
}
root_add_str("cap", json_str);
root_add_str("Controller Ready With Media Support (CRWMS)",
- cap->crwms ? supported_str : not_supported_str);
+ cap->crwms ? "Supported" : "Not supported");
root_add_str("Controller Ready Independent of Media Support (CRIMS)",
- cap->crims ? supported_str : not_supported_str);
+ cap->crims ? "Supported" : "Not supported");
root_add_str("NVM Subsystem Shutdown Supported (NSSS)",
- cap->nsss ? supported_str : not_supported_str);
+ cap->nsss ? "Supported" : "Not supported");
root_add_str("Controller Memory Buffer Supported (CMBS):",
- cap->cmbs ? supported_str : not_supported_str);
+ cap->cmbs ? "Supported" : "Not supported");
root_add_str("Persistent Memory Region Supported (PMRS)",
- cap->pmrs ? supported_str : not_supported_str);
+ cap->pmrs ? "Supported" : "Not supported");
sprintf(json_str, "%u bytes", 1 << (12 + cap->mpsmax));
root_add_str("Memory Page Size Maximum (MPSMAX)", json_str);
root_add_str("Controller Power Scope (CPS)", !cap->cps ? "Not Reported" : cap->cps == 1 ?
"Controller scope" : cap->cps == 2 ? "Domain scope" : "NVM subsystem scope");
- root_add_str("Boot Partition Support (BPS)", cap->bps ? yes_str : no_str);
+ root_add_str("Boot Partition Support (BPS)", cap->bps ? "Yes" : "No");
root_add_array("Command Sets Supported (CSS)", cssa);
- obj_add_str(csso, "NVM command set", cap->css & 1 ? supported_str : not_supported_str);
+ obj_add_str(csso, "NVM command set", cap->css & 1 ? "Supported" : "Not supported");
obj_add_str(csso, "One or more I/O Command Sets",
- cap->css & 0x40 ? supported_str : not_supported_str);
+ cap->css & 0x40 ? "Supported" : "Not supported");
obj_add_str(csso, cap->css & 0x80 ? "Only Admin Command Set" : "I/O Command Set",
- supported_str);
+ "Supported");
array_add_obj(cssa, csso);
- root_add_str("NVM Subsystem Reset Supported (NSSRS)", cap->nssrs ? yes_str : no_str);
+ root_add_str("NVM Subsystem Reset Supported (NSSRS)", cap->nssrs ? "Yes" : "No");
sprintf(json_str, "%u bytes", 1 << (2 + cap->dstrd));
root_add_str("Doorbell Stride (DSTRD)", json_str);
root_add_array("Arbitration Mechanism Supported (AMS)", amsa);
obj_add_str(amso, "Weighted Round Robin with Urgent Priority Class",
- cap->ams & 2 ? supported_str : not_supported_str);
+ cap->ams & 2 ? "Supported" : "Not supported");
array_add_obj(amsa, amso);
- root_add_str("Contiguous Queues Required (CQR)", cap->cqr ? yes_str : no_str);
+ root_add_str("Contiguous Queues Required (CQR)", cap->cqr ? "Yes" : "No");
root_add_uint("Maximum Queue Entries Supported (MQES)", cap->mqes + 1);
}
char json_str[STR_LEN];
sprintf(json_str, "%x", vs);
- root_add_str(version_str, json_str);
+ root_add_str("Version", json_str);
sprintf(json_str, "%d.%d", (vs & 0xffff0000) >> 16, (vs & 0x0000ff00) >> 8);
root_add_str("NVMe specification", json_str);
sprintf(json_str, "Vendor Specific");
break;
default:
- sprintf(json_str, "%s", reserved_str);
+ sprintf(json_str, "%s", "Reserved");
break;
}
sprintf(json_str, "Abrupt shutdown notification");
break;
default:
- sprintf(json_str, "%s", reserved_str);
+ sprintf(json_str, "%s", "Reserved");
break;
}
root_add_str("cc", json_str);
root_add_str("Controller Ready Independent of Media Enable (CRIME)",
- NVME_CC_CRIME(cc) ? enabled_str : disabled_str);
+ NVME_CC_CRIME(cc) ? "Enabled" : "Disabled");
sprintf(json_str, "%u bytes", POWER_OF_TWO(NVME_GET(cc, CC_IOCQES)));
root_add_str("I/O Completion Queue Entry Size (IOCQES): ", json_str);
root_add_str("Memory Page Size (MPS)", json_str);
root_add_str("I/O Command Set Selected (CSS)", (cc & 0x70) == 0x00 ? "NVM Command Set" :
- (cc & 0x70) == 0x60 ? "All supported_str I/O Command Sets" :
- (cc & 0x70) == 0x70 ? "Admin Command Set only" : reserved_str);
- root_add_str("Enable (EN)", cc & 1 ? yes_str : no_str);
+ (cc & 0x70) == 0x60 ? "All supported I/O Command Sets" :
+ (cc & 0x70) == 0x70 ? "Admin Command Set only" : "Reserved");
+ root_add_str("Enable (EN)", cc & 1 ? "Yes" : "No");
}
static void json_registers_csts_shst(__u8 shst, struct json_object *root)
sprintf(json_str, "Shutdown processing complete");
break;
default:
- sprintf(json_str, "%s", reserved_str);
+ sprintf(json_str, "%s", "Reserved");
break;
}
{
root_add_uint_x("csts", csts);
- root_add_str("Processing Paused (PP)", csts & 0x20 ? yes_str : no_str);
- root_add_str("NVM Subsystem Reset Occurred (NSSRO)", csts & 0x10 ? yes_str : no_str);
+ root_add_str("Processing Paused (PP)", csts & 0x20 ? "Yes" : "No");
+ root_add_str("NVM Subsystem Reset Occurred (NSSRO)", csts & 0x10 ? "Yes" : "No");
json_registers_csts_shst((csts & 0xc) >> 2, root);
- root_add_str("Controller Fatal Status (CFS)", csts & 2 ? true_str : false_str);
- root_add_str("Ready (RDY)", csts & 1 ? yes_str : no_str);
+ root_add_str("Controller Fatal Status (CFS)", csts & 2 ? "True" : "False");
+ root_add_str("Ready (RDY)", csts & 1 ? "Yes" : "No");
}
static void json_registers_nssr(__u32 nssr, struct json_object *root)
(cmbloc & 0xfffff000) >> 12);
root_add_int("CMB Queue Dword Alignment (CQDA)", (cmbloc & 0x100) >> 8);
root_add_str("CMB Data Metadata Mixed Memory Support (CDMMMS)",
- (cmbloc & 0x00000080) >> 7 ? not_enforced_str : enforced_str);
+ (cmbloc & 0x00000080) >> 7 ? "Not enforced" : "Enforced");
root_add_str("CMB Data Pointer and Command Independent Locations Support (CDPCILS)",
- (cmbloc & 0x00000040) >> 6 ? not_enforced_str : enforced_str);
+ (cmbloc & 0x00000040) >> 6 ? "Not enforced" : "Enforced");
root_add_str("CMB Data Pointer Mixed Locations Support (CDPMLS)",
- (cmbloc & 0x00000020) >> 5 ? not_enforced_str : enforced_str);
+ (cmbloc & 0x00000020) >> 5 ? "Not enforced" : "Enforced");
root_add_str("CMB Queue Physically Discontiguous Support (CQPDS)",
- (cmbloc & 0x00000010) >> 4 ? not_enforced_str : enforced_str);
+ (cmbloc & 0x00000010) >> 4 ? "Not enforced" : "Enforced");
root_add_str("CMB Queue Mixed Memory Support (CQMMS)",
- (cmbloc & 0x00000008) >> 3 ? not_enforced_str : enforced_str);
+ (cmbloc & 0x00000008) >> 3 ? "Not enforced" : "Enforced");
root_add_uint_0x("Base Indicator Register (BIR)", (cmbloc & 0x00000007));
}
root_add_uint("Size (SZ)", (cmbsz & 0xfffff000) >> 12);
root_add_str("Size Units (SZU)", nvme_register_szu_to_string((cmbsz & 0xf00) >> 8));
- root_add_str("Write Data Support (WDS)", cmbsz & 0x10 ? supported_str : not_supported_str);
- root_add_str("Read Data Support (RDS)", cmbsz & 8 ? supported_str : not_supported_str);
- root_add_str("PRP SGL List Support (LISTS)", cmbsz & 4 ? supported_str : not_supported_str);
- root_add_str("Completion Queue Support (CQS)", cmbsz & 2 ? supported_str : not_supported_str);
- root_add_str("Submission Queue Support (SQS)", cmbsz & 1 ? supported_str : not_supported_str);
+ root_add_str("Write Data Support (WDS)", cmbsz & 0x10 ? "Supported" : "Not supported");
+ root_add_str("Read Data Support (RDS)", cmbsz & 8 ? "Supported" : "Not supported");
+ root_add_str("PRP SGL List Support (LISTS)", cmbsz & 4 ? "Supported" : "Not supported");
+ root_add_str("Completion Queue Support (CQS)", cmbsz & 2 ? "Supported" : "Not supported");
+ root_add_str("Submission Queue Support (SQS)", cmbsz & 1 ? "Supported" : "Not supported");
}
static void json_registers_bpinfo_brs(__u8 brs, struct json_object *root)
sprintf(json_str, "Error completing Boot Partition read");
break;
default:
- sprintf(json_str, "%s", invalid_str);
+ sprintf(json_str, "%s", "Invalid");
break;
}
root_add_prix64("Controller Base Address (CBA)", (cmbmsc & 0xfffffffffffff000) >> 12);
root_add_prix64("Controller Memory Space Enable (CMSE)", (cmbmsc & 2) >> 1);
root_add_str("Capabilities Registers Enabled (CRE)",
- cmbmsc & 1 ? enabled_str : not_enabled_str);
+ cmbmsc & 1 ? "Enabled" : "Not enabled");
}
static void json_registers_cmbsts(uint32_t cmbsts , struct json_object *root)
root_add_uint_x("pmrcap", pmrcap);
root_add_str("Controller Memory Space Supported (CMSS)",
- ((pmrcap & 0x01000000) >> 24) ? supported_str : not_supported_str);
+ ((pmrcap & 0x01000000) >> 24) ? "Supported" : "Not supported");
root_add_uint_x("Persistent Memory Region Timeout (PMRTO)", (pmrcap & 0xff0000) >> 16);
root_add_uint_x("Persistent Memory Region Write Barrier Mechanisms (PMRWBM)",
(pmrcap & 0x3c00) >> 10);
root_add_str("Persistent Memory Region Time Units (PMRTU)",
(pmrcap & 0x300) >> 8 ? "minutes" : "500 milliseconds");
root_add_uint_x("Base Indicator Register (BIR)", (pmrcap & 0xe0) >> 5);
- root_add_str("Write Data Support (WDS)", pmrcap & 0x10 ? supported_str : not_supported_str);
- root_add_str("Read Data Support (RDS)", pmrcap & 8 ? supported_str : not_supported_str);
+ root_add_str("Write Data Support (WDS)", pmrcap & 0x10 ? "Supported" : "Not supported");
+ root_add_str("Read Data Support (RDS)", pmrcap & 8 ? "Supported" : "Not supported");
}
static void json_registers_pmrctl(uint32_t pmrctl, struct json_object *root)
{
root_add_uint_x("pmrctl", pmrctl);
- root_add_str("Enable (EN)", pmrctl & 1 ? ready_str : disabled_str);
+ root_add_str("Enable (EN)", pmrctl & 1 ? "Ready" : "Disabled");
}
static void json_registers_pmrsts(uint32_t pmrsts, void *bar, struct json_object *root)
root_add_str("Health Status (HSTS)",
nvme_register_pmr_hsts_to_string((pmrsts & 0xe00) >> 9));
root_add_str("Not Ready (NRDY)",
- !(pmrsts & 0x100) && (pmrctl & 1) ? ready_str : not_ready_str);
+ !(pmrsts & 0x100) && (pmrctl & 1) ? "Ready" : "Not ready");
root_add_uint_x("Error (ERR)", pmrsts & 0xff);
}
root_add_uint_x("pmrebs", pmrebs);
root_add_uint_x("PMR Elasticity Buffer Size Base (PMRWBZ)", (pmrebs & 0xffffff00) >> 8);
- root_add_str("Read Bypass Behavior", pmrebs & 0x10 ? shall_str : may_str);
+ root_add_str("Read Bypass Behavior", pmrebs & 0x10 ? "Shall" : "May");
root_add_str("PMR Elasticity Buffer Size Units (PMRSZU)",
nvme_register_pmr_pmrszu_to_string(pmrebs & 0xf));
}
static void json_registers_unknown(int offset, uint64_t value64, struct json_object *root)
{
root_add_uint_02x("unknown property", offset);
- root_add_str(name_str, nvme_register_to_string(offset));
- root_add_prix64(value_str, value64);
+ root_add_str("Name", nvme_register_to_string(offset));
+ root_add_prix64("Value", value64);
}
static void json_single_property_human(int offset, uint64_t value64, struct json_object *root)
sprintf(json_str, "0x%02x", offset);
root_add_str("property", json_str);
- root_add_str(name_str, nvme_register_to_string(offset));
+ root_add_str("Name", nvme_register_to_string(offset));
if (nvme_is_64bit_reg(offset))
sprintf(json_str, "%"PRIx64"", value64);
else
sprintf(json_str, "%x", value32);
- root_add_str(value_str, json_str);
+ root_add_str("Value", json_str);
}
json_print(root);
struct json_object *root = json_create_object();
root_add_uint("nvmset_id", le16_to_cpu(nvmset_id));
- root_add_uint(status_str, plpns_log->status);
+ root_add_uint("Status", plpns_log->status);
root_add_uint("event_type", le16_to_cpu(plpns_log->event_type));
root_add_uint64("dtwin_reads_typical", le64_to_cpu(plpns_log->dtwin_rt));
root_add_uint64("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, endry_str, 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_str, 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_str, 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_str, 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_str, 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_str, 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, endry_str, 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_str, json_str);
+ obj_add_str(lsde, "Status", json_str);
}
json_print(root);
{
struct json_object *root = json_create_object();
- root_add_uint64(count_str, le64_to_cpu(resv->lpc));
+ root_add_uint64("Count", le64_to_cpu(resv->lpc));
root_add_uint("rn_log_type", resv->rnlpt);
root_add_uint("num_logs", resv->nalp);
- root_add_uint(nsid_str, le32_to_cpu(resv->nsid));
+ root_add_uint("NSID", le32_to_cpu(resv->nsid));
json_print(root);
}
struct nvme_boot_partition *hdr = bp_log;
struct json_object *root = json_create_object();
- root_add_uint(count_str, hdr->lid);
+ root_add_uint("Count", hdr->lid);
root_add_uint("abpid", (le32_to_cpu(hdr->bpinfo) >> 31) & 0x1);
root_add_uint("bpsz", le32_to_cpu(hdr->bpinfo) & 0x7fff);
struct json_object *obj_event = json_create_object();
- obj_add_uint(obj_event, type_str, 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_str, 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;
nvme_ctrl_t c = nvme_path_get_ctrl(p);
path_attrs = json_create_object();
- obj_add_str(path_attrs, name_str, nvme_ctrl_get_name(c));
- obj_add_str(path_attrs, transport_str, nvme_ctrl_get_transport(c));
- obj_add_str(path_attrs, address_str, nvme_ctrl_get_address(c));
- obj_add_str(path_attrs, state_str, nvme_ctrl_get_state(c));
+ obj_add_str(path_attrs, "Name", nvme_ctrl_get_name(c));
+ obj_add_str(path_attrs, "Transport", nvme_ctrl_get_transport(c));
+ obj_add_str(path_attrs, "Address", nvme_ctrl_get_address(c));
+ obj_add_str(path_attrs, "State", nvme_ctrl_get_state(c));
obj_add_str(path_attrs, "ANAState", nvme_path_get_ana_state(p));
array_add_obj(paths, path_attrs);
i++;
struct json_object *path_attrs;
path_attrs = json_create_object();
- obj_add_str(path_attrs, name_str, nvme_ctrl_get_name(c));
- obj_add_str(path_attrs, transport_str, nvme_ctrl_get_transport(c));
- obj_add_str(path_attrs, address_str, nvme_ctrl_get_address(c));
- obj_add_str(path_attrs, state_str, nvme_ctrl_get_state(c));
+ obj_add_str(path_attrs, "Name", nvme_ctrl_get_name(c));
+ obj_add_str(path_attrs, "Transport", nvme_ctrl_get_transport(c));
+ obj_add_str(path_attrs, "Address", nvme_ctrl_get_address(c));
+ obj_add_str(path_attrs, "State", nvme_ctrl_get_state(c));
array_add_obj(paths, path_attrs);
}
}
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_str, hostid);
+ obj_add_str(host_attrs, "Host ID", hostid);
subsystems = json_create_array();
nvme_for_each_subsystem(h, s) {
subsystem_attrs = json_create_object();
- obj_add_str(subsystem_attrs, name_str, nvme_subsystem_get_name(s));
+ obj_add_str(subsystem_attrs, "Name", nvme_subsystem_get_name(s));
obj_add_str(subsystem_attrs, "NQN", nvme_subsystem_get_nqn(s));
obj_add_str(subsystem_attrs, "IOPolicy", nvme_subsystem_get_iopolicy(s));
obj_add_int(elem, "loc", pos);
obj_add_int(elem, "nidt", (int)cur->nidt);
obj_add_int(elem, "nidl", (int)cur->nidl);
- obj_add_str(elem, type_str, nidt_name);
+ obj_add_str(elem, "Type", nidt_name);
obj_add_str(elem, nidt_name, json_str);
if (!json_array)
for (i = 0; i < 1024; i++) {
if (ns_list->ns[i]) {
valid_attrs = json_create_object();
- obj_add_uint(valid_attrs, nsid_str, 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_str, nvme_zone_state_to_string(desc->zs >> 4));
- obj_add_str(zone, type_str, 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);
ext_size, 16, 1, ext_data);
obj_add_array(zone, "ext_data", ext_data);
} else {
- obj_add_str(zone, "ext_data", not_valid_str);
+ obj_add_str(zone, "ext_data", "Not valid");
}
}
obj_add_int(lbare, "LBA range", i);
- obj_add_uint_nx(lbare, type_str, 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));
char json_str[STR_LEN];
root_add_str("Deallocated or Unwritten Logical Block Error Enable (DULBE)",
- (result & 0x10000) >> 16 ? enabled_str : disabled_str);
+ (result & 0x10000) >> 16 ? "Enabled" : "Disabled");
sprintf(json_str, "%u ms", (result & 0xffff) * 100);
root_add_str("Time Limited Error Recovery (TLER)", json_str);
{
struct json_object *root = json_create_object();
- root_add_str("Volatile Write Cache Enable (WCE)", result & 1 ? enabled_str : disabled_str);
+ root_add_str("Volatile Write Cache Enable (WCE)", result & 1 ? "Enabled" : "Disabled");
json_print(root);
}
{
struct json_object *root = json_create_object();
- root_add_str("Coalescing Disable (CD)", (result & 0x10000) >> 16 ? true_str : false_str);
+ root_add_str("Coalescing Disable (CD)", (result & 0x10000) >> 16 ? "True" : "False");
root_add_uint("Interrupt Vector (IV)", result & 0xffff);
{
struct json_object *root = json_create_object();
- root_add_str("Disable Normal (DN)", result & 1 ? true_str : false_str);
+ root_add_str("Disable Normal (DN)", result & 1 ? "True" : "False");
json_print(root);
}
apste = json_create_object();
array_add_obj(apsta, apste);
sprintf(json_str, "%2d", i);
- obj_add_str(apste, endry_str, 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 *root = json_create_object();
- root_add_str("Autonomous Power State Transition Enable (APSTE)", result & 1 ? enabled_str :
- disabled_str);
+ root_add_str("Autonomous Power State Transition Enable (APSTE)", result & 1 ? "Enabled" :
+ "Disabled");
if (buf)
json_auto_pst((struct nvme_feat_auto_pst *)buf, root);
{
struct json_object *root = json_create_object();
- root_add_str("Enable Host Memory (EHM)", result & 1 ? enabled_str : disabled_str);
+ root_add_str("Enable Host Memory (EHM)", result & 1 ? "Enabled" : "Disabled");
if (buf)
json_host_mem_buffer((struct nvme_host_mem_buf_attrs *)buf, root);
struct json_object *root = json_create_object();
root_add_str("Non-Operational Power State Permissive Mode Enable (NOPPME)", result & 1 ?
- true_str : false_str);
+ "True" : "False");
json_print(root);
}
{
struct json_object *root = json_create_object();
- root_add_str("Predictable Latency Window Enabled", result & 1 ? true_str : false_str);
+ root_add_str("Predictable Latency Window Enabled", result & 1 ? "True" : "False");
if (buf)
json_plm_config((struct nvme_plm_config *)buf, root);
struct json_object *root = json_create_object();
if (buf)
- root_add_str("Host Behavior Support", buf[0] & 0x1 ? true_str : false_str);
+ root_add_str("Host Behavior Support", buf[0] & 0x1 ? "True" : "False");
json_print(root);
}
{
struct json_object *root = json_create_object();
- root_add_str("I/O Command Set Profile", result & 0x1 ? true_str : false_str);
+ root_add_str("I/O Command Set Profile", result & 0x1 ? "True" : "False");
json_print(root);
}
{
struct json_object *root = json_create_object();
- root_add_str("Spinup control feature Enabled", result & 1 ? true_str : false_str);
+ root_add_str("Spinup control feature Enabled", result & 1 ? "True" : "False");
json_print(root);
}
desce = json_create_object();
array_add_obj(desca, desce);
- obj_add_int(desce, element_str, i);
+ obj_add_int(desce, "Element", i);
sprintf(json_str, "0x%02x", desc->type);
- obj_add_str(desce, type_str, json_str);
+ obj_add_str(desce, "Type", json_str);
obj_add_str(desce, "Type definition",
nvme_host_metadata_type_to_string(fid, desc->type));
- obj_add_int(desce, revision_str, desc->rev);
+ obj_add_int(desce, "Revision", desc->rev);
len = le16_to_cpu(desc->len);
- obj_add_int(desce, length_str, len);
+ obj_add_int(desce, "Length", len);
strncpy(val, (char *)desc->val, min(sizeof(val) - 1, len));
- obj_add_str(desce, value_str, val);
+ obj_add_str(desce, "Value", val);
desc = (struct nvme_metadata_element_desc *)&desc->val[desc->len];
}
struct json_object *root = json_create_object();
root_add_str("Mask Reservation Preempted Notification (RESPRE)", (result & 8) >> 3 ?
- true_str : false_str);
+ "True" : "False");
root_add_str("Mask Reservation Released Notification (RESREL)", (result & 4) >> 2 ?
- true_str : false_str);
+ "True" : "False");
root_add_str("Mask Registration Preempted Notification (REGPRE)", (result & 2) >> 1 ?
- true_str : false_str);
+ "True" : "False");
json_print(root);
}
{
struct json_object *root = json_create_object();
- root_add_str("Persist Through Power Loss (PTPL)", result & 1 ? true_str : false_str);
+ root_add_str("Persist Through Power Loss (PTPL)", result & 1 ? "True" : "False");
json_print(root);
}
{
struct json_object *root = json_create_object();
- root_add_str("Flexible Direct Placement Enable (FDPE)", result & 1 ? yes_str : no_str);
+ root_add_str("Flexible Direct Placement Enable (FDPE)", result & 1 ? "Yes" : "No");
root_add_uint("Flexible Direct Placement Configuration Index", result >> 8 & 0xf);
json_print(root);
for (i = 0; i < result; i++) {
d = &((struct nvme_fdp_supported_event_desc *)buf)[i];
- sprintf(json_str, "%s", d->evta & 0x1 ? enabled_str : not_enabled_str);
+ sprintf(json_str, "%s", d->evta & 0x1 ? "Enabled" : "Not enabled");
root_add_str(nvme_fdp_event_to_string(d->evt), json_str);
}
char json_str[STR_LEN];
sprintf(json_str, "%#0*x", fid ? 4 : 2, fid);
- root_add_str(feature_str, json_str);
+ root_add_str("Feature", json_str);
- root_add_str(name_str, nvme_feature_to_string(fid));
+ root_add_str("Name", nvme_feature_to_string(fid));
sprintf(json_str, "%#0*x", result ? 10 : 8, result);
root_add_str(nvme_select_to_string(sel), json_str);
struct json_object *data = json_create_array();
d_json(buf, len, width, group, data);
- root_add_array(data_str, data);
+ root_add_array("Data", data);
json_print(root);
}
struct json_object *root = json_create_object();
root_add_uint("cntlid", le16_to_cpu(caps->cntlid));
- root_add_uint(port_id_str, le16_to_cpu(caps->portid));
+ root_add_uint("Port ID", le16_to_cpu(caps->portid));
root_add_uint("crt", caps->crt);
root_add_uint("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_str, hostid);
+ obj_add_str(hss, "Host ID", hostid);
nvme_for_each_subsystem(h , s) {
struct json_object *jss = json_create_object();
struct json_object *jctrls = json_create_array();
struct json_object *jnss = json_create_array();
- obj_add_str(jss, subsystem_str, nvme_subsystem_get_name(s));
+ obj_add_str(jss, "Subsystem", nvme_subsystem_get_name(s));
obj_add_str(jss, "SubsystemNQN", nvme_subsystem_get_nqn(s));
nvme_subsystem_for_each_ctrl(s, c) {
struct json_object *jnss = json_create_array();
struct json_object *jpaths = json_create_array();
- obj_add_str(jctrl, controller_str, nvme_ctrl_get_name(c));
- obj_add_str(jctrl, serial_number_str, nvme_ctrl_get_serial(c));
- obj_add_str(jctrl, model_number_str, nvme_ctrl_get_model(c));
- obj_add_str(jctrl, firmware_str, nvme_ctrl_get_firmware(c));
- obj_add_str(jctrl, transport_str, nvme_ctrl_get_transport(c));
- obj_add_str(jctrl, address_str, nvme_ctrl_get_address(c));
- obj_add_str(jctrl, slot_str, nvme_ctrl_get_phy_slot(c));
+ 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, "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));
+ obj_add_str(jctrl, "Slot", nvme_ctrl_get_phy_slot(c));
nvme_ctrl_for_each_ns(c, n) {
struct json_object *jns = json_create_object();
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_str, nvme_ns_get_name(n));
- obj_add_str(jns, generic_str, nvme_ns_get_generic_name(n));
- obj_add_int(jns, nsid_str, nvme_ns_get_nsid(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);
obj_add_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n));
obj_add_uint64(jns, "PhysicalSize", nsze);
nvme_ctrl_for_each_path(c, p) {
struct json_object *jpath = json_create_object();
- obj_add_str(jpath, path_str, nvme_path_get_name(p));
+ obj_add_str(jpath, "Path", nvme_path_get_name(p));
obj_add_str(jpath, "ANAState", nvme_path_get_ana_state(p));
array_add_obj(jpaths, jpath);
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_str, nvme_ns_get_name(n));
- obj_add_str(jns, generic_str, nvme_ns_get_generic_name(n));
- obj_add_int(jns, nsid_str, nvme_ns_get_nsid(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);
obj_add_uint64(jns, "MaximumLBA", nvme_ns_get_lba_count(n));
obj_add_uint64(jns, "PhysicalSize", nsze);
nvme_dev_full_path(n, devname, sizeof(devname));
nvme_generic_full_path(n, genname, sizeof(genname));
- root_add_int(namespace_str, nvme_ns_get_nsid(n));
+ root_add_int("Namespace", nvme_ns_get_nsid(n));
root_add_str("DevicePath", devname);
root_add_str("GenericPath", genname);
- root_add_str(firmware_str, nvme_ns_get_firmware(n));
- root_add_str(model_number_str, nvme_ns_get_model(n));
- root_add_str(serial_number_str, nvme_ns_get_serial(n));
+ root_add_str("Firmware", nvme_ns_get_firmware(n));
+ root_add_str("Model number", nvme_ns_get_model(n));
+ root_add_str("Serial number", nvme_ns_get_serial(n));
root_add_uint64("UsedBytes", nuse);
root_add_uint64("MaximumLBA", nvme_ns_get_lba_count(n));
root_add_uint64("PhysicalSize", nsze);
struct json_object *paths;
ns_attrs = json_create_object();
- obj_add_int(ns_attrs, nsid_str, nvme_ns_get_nsid(n));
+ obj_add_int(ns_attrs, "NSID", nvme_ns_get_nsid(n));
paths = json_create_array();
nvme_namespace_for_each_path(n, p) {
nvme_ctrl_t c = nvme_path_get_ctrl(p);
path_attrs = json_create_object();
- obj_add_str(path_attrs, name_str, nvme_ctrl_get_name(c));
- obj_add_str(path_attrs, transport_str, nvme_ctrl_get_transport(c));
- obj_add_str(path_attrs, address_str, nvme_ctrl_get_address(c));
- obj_add_str(path_attrs, state_str, nvme_ctrl_get_state(c));
+ obj_add_str(path_attrs, "Name", nvme_ctrl_get_name(c));
+ obj_add_str(path_attrs, "Transport", nvme_ctrl_get_transport(c));
+ obj_add_str(path_attrs, "Address", nvme_ctrl_get_address(c));
+ obj_add_str(path_attrs, "State", nvme_ctrl_get_state(c));
obj_add_str(path_attrs, "ANAState", nvme_path_get_ana_state(p));
array_add_obj(paths, path_attrs);
}
struct json_object *ctrl;
ns_attrs = json_create_object();
- obj_add_int(ns_attrs, nsid_str, nvme_ns_get_nsid(n));
+ obj_add_int(ns_attrs, "NSID", nvme_ns_get_nsid(n));
ctrl = json_create_array();
ctrl_attrs = json_create_object();
- obj_add_str(ctrl_attrs, name_str,
+ obj_add_str(ctrl_attrs, "Name",
nvme_ctrl_get_name(c));
- obj_add_str(ctrl_attrs, transport_str,
+ obj_add_str(ctrl_attrs, "Transport",
nvme_ctrl_get_transport(c));
- obj_add_str(ctrl_attrs, address_str,
+ obj_add_str(ctrl_attrs, "Address",
nvme_ctrl_get_address(c));
- obj_add_str(ctrl_attrs, state_str,
+ obj_add_str(ctrl_attrs, "State",
nvme_ctrl_get_state(c));
array_add_obj(ctrl, ctrl_attrs);
- obj_add_array(ns_attrs, controller_str, ctrl);
+ obj_add_array(ns_attrs, "Controller", ctrl);
array_add_obj(namespaces, ns_attrs);
}
}
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_str, hostid);
+ obj_add_str(host_attrs, "Host ID", hostid);
subsystems = json_create_array();
nvme_for_each_subsystem(h, s) {
subsystem_attrs = json_create_object();
- obj_add_str(subsystem_attrs, name_str, nvme_subsystem_get_name(s));
+ obj_add_str(subsystem_attrs, "Name", nvme_subsystem_get_name(s));
obj_add_str(subsystem_attrs, "NQN", nvme_subsystem_get_nqn(s));
obj_add_str(subsystem_attrs, "IOPolicy", nvme_subsystem_get_iopolicy(s));
support = json_create_array();
root_add_array("Directive support", support);
obj_add_str(support, "Identify Directive",
- *field & 0x1 ? supported_str : not_supported_str);
+ *field & 0x1 ? "Supported" : "Not supported");
obj_add_str(support, "Stream Directive",
- *field & 0x2 ? supported_str : not_supported_str);
+ *field & 0x2 ? "Supported" : "Not supported");
obj_add_str(support, "Data Placement Directive",
- *field & 0x4 ? supported_str : not_supported_str);
+ *field & 0x4 ? "Supported" : "Not supported");
enabled = json_create_array();
root_add_array("Directive enabled", enabled);
obj_add_str(enabled, "Identify Directive",
- *(field + 32) & 0x1 ? enabled_str : disabled_str);
+ *(field + 32) & 0x1 ? "Enabled" : "Disabled");
obj_add_str(enabled, "Stream Directive",
- *(field + 32) & 0x2 ? enabled_str : disabled_str);
+ *(field + 32) & 0x2 ? "Enabled" : "Disabled");
obj_add_str(enabled, "Data Placement Directive",
- *(field + 32) & 0x4 ? enabled_str : disabled_str);
+ *(field + 32) & 0x4 ? "Enabled" : "Disabled");
persistent = json_create_array();
obj_add_array(root, "Directive Persistent Across Controller Level Resets",
persistent);
obj_add_str(persistent, "Identify Directive",
- *(field + 32) & 0x1 ? enabled_str : disabled_str);
+ *(field + 32) & 0x1 ? "Enabled" : "Disabled");
obj_add_str(persistent, "Stream Directive",
- *(field + 32) & 0x2 ? enabled_str : disabled_str);
+ *(field + 32) & 0x2 ? "Enabled" : "Disabled");
obj_add_str(persistent, "Data Placement Directive",
- *(field + 32) & 0x4 ? enabled_str : disabled_str);
+ *(field + 32) & 0x4 ? "Enabled" : "Disabled");
break;
default:
- root_add_str(error_str, "invalid directive operations for Identify Directives");
+ root_add_str("Error", "invalid directive operations for Identify Directives");
break;
}
}
root_add_uint("Namespace Streams Allocated (NSA)", result & 0xffff);
break;
default:
- root_add_str(error_str,
+ root_add_str("Error",
"invalid directive operations for Streams Directives");
break;
}
json_directive_show_fields_streams(doper, result, (__u16 *)field, root);
break;
default:
- root_add_str(error_str, "invalid directive type");
+ root_add_str("Error", "invalid directive type");
break;
}
}
char json_str[STR_LEN];
sprintf(json_str, "%#x", type);
- root_add_str(type_str, json_str);
+ root_add_str("Type", json_str);
sprintf(json_str, "%#x", oper);
- root_add_str(operation_str, json_str);
+ root_add_str("Operation", json_str);
sprintf(json_str, "%#x", spec);
root_add_str("spec", json_str);
sprintf(json_str, "%#x", nsid);
- root_add_str(nsid_str, json_str);
+ root_add_str("NSID", json_str);
sprintf(json_str, "%#x", result);
root_add_result(json_str);
} else if (buf) {
data = json_create_array();
d_json((unsigned char *)buf, len, 16, 1, data);
- root_add_array(data_str, data);
+ root_add_array("Data", data);
}
json_print(root);
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_str, le16_to_cpu(e->portid));
+ obj_add_uint(entry, "Port ID", 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 *root = json_create_object();
- root_add_str(device_str, nvme_ctrl_get_name(c));
+ root_add_str("Device", nvme_ctrl_get_name(c));
json_print(root);
}
int type;
if (status < 0) {
- root_add_str(error_str, nvme_strerror(errno));
+ root_add_str("Error", nvme_strerror(errno));
return json_output_object(root);
}
switch (type) {
case NVME_STATUS_TYPE_NVME:
- root_add_str(error_str, nvme_status_to_string(val, false));
- root_add_str(type_str, "nvme");
+ root_add_str("Error", nvme_status_to_string(val, false));
+ root_add_str("Type", "nvme");
break;
case NVME_STATUS_TYPE_MI:
- root_add_str(error_str, nvme_mi_status_to_string(val));
- root_add_str(type_str, "nvme-mi");
+ root_add_str("Error", nvme_mi_status_to_string(val));
+ root_add_str("Type", "nvme-mi");
break;
default:
- root_add_str(type_str, unknow_str);
+ root_add_str("Type", "Unknown");
break;
}
- root_add_int(value_str, val);
+ root_add_int("Value", val);
json_output_object(root);
}
{
struct json_object *root = json_create_object();
char *value;
- const char *key = error ? error_str : result_str;
+ const char *key = error ? "Error" : "Result";
if (vasprintf(&value, msg, ap) < 0)
value = NULL;
error = NULL;
if (error)
- root_add_str(error_str, error);
+ root_add_str("Error", error);
else
- root_add_str(error_str, "Could not allocate string");
+ root_add_str("Error", "Could not allocate string");
json_output_object(root);