mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-29 21:24:18 +01:00
Use CLUSTER_ERROR when an error occurs with the FAT, not CLUSTER_FREE
This commit is contained in:
parent
8c319ec76a
commit
def250bd28
@ -35,7 +35,7 @@
|
|||||||
2006-10-01 - Chishm
|
2006-10-01 - Chishm
|
||||||
* Added _FAT_fat_linkFreeClusterCleared to clear a cluster when it is allocated
|
* Added _FAT_fat_linkFreeClusterCleared to clear a cluster when it is allocated
|
||||||
|
|
||||||
2007-09-01 - Chishm
|
2007-10-25 - Chishm
|
||||||
* Use CLUSTER_ERROR when an error occurs with the FAT, not CLUSTER_FREE
|
* Use CLUSTER_ERROR when an error occurs with the FAT, not CLUSTER_FREE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -332,3 +332,21 @@ u32 _FAT_fat_lastCluster (PARTITION* partition, u32 cluster) {
|
|||||||
}
|
}
|
||||||
return cluster;
|
return cluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------
|
||||||
|
_FAT_fat_freeClusterCount
|
||||||
|
Return the number of free clusters available
|
||||||
|
-----------------------------------------------------------------*/
|
||||||
|
u32 _FAT_fat_freeClusterCount (PARTITION* partition) {
|
||||||
|
u32 count = 0;
|
||||||
|
u32 curCluster;
|
||||||
|
|
||||||
|
for (curCluster = CLUSTER_FIRST; curCluster <= partition->fat.lastCluster; curCluster++) {
|
||||||
|
if (_FAT_fat_nextCluster(partition, curCluster) == CLUSTER_FREE) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
2006-10-01 - Chishm
|
2006-10-01 - Chishm
|
||||||
* Added _FAT_fat_linkFreeClusterCleared to clear a cluster when it is allocated
|
* Added _FAT_fat_linkFreeClusterCleared to clear a cluster when it is allocated
|
||||||
|
|
||||||
2007-09-01 - Chishm
|
2007-10-25 - Chishm
|
||||||
* Use CLUSTER_ERROR when an error occurs with the FAT, not CLUSTER_FREE
|
* Use CLUSTER_ERROR when an error occurs with the FAT, not CLUSTER_FREE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -61,6 +61,8 @@ bool _FAT_fat_clearLinks (PARTITION* partition, u32 cluster);
|
|||||||
|
|
||||||
u32 _FAT_fat_lastCluster (PARTITION* partition, u32 cluster);
|
u32 _FAT_fat_lastCluster (PARTITION* partition, u32 cluster);
|
||||||
|
|
||||||
|
u32 _FAT_fat_freeClusterCount (PARTITION* partition);
|
||||||
|
|
||||||
static inline u32 _FAT_fat_clusterToSector (PARTITION* partition, u32 cluster) {
|
static inline u32 _FAT_fat_clusterToSector (PARTITION* partition, u32 cluster) {
|
||||||
return (cluster >= CLUSTER_FIRST) ? ((cluster - CLUSTER_FIRST) * partition->sectorsPerCluster) + partition->dataStart : partition->rootDirStart;
|
return (cluster >= CLUSTER_FIRST) ? ((cluster - CLUSTER_FIRST) * partition->sectorsPerCluster) + partition->dataStart : partition->rootDirStart;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user