From 33b8fe1a294d670d67a2e9802ca0c753826b1562 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Aug 2022 14:26:29 +0200 Subject: Merging upstream version 1.1. Signed-off-by: Daniel Baumann --- src/nvme/json.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/nvme/json.c') diff --git a/src/nvme/json.c b/src/nvme/json.c index 6f0b81c..b42cd51 100644 --- a/src/nvme/json.c +++ b/src/nvme/json.c @@ -95,7 +95,7 @@ static void json_parse_port(nvme_subsystem_t s, struct json_object *port_obj) if (!c) return; json_update_attributes(c, port_obj); - attr_obj = json_object_object_get(port_obj, "dhchap_key"); + attr_obj = json_object_object_get(port_obj, "dhchap_ctrl_key"); if (attr_obj) nvme_ctrl_set_dhchap_key(c, json_object_get_string(attr_obj)); } @@ -224,7 +224,7 @@ static void json_update_port(struct json_object *ctrl_array, nvme_ctrl_t c) json_object_new_string(value)); value = nvme_ctrl_get_dhchap_key(c); if (value) - json_object_object_add(port_obj, "dhchap_key", + json_object_object_add(port_obj, "dhchap_ctrl_key", json_object_new_string(value)); JSON_INT_OPTION(cfg, port_obj, nr_io_queues, 0); JSON_INT_OPTION(cfg, port_obj, nr_write_queues, 0); @@ -318,9 +318,10 @@ int json_update_config(nvme_root_t r, const char *config_file) json_object_put(subsys_array); json_object_array_add(json_root, host_obj); } - if (!config_file) + if (!config_file) { ret = json_object_to_fd(1, json_root, JSON_C_TO_STRING_PRETTY); - else + printf("\n"); + } else ret = json_object_to_file_ext(config_file, json_root, JSON_C_TO_STRING_PRETTY); if (ret < 0) { @@ -366,7 +367,7 @@ static void json_dump_ctrl(struct json_object *ctrl_array, nvme_ctrl_t c) json_object_new_string(value)); value = nvme_ctrl_get_dhchap_key(c); if (value) - json_object_object_add(ctrl_obj, "dhchap_key", + json_object_object_add(ctrl_obj, "dhchap_ctrl_key", json_object_new_string(value)); JSON_INT_OPTION(cfg, ctrl_obj, nr_io_queues, 0); JSON_INT_OPTION(cfg, ctrl_obj, nr_write_queues, 0); -- cgit v1.2.3