FreeRTOS + FAT FF_CountFreeClusters() Function Implementation

Hello Hein Tibosch Recently, I am studying the FreeRTOS + FAT source code using FreeRTOS-Plus-FAT-160919a-MIT.zip. I have some questions about the implementation of uint32_t FF_CountFreeClusters( FF_IOManager_t *pxIOManager, FF_Error_t *pxError ) need your advice. Question 1: I Think for( ulIndex = 0; ulIndex < pxIOManager->xPartition.ulSectorsPerFAT; ulIndex++ ) should be changed to for( ulIndex = 0; ulIndex < pxIOManager->xPartition.ulSectorsPerFAT * pxIOManager->xPartition.ucBlkFactor; ulIndex++ ) for the case that pxIOManager->xPartition.usBlkSize > pxIOManager->usSectorSize Question 2: pxIOManager->xPartition.ulNumClusters don’t include the first reserved 2 fat entries, so I think if( ClusterNum > pxIOManager->xPartition.ulNumClusters ) should be changed to if( ClusterNum > pxIOManager->xPartition.ulNumClusters + 2) because the code also check the first reserved 2 fat entries in the FAT Area. and count these 2 fat entries into ClusterNum. Question 3: ~~~ /* ulFreeClusters is -2 because the first 2 fat entries in the table are reserved. */ if( ulFreeClusters > pxIOManager->xPartition.ulNumClusters ) { ulFreeClusters = pxIOManager->xPartition.ulNumClusters; } ~~~ The values of the first 2 fat entries aren’t zero, So I don’t think this if condition could be TRUE in some cases.