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 |
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 |
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); |
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); |
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); |
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); |