Skip to content

Commit 4472b99

Browse files
committed
Revert changes
It is a little more complicated and should happen in a seperate PR.
1 parent 2913e9e commit 4472b99

File tree

2 files changed

+40
-32
lines changed

2 files changed

+40
-32
lines changed

targets/ChibiOS/_FatFs/fatfs_FS_Driver.cpp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,30 +168,34 @@ 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-
// get free clusters
182-
f_getfree(buffer, &freeClusters, &fsPtr);
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);
183184

184-
// Get total sectors and free sectors
185-
totalSectors = (fs.n_fatent - 2) * fs.csize;
186-
freeSectors = freeClusters * fs.csize;
185+
// // Get total sectors and free sectors
186+
// totalSectors = (fs.n_fatent - 2) * fs.csize;
187+
// freeSectors = freeClusters * fs.csize;
187188

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
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;
195199

196200
return S_OK;
197201
}

targets/ESP32/_FatFs/fatfs_FS_Driver.cpp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,30 +83,34 @@ HRESULT FATFS_FS_Driver::GetSizeInfo(const VOLUME_ID *volume, int64_t *totalSize
8383
{
8484
(void)totalSize;
8585

86-
FATFS *fsPtr = &fs;
87-
char buffer[3];
88-
DWORD freeClusters, freeSectors, totalSectors;
86+
// FATFS *fsPtr = &fs;
87+
// char buffer[3];
88+
// DWORD freeClusters, freeSectors, totalSectors;
8989

90-
FATFS *fs = GetFatFsByVolumeId(volume, false);
90+
// FATFS *fs = GetFatFsByVolumeId(volume, false);
9191

9292
FileSystemVolume *currentVolume = FileSystemVolumeList::FindVolume(volume->volumeId);
9393

9494
f_chdrive(currentVolume->m_rootName);
9595

96-
// get free clusters
97-
f_getfree(buffer, &freeClusters, &fsPtr);
96+
// this call is prone to take a long time, thus hitting the watchdog, therefore we are skipping this for now
97+
// // get free clusters
98+
// f_getfree(buffer, &freeClusters, &fsPtr);
9899

99-
// Get total sectors and free sectors
100-
totalSectors = (fs.n_fatent - 2) * fs.csize;
101-
freeSectors = freeClusters * fs.csize;
100+
// // Get total sectors and free sectors
101+
// totalSectors = (fs.n_fatent - 2) * fs.csize;
102+
// freeSectors = freeClusters * fs.csize;
102103

103-
#if FF_MAX_SS != FF_MIN_SS
104-
*totalSize = (int64_t)totalSectors * fs.ssize;
105-
*totalFreeSpace = (int64_t)freeSectors * fs.ssize;
106-
#else
107-
*totalSize = (int64_t)totalSectors * FF_MAX_SS;
108-
*totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS;
109-
#endif
104+
// #if FF_MAX_SS != FF_MIN_SS
105+
// *totalSize = (int64_t)totalSectors * fs.ssize;
106+
// *totalFreeSpace = (int64_t)freeSectors * fs.ssize;
107+
// #else
108+
// *totalSize = (int64_t)totalSectors * FF_MAX_SS;
109+
// *totalFreeSpace = (int64_t)freeSectors * FF_MAX_SS;
110+
// #endif
111+
112+
*totalSize = -1;
113+
*totalFreeSpace = -1;
110114

111115
return S_OK;
112116
}

0 commit comments

Comments
 (0)