diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/inc/sl_std.inl --- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl Thu Jan 07 13:38:45 2010 +0200 @@ -20,21 +20,6 @@ -TBool IsPowerOf2(TUint32 aVal) - { - if (aVal==0) - return EFalse; - - return !(aVal & (aVal-1)); - } - -TUint32 Pow2(TUint32 aVal) - { - //ASSERT(aVal<32); - return 1 << aVal; - } - - //--------------------------------------------------------------------------------------------------------------------------------- // class TEntryPos TUint32 TEntryPos::Cluster() const @@ -253,9 +238,9 @@ } -TFatDriveInterface& CFatMountCB::DriveInterface() const +TDriveInterface& CFatMountCB::DriveInterface() const { - return (TFatDriveInterface&)iDriverInterface; + return (TDriveInterface&)iDriverInterface; } const TFatConfig& CFatMountCB::FatConfig() const @@ -325,6 +310,34 @@ } +/** + Checks for "EOC" for all Fat types + @param aCluster FAT table entry (cluster number) to check + @return ETrue if aCluster is a EOC for the FAT type being used by CFatMountCB +*/ +TBool CFatMountCB::IsEndOfClusterCh(TInt aCluster) const + { + ASSERT(iFatEocCode); + + if((TUint32)aCluster >= iFatEocCode) + return ETrue; + + ASSERT((TUint32)aCluster <= iFatEocCode+7); + + return EFalse; + } + +/** + Sets "End of Cluster Chain" value in aCluster depending on the FAT type. + @param aCluster cluster to set to end of chain marker +*/ +void CFatMountCB::SetEndOfClusterCh(TInt &aCluster) const + { + ASSERT(iFatEocCode); + aCluster = iFatEocCode+7; + } + + //------- debug methods #ifdef _DEBUG /** @@ -369,6 +382,9 @@ #endif + + + //--------------------------------------------------------------------------------------------------------------------------------- // class CFatFormatCB @@ -447,17 +463,6 @@ return iFreeClusters; } -TBool CFatTable::IsEof32Bit(TInt aCluster) const - {return(aCluster>=(TInt)0x0FFFFFF8 && aCluster<=(TInt)0x0FFFFFFF);} - -TBool CFatTable::IsEof16Bit(TInt aCluster) const - {return(aCluster>=0xFFF8 && aCluster<=0xFFFF);} - -TBool CFatTable::IsEof12Bit(TInt aCluster) const - {return(aCluster>=0xFF8 && aCluster<=0xFFF);} - -TInt CFatTable::SectorSizeLog2() const - {return(iOwner->SectorSizeLog2());} //--------------------------------------------------------------------------------------------------------------------------------- @@ -483,6 +488,23 @@ /** + Checks for "EOC" for all Fat types + @param aCluster FAT table entry (cluster number) to check + @return ETrue if aCluster is a EOC for the FAT type being used by CFatMountCB that owns the CFatTable +*/ +inline TBool CFatTable::IsEndOfClusterCh(TUint32 aCluster) const + { + ASSERT(iFatEocCode); + + if(aCluster >= iFatEocCode) + return ETrue; + + ASSERT((TUint32)aCluster <= iFatEocCode+7); + return EFalse; + } + + +/** @return Maximal number of addresable FAT entries. This value is taken from the owning mount */ inline TUint32 CFatTable::MaxEntries() const @@ -492,8 +514,8 @@ } -// class TFatDriveInterface -TBool TFatDriveInterface::NotifyUser() const +// class TDriveInterface +TBool TDriveInterface::NotifyUser() const {return(iMount->GetNotifyUser());}