fatfs: Fix undefined ssize member of FATFS struct

This commit is contained in:
Adam Múdry
2022-06-23 17:48:56 +02:00
committed by BOT
parent b0fa5c7c2d
commit 0fac7d1c02

View File

@@ -224,13 +224,17 @@ esp_err_t esp_vfs_fat_info(const char* base_path,
}
uint64_t total_sectors = ((uint64_t)(fs->n_fatent - 2)) * fs->csize;
uint64_t free_sectors = ((uint64_t)free_clusters) * fs->csize;
WORD sector_size = FF_MIN_SS; // 512
#if FF_MAX_SS != FF_MIN_SS
sector_size = fs->ssize;
#endif
// Assuming the total size is < 4GiB, should be true for SPI Flash
if (out_total_bytes != NULL) {
*out_total_bytes = total_sectors * fs->ssize;
*out_total_bytes = total_sectors * sector_size;
}
if (out_free_bytes != NULL) {
*out_free_bytes = free_sectors * fs->ssize;
*out_free_bytes = free_sectors * sector_size;
}
return ESP_OK;
}