userlibandfileserver/fileserver/sfat32/sl_mnt.cpp
changeset 189 a5496987b1da
parent 176 af6ec97d9189
child 199 189ece41fa29
equal deleted inserted replaced
177:a232af6b0b1f 189:a5496987b1da
   611 /**
   611 /**
   612 @return ETrue if "VolumeClean" flag is supported i.e. this is not FAT12
   612 @return ETrue if "VolumeClean" flag is supported i.e. this is not FAT12
   613 */
   613 */
   614 TBool CFatMountCB::VolCleanFlagSupported() const
   614 TBool CFatMountCB::VolCleanFlagSupported() const
   615     {
   615     {
   616         const TFatType fatType=FatType();
   616     const TFatType fatType=FatType();
   617 
   617 
   618         ASSERT(fatType == EFat12 || fatType == EFat16 || fatType == EFat32);
   618     ASSERT(fatType == EFat12 || fatType == EFat16 || fatType == EFat32);
   619         return (fatType != EFat12);
   619     return (fatType != EFat12);
       
   620     }
       
   621 
       
   622 
       
   623 //-----------------------------------------------------------------------------------------
       
   624 /**
       
   625     @return Volume size in bytes according to the number of usable clusters.
       
   626     This approach is not applicable to RAM drive, because its size isn't fixed and can be adjusted by the system.
       
   627 */
       
   628 TUint64 CFatMountCB::VolumeSizeInBytes() const
       
   629     {
       
   630     ASSERT(ConsistentState());
       
   631     ASSERT(!iRamDrive);
       
   632     return ((TUint64)UsableClusters()) << ClusterSizeLog2();
   620     }
   633     }
   621 
   634 
   622 //-----------------------------------------------------------------------------------------
   635 //-----------------------------------------------------------------------------------------
   623 
   636 
   624 
   637 
   679 
   692 
   680 #endif
   693 #endif
   681 
   694 
   682 
   695 
   683     const TUint32 freeClusters = FAT().NumberOfFreeClusters(bSyncOp);
   696     const TUint32 freeClusters = FAT().NumberOfFreeClusters(bSyncOp);
   684 
   697     aVolume.iFree = (TInt64)freeClusters << ClusterSizeLog2();
   685     __PRINT1(_L("CFatMountCB::VolumeL() free clusters:%d"), freeClusters);
   698     __PRINT1(_L("CFatMountCB::VolumeL() free clusters:%d"), freeClusters);
   686 
   699 
   687     aVolume.iFree = (TInt64)freeClusters << ClusterSizeLog2();
   700 
   688 
   701     if(drvInfo.iType==EMediaRam)
   689     if (drvInfo.iType==EMediaRam)
   702         {//-- a special case. RAM drive size is variable and adjustable. It should be calculated from aVolume.iFree and CMountCB::iFree
       
   703         ASSERT(iRamDrive);
   690         aVolume.iSize=aVolume.iFree+iSize;
   704         aVolume.iSize=aVolume.iFree+iSize;
   691 
   705         aVolume.iSize-=ClusterBasePosition(); // Allow for bytes used by FAT etc
   692     aVolume.iSize-=ClusterBasePosition(); // Allow for bytes used by FAT etc
   706         aVolume.iSize=(aVolume.iSize >> ClusterSizeLog2()) << ClusterSizeLog2();  //-- round down to cluster size
   693     aVolume.iSize=(aVolume.iSize >> ClusterSizeLog2()) << ClusterSizeLog2();  //-- round down to cluster size
   707         }
       
   708     else
       
   709         {//-- normal case; the volume size is determined by amount of usable clusters
       
   710         aVolume.iSize = VolumeSizeInBytes();
       
   711         }
   694 
   712 
   695     }
   713     }
   696 
   714 
   697 
   715 
   698 //-----------------------------------------------------------------------------------------
   716 //-----------------------------------------------------------------------------------------