@@ -168,34 +168,30 @@ HRESULT FATFS_FS_Driver::GetSizeInfo(const VOLUME_ID *volume, int64_t *totalSize
168168{
169169 (void )totalSize;
170170
171- // FATFS *fsPtr = &fs;
172- // char buffer[3];
173- // DWORD freeClusters, freeSectors, totalSectors;
171+ FATFS *fsPtr = &fs;
172+ char buffer[3 ];
173+ DWORD freeClusters, freeSectors, totalSectors;
174174
175- // FATFS *fs = GetFatFsByVolumeId(volume, false);
175+ FATFS *fs = GetFatFsByVolumeId (volume, false );
176176
177177 FileSystemVolume *currentVolume = FileSystemVolumeList::FindVolume (volume->volumeId );
178178
179179 f_chdrive (currentVolume->m_rootName );
180180
181- // this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now
182- // // get free clusters
183- // f_getfree(buffer, &freeClusters, &fsPtr);
181+ // get free clusters
182+ f_getfree (buffer, &freeClusters, &fsPtr);
184183
185- // // Get total sectors and free sectors
186- // totalSectors = (fs.n_fatent - 2) * fs.csize;
187- // freeSectors = freeClusters * fs.csize;
184+ // Get total sectors and free sectors
185+ totalSectors = (fs.n_fatent - 2 ) * fs.csize ;
186+ freeSectors = freeClusters * fs.csize ;
188187
189- // #if FF_MAX_SS != FF_MIN_SS
190- // *totalSize = (int64_t)totalSectors * fs.ssize;
191- // *totalFreeSpace = (int64_t)freeSectors * fs.ssize;
192- // #else
193- // *totalSize = (int64_t)totalSectors * FF_MAX_SS;
194- // *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS;
195- // #endif
196-
197- *totalSize = -1 ;
198- *totalFreeSpace = -1 ;
188+ #if FF_MAX_SS != FF_MIN_SS
189+ *totalSize = (int64_t )totalSectors * fs.ssize ;
190+ *totalFreeSpace = (int64_t )freeSectors * fs.ssize ;
191+ #else
192+ *totalSize = (int64_t )totalSectors * FF_MAX_SS;
193+ *totalFreeSpace = (int64_t )freeSectors * FF_MAX_SS;
194+ #endif
199195
200196 return S_OK;
201197}
0 commit comments