@@ -4591,6 +4591,44 @@ void json_show_finish(void)
45914591 json_r = NULL ;
45924592}
45934593
4594+ static void json_mgmt_addr_list_log (struct nvme_mgmt_addr_list_log * ma_list )
4595+ {
4596+ int i ;
4597+ bool reserved = true;
4598+ struct json_object * r = json_create_object ();
4599+ struct json_object * mad ;
4600+ struct json_object * mat ;
4601+ char json_str [STR_LEN ];
4602+
4603+ for (i = 0 ; i < ARRAY_SIZE (ma_list -> mad ); i ++ ) {
4604+ switch (ma_list -> mad [i ].mat ) {
4605+ case 1 :
4606+ case 2 :
4607+ mad = json_create_object ();
4608+ mat = json_create_object ();
4609+ obj_add_str (mat , "definition" , ma_list -> mad [i ].mat == 1 ?
4610+ "NVM subsystem management agent" : "fabric interface manager" );
4611+ snprintf (json_str , sizeof (json_str ), "type: %d" , ma_list -> mad [i ].mat );
4612+ obj_add_obj (mad , json_str , mat );
4613+ obj_add_str (mad , "address" , (const char * )ma_list -> mad [i ].madrs );
4614+ snprintf (json_str , sizeof (json_str ), "descriptor: %d" , i );
4615+ obj_add_obj (r , json_str , mad );
4616+ reserved = false;
4617+ break ;
4618+ case 0xff :
4619+ goto out ;
4620+ default :
4621+ break ;
4622+ }
4623+ }
4624+
4625+ out :
4626+ if (reserved )
4627+ obj_add_str (r , "list" , "All management address descriptors reserved" );
4628+
4629+ json_print (r );
4630+ }
4631+
45944632static struct print_ops json_print_ops = {
45954633 /* libnvme types.h print functions */
45964634 .ana_log = json_ana_log ,
@@ -4658,6 +4696,7 @@ static struct print_ops json_print_ops = {
46584696 .d = json_d ,
46594697 .show_init = json_show_init ,
46604698 .show_finish = json_show_finish ,
4699+ .mgmt_addr_list_log = json_mgmt_addr_list_log ,
46614700
46624701 /* libnvme tree print functions */
46634702 .list_item = json_list_item ,
0 commit comments