[PATCH nvme-cli 1/2] add "State" entry
chengjike
chengjike.cheng at huawei.com
Wed Sep 15 06:29:11 PDT 2021
From: chengjike <jiangtao62 at huawei.com>
Add "State" entry in nvme-print.c
Signed-off-by: chengjike <chengjike.cheng at huawei.com>
---
nvme-print.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/nvme-print.c b/nvme-print.c
index d321ec0..f2b12c0 100644
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -5647,10 +5647,10 @@ static void nvme_show_list_item(nvme_ns_t n)
snprintf(format, sizeof(format), "%3.0f %2sB + %2d B", (double)lba,
l_suffix, nvme_ns_get_meta_size(n));
- printf("%-21s %-20s %-40s %-9d %-26s %-16s %-8s\n",
+ printf("%-21s %-20s %-40s %-9d %-26s %-16s %-8s %-8s\n",
nvme_ns_get_name(n), nvme_ns_get_serial(n),
nvme_ns_get_model(n), nvme_ns_get_nsid(n), usage, format,
- nvme_ns_get_firmware(n));
+ nvme_ns_get_firmware(n), nvme_ns_get_state(n));
}
static void nvme_show_simple_list(nvme_root_t r)
@@ -5660,10 +5660,10 @@ static void nvme_show_simple_list(nvme_root_t r)
nvme_ctrl_t c;
nvme_ns_t n;
- printf("%-21s %-20s %-40s %-9s %-26s %-16s %-8s\n",
- "Node", "SN", "Model", "Namespace", "Usage", "Format", "FW Rev");
- printf("%-.21s %-.20s %-.40s %-.9s %-.26s %-.16s %-.8s\n", dash, dash,
- dash, dash, dash, dash, dash);
+ printf("%-21s %-20s %-40s %-9s %-26s %-16s %-8s %-8s\n",
+ "Node", "SN", "Model", "Namespace", "Usage", "Format", "FW Rev", "State");
+ printf("%-.21s %-.20s %-.40s %-.9s %-.26s %-.16s %-.8s %-.8s\n", dash, dash,
+ dash, dash, dash, dash, dash, dash);
nvme_for_each_host(r, h) {
nvme_for_each_subsystem(h, s) {
@@ -5839,6 +5839,7 @@ static void json_detail_list(nvme_root_t r)
json_object_add_value_int(jns, "maxlba", nvme_ns_get_lba_count(n));
json_object_add_value_int(jns, "capacity", nsze);
json_object_add_value_int(jns, "sector", lba);
+ json_object_add_value_string(jns, "state", nvme_ns_get_state(n));
json_array_add_value_object(jnss, jns);
}
@@ -5871,6 +5872,7 @@ static void json_detail_list(nvme_root_t r)
json_object_add_value_int(jns, "maxlba", nvme_ns_get_lba_count(n));
json_object_add_value_int(jns, "capacity", nsze);
json_object_add_value_int(jns, "sector", lba);
+ json_object_add_value_string(jns, "state", nvme_ns_get_state(n));
json_array_add_value_object(jnss, jns);
}
@@ -5905,6 +5907,7 @@ static struct json_object *json_list_item(nvme_ns_t n)
json_object_add_value_int(jdevice, "maxlba", nvme_ns_get_lba_count(n));
json_object_add_value_int(jdevice, "capacity", nsze);
json_object_add_value_int(jdevice, "sector", lba);
+ json_object_add_value_string(jdevice, "state", nvme_ns_get_state(n));
return jdevice;
}
--
2.21.0.windows.1
More information about the Linux-nvme
mailing list