userlibandfileserver/fileserver/sfat32/inc/sl_std.inl
branchRCL_3
changeset 19 4a8fed1c0ef6
parent 8 538db54a451d
child 22 2f92ad2dc5db
equal deleted inserted replaced
15:2d65c2f76d7b 19:4a8fed1c0ef6
    36     {
    36     {
    37     ASSERT(this != &aRhs);
    37     ASSERT(this != &aRhs);
    38     return (iCluster == aRhs.iCluster && iPos == aRhs.iPos);
    38     return (iCluster == aRhs.iCluster && iPos == aRhs.iPos);
    39     }
    39     }
    40 
    40 
       
    41 /** set "end of directory" indicator*/
       
    42 void TEntryPos::SetEndOfDir()
       
    43     {
       
    44     iCluster = EOF_32Bit;
       
    45     }
       
    46 
    41 
    47 
    42 //---------------------------------------------------------------------------------------------------------------------------------
    48 //---------------------------------------------------------------------------------------------------------------------------------
    43 // class CFatMountCB
    49 // class CFatMountCB
       
    50 
       
    51 
       
    52 /** @return ETrue if the value of aClusterNo is valid*/
       
    53 inline TBool CFatMountCB::ClusterNumberValid(TUint32 aClusterNo) const 
       
    54     {   
       
    55     ASSERT(ConsistentState()); 
       
    56             
       
    57     if(!aClusterNo && !Is32BitFat())
       
    58         return ETrue; //-- root dir. cluster for FAT12/16
       
    59 
       
    60     return (aClusterNo >= KFatFirstSearchCluster) && (aClusterNo < UsableClusters()+KFatFirstSearchCluster); 
       
    61     }
       
    62 
    44 
    63 
    45 inline TInt CFatMountCB::RootDirectorySector() const
    64 inline TInt CFatMountCB::RootDirectorySector() const
    46     {return iVolParam.RootDirectorySector();}
    65     {return iVolParam.RootDirectorySector();}
    47 
    66 
    48 inline TUint CFatMountCB::RootDirEnd() const
    67 inline TUint CFatMountCB::RootDirEnd() const
   157 TBool CFatMountCB::IsBadCluster(TInt aCluster) const
   176 TBool CFatMountCB::IsBadCluster(TInt aCluster) const
   158 	{return Is32BitFat() ? aCluster==0xFFFFFF7 : Is16BitFat() ? aCluster==0xFFF7 : aCluster==0xFF7;}
   177 	{return Is32BitFat() ? aCluster==0xFFFFFF7 : Is16BitFat() ? aCluster==0xFFF7 : aCluster==0xFF7;}
   159 
   178 
   160 /**
   179 /**
   161 Returns whether the current mount is running as rugged Fat or not, this is held in the file system object
   180 Returns whether the current mount is running as rugged Fat or not, this is held in the file system object
   162 @return Is rugged fat flag
   181     @return ETrue if this is Rugged FAT
   163 */
   182 */
   164 TBool CFatMountCB::IsRuggedFSys() const
   183 TBool CFatMountCB::IsRuggedFSys() const
   165 	{return Drive().IsRugged();}
   184 	{
       
   185     return Drive().IsRugged();
       
   186     }
   166 
   187 
   167 /**
   188 /**
   168 Sets the rugged flag in the file system object
   189 Sets the rugged flag in the file system object
   169 @param Flag to set or clear the rugged flag
   190 @param Flag to set or clear the rugged flag
   170 */
   191 */
   171 void CFatMountCB::SetRuggedFSys(TBool aVal)
   192 void CFatMountCB::SetRuggedFSys(TBool aVal)
   172 	{Drive().SetRugged(aVal);}
   193 	{
       
   194     Drive().SetRugged(aVal);
       
   195     }
       
   196 
       
   197 /**
       
   198     @return Log2(Meida atomic write granularity).
       
   199     This is mostly to be used in Rugged FAT mode, see IsRuggedFSys(). For Rugged FAT the media shall support atomic writes.
       
   200     By default this is the sector (512 bytes)
       
   201 
       
   202 */
       
   203 TUint32 CFatMountCB::AtomicWriteGranularityLog2() const
       
   204     {
       
   205     return KDefSectorSzLog2;    
       
   206     }
       
   207 
   173 
   208 
   174 /** @return the usable clusters count for a volume */
   209 /** @return the usable clusters count for a volume */
   175 TUint32 CFatMountCB::UsableClusters() const
   210 TUint32 CFatMountCB::UsableClusters() const
   176 	{return(iUsableClusters);}
   211 	{return(iUsableClusters);}
   177 
   212 
   336     ASSERT(iFatEocCode);
   371     ASSERT(iFatEocCode);
   337     aCluster = iFatEocCode+7;
   372     aCluster = iFatEocCode+7;
   338 	}
   373 	}
   339 
   374 
   340 
   375 
       
   376 CFatMountCB::TEntrySetChunkInfo::TEntrySetChunkInfo()
       
   377                                 :iNumEntries(KMaxTUint) 
       
   378     {
       
   379     }
       
   380 
       
   381 
       
   382 TBool CFatMountCB::TEntrySetChunkInfo::operator==(const TEntrySetChunkInfo& aRhs)
       
   383     {
       
   384     ASSERT(&aRhs != this);
       
   385     return (iNumEntries == aRhs.iNumEntries) && (iEntryPos==aRhs.iEntryPos);
       
   386     }
       
   387 
       
   388 
       
   389 
       
   390 
   341 //-------  debug methods
   391 //-------  debug methods
   342 #ifdef  _DEBUG
   392 #ifdef  _DEBUG
   343 /**
   393 /**
   344 Debug function indicates whether write fails are active or not, for test
   394 Debug function indicates whether write fails are active or not, for test
   345 @return ETrue if write fails on or not
   395 @return ETrue if write fails on or not