@@ -215,7 +215,7 @@ static bool isRemovable(FFDisk* currentDisk)
215215 return ffReadFileData (sysBlockVolume , 1 , & removableChar ) > 0 && removableChar == '1' ;
216216}
217217
218- static void detectType (const FFlist * disks , FFDisk * currentDisk )
218+ static void detectType (const FFlist * disks , FFDisk * currentDisk , struct mntent * device )
219219{
220220 if (ffStrbufStartsWithS (& currentDisk -> mountpoint , "/boot" ) || ffStrbufStartsWithS (& currentDisk -> mountpoint , "/efi" ))
221221 currentDisk -> type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT ;
@@ -225,6 +225,8 @@ static void detectType(const FFlist* disks, FFDisk* currentDisk)
225225 currentDisk -> type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT ;
226226 else
227227 currentDisk -> type = FF_DISK_VOLUME_TYPE_REGULAR_BIT ;
228+ if (hasmntopt (device , MNTOPT_RO ))
229+ currentDisk -> type |= FF_DISK_VOLUME_TYPE_READONLY_BIT ;
228230}
229231
230232#endif
@@ -251,9 +253,6 @@ static void detectStats(FFDisk* disk)
251253 disk -> filesTotal = disk -> filesUsed = 0 ;
252254 }
253255
254- if (fs .f_flag & ST_RDONLY )
255- disk -> type |= FF_DISK_VOLUME_TYPE_READONLY_BIT ;
256-
257256 disk -> createTime = 0 ;
258257 #ifdef FF_HAVE_STATX
259258 struct statx stx ;
@@ -298,7 +297,7 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
298297 detectName (disk ); // Also detects external devices
299298
300299 //detect type
301- detectType (disks , disk );
300+ detectType (disks , disk , device );
302301
303302 //Detects stats
304303 detectStats (disk );
0 commit comments