@@ -199,7 +199,7 @@ static void json_id_iocs_iocsc(struct json_object *obj_iocsc, __u64 iocsc)
199199
200200static bool human (void )
201201{
202- return json_print_ops .flags & VERBOSE ;
202+ return json_print_ops .flags & VERBOSE || nvme_cfg . output_format_ver == 2 ;
203203}
204204
205205static void json_id_iocs (struct nvme_id_iocs * iocs )
@@ -2540,7 +2540,7 @@ static void json_print_nvme_subsystem_list(nvme_root_t r, bool show_ana)
25402540 obj_add_str (subsystem_attrs , "Name" , nvme_subsystem_get_name (s ));
25412541 obj_add_str (subsystem_attrs , "NQN" , nvme_subsystem_get_nqn (s ));
25422542
2543- if (json_print_ops . flags & VERBOSE ) {
2543+ if (human () ) {
25442544 obj_add_str (subsystem_attrs , "Model" ,
25452545 nvme_subsystem_get_model (s ));
25462546 obj_add_str (subsystem_attrs , "Firmware" ,
@@ -2995,14 +2995,13 @@ static void json_ctrl_register_human(int offset, uint64_t value, struct json_obj
29952995
29962996static void json_ctrl_register (int offset , uint64_t value )
29972997{
2998- bool human = json_print_ops .flags & VERBOSE ;
29992998 struct json_object * r ;
30002999 char json_str [STR_LEN ];
30013000
30023001 sprintf (json_str , "register: %#04x" , offset );
30033002 r = obj_create (json_str );
30043003
3005- if (human ) {
3004+ if (human () ) {
30063005 obj_add_uint64 (r , nvme_register_to_string (offset ), value );
30073006 json_ctrl_register_human (offset , value , r );
30083007 } else {
@@ -3130,7 +3129,7 @@ static void json_nvme_id_ctrl_nvm(struct nvme_id_ctrl_nvm *ctrl_nvm)
31303129 obj_add_uint (r , "wzdsl" , ctrl_nvm -> wzdsl );
31313130 obj_add_uint (r , "aocs" , le16_to_cpu (ctrl_nvm -> aocs ));
31323131
3133- if (json_print_ops . flags & VERBOSE ) {
3132+ if (human () ) {
31343133 __u16 rsvd = (ctrl_nvm -> aocs & 0xfffe ) >> 1 ;
31353134 __u8 ralbas = ctrl_nvm -> aocs & 0x1 ;
31363135
@@ -4475,7 +4474,7 @@ static void json_list_item(nvme_ns_t n)
44754474
44764475static void json_print_list_items (nvme_root_t t )
44774476{
4478- if (json_print_ops . flags & VERBOSE )
4477+ if (human () )
44794478 json_detail_list (t );
44804479 else
44814480 json_simple_list (t );
@@ -4572,7 +4571,7 @@ static void json_simple_topology(nvme_root_t r)
45724571 obj_add_str (subsystem_attrs , "Name" , nvme_subsystem_get_name (s ));
45734572 obj_add_str (subsystem_attrs , "NQN" , nvme_subsystem_get_nqn (s ));
45744573
4575- if (json_print_ops . flags & VERBOSE ) {
4574+ if (human () ) {
45764575 obj_add_str (subsystem_attrs , "Model" ,
45774576 nvme_subsystem_get_model (s ));
45784577 obj_add_str (subsystem_attrs , "Firmware" ,
@@ -4710,7 +4709,7 @@ static void json_directive_show(__u8 type, __u8 oper, __u16 spec, __u32 nsid, __
47104709 sprintf (json_str , "%#x" , result );
47114710 obj_add_result (r , json_str );
47124711
4713- if (json_print_ops . flags & VERBOSE ) {
4712+ if (human () ) {
47144713 json_directive_show_fields (type , oper , result , buf , r );
47154714 } else if (buf ) {
47164715 data = json_create_array ();
0 commit comments