@@ -155,11 +155,11 @@ static void detectName(FFDisk* disk, const FFstrbuf* device)
155155static void detectType (FF_MAYBE_UNUSED const FFlist * devices , FFDisk * currentDisk , FF_MAYBE_UNUSED const char * options )
156156{
157157 if (ffStrbufEqualS (& currentDisk -> mountpoint , "/" ) || ffStrbufEqualS (& currentDisk -> mountpoint , "/storage/emulated" ))
158- currentDisk -> type = FF_DISK_TYPE_REGULAR_BIT ;
158+ currentDisk -> type = FF_DISK_VOLUME_TYPE_REGULAR_BIT ;
159159 else if (ffStrbufStartsWithS (& currentDisk -> mountpoint , "/mnt/media_rw/" ))
160- currentDisk -> type = FF_DISK_TYPE_EXTERNAL_BIT ;
160+ currentDisk -> type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT ;
161161 else
162- currentDisk -> type = FF_DISK_TYPE_HIDDEN_BIT ;
162+ currentDisk -> type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT ;
163163}
164164
165165#else
@@ -191,13 +191,13 @@ static bool isSubvolume(const FFlist* devices)
191191static void detectType (const FFlist * devices , FFDisk * currentDisk , const char * options )
192192{
193193 if (isSubvolume (devices ))
194- currentDisk -> type = FF_DISK_TYPE_SUBVOLUME_BIT ;
194+ currentDisk -> type = FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT ;
195195 else if (strstr (options , "nosuid" ) != NULL || strstr (options , "nodev" ) != NULL )
196- currentDisk -> type = FF_DISK_TYPE_EXTERNAL_BIT ;
196+ currentDisk -> type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT ;
197197 else if (ffStrbufStartsWithS (& currentDisk -> mountpoint , "/boot" ) || ffStrbufStartsWithS (& currentDisk -> mountpoint , "/efi" ))
198- currentDisk -> type = FF_DISK_TYPE_HIDDEN_BIT ;
198+ currentDisk -> type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT ;
199199 else
200- currentDisk -> type = FF_DISK_TYPE_REGULAR_BIT ;
200+ currentDisk -> type = FF_DISK_VOLUME_TYPE_REGULAR_BIT ;
201201}
202202
203203#endif
@@ -209,10 +209,15 @@ static void detectStats(FFDisk* disk)
209209 memset (& fs , 0 , sizeof (struct statvfs )); //Set all values to 0, so our values get initialized to 0 too
210210
211211 disk -> bytesTotal = fs .f_blocks * fs .f_frsize ;
212- disk -> bytesUsed = disk -> bytesTotal - (fs .f_bfree * fs .f_frsize );
212+ disk -> bytesFree = fs .f_bfree * fs .f_frsize ;
213+ disk -> bytesAvailable = fs .f_bavail * fs .f_frsize ;
214+ disk -> bytesUsed = 0 ; // To be filled in ./disk.c
213215
214216 disk -> filesTotal = (uint32_t ) fs .f_files ;
215217 disk -> filesUsed = (uint32_t ) (disk -> filesTotal - fs .f_ffree );
218+
219+ if (fs .f_flag & ST_RDONLY )
220+ disk -> type |= FF_DISK_VOLUME_TYPE_READONLY_BIT ;
216221}
217222
218223const char * ffDetectDisksImpl (FFlist * disks )
0 commit comments