@@ -74,6 +74,7 @@ struct nvme_vu_id_ctrl_field { /* CDR MR5 */
7474 __u8 mic_fw [4 ];
7575};
7676
77+ #ifdef CONFIG_JSONC
7778static void json_intel_id_ctrl (struct nvme_vu_id_ctrl_field * id ,
7879 char * health , char * bl , char * ww , char * mic_bl , char * mic_fw ,
7980 struct json_object * root )
@@ -89,6 +90,9 @@ static void json_intel_id_ctrl(struct nvme_vu_id_ctrl_field *id,
8990 json_object_add_value_string (root , "mic_bl" , mic_bl );
9091 json_object_add_value_string (root , "mic_fw" , mic_fw );
9192}
93+ #else /* CONFIG_JSONC */
94+ #define json_intel_id_ctrl (id , health , bl , ww , mic_bl , mic_fw , root )
95+ #endif /* CONFIG_JSONC */
9296
9397static void intel_id_ctrl (__u8 * vs , struct json_object * root )
9498{
@@ -134,6 +138,7 @@ static int id_ctrl(int argc, char **argv, struct command *cmd, struct plugin *pl
134138 return __id_ctrl (argc , argv , cmd , plugin , intel_id_ctrl );
135139}
136140
141+ #ifdef CONFIG_JSONC
137142static void show_intel_smart_log_jsn (struct nvme_additional_smart_log * smart ,
138143 unsigned int nsid , const char * devname )
139144{
@@ -256,6 +261,9 @@ static void show_intel_smart_log_jsn(struct nvme_additional_smart_log *smart,
256261 json_print_object (root , NULL );
257262 json_free_object (root );
258263}
264+ #else /* CONFIG_JSONC */
265+ #define show_intel_smart_log_jsn (smart , nsid , devname )
266+ #endif /* CONFIG_JSONC */
259267
260268static char * id_to_key (__u8 id )
261269{
@@ -336,7 +344,9 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,
336344 "Get Intel vendor specific additional smart log (optionally, for the specified namespace), and show it." ;
337345 const char * namespace = "(optional) desired namespace" ;
338346 const char * raw = "Dump output in binary format" ;
347+ #ifdef CONFIG_JSONC
339348 const char * json = "Dump output in json format" ;
349+ #endif /* CONFIG_JSONC */
340350
341351 struct nvme_additional_smart_log smart_log ;
342352 struct nvme_dev * dev ;
@@ -355,7 +365,9 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,
355365 OPT_ARGS (opts ) = {
356366 OPT_UINT ("namespace-id" , 'n' , & cfg .namespace_id , namespace ),
357367 OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ),
368+ #ifdef CONFIG_JSONC
358369 OPT_FLAG ("json" , 'j' , & cfg .json , json ),
370+ #endif /* CONFIG_JSONC */
359371 OPT_END ()
360372 };
361373
@@ -683,6 +695,7 @@ static int lat_stats_log_scale(int i)
683695 * "type" : "write" or "read",
684696 * "values" : {
685697 */
698+ #ifdef CONFIG_JSONC
686699static void lat_stats_make_json_root (
687700 struct json_object * root , struct json_object * bucket_list ,
688701 int write )
@@ -814,6 +827,7 @@ static void json_lat_stats_4_0(struct intel_lat_stats *stats,
814827 json_print_object (root , NULL );
815828 json_free_object (root );
816829}
830+ #endif /* CONFIG_JSONC */
817831
818832static void show_lat_stats_3_0 (struct intel_lat_stats * stats )
819833{
@@ -844,6 +858,7 @@ static void show_lat_stats_4_0(struct intel_lat_stats *stats)
844858 }
845859}
846860
861+ #ifdef CONFIG_JSONC
847862static void json_lat_stats_v1000_0 (struct optane_lat_stats * stats , int write )
848863{
849864 int i ;
@@ -892,6 +907,7 @@ static void json_lat_stats_v1000_0(struct optane_lat_stats *stats, int write)
892907 json_free_object (root );
893908
894909}
910+ #endif /* CONFIG_JSONC */
895911
896912static void show_lat_stats_v1000_0 (struct optane_lat_stats * stats , int write )
897913{
@@ -925,6 +941,7 @@ static void show_lat_stats_v1000_0(struct optane_lat_stats *stats, int write)
925941
926942}
927943
944+ #ifdef CONFIG_JSONC
928945static void json_lat_stats (int write )
929946{
930947 switch (media_version [MEDIA_MAJOR_IDX ]) {
@@ -965,6 +982,9 @@ static void json_lat_stats(int write)
965982 }
966983 printf ("\n" );
967984}
985+ #else /* CONFIG_JSONC */
986+ #define json_lat_stats (write )
987+ #endif /* CONFIG_JSONC */
968988
969989static void print_dash_separator (int count )
970990{
@@ -1032,7 +1052,9 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, struct
10321052
10331053 const char * desc = "Get Intel Latency Statistics log and show it." ;
10341054 const char * raw = "Dump output in binary format" ;
1055+ #ifdef CONFIG_JSONC
10351056 const char * json = "Dump output in json format" ;
1057+ #endif /* CONFIG_JSONC */
10361058 const char * write = "Get write statistics (read default)" ;
10371059
10381060 struct config {
@@ -1047,7 +1069,9 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, struct
10471069 OPT_ARGS (opts ) = {
10481070 OPT_FLAG ("write" , 'w' , & cfg .write , write ),
10491071 OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ),
1072+ #ifdef CONFIG_JSONC
10501073 OPT_FLAG ("json" , 'j' , & cfg .json , json ),
1074+ #endif /* CONFIG_JSONC */
10511075 OPT_END ()
10521076 };
10531077
0 commit comments