directory cluster pre-allocation problem
Brought to you by:
flecxie,
lennartyseboodt
When directory cluster preallocation is enabled (CLUSTER_PREALLOC_DIRECTORY > 0), the first allocated sector does not get cleared. In the dir_addCluster() function, the preincrement for logicalc should be changed to a postincrement, as logicalc initially points to the first allocated cluster.
if(CLUSTER_PREALLOC_DIRECTORY){
if(fat_allocClusterChain(fs,&cache,CLUSTER_PREALLOC_DIRECTORY)){
return(-1);
}
logicalc = fat_DiscToLogicCluster(fs,firstCluster,lastc);
while(!fat_LogicToDiscCluster(fs,&cache,logicalc++)){ //Fix for cluster pre-allocation problem
fs_clearCluster(fs,cache.DiscCluster);
}
}else{
fs_clearCluster(fs,lastc);
}