]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print: update subsys verbose outputs
authorMartin George <marting@netapp.com>
Sun, 18 Aug 2024 16:54:18 +0000 (22:24 +0530)
committerDaniel Wagner <wagi@monom.org>
Mon, 19 Aug 2024 09:18:35 +0000 (11:18 +0200)
The current list-subsys & show-topology simple outputs are a
little crowded. Also the respective verbose options to both
these commands are a no-op at the moment. So move the iopolicy
and subsystype details to the respective verbose outputs instead
so that the simple outputs are restricted to displaying key subsys
details like subsys name & NQN alone.

Signed-off-by: Martin George <marting@netapp.com>
nvme-print-json.c
nvme-print-stdout.c

index 9101c4830545e114725578dccffbbec33c2e9ac8..a05015ff52357a48e77959840870107fdf306981 100644 (file)
@@ -2465,8 +2465,13 @@ static void json_print_nvme_subsystem_list(nvme_root_t r, bool show_ana)
                        subsystem_attrs = json_create_object();
                        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_str(subsystem_attrs, "Type", nvme_subsystem_get_type(s));
+
+                       if (json_print_ops.flags & VERBOSE) {
+                               obj_add_str(subsystem_attrs, "IOPolicy",
+                                               nvme_subsystem_get_iopolicy(s));
+                               obj_add_str(subsystem_attrs, "Type",
+                                               nvme_subsystem_get_type(s));
+                       }
 
                        array_add_obj(subsystems, subsystem_attrs);
                        paths = json_create_array();
@@ -4360,8 +4365,13 @@ static void json_simple_topology(nvme_root_t r)
                        subsystem_attrs = json_create_object();
                        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_str(subsystem_attrs, "Type", nvme_subsystem_get_type(s));
+
+                       if (json_print_ops.flags & VERBOSE) {
+                               obj_add_str(subsystem_attrs, "IOPolicy",
+                                               nvme_subsystem_get_iopolicy(s));
+                               obj_add_str(subsystem_attrs, "Type",
+                                               nvme_subsystem_get_type(s));
+                       }
 
                        array_add_obj(subsystems, subsystem_attrs);
                        namespaces = json_create_array();
index 784792e12d7dda367322ca8084536c6c561623a8..fc0cd4e63477b20c1246dc5e2356772b37c70bef 100644 (file)
@@ -1071,10 +1071,13 @@ static void stdout_subsys_config(nvme_subsystem_t s)
               nvme_subsystem_get_nqn(s));
        printf("%*s   hostnqn=%s\n", len, " ",
               nvme_host_get_hostnqn(nvme_subsystem_get_host(s)));
-       printf("%*s   iopolicy=%s\n", len, " ",
-              nvme_subsystem_get_iopolicy(s));
-       printf("%*s   type=%s\n", len, " ",
-              nvme_subsystem_get_type(s));
+
+       if (stdout_print_ops.flags & VERBOSE) {
+               printf("%*s   iopolicy=%s\n", len, " ",
+                       nvme_subsystem_get_iopolicy(s));
+               printf("%*s   type=%s\n", len, " ",
+                       nvme_subsystem_get_type(s));
+       }
 }
 
 static void stdout_subsystem(nvme_root_t r, bool show_ana)