@@ -100,6 +100,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
100100
101101 bool isExternal = !!(disk -> type & FF_DISK_VOLUME_TYPE_EXTERNAL_BIT );
102102 bool isHidden = !!(disk -> type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT );
103+ bool isReadOnly = !!(disk -> type & FF_DISK_VOLUME_TYPE_READONLY_BIT );
103104 ffPrintFormatString (key .chars , 0 , & options -> moduleArgs , FF_PRINT_TYPE_NO_CUSTOM_KEY , FF_DISK_NUM_FORMAT_ARGS , (FFformatarg []){
104105 {FF_FORMAT_ARG_TYPE_STRBUF , & usedPretty },
105106 {FF_FORMAT_ARG_TYPE_STRBUF , & totalPretty },
@@ -110,7 +111,8 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
110111 {FF_FORMAT_ARG_TYPE_BOOL , & isExternal },
111112 {FF_FORMAT_ARG_TYPE_BOOL , & isHidden },
112113 {FF_FORMAT_ARG_TYPE_STRBUF , & disk -> filesystem },
113- {FF_FORMAT_ARG_TYPE_STRBUF , & disk -> name }
114+ {FF_FORMAT_ARG_TYPE_STRBUF , & disk -> name },
115+ {FF_FORMAT_ARG_TYPE_BOOL , & isReadOnly },
114116 });
115117 }
116118}
@@ -156,7 +158,7 @@ static void printAutodetected(FFDiskOptions* options, const FFlist* disks)
156158{
157159 FF_LIST_FOR_EACH (FFDisk , disk , * disks )
158160 {
159- if (!( disk -> type & options -> showTypes ) )
161+ if (disk -> type & ~ options -> showTypes )
160162 continue ;
161163
162164 printDisk (options , disk );
@@ -194,7 +196,7 @@ void ffInitDiskOptions(FFDiskOptions* options)
194196 ffOptionInitModuleArg (& options -> moduleArgs );
195197
196198 ffStrbufInit (& options -> folders );
197- options -> showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT ;
199+ options -> showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT | FF_DISK_VOLUME_TYPE_READONLY_BIT ;
198200 options -> calcType = FF_DISK_CALC_TYPE_FREE ;
199201}
200202
@@ -247,6 +249,15 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
247249 return true;
248250 }
249251
252+ if (ffStrEqualsIgnCase (subKey , "show-readonly" ))
253+ {
254+ if (ffOptionParseBoolean (value ))
255+ options -> showTypes |= FF_DISK_VOLUME_TYPE_READONLY_BIT ;
256+ else
257+ options -> showTypes &= ~FF_DISK_VOLUME_TYPE_READONLY_BIT ;
258+ return true;
259+ }
260+
250261 if (ffStrEqualsIgnCase (subKey , "show-unknown" ))
251262 {
252263 if (ffOptionParseBoolean (value ))
@@ -319,6 +330,15 @@ void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module)
319330 continue ;
320331 }
321332
333+ if (ffStrEqualsIgnCase (key , "showReadOnly" ))
334+ {
335+ if (yyjson_get_bool (val ))
336+ options -> showTypes |= FF_DISK_VOLUME_TYPE_READONLY_BIT ;
337+ else
338+ options -> showTypes &= ~FF_DISK_VOLUME_TYPE_READONLY_BIT ;
339+ continue ;
340+ }
341+
322342 if (ffStrEqualsIgnCase (key , "showUnknown" ))
323343 {
324344 if (yyjson_get_bool (val ))
0 commit comments