Menu

full card ,directory cluster rewriting

robs18
2007-11-29
2013-04-24
  • robs18

    robs18 - 2007-11-29

    Hello

    I have something wrong with make new file when sd card is full ( or allmost full - fat_countFreeClusters report 1 cluster free).
    If memory was full and is created empty file (file_fopen) and ( directory cluster was fully used ) the new file desription make clear the lastdirectory cluster.  Cluster was reset and new empty file description was writed at beginning of the last directory claster ( not created new cluster).

    I found something ( but it was fast tested and now testing for formatted card)
    I function  : fat_allocClusterChain

                if(overflow){
                    bufa=part_getSect(fs->part,fat_getSectorAddressFatEntry(fs,lc),IOM_MODE_READWRITE);
                    fat_setNextClusterAddressWBuf(fs,lc,fat_giveEocMarker(fs),bufa);
                    Cache->LastCluster=lc;
                    part_relSect(fs->part,bufa);
                    fs->FreeClusterCount-=num_clusters-ncl;
                    return(num_clusters-ncl);
                }

     
    • robs18

      robs18 - 2007-11-29

      sorry but send not ended post :)

      i'm changing return values from (num_clusters-ncl) to (ncl) and there looks like there wasn't be rewriting last cluster.

      if(overflow){
      bufa=part_getSect(fs->part,fat_getSectorAddressFatEntry(fs,lc),IOM_MODE_READWRITE);
      fat_setNextClusterAddressWBuf(fs,lc,fat_giveEocMarker(fs),bufa);
      Cache->LastCluster=lc;
      part_relSect(fs->part,bufa);
      fs->FreeClusterCount-=num_clusters-ncl;
      return(ncl);
      }

      sory for my english but not good.

      robs

       

Log in to post a comment.