userlibandfileserver/fileserver/sfat/inc/sl_std.h
changeset 15 4122176ea935
parent 0 a41df078684a
equal deleted inserted replaced
0:a41df078684a 15:4122176ea935
    18 /**
    18 /**
    19  @file
    19  @file
    20  @internalTechnology
    20  @internalTechnology
    21 */
    21 */
    22 
    22 
       
    23 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    24 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    25 //!!
       
    26 //!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
       
    27 //!!
       
    28 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    29 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    30 
       
    31 
    23 #ifndef SL_STD_H
    32 #ifndef SL_STD_H
    24 #define SL_STD_H
    33 #define SL_STD_H
    25 
    34 
    26 //
    35 //
    27 // #define _DEBUG_RELEASE
    36 // #define _DEBUG_RELEASE
    79 
    88 
    80 public:
    89 public:
    81 
    90 
    82     //-- public interface to the local drive. Provides media driver's error handling (critical and non-critical user notifiers)
    91     //-- public interface to the local drive. Provides media driver's error handling (critical and non-critical user notifiers)
    83     //-- and thread-safety if required.
    92     //-- and thread-safety if required.
    84 	TInt ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const;
    93     TInt ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const;
    85 	TInt ReadNonCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
    94     TInt ReadNonCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
    86     TInt ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
    95     TInt ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const;
    87 	
    96     
    88     TInt WriteCritical(TInt64 aPos,const TDesC8& aSrc);
    97     TInt WriteCritical(TInt64 aPos,const TDesC8& aSrc);
    89     TInt WriteNonCritical(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset);
    98     TInt WriteNonCritical(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset);
    90 	
    99     
    91     TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
   100     TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
    92 
   101 
    93     //-- lock the mutex guarding CProxyDrive interface in order to be sure that no other thread can access it.
   102     //-- lock the mutex guarding CProxyDrive interface in order to be sure that no other thread can access it.
    94     //-- The thread that calls this method may be suspended until another signals the mutex, i.e. leaves the critical section.
   103     //-- The thread that calls this method may be suspended until another signals the mutex, i.e. leaves the critical section.
    95     inline void AcquireLock() const {} //-- dummy
   104     inline void AcquireLock() const {} //-- dummy
   112     TInt UnlockAndReMount() const;
   121     TInt UnlockAndReMount() const;
   113     TBool IsDriveWriteProtected() const;
   122     TBool IsDriveWriteProtected() const;
   114     TBool IsRecoverableRemount() const;
   123     TBool IsRecoverableRemount() const;
   115 
   124 
   116 private:
   125 private:
   117 	
   126     
   118 	/** 
   127     /** 
   119         An internal class that represents a thread-safe wrapper around raw interface to the CProxyDrive 
   128         An internal class that represents a thread-safe wrapper around raw interface to the CProxyDrive 
   120         and restricts access to it.
   129         and restricts access to it.
   121     */
   130     */
   122     class XProxyDriveWrapper
   131     class XProxyDriveWrapper
   123         {
   132         {
   156     Class providing FAT table interface and basic functionality.
   165     Class providing FAT table interface and basic functionality.
   157 */  
   166 */  
   158 class CFatTable : public CBase
   167 class CFatTable : public CBase
   159     {
   168     {
   160 public:
   169 public:
   161 	static CFatTable* NewL(CFatMountCB& aOwner, const TLocalDriveCaps& aLocDrvCaps);
   170     static CFatTable* NewL(CFatMountCB& aOwner, const TLocalDriveCaps& aLocDrvCaps);
   162 
   171 
   163     virtual ~CFatTable();
   172     virtual ~CFatTable();
   164 
   173 
   165 	/** Empty and deallocate the cache*/
   174     /** Empty and deallocate the cache*/
   166 	virtual void Dismount(TBool /*aDiscardDirtyData*/) {}
   175     virtual void Dismount(TBool /*aDiscardDirtyData*/) {}
   167     
   176     
   168 	/** Flush data cahed data to the media */
   177     /** Flush data cahed data to the media */
   169 	virtual void FlushL() {};
   178     virtual void FlushL() {};
   170 	
   179     
   171     /**
   180     /**
   172     Invalidate specified region of the FAT cache
   181     Invalidate specified region of the FAT cache
   173     Depending of cache type this may just mark part of the cache invalid with reading on demand later
   182     Depending of cache type this may just mark part of the cache invalid with reading on demand later
   174     or re-read whole cache from the media.
   183     or re-read whole cache from the media.
   175 
   184 
   176     @param aPos absolute media position where the region being invalidated starts.
   185     @param aPos absolute media position where the region being invalidated starts.
   177     @param aLength length in bytes of region to invalidate / refresh
   186     @param aLength length in bytes of region to invalidate / refresh
   178     */
   187     */
   179 	virtual void InvalidateCacheL(TInt64 /*aPos*/,TUint32 /*aLength*/) {};
   188     virtual void InvalidateCacheL(TInt64 /*aPos*/,TUint32 /*aLength*/) {};
   180 
   189 
   181     
   190     
   182     /**
   191     /**
   183     Invalidate whole FAT cache.
   192     Invalidate whole FAT cache.
   184     Depending of cache type this may just mark cache invalid with reading on demand or re-read whole cache from the media
   193     Depending of cache type this may just mark cache invalid with reading on demand or re-read whole cache from the media
   185     */
   194     */
   186     virtual void InvalidateCacheL() {};
   195     virtual void InvalidateCacheL() {};
   187 	
   196     
   188 
   197 
   189     /**
   198     /**
   190 	Gets the next cluster in a cluster chain
   199     Gets the next cluster in a cluster chain
   191 
   200 
   192 	@param aCluster	Cluster number to start lookup. On return contains number of the next cluster.
   201     @param aCluster Cluster number to start lookup. On return contains number of the next cluster.
   193 	@return EFalse if cluster is at the end of a cluster chain
   202     @return EFalse if cluster is at the end of a cluster chain
   194     */
   203     */
   195     virtual TBool GetNextClusterL(TInt& aCluster) const;
   204     virtual TBool GetNextClusterL(TInt& aCluster) const;
   196 	
   205     
   197     /**
   206     /**
   198     Writes end of cluster chain
   207     Writes end of cluster chain
   199 	@param aFatIndex index in Fat table where EOF will be written to.
   208     @param aFatIndex index in Fat table where EOF will be written to.
   200     */
   209     */
   201 	virtual void WriteFatEntryEofL(TUint32 aFatIndex);
   210     virtual void WriteFatEntryEofL(TUint32 aFatIndex);
   202 
   211 
   203     /** 
   212     /** 
   204 	Read an entry from the FAT.
   213     Read an entry from the FAT.
   205 
   214 
   206 	@param aFatIndex aFatIndex index in Fat table
   215     @param aFatIndex aFatIndex index in Fat table
   207 	@return value of the FAT entry number aFatIndex
   216     @return value of the FAT entry number aFatIndex
   208     */
   217     */
   209 	virtual TUint32 ReadL(TUint32 aFatIndex) const = 0;
   218     virtual TUint32 ReadL(TUint32 aFatIndex) const = 0;
   210 	
   219     
   211     /**
   220     /**
   212 	Write FAT entry to FAT by its index.
   221     Write FAT entry to FAT by its index.
   213 
   222 
   214 	@param aFatIndex index in FAT
   223     @param aFatIndex index in FAT
   215     @param aValue value to write
   224     @param aValue value to write
   216     */
   225     */
   217 	virtual void WriteL(TUint32 aFatIndex, TUint32 aValue) = 0;
   226     virtual void WriteL(TUint32 aFatIndex, TUint32 aValue) = 0;
   218 	
   227     
   219     /**
   228     /**
   220     return the byte position of a cluster in the fat table
   229     return the byte position of a cluster in the fat table
   221 
   230 
   222     @param aCluster cluster to find position of
   231     @param aCluster cluster to find position of
   223     @return byte position of the cluster
   232     @return byte position of the cluster
   224     */
   233     */
   225 	virtual TInt64 DataPositionInBytes(TUint32 aCluster) const = 0;
   234     virtual TInt64 DataPositionInBytes(TUint32 aCluster) const = 0;
   226 
   235 
   227 	virtual void FreeClusterListL(TUint32 aCluster);
   236     virtual void FreeClusterListL(TUint32 aCluster);
   228 	virtual void ExtendClusterListL(TUint32 aNumber,TInt& aCluster);
   237     virtual void ExtendClusterListL(TUint32 aNumber,TInt& aCluster);
   229 	virtual TUint32 AllocateSingleClusterL(TUint32 aNearestCluster);
   238     virtual TUint32 AllocateSingleClusterL(TUint32 aNearestCluster);
   230 	virtual TUint32 AllocateClusterListL(TUint32 aNumber,TUint32 aNearestCluster);
   239     virtual TUint32 AllocateClusterListL(TUint32 aNumber,TUint32 aNearestCluster);
   231     virtual void CountFreeClustersL();
   240     virtual void CountFreeClustersL();
   232 
   241 
   233     virtual void RequestRawWriteAccess(TInt64 /*aPos*/, TUint32 /*aLen*/) const {};
   242     virtual void RequestRawWriteAccess(TInt64 /*aPos*/, TUint32 /*aLen*/) const {};
   234     
   243     
   235 
   244 
   259     CFatTable& operator=(const CFatTable&);
   268     CFatTable& operator=(const CFatTable&);
   260 
   269 
   261     
   270     
   262 
   271 
   263     void DecrementFreeClusterCount(TUint32 aCount); 
   272     void DecrementFreeClusterCount(TUint32 aCount); 
   264 	void IncrementFreeClusterCount(TUint32 aCount);
   273     void IncrementFreeClusterCount(TUint32 aCount);
   265 
   274 
   266     inline TUint32 FreeClusters() const;
   275     inline TUint32 FreeClusters() const;
   267 
   276 
   268     inline TBool IsEof16Bit(TInt aCluster) const;
   277     inline TBool IsEof16Bit(TInt aCluster) const;
   269     inline TBool IsEof12Bit(TInt aCluster) const;
   278     inline TBool IsEof12Bit(TInt aCluster) const;
   288     TUint        iMediaAtt;         ///< Cached copy of TLocalDriveCaps::iMediaAtt
   297     TUint        iMediaAtt;         ///< Cached copy of TLocalDriveCaps::iMediaAtt
   289 
   298 
   290 private:   
   299 private:   
   291 
   300 
   292     TUint32  iFreeClusters;     ///< Number of free cluster in the fat table
   301     TUint32  iFreeClusters;     ///< Number of free cluster in the fat table
   293 	TUint32  iFreeClusterHint;  ///< Next free custer in the fat table, just for use in TFsInfo; This is just a hint, not required to contain exact information.
   302     TUint32  iFreeClusterHint;  ///< Next free custer in the fat table, just for use in TFsInfo; This is just a hint, not required to contain exact information.
   294     TFatType iFatType;          ///< FAT type 12/16/32, cached from the iOwner
   303     TFatType iFatType;          ///< FAT type 12/16/32, cached from the iOwner
   295     TUint32  iMaxEntries;       ///< maximal number of FAT entries in the table. This value is taken from the CFatMount that calculates it
   304     TUint32  iMaxEntries;       ///< maximal number of FAT entries in the table. This value is taken from the CFatMount that calculates it
   296     
   305     
   297     };
   306     };
   298 
   307 
   310 public:
   319 public:
   311 
   320 
   312     static CRawDisk* NewL(CFatMountCB& aOwner, const TLocalDriveCaps& aLocDrvCaps);
   321     static CRawDisk* NewL(CFatMountCB& aOwner, const TLocalDriveCaps& aLocDrvCaps);
   313 
   322 
   314     virtual void InitializeL();
   323     virtual void InitializeL();
   315 	
   324     
   316     virtual TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
   325     virtual TInt GetLastErrorInfo(TDes8& aErrorInfo) const;
   317 public:
   326 public:
   318 	
   327     
   319     /**
   328     /**
   320 	Read data from the media via simple WT data cache if it is present. Some media types, like RAM do not have caches.
   329     Read data from the media via simple WT data cache if it is present. Some media types, like RAM do not have caches.
   321     This method is mostly used to read UIDs of executable modules and store them in the cache.
   330     This method is mostly used to read UIDs of executable modules and store them in the cache.
   322 
   331 
   323 	@param aPos		Media position in bytes
   332     @param aPos     Media position in bytes
   324     @param aLength  Length in bytes of read
   333     @param aLength  Length in bytes of read
   325     @param aDes     Data from read
   334     @param aDes     Data from read
   326     */
   335     */
   327 	virtual void ReadCachedL(TInt64 aPos,TInt aLength,TDes8& aDes) const = 0;
   336     virtual void ReadCachedL(TInt64 aPos,TInt aLength,TDes8& aDes) const = 0;
   328 	
   337     
   329     /**
   338     /**
   330 	Write data to the media via simple WT data cache if it is present. Some media types, like RAM do not have caches.
   339     Write data to the media via simple WT data cache if it is present. Some media types, like RAM do not have caches.
   331 	@param aPos		Media position in bytes
   340     @param aPos     Media position in bytes
   332     @param aDes     Data to write
   341     @param aDes     Data to write
   333     */
   342     */
   334 	virtual void WriteCachedL(TInt64 aPos,const TDesC8& aDes) = 0;
   343     virtual void WriteCachedL(TInt64 aPos,const TDesC8& aDes) = 0;
   335     
   344     
   336     virtual void InvalidateUidCache() {}
   345     virtual void InvalidateUidCache() {}
   337     virtual void InvalidateUidCachePage(TUint64 /*aPos*/) {}
   346     virtual void InvalidateUidCachePage(TUint64 /*aPos*/) {}
   338     
   347     
   339 
   348 
   340     /**
   349     /**
   341 	Disk read function
   350     Disk read function
   342     
   351     
   343 	@param aPos		Media position in bytes
   352     @param aPos     Media position in bytes
   344     @param aLength  Length in bytes of read
   353     @param aLength  Length in bytes of read
   345 	@param aTrg		Pointer to the data descriptor, i.e. (const TAny*)(&TDes8)
   354     @param aTrg     Pointer to the data descriptor, i.e. (const TAny*)(&TDes8)
   346     @param aMessage Refrence to server message from request
   355     @param aMessage Refrence to server message from request
   347     @param anOffset Offset into read data to write
   356     @param anOffset Offset into read data to write
   348     */
   357     */
   349     virtual void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const = 0;
   358     virtual void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const = 0;
   350 
   359 
   351     /**
   360     /**
   352 	Disk write function
   361     Disk write function
   353 
   362 
   354 	@param aPos		Media position in bytes
   363     @param aPos     Media position in bytes
   355     @param aLength  Length in bytes of write
   364     @param aLength  Length in bytes of write
   356 	@param aTrg		Pointer to the data descriptor, i.e. (const TAny*)(&TDes8)
   365     @param aTrg     Pointer to the data descriptor, i.e. (const TAny*)(&TDes8)
   357     @param aMessage Refrence to server message from request, contains data
   366     @param aMessage Refrence to server message from request, contains data
   358     @param anOffset Offset into write data to use in write
   367     @param anOffset Offset into write data to use in write
   359     */
   368     */
   360     virtual void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) = 0;
   369     virtual void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) = 0;
   361 
   370 
   396     TFatVolParam();
   405     TFatVolParam();
   397     void Populate(const TFatBootSector& aBootSector);
   406     void Populate(const TFatBootSector& aBootSector);
   398     TBool operator==(const TFatVolParam& aRhs) const;
   407     TBool operator==(const TFatVolParam& aRhs) const;
   399 
   408 
   400     //-- simple getters
   409     //-- simple getters
   401 	TUint32 ClusterSizeLog2() const     {return iClusterSizeLog2;    }        
   410     TUint32 ClusterSizeLog2() const     {return iClusterSizeLog2;    }        
   402 	TUint32 SectorSizeLog2() const      {return iSectorSizeLog2;     }        
   411     TUint32 SectorSizeLog2() const      {return iSectorSizeLog2;     }        
   403 	TUint32 RootDirEnd() const          {return iRootDirEnd;         }        
   412     TUint32 RootDirEnd() const          {return iRootDirEnd;         }        
   404 	TUint32 SectorsPerCluster() const   {return iSectorsPerCluster;  }        
   413     TUint32 SectorsPerCluster() const   {return iSectorsPerCluster;  }        
   405 	TUint32 RootDirectorySector() const {return iRootDirectorySector;}        
   414     TUint32 RootDirectorySector() const {return iRootDirectorySector;}        
   406 	TUint32 FirstFatSector() const      {return iFirstFatSector;     }        
   415     TUint32 FirstFatSector() const      {return iFirstFatSector;     }        
   407 	TUint32 TotalSectors() const        {return iTotalSectors;       }        
   416     TUint32 TotalSectors() const        {return iTotalSectors;       }        
   408 	TUint32 NumberOfFats() const        {return iNumberOfFats;       }        
   417     TUint32 NumberOfFats() const        {return iNumberOfFats;       }        
   409 	TUint32 FatSizeInBytes() const      {return iFatSizeInBytes;     }        
   418     TUint32 FatSizeInBytes() const      {return iFatSizeInBytes;     }        
   410 	TUint32 RootClusterNum() const      {return iRootClusterNum;     }        
   419     TUint32 RootClusterNum() const      {return iRootClusterNum;     }        
   411     TUint32 FSInfoSectorNum() const     {return iFSInfoSectorNum;    }        
   420     TUint32 FSInfoSectorNum() const     {return iFSInfoSectorNum;    }        
   412     TUint32 BkFSInfoSectorNum() const   {return iBkFSInfoSectorNum;  }        
   421     TUint32 BkFSInfoSectorNum() const   {return iBkFSInfoSectorNum;  }        
   413     
   422     
   414     protected:
   423     protected:
   415      TUint32 iClusterSizeLog2;      ///< Log2 of fat file system cluster size
   424      TUint32 iClusterSizeLog2;      ///< Log2 of fat file system cluster size
   416 	 TUint32 iSectorSizeLog2;       ///< Log2 of media sector size
   425      TUint32 iSectorSizeLog2;       ///< Log2 of media sector size
   417 	 TUint32 iRootDirEnd;           ///< End position of the root directory for Fat12/16
   426      TUint32 iRootDirEnd;           ///< End position of the root directory for Fat12/16
   418 	 TUint32 iSectorsPerCluster;    ///< Sector per cluster ratio for mounted Fat file system volume 
   427      TUint32 iSectorsPerCluster;    ///< Sector per cluster ratio for mounted Fat file system volume 
   419 	 TUint32 iRootDirectorySector;  ///< Start sector of the root directory for Fat12/16
   428      TUint32 iRootDirectorySector;  ///< Start sector of the root directory for Fat12/16
   420 	 TUint32 iFirstFatSector;       ///< Start sector of the first Fat table in volume
   429      TUint32 iFirstFatSector;       ///< Start sector of the first Fat table in volume
   421 	 TUint32 iTotalSectors;         ///< Total sectors on media partition
   430      TUint32 iTotalSectors;         ///< Total sectors on media partition
   422 	 TUint32 iNumberOfFats;         ///< Number of Fats the volume has
   431      TUint32 iNumberOfFats;         ///< Number of Fats the volume has
   423 	 TUint32 iFatSizeInBytes;       ///< Size of a single Fat table in volume
   432      TUint32 iFatSizeInBytes;       ///< Size of a single Fat table in volume
   424 	 TUint32 iRootClusterNum;       ///< Cluster number for Root directory, for Fat32
   433      TUint32 iRootClusterNum;       ///< Cluster number for Root directory, for Fat32
   425      TUint32 iFSInfoSectorNum;      ///< FSInfo Sector number. If 0, this means that corresponding value isn't set in BPB
   434      TUint32 iFSInfoSectorNum;      ///< FSInfo Sector number. If 0, this means that corresponding value isn't set in BPB
   426      TUint32 iBkFSInfoSectorNum;    ///< backup FSInfo Sector number
   435      TUint32 iBkFSInfoSectorNum;    ///< backup FSInfo Sector number
   427     };
   436     };
   428 
   437 
   429 TUint32 CalculatePageOffsetInCluster(TUint32 aPos, TUint aPageSzLog2);
   438 TUint32 CalculatePageOffsetInCluster(TUint32 aPos, TUint aPageSzLog2);
   444     ~CFatMountCB();
   453     ~CFatMountCB();
   445     void ConstructL();
   454     void ConstructL();
   446 
   455 
   447 public:
   456 public:
   448     
   457     
   449 	//-- overrides from the abstract CMountCB
   458     //-- overrides from the abstract CMountCB
   450     void MountL(TBool aForceMount);
   459     void MountL(TBool aForceMount);
   451     TInt ReMount();
   460     TInt ReMount();
   452     void Dismounted();
   461     void Dismounted();
   453     void VolumeL(TVolumeInfo& aVolume) const;
   462     void VolumeL(TVolumeInfo& aVolume) const;
   454     void SetVolumeL(TDes& aName);
   463     void SetVolumeL(TDes& aName);
   476     TInt ForceRemountDrive(const TDesC8* aMountInfo,TInt aMountInfoMessageHandle,TUint aFlags);
   485     TInt ForceRemountDrive(const TDesC8* aMountInfo,TInt aMountInfoMessageHandle,TUint aFlags);
   477 
   486 
   478     void FinaliseMountL();
   487     void FinaliseMountL();
   479     void FinaliseMountL(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
   488     void FinaliseMountL(TInt aOperation, TAny* aParam1=NULL, TAny* aParam2=NULL);
   480     TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
   489     TInt MountControl(TInt aLevel, TInt aOption, TAny* aParam);
   481    	TTimeIntervalSeconds TimeOffset() const;
   490     TTimeIntervalSeconds TimeOffset() const;
   482 
   491 
   483 protected:
   492 protected:
   484 
   493 
   485     /** CFatMountCB states */
   494     /** CFatMountCB states */
   486     enum  TFatMntState
   495     enum  TFatMntState
   544 
   553 
   545     inline TInt NumberOfFats() const;
   554     inline TInt NumberOfFats() const;
   546     inline TInt FatSizeInBytes() const;
   555     inline TInt FatSizeInBytes() const;
   547     inline TInt ClusterRelativePos(TInt aPos) const;
   556     inline TInt ClusterRelativePos(TInt aPos) const;
   548     inline TUint StartOfRootDirInBytes() const;
   557     inline TUint StartOfRootDirInBytes() const;
   549 	inline TUint32 UsableClusters() const;
   558     inline TUint32 UsableClusters() const;
   550     inline TBool IsBadCluster(TInt aCluster) const;
   559     inline TBool IsBadCluster(TInt aCluster) const;
   551     inline TBool IsRuggedFSys() const;
   560     inline TBool IsRuggedFSys() const;
   552     inline void SetRuggedFSys(TBool aVal);
   561     inline void SetRuggedFSys(TBool aVal);
   553 	
   562     
   554     inline TInt RootIndicator() const;
   563     inline TInt RootIndicator() const;
   555     
   564     
   556     inline TBool IsRootDir(const TEntryPos &aEntry) const;
   565     inline TBool IsRootDir(const TEntryPos &aEntry) const;
   557     inline CAsyncNotifier* Notifier() const;
   566     inline CAsyncNotifier* Notifier() const;
   558 	inline TFatDriveInterface& DriveInterface() const;
   567     inline TFatDriveInterface& DriveInterface() const;
   559     
   568     
   560     void ReadUidL(TInt aCluster,TEntry& anEntry) const;
   569     void ReadUidL(TInt aCluster,TEntry& anEntry) const;
   561     
   570     
   562     void ReadDirEntryL(const TEntryPos& aPos,TFatDirEntry& aDirEntry) const;
   571     void ReadDirEntryL(const TEntryPos& aPos,TFatDirEntry& aDirEntry) const;
   563     void WriteDirEntryL(const TEntryPos& aPos,const TFatDirEntry& aDirEntry);
   572     void WriteDirEntryL(const TEntryPos& aPos,const TFatDirEntry& aDirEntry);
   583     TBool IsEndOfClusterCh(TInt aCluster) const;
   592     TBool IsEndOfClusterCh(TInt aCluster) const;
   584     void SetEndOfClusterCh(TInt &aCluster) const; 
   593     void SetEndOfClusterCh(TInt &aCluster) const; 
   585     void InitializeRootEntry(TFatDirEntry & anEntry) const;
   594     void InitializeRootEntry(TFatDirEntry & anEntry) const;
   586 
   595 
   587     TInt64 MakeLinAddrL(const TEntryPos& aPos) const;
   596     TInt64 MakeLinAddrL(const TEntryPos& aPos) const;
   588 	
   597     
   589     inline const TFatConfig& FatConfig() const;
   598     inline const TFatConfig& FatConfig() const;
   590     TBool CheckVolumeTheSame();
   599     TBool CheckVolumeTheSame();
   591     
   600     
   592     void InvalidateLeafDirCache();
   601     void InvalidateLeafDirCache();
   593     
   602     
   626             TShortName  iShortName;         ///< a short DOS name in XXXXXXXXYYY format generated from aTargetName
   635             TShortName  iShortName;         ///< a short DOS name in XXXXXXXXYYY format generated from aTargetName
   627         };
   636         };
   628 
   637 
   629 
   638 
   630         /** 
   639         /** 
   631        	An ad hoc internal helper object for entry creations  
   640         An ad hoc internal helper object for entry creations  
   632         */
   641         */
   633 	    class XFileCreationHelper
   642         class XFileCreationHelper
   634 	    {
   643         {
   635 	    public:
   644         public:
   636 	    	XFileCreationHelper();
   645             XFileCreationHelper();
   637 	    	~XFileCreationHelper();
   646             ~XFileCreationHelper();
   638 	    	void Close();
   647             void Close();
   639 	    	void InitialiseL(const TDesC&  aTargetName);
   648             void InitialiseL(const TDesC&  aTargetName);
   640 	        TInt GetValidatedShortName(TShortName& aShortName) const;
   649             TInt GetValidatedShortName(TShortName& aShortName) const;
   641 	    	void CheckShortNameCandidates(const TUint8* apDosEntryName);
   650             void CheckShortNameCandidates(const TUint8* apDosEntryName);
   642 	
   651     
   643 	        // inline functions for sets and gets
   652             // inline functions for sets and gets
   644 	        //  note all the get functions have been checked against initialisation status
   653             //  note all the get functions have been checked against initialisation status
   645 	    	inline TBool 	IsInitialised() const;
   654             inline TBool    IsInitialised() const;
   646 	        inline TUint16	NumOfAddingEntries() const;
   655             inline TUint16  NumOfAddingEntries() const;
   647 	        inline TEntryPos EntryAddingPos()const;
   656             inline TEntryPos EntryAddingPos()const;
   648 	        inline TBool 	IsNewEntryPosFound() const;
   657             inline TBool    IsNewEntryPosFound() const;
   649 	    	inline TBool 	IsTrgNameLegalDosName() const;
   658             inline TBool    IsTrgNameLegalDosName() const;
   650 	
   659     
   651 	    	inline void	SetEntryAddingPos(const TEntryPos& aEntryPos);
   660             inline void SetEntryAddingPos(const TEntryPos& aEntryPos);
   652 	    	inline void	SetIsNewEntryPosFound(TBool aFound);
   661             inline void SetIsNewEntryPosFound(TBool aFound);
   653 	
   662     
   654 	    private:
   663         private:
   655 	    	XFileCreationHelper(const XFileCreationHelper&);
   664             XFileCreationHelper(const XFileCreationHelper&);
   656 	    	XFileCreationHelper& operator=(const TFindHelper&);
   665             XFileCreationHelper& operator=(const TFindHelper&);
   657 	
   666     
   658 	    private:
   667         private:
   659 	        TPtrC       iTargetName;		///< pointer to hold the long file name of the target file
   668             TPtrC       iTargetName;        ///< pointer to hold the long file name of the target file
   660 	        TUint16		iNumOfAddingEntries;///< calculated number of entries to add
   669             TUint16     iNumOfAddingEntries;///< calculated number of entries to add
   661 	        TEntryPos	iEntryAddingPos;	///< contains new entry position for adding if found any
   670             TEntryPos   iEntryAddingPos;    ///< contains new entry position for adding if found any
   662 	        TBool		isNewEntryPosFound; ///< flags whether the position for new entries is found
   671             TBool       isNewEntryPosFound; ///< flags whether the position for new entries is found
   663 	        TBool       isInitialised	:1;	///< flags whether the object is initialised
   672             TBool       isInitialised   :1; ///< flags whether the object is initialised
   664 	        TBool       isTrgNameLegalDosName	:1;	///< flags whether the target file name is a valid Dos name
   673             TBool       isTrgNameLegalDosName   :1; ///< flags whether the target file name is a valid Dos name
   665 	        /**
   674             /**
   666 	        an array that holds short name candidates, prepared on initialisation.
   675             an array that holds short name candidates, prepared on initialisation.
   667 	        */
   676             */
   668 	        RArray<TShortName>  iShortNameCandidates;
   677             RArray<TShortName>  iShortNameCandidates;
   669 	    };
   678         };
   670 
   679 
   671 
   680 
   672 	TBool DoRummageDirCacheL(TUint anAtt,TEntryPos& aStartEntryPos,TFatDirEntry& aStartEntry,TEntryPos& aDosEntryPos,TFatDirEntry& aDosEntry,TDes& aFileName, const TFindHelper& aAuxParam, XFileCreationHelper* aFileCreationHelper, const TLeafDirData& aLeafDirData) const;
   681     TBool DoRummageDirCacheL(TUint anAtt,TEntryPos& aStartEntryPos,TFatDirEntry& aStartEntry,TEntryPos& aDosEntryPos,TFatDirEntry& aDosEntry,TDes& aFileName, const TFindHelper& aAuxParam, XFileCreationHelper* aFileCreationHelper, const TLeafDirData& aLeafDirData) const;
   673     TBool DoFindL(const TDesC& aName,TUint anAtt,TEntryPos& aStartEntryPos,TFatDirEntry& aStartEntry,TEntryPos& aDosEntryPos,TFatDirEntry& aDosEntry,TDes& aFileName,TInt anError, XFileCreationHelper* aFileCreationHelper, const TLeafDirData& aLeafDirData) const;
   682     TBool DoFindL(const TDesC& aName,TUint anAtt,TEntryPos& aStartEntryPos,TFatDirEntry& aStartEntry,TEntryPos& aDosEntryPos,TFatDirEntry& aDosEntry,TDes& aFileName,TInt anError, XFileCreationHelper* aFileCreationHelper, const TLeafDirData& aLeafDirData) const;
   674     void FindEntryStartL(const TDesC& aName,TUint anAtt,TFatDirEntry& anEntry,TEntryPos& aPos, XFileCreationHelper* aFileCreationHelper) const;
   683     void FindEntryStartL(const TDesC& aName,TUint anAtt,TFatDirEntry& anEntry,TEntryPos& aPos, XFileCreationHelper* aFileCreationHelper) const;
   675 
   684 
   676     void FindEntryStartL(const TDesC& aName,TUint anAtt,TFatDirEntry& anEntry,TEntryPos& aPos) const;
   685     void FindEntryStartL(const TDesC& aName,TUint anAtt,TFatDirEntry& anEntry,TEntryPos& aPos) const;
   677 
   686 
   678     void CheckFatForLoopsL(const TFatDirEntry& anEntry) const;
   687     void CheckFatForLoopsL(const TFatDirEntry& anEntry) const;
   679     void DoCheckFatForLoopsL(TInt aCluster,TInt& aPreviousCluster,TInt& aChangePreviousCluster,TInt& aCount) const;
   688     void DoCheckFatForLoopsL(TInt aCluster,TInt& aPreviousCluster,TInt& aChangePreviousCluster,TInt& aCount) const;
   680 	void InitializeL(const TLocalDriveCaps& aLocDrvCaps, TBool aIgnoreFSInfo=EFalse);
   689     void InitializeL(const TLocalDriveCaps& aLocDrvCaps, TBool aIgnoreFSInfo=EFalse);
   681     void DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const;
   690     void DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const;
   682     void DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TInt aLastcluster, TInt& aBadcluster, TInt& aGoodcluster);
   691     void DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TInt aLastcluster, TInt& aBadcluster, TInt& aGoodcluster);
   683     TBool IsUniqueNameL(const TShortName& aName,TInt aDirCluster);
   692     TBool IsUniqueNameL(const TShortName& aName,TInt aDirCluster);
   684     TBool FindShortNameL(const TShortName& aName,TEntryPos& anEntryPos);
   693     TBool FindShortNameL(const TShortName& aName,TEntryPos& anEntryPos);
   685     void ReplaceClashingNameL(const TShortName& aNewName,const TEntryPos& anEntryPos);
   694     void ReplaceClashingNameL(const TShortName& aNewName,const TEntryPos& anEntryPos);
   686     TBool GenerateShortNameL(TInt aDirCluster,const TDesC& aLongName,TShortName& aShortName, TBool aForceRandomize=EFalse);
   695     TBool GenerateShortNameL(TInt aDirCluster,const TDesC& aLongName,TShortName& aShortName, TBool aForceRandomize=EFalse);
   687     TInt FindLeafDirL(const TDesC& aName, TLeafDirData& aLeafDir) const;
   696     TInt FindLeafDirL(const TDesC& aName, TLeafDirData& aLeafDir) const;
   688 	
   697     
   689 	TInt GetDirEntry(TEntryPos& aPos,TFatDirEntry& aDosEntry,TFatDirEntry& aStartEntry,TDes& aLongFileName) const;
   698     TInt GetDirEntry(TEntryPos& aPos,TFatDirEntry& aDosEntry,TFatDirEntry& aStartEntry,TDes& aLongFileName) const;
   690     TBool DoGetDirEntryL(TEntryPos& aPos,TFatDirEntry& aDosEntry,TFatDirEntry& aStartEntry,TDes& aLongFileName) const;
   699     TBool DoGetDirEntryL(TEntryPos& aPos,TFatDirEntry& aDosEntry,TFatDirEntry& aStartEntry,TDes& aLongFileName) const;
   691 
   700 
   692     void WriteDirEntryL(TEntryPos& aPos,const TFatDirEntry& aFatDirEntry,const TDesC& aLongFileName);
   701     void WriteDirEntryL(TEntryPos& aPos,const TFatDirEntry& aFatDirEntry,const TDesC& aLongFileName);
   693     void EraseDirEntryL(TEntryPos aPos,const TFatDirEntry& anEntry);
   702     void EraseDirEntryL(TEntryPos aPos,const TFatDirEntry& anEntry);
   694     void EraseDirEntryL(const TEntryPos& aPos);
   703     void EraseDirEntryL(const TEntryPos& aPos);
   701     TInt ReadBootSector(TFatBootSector& aBootSector, TBool aDoNotReadBkBootSec=EFalse);
   710     TInt ReadBootSector(TFatBootSector& aBootSector, TBool aDoNotReadBkBootSec=EFalse);
   702 
   711 
   703     TBool IsDirectoryEmptyL(TInt aCluster);
   712     TBool IsDirectoryEmptyL(TInt aCluster);
   704     void ExtendClusterListZeroedL(TInt aNumber,TInt& aCluster);
   713     void ExtendClusterListZeroedL(TInt aNumber,TInt& aCluster);
   705     void WritePasswordData();
   714     void WritePasswordData();
   706 	
   715     
   707     void WriteVolumeLabelL(const TDesC8& aVolumeLabel) const;
   716     void WriteVolumeLabelL(const TDesC8& aVolumeLabel) const;
   708     TInt ReadVolumeLabelFile(TDes8& aLabel);
   717     TInt ReadVolumeLabelFile(TDes8& aLabel);
   709     void WriteVolumeLabelFileL(const TDesC8& aNewName);
   718     void WriteVolumeLabelFileL(const TDesC8& aNewName);
   710     void FindVolumeLabelFileL(TDes8& aLabel, TEntryPos& aDosEntryPos, TFatDirEntry& aDosEntry);
   719     void FindVolumeLabelFileL(TDes8& aLabel, TEntryPos& aDosEntryPos, TFatDirEntry& aDosEntry);
   711     void GetVolumeLabelFromDiskL(const TFatBootSector& aBootSector);
   720     void GetVolumeLabelFromDiskL(const TFatBootSector& aBootSector);
   719     void    DoUpdateFSInfoSectorsL(TBool) {return;} //-- dummy, only FAT32 has FSInfo sector
   728     void    DoUpdateFSInfoSectorsL(TBool) {return;} //-- dummy, only FAT32 has FSInfo sector
   720     void    UnFinaliseMountL();
   729     void    UnFinaliseMountL();
   721     void    DoReMountL();
   730     void    DoReMountL();
   722 
   731 
   723 private:
   732 private:
   724 	
   733     
   725     TBool ValidClusterNumber(TUint32 aCluster) const;
   734     TBool ValidClusterNumber(TUint32 aCluster) const;
   726     void  CheckUnvisitedClustersL(const RBitVector& aFatBitVec) const;
   735     void  CheckUnvisitedClustersL(const RBitVector& aFatBitVec) const;
   727 	TInt  WalkClusterListL(RBitVector& aFatBitVec, TInt aCluster);
   736     TInt  WalkClusterListL(RBitVector& aFatBitVec, TInt aCluster);
   728 	void  ChkEntryL(RBitVector& aFatBitVec, const TFatDirEntry& anEntry);
   737     void  ChkEntryL(RBitVector& aFatBitVec, const TFatDirEntry& anEntry);
   729 	void  ChkDirL(RBitVector& aFatBitVec, TInt aDirCluster);
   738     void  ChkDirL(RBitVector& aFatBitVec, TInt aDirCluster);
   730 
   739 
   731     CFatMountCB();
   740     CFatMountCB();
   732 
   741 
   733     TInt GetDosEntryFromNameL(const TDesC& aName, TEntryPos& aDosEntryPos, TFatDirEntry& aDosEntry);
   742     TInt GetDosEntryFromNameL(const TDesC& aName, TEntryPos& aDosEntryPos, TFatDirEntry& aDosEntry);
   734     
   743     
   740     TBool iRamDrive : 1;        ///< true if this is a RAM drive    
   749     TBool iRamDrive : 1;        ///< true if this is a RAM drive    
   741 
   750 
   742     TFatMntState iState;        ///< this mounnt internal state
   751     TFatMntState iState;        ///< this mounnt internal state
   743     TFatType iFatType;          ///< FAT type, FAT12,16 or 32
   752     TFatType iFatType;          ///< FAT type, FAT12,16 or 32
   744 
   753 
   745     CLeafDirCache* iLeafDirCache;	///< A cache for most recently visited directories, only valid when limit is set bigger than 1
   754     CLeafDirCache* iLeafDirCache;   ///< A cache for most recently visited directories, only valid when limit is set bigger than 1
   746     HBufC* iLastLeafDir;        	///< The last visited directory, only valid when limit of iLeafDirCache is less than 1 
   755     HBufC* iLastLeafDir;            ///< The last visited directory, only valid when limit of iLeafDirCache is less than 1 
   747     TInt iLastLeafDirCluster;   	///< Cluster number of the last visited cluster, only valid when limit of iLeafDirCache is less than 1
   756     TInt iLastLeafDirCluster;       ///< Cluster number of the last visited cluster, only valid when limit of iLeafDirCache is less than 1
   748 
   757 
   749 	TFatVolParam iVolParam;     ///< FAT volume parameters, populated form the boot sector values.
   758     TFatVolParam iVolParam;     ///< FAT volume parameters, populated form the boot sector values.
   750     
   759     
   751     TInt iFirstFreeByte;        ///< First free byte in media (start of the data area on the volume)
   760     TInt iFirstFreeByte;        ///< First free byte in media (start of the data area on the volume)
   752     TUint32 iUsableClusters;    ///< Number of usable cluster on the volume 
   761     TUint32 iUsableClusters;    ///< Number of usable cluster on the volume 
   753 
   762 
   754     CFatTable* iFatTable;       ///< Pointer to the volume Fat 
   763     CFatTable* iFatTable;       ///< Pointer to the volume Fat 
   757     CAsyncNotifier* iNotifier;  ///< Async notifier for notifying user of Fat error conditions 
   766     CAsyncNotifier* iNotifier;  ///< Async notifier for notifying user of Fat error conditions 
   758     CLruCache*      iLruUidCache;   ///< LRU Data cache used for dealing with executable files' UIDs
   767     CLruCache*      iLruUidCache;   ///< LRU Data cache used for dealing with executable files' UIDs
   759 
   768 
   760     XDriveInterface iDriverInterface; ///< the object representing interface to the drive, provides read/write access and notifiers
   769     XDriveInterface iDriverInterface; ///< the object representing interface to the drive, provides read/write access and notifiers
   761     TInt            iChkDiscRecLevel; ///< Check disk recursion level counter. A temporary measure. 
   770     TInt            iChkDiscRecLevel; ///< Check disk recursion level counter. A temporary measure. 
   762 	TFatConfig      iFatConfig;       ///< FAT parametrers from estart.txt
   771     TFatConfig      iFatConfig;       ///< FAT parametrers from estart.txt
   763 
   772 
   764 	XFileCreationHelper iFileCreationHelper;
   773     XFileCreationHelper iFileCreationHelper;
   765 
   774 
   766 #ifdef  _DEBUG
   775 #ifdef  _DEBUG
   767     private:
   776     private:
   768     //-- debug odds and ends
   777     //-- debug odds and ends
   769     inline TBool IsWriteFail()const;
   778     inline TBool IsWriteFail()const;
   770 	inline void SetWriteFail(TBool aIsWriteFail);
   779     inline void SetWriteFail(TBool aIsWriteFail);
   771 	inline TInt WriteFailCount()const;
   780     inline TInt WriteFailCount()const;
   772 	inline void SetWriteFailCount(TInt aFailCount);
   781     inline void SetWriteFailCount(TInt aFailCount);
   773 	inline void DecWriteFailCount();
   782     inline void DecWriteFailCount();
   774 	inline TInt WriteFailError()const;
   783     inline TInt WriteFailError()const;
   775 	inline void SetWriteFailError(TInt aErrorValue);
   784     inline void SetWriteFailError(TInt aErrorValue);
   776 
   785 
   777 
   786 
   778 	TBool   iIsWriteFail : 1; ///< Flag to indicate if write failed used for debugging
   787     TBool   iIsWriteFail : 1; ///< Flag to indicate if write failed used for debugging
   779     TBool   iCBRecFlag   : 1; ///< in debug mode used for checking unwanted recursion
   788     TBool   iCBRecFlag   : 1; ///< in debug mode used for checking unwanted recursion
   780 
   789 
   781     TInt    iWriteFailCount;  ///< Write fail count for debug
   790     TInt    iWriteFailCount;  ///< Write fail count for debug
   782 	TInt    iWriteFailError;  ///< Write fail error to use for debug
   791     TInt    iWriteFailError;  ///< Write fail error to use for debug
   783 
   792 
   784 #endif
   793 #endif
   785 
   794 
   786 friend class CFatFormatCB;
   795 friend class CFatFormatCB;
   787 friend class CScanDrive;
   796 friend class CScanDrive;
   810     void FlushAllL();
   819     void FlushAllL();
   811 public:
   820 public:
   812     void CheckPosL(TUint aPos);
   821     void CheckPosL(TUint aPos);
   813     void SetL(const TFatDirEntry& aFatDirEntry,TShare aShare,const TEntryPos& aPos);
   822     void SetL(const TFatDirEntry& aFatDirEntry,TShare aShare,const TEntryPos& aPos);
   814     void CreateSeekIndex();
   823     void CreateSeekIndex();
   815 	
   824     
   816     inline TBool IsSeekIndex() const;
   825     inline TBool IsSeekIndex() const;
   817 
   826 
   818     // from MBlockMapInterface
   827     // from MBlockMapInterface
   819 	TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos);
   828     TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos);
   820 	
   829     
   821 	// from CFileCB
   830     // from CFileCB
   822 	virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
   831     virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
   823 
   832 
   824 	// from CFileCB::MExtendedFileInterface
   833     // from CFileCB::MExtendedFileInterface
   825 	virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
   834     virtual void ReadL(TInt64 aPos,TInt& aLength,TDes8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
   826 	virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
   835     virtual void WriteL(TInt64 aPos,TInt& aLength,const TDesC8* aDes,const RMessagePtr2& aMessage, TInt aOffset);
   827 	virtual void SetSizeL(TInt64 aSize);
   836     virtual void SetSizeL(TInt64 aSize);
   828 
   837 
   829 private:
   838 private:
   830 	inline CFatMountCB& FatMount() const;
   839     inline CFatMountCB& FatMount() const;
   831     inline CFatTable& FAT();
   840     inline CFatTable& FAT();
   832 	inline TInt ClusterSizeLog2();
   841     inline TInt ClusterSizeLog2();
   833 	inline TInt ClusterRelativePos(TInt aPos);
   842     inline TInt ClusterRelativePos(TInt aPos);
   834 
   843 
   835 
   844 
   836     void FlushStartClusterL();
   845     void FlushStartClusterL();
   837     TInt SeekToPosition(TInt aNewCluster,TInt aClusterOffset);
   846     TInt SeekToPosition(TInt aNewCluster,TInt aClusterOffset);
   838     void SetSeekIndexValueL(TInt aFileCluster,TInt aStoredCluster);
   847     void SetSeekIndexValueL(TInt aFileCluster,TInt aStoredCluster);
   849     TInt iSeekIndexSize;    ///< size of seek index
   858     TInt iSeekIndexSize;    ///< size of seek index
   850     TBool iAttPending;      
   859     TBool iAttPending;      
   851     TInt iStartCluster;     ///< Start cluster number of file
   860     TInt iStartCluster;     ///< Start cluster number of file
   852     TEntryPos iCurrentPos;  ///< Current position in file data
   861     TEntryPos iCurrentPos;  ///< Current position in file data
   853     TEntryPos iFileDirPos;  ///< File directory entry position
   862     TEntryPos iFileDirPos;  ///< File directory entry position
   854 	TBool iFileSizeModified; 
   863     TBool iFileSizeModified; 
   855     };
   864     };
   856 //
   865 //
   857 
   866 
   858 /**
   867 /**
   859 Fat file system directory subsession implmentation, provides all that is required of a plug in
   868 Fat file system directory subsession implmentation, provides all that is required of a plug in
   888     {
   897     {
   889 public:
   898 public:
   890     CFatFormatCB();
   899     CFatFormatCB();
   891     ~CFatFormatCB();
   900     ~CFatFormatCB();
   892 public:
   901 public:
   893 	
   902     
   894     //-- overrides from CFormatCB
   903     //-- overrides from CFormatCB
   895     void DoFormatStepL();
   904     void DoFormatStepL();
   896 
   905 
   897 private:
   906 private:
   898     //-- overrides from CFormatCB
   907     //-- overrides from CFormatCB
   899     TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
   908     TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
   900 
   909 
   901 private:	
   910 private:    
   902     
   911     
   903     TInt DoProcessTVolFormatParam(const TVolFormatParam_FAT* apVolFormatParam);
   912     TInt DoProcessTVolFormatParam(const TVolFormatParam_FAT* apVolFormatParam);
   904 
   913 
   905     void CreateBootSectorL();
   914     void CreateBootSectorL();
   906     void InitializeFormatDataL();
   915     void InitializeFormatDataL();
   908      
   917      
   909     TInt InitFormatDataForVariableSizeDisk(TInt aDiskSizeInSectors);
   918     TInt InitFormatDataForVariableSizeDisk(TInt aDiskSizeInSectors);
   910     TInt InitFormatDataForFixedSizeDiskNormal(TInt aDiskSizeInSectors, const TLocalDriveCapsV6& aCaps);
   919     TInt InitFormatDataForFixedSizeDiskNormal(TInt aDiskSizeInSectors, const TLocalDriveCapsV6& aCaps);
   911     TInt InitFormatDataForFixedSizeDiskCustom(const TLDFormatInfo& aFormatInfo);
   920     TInt InitFormatDataForFixedSizeDiskCustom(const TLDFormatInfo& aFormatInfo);
   912     TInt InitFormatDataForFixedSizeDiskUser(TInt aDiskSizeInSectors);
   921     TInt InitFormatDataForFixedSizeDiskUser(TInt aDiskSizeInSectors);
   913 	void AdjustClusterSize(TInt aRecommendedSectorsPerCluster);
   922     void AdjustClusterSize(TInt aRecommendedSectorsPerCluster);
   914 	TInt AdjustFirstDataSectorAlignment(TInt aBlockSize);
   923     TInt AdjustFirstDataSectorAlignment(TInt aBlockSize);
   915 	TInt FirstDataSector() const;
   924     TInt FirstDataSector() const;
   916     
   925     
   917     TInt HandleCorrupt(TInt aError);
   926     TInt HandleCorrupt(TInt aError);
   918     TInt BadSectorToCluster();
   927     TInt BadSectorToCluster();
   919     void TranslateL();
   928     void TranslateL();
   920     TInt DoTranslate(TPtr8& aBuf, RArray<TInt>& aArray);
   929     TInt DoTranslate(TPtr8& aBuf, RArray<TInt>& aArray);
   925     inline CFatMountCB& FatMount();
   934     inline CFatMountCB& FatMount();
   926     inline CProxyDrive* LocalDrive();
   935     inline CProxyDrive* LocalDrive();
   927     TFatType SuggestFatType() const;
   936     TFatType SuggestFatType() const;
   928 
   937 
   929 private:
   938 private:
   930 	
   939     
   931     TBool   iVariableSize;      ///< Flag to indicat if we are dealing with a variable size volume
   940     TBool   iVariableSize;      ///< Flag to indicat if we are dealing with a variable size volume
   932     TInt    iBytesPerSector;    ///< Byte per sector of media
   941     TInt    iBytesPerSector;    ///< Byte per sector of media
   933     TInt    iSectorSizeLog2;    ///< Sector size in log2
   942     TInt    iSectorSizeLog2;    ///< Sector size in log2
   934     TInt    iNumberOfFats;      ///< Number of Fats the volume will contain
   943     TInt    iNumberOfFats;      ///< Number of Fats the volume will contain
   935     TInt    iReservedSectors;   ///< Number of reserved sectors in the volume
   944     TInt    iReservedSectors;   ///< Number of reserved sectors in the volume
   965     CDirCB* NewDirL() const;
   974     CDirCB* NewDirL() const;
   966     CFormatCB* NewFormatL() const;
   975     CFormatCB* NewFormatL() const;
   967     void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
   976     void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
   968     TInt DefaultPath(TDes& aPath) const;
   977     TInt DefaultPath(TDes& aPath) const;
   969     TBool IsExtensionSupported() const;
   978     TBool IsExtensionSupported() const;
   970 	TBool GetUseLocalTime() const;
   979     TBool GetUseLocalTime() const;
   971 	void SetUseLocalTime(TBool aFlag);
   980     void SetUseLocalTime(TBool aFlag);
   972 	TInt GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput);
   981     TInt GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput);
   973 protected:
   982 protected:
   974     CFatFileSystem();
   983     CFatFileSystem();
   975 	/**
   984     /**
   976 	If true, then local time will be used when writing timestamps to FS. When reading,
   985     If true, then local time will be used when writing timestamps to FS. When reading,
   977 	timestamps will be assumed local and converted back to UTC.
   986     timestamps will be assumed local and converted back to UTC.
   978 	At present, this behaviour will also be conditional upon a particular drive being logically removable.
   987     At present, this behaviour will also be conditional upon a particular drive being logically removable.
   979 	*/
   988     */
   980 	TBool iUseLocalTimeIfRemovable;
   989     TBool iUseLocalTimeIfRemovable;
   981     };
   990     };
   982 
   991 
   983 
   992 
   984 
   993 
   985 /**
   994 /**
   989 */
   998 */
   990 class LocaleUtils
   999 class LocaleUtils
   991 
  1000 
   992     {
  1001     {
   993 public:
  1002 public:
   994 	static void ConvertFromUnicodeL(TDes8& aForeign, const TDesC16& aUnicode, TFatUtilityFunctions::TOverflowAction aOverflowAction=TFatUtilityFunctions::EOverflowActionTruncate);
  1003     static void ConvertFromUnicodeL(TDes8& aForeign, const TDesC16& aUnicode, TFatUtilityFunctions::TOverflowAction aOverflowAction=TFatUtilityFunctions::EOverflowActionTruncate);
   995 	static void ConvertToUnicodeL(TDes16& aUnicode, const TDesC8& aForeign, TFatUtilityFunctions::TOverflowAction aOverflowAction=TFatUtilityFunctions::EOverflowActionTruncate);
  1004     static void ConvertToUnicodeL(TDes16& aUnicode, const TDesC8& aForeign, TFatUtilityFunctions::TOverflowAction aOverflowAction=TFatUtilityFunctions::EOverflowActionTruncate);
   996 	static TBool IsLegalShortNameCharacter(TUint aCharacter,TBool aUseExtendedChars=EFalse);
  1005     static TBool IsLegalShortNameCharacter(TUint aCharacter,TBool aUseExtendedChars=EFalse);
   997     };
  1006     };
   998 
  1007 
   999 //
  1008 //
  1000 
  1009 
  1001 TPtrC RemoveTrailingDots(const TDesC& aName);
  1010 TPtrC RemoveTrailingDots(const TDesC& aName);