system/drivers/fatfs/cluster.c
/*
 * FreeClusters();
 *
 * Modify so that it takes a node as a parameter,  only free upto official
 * filesize cluster.  But remember we may not be freeing clusters starting
 * from the beginning of a file.
 */


Modify so that it takes a node as a parameter,  only free upto official
filesize cluster.  But remember we may not be freeing clusters starting
from the beginning of a file.
Modify so that it takes a node as a parameter only free upto official filesize cluster . But remember we may not be freeing clusters starting from the beginning of a file .
void FreeClusters(uint32_t first_cluster) {
  uint32_t cluster, next_cluster;
  cluster = first_cluster;
  while (cluster >= CLUSTER_ALLOC_MIN && cluster <= CLUSTER_ALLOC_MAX) {
    if (ReadFATEntry(cluster, &next_cluster) != 0)
      return;
    if (WriteFATEntry(cluster, CLUSTER_FREE) != 0)
      return;
    cluster = next_cluster;
  }
  FlushFSInfo();
}
void FreeClusters ( uint32_t first_cluster ) { uint32_t cluster , next_cluster ; cluster = first_cluster ; while ( cluster >= CLUSTER_ALLOC_MIN && cluster <= CLUSTER_ALLOC_MAX ) { if ( ReadFATEntry ( cluster , & next_cluster ) != 0 ) return ; if ( WriteFATEntry ( cluster , CLUSTER_FREE ) != 0 ) return ; cluster = next_cluster ; } FlushFSInfo ( ) ; }
FreeClusters();
FreeClusters () ;
//		if (fsb.fsinfo_valid)
 //			fsb.fsi.free_cnt ++;
