system/drivers/fatfs/cluster.c
/*
 * AppendCluster();
 *
 * Clearing the directory cluster may fail, but we carry on regardless
 *
 */


Clearing the directory cluster may fail, but we carry on regardless
Clearing the directory cluster may fail but we carry on regardless
int AppendCluster(struct FatNode *node, uint32_t *r_cluster) {
  uint32_t last_cluster;
  uint32_t cluster;
  if (FindLastCluster(node, &last_cluster) == 0) {
    if (FindFreeCluster(&cluster) == 0) {
      if (GetFirstCluster(&node->dirent) == CLUSTER_EOC) {
        SetFirstCluster(&node->dirent, cluster);
        FlushDirent(node);
      } else {
        WriteFATEntry(last_cluster, cluster);
      }
      *r_cluster = cluster;
      return 0;
    }
  }
  return -1;
}
int AppendCluster ( struct FatNode * node , uint32_t * r_cluster ) { uint32_t last_cluster ; uint32_t cluster ; if ( FindLastCluster ( node , & last_cluster ) == 0 ) { if ( FindFreeCluster ( & cluster ) == 0 ) { if ( GetFirstCluster ( & node -> dirent ) == CLUSTER_EOC ) { SetFirstCluster ( & node -> dirent , cluster ) ; FlushDirent ( node ) ; } else { WriteFATEntry ( last_cluster , cluster ) ; } * r_cluster = cluster ; return 0 ; } } return -1 ; }
AppendCluster();
AppendCluster () ;