66#include "modules/disk/disk.h"
77#include "util/stringUtils.h"
88
9- #define FF_DISK_NUM_FORMAT_ARGS 10
9+ #define FF_DISK_NUM_FORMAT_ARGS 11
1010#pragma GCC diagnostic ignored "-Wsign-conversion"
1111
1212static void printDisk (FFDiskOptions * options , const FFDisk * disk )
@@ -111,6 +111,19 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
111111 bool isExternal = !!(disk -> type & FF_DISK_VOLUME_TYPE_EXTERNAL_BIT );
112112 bool isHidden = !!(disk -> type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT );
113113 bool isReadOnly = !!(disk -> type & FF_DISK_VOLUME_TYPE_READONLY_BIT );
114+ const char * physicalType ;
115+ switch (disk -> physicalType )
116+ {
117+ case FF_DISK_PHYSICAL_TYPE_HDD :
118+ physicalType = "HDD" ;
119+ break ;
120+ case FF_DISK_PHYSICAL_TYPE_SSD :
121+ physicalType = "SSD" ;
122+ break ;
123+ default :
124+ physicalType = "Unknown" ;
125+ break ;
126+ }
114127 ffPrintFormatString (key .chars , 0 , & options -> moduleArgs , FF_PRINT_TYPE_NO_CUSTOM_KEY , FF_DISK_NUM_FORMAT_ARGS , (FFformatarg []){
115128 {FF_FORMAT_ARG_TYPE_STRBUF , & usedPretty },
116129 {FF_FORMAT_ARG_TYPE_STRBUF , & totalPretty },
@@ -123,6 +136,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
123136 {FF_FORMAT_ARG_TYPE_STRBUF , & disk -> filesystem },
124137 {FF_FORMAT_ARG_TYPE_STRBUF , & disk -> name },
125138 {FF_FORMAT_ARG_TYPE_BOOL , & isReadOnly },
139+ {FF_FORMAT_ARG_TYPE_STRING , physicalType }
126140 });
127141 }
128142}
@@ -403,7 +417,7 @@ void ffGenerateDiskJson(FFDiskOptions* options, yyjson_mut_doc* doc, yyjson_mut_
403417 yyjson_mut_obj_add_strbuf (doc , obj , "mountpoint" , & item -> mountpoint );
404418 yyjson_mut_obj_add_strbuf (doc , obj , "mountFrom" , & item -> mountFrom );
405419 yyjson_mut_obj_add_strbuf (doc , obj , "name" , & item -> name );
406- yyjson_mut_val * typeArr = yyjson_mut_obj_add_arr (doc , obj , "type " );
420+ yyjson_mut_val * typeArr = yyjson_mut_obj_add_arr (doc , obj , "volumeType " );
407421 if (item -> type & FF_DISK_VOLUME_TYPE_REGULAR_BIT )
408422 yyjson_mut_arr_add_str (doc , typeArr , "Regular" );
409423 if (item -> type & FF_DISK_VOLUME_TYPE_EXTERNAL_BIT )
@@ -414,6 +428,19 @@ void ffGenerateDiskJson(FFDiskOptions* options, yyjson_mut_doc* doc, yyjson_mut_
414428 yyjson_mut_arr_add_str (doc , typeArr , "Hidden" );
415429 if (item -> type & FF_DISK_VOLUME_TYPE_READONLY_BIT )
416430 yyjson_mut_arr_add_str (doc , typeArr , "Read-only" );
431+
432+ switch (item -> physicalType )
433+ {
434+ case FF_DISK_PHYSICAL_TYPE_HDD :
435+ yyjson_mut_obj_add_str (doc , obj , "physicalType" , "HDD" );
436+ break ;
437+ case FF_DISK_PHYSICAL_TYPE_SSD :
438+ yyjson_mut_obj_add_str (doc , obj , "physicalType" , "SSD" );
439+ break ;
440+ default :
441+ yyjson_mut_obj_add_null (doc , obj , "physicalType" );
442+ break ;
443+ }
417444 }
418445
419446 FF_LIST_FOR_EACH (FFDisk , item , disks )
0 commit comments