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_SCANDRV_H |
32 #ifndef SL_SCANDRV_H |
24 #define SL_SCANDRV_H |
33 #define SL_SCANDRV_H |
25 |
34 |
26 //--------------------------------------------------------------------------------------------------------------------------------- |
35 //--------------------------------------------------------------------------------------------------------------------------------- |
27 |
36 |
28 const TInt KMaxMatchingEntries = 2; ///< Maximum number of matching directory entries scan drive can fix. Any more indicates a fault in the file system |
37 const TInt KMaxMatchingEntries = 2; ///< Maximum number of matching directory entries scan drive can fix. Any more indicates a fault in the file system |
29 const TInt KMaxArrayDepth = 6; ///< Maximum array depth for cluster storage when KMaxScanDepth is reached |
38 const TInt KMaxArrayDepth = 6; ///< Maximum array depth for cluster storage when KMaxScanDepth is reached |
30 |
39 |
31 //--------------------------------------------------------------------------------------------------------------------------------- |
40 //--------------------------------------------------------------------------------------------------------------------------------- |
32 |
41 |
33 /** |
42 /** |
34 Data structure used to store the location of a partial VFat entry |
43 Data structure used to store the location of a partial VFat entry |
35 */ |
44 */ |
36 struct TPartVFatEntry |
45 struct TPartVFatEntry |
37 { |
46 { |
38 TEntryPos iEntryPos; ///< The position of the partial VFat entry |
47 TEntryPos iEntryPos; ///< The position of the partial VFat entry |
39 TFatDirEntry iEntry; ///< The Dos entry The VFat entries belong with |
48 TFatDirEntry iEntry; ///< The Dos entry The VFat entries belong with |
40 }; |
49 }; |
41 |
50 |
42 //--------------------------------------------------------------------------------------------------------------------------------- |
51 //--------------------------------------------------------------------------------------------------------------------------------- |
43 |
52 |
44 /** |
53 /** |
45 Data structure used to store the locations of entries with matching |
54 Data structure used to store the locations of entries with matching |
46 start cluster numbers. |
55 start cluster numbers. |
47 */ |
56 */ |
48 struct TMatchingStartCluster |
57 struct TMatchingStartCluster |
49 { |
58 { |
50 TEntryPos iEntries[KMaxMatchingEntries]; ///< The positions of the matching entries |
59 TEntryPos iEntries[KMaxMatchingEntries]; ///< The positions of the matching entries |
51 TInt iCount; ///< Count of matching entries |
60 TInt iCount; ///< Count of matching entries |
52 TInt iStartCluster; ///< The matching cluster number found in more than one entry |
61 TInt iStartCluster; ///< The matching cluster number found in more than one entry |
53 }; |
62 }; |
54 |
63 |
55 |
64 |
56 //--------------------------------------------------------------------------------------------------------------------------------- |
65 //--------------------------------------------------------------------------------------------------------------------------------- |
57 |
66 |
58 class CCheckFatTable : public CBase |
67 class CCheckFatTable : public CBase |
59 { |
68 { |
60 public: |
69 public: |
61 static CCheckFatTable* NewL(CFatMountCB* aOwner); |
70 static CCheckFatTable* NewL(CFatMountCB* aOwner); |
62 CCheckFatTable(CFatMountCB* aOwner); |
71 CCheckFatTable(CFatMountCB* aOwner); |
63 ~CCheckFatTable(); |
72 ~CCheckFatTable(); |
64 void InitializeL(); |
73 void InitializeL(); |
65 TBool FlushL(); |
74 TBool FlushL(); |
66 TBool GetNextClusterL(TInt& aCluster) const; |
75 TBool GetNextClusterL(TInt& aCluster) const; |
67 void WriteFatEntryEofFL(TInt aCluster); |
76 void WriteFatEntryEofFL(TInt aCluster); |
68 TInt ReadL(TInt aFatIndex) const; |
77 TInt ReadL(TInt aFatIndex) const; |
69 void WriteL(TInt aFatIndex,TInt aValue); |
78 void WriteL(TInt aFatIndex,TInt aValue); |
70 private: |
79 private: |
71 void WriteMediaDescriptor(); |
80 void WriteMediaDescriptor(); |
72 TInt PosInBytes(TInt aFatIndex) const; |
81 TInt PosInBytes(TInt aFatIndex) const; |
73 TInt PosInIndex(TInt aBytePos) const; |
82 TInt PosInIndex(TInt aBytePos) const; |
74 inline TBool IsEof16Bit(TInt aCluster) const; |
83 inline TBool IsEof16Bit(TInt aCluster) const; |
75 inline TBool IsEof12Bit(TInt aCluster) const; |
84 inline TBool IsEof12Bit(TInt aCluster) const; |
76 inline TInt MaxFatIndex() const; |
85 inline TInt MaxFatIndex() const; |
77 protected: |
86 protected: |
78 TInt iMaxFatIndex; |
87 TInt iMaxFatIndex; |
79 TUint8* iCheckFat; |
88 TUint8* iCheckFat; |
80 CFatMountCB* iOwner; |
89 CFatMountCB* iOwner; |
81 }; |
90 }; |
82 |
91 |
83 |
92 |
84 //--------------------------------------------------------------------------------------------------------------------------------- |
93 //--------------------------------------------------------------------------------------------------------------------------------- |
85 |
94 |
86 /** |
95 /** |
87 Scan drive class performs scan drive functionality on all types |
96 Scan drive class performs scan drive functionality on all types |
88 of fat volume. |
97 of fat volume. |
89 */ |
98 */ |
90 class CScanDrive : public CBase |
99 class CScanDrive : public CBase |
91 { |
100 { |
92 public: |
101 public: |
93 enum TDirError{EScanMatchingEntry=1,EScanPartEntry}; |
102 enum TDirError{EScanMatchingEntry=1,EScanPartEntry}; |
94 public: |
103 public: |
95 CScanDrive(); |
104 CScanDrive(); |
96 ~CScanDrive(); |
105 ~CScanDrive(); |
97 static CScanDrive* NewL(CFatMountCB* aMount); |
106 static CScanDrive* NewL(CFatMountCB* aMount); |
98 void ConstructL(CFatMountCB* aMount); |
107 void ConstructL(CFatMountCB* aMount); |
99 TInt StartL(); |
108 TInt StartL(); |
100 TBool ProblemsDiscovered() const; |
109 TBool ProblemsDiscovered() const; |
101 |
110 |
102 |
111 |
103 private: |
112 private: |
104 |
113 |
105 #if defined(DEBUG_SCANDRIVE) |
114 #if defined(DEBUG_SCANDRIVE) |
106 void PrintErrors(); |
115 void PrintErrors(); |
107 void CompareFatsL() const; |
116 void CompareFatsL() const; |
108 #endif |
117 #endif |
109 |
118 |
110 void FixupDirErrorL(); |
119 void FixupDirErrorL(); |
111 void FindSameStartClusterL(); |
120 void FindSameStartClusterL(); |
112 TInt FindStartClusterL(TInt aDirCluster); |
121 TInt FindStartClusterL(TInt aDirCluster); |
113 void CheckDirStructureL(); |
122 void CheckDirStructureL(); |
114 void CheckDirL(TInt aCluster); |
123 void CheckDirL(TInt aCluster); |
115 void ProcessEntryL(const TFatDirEntry& aEntry); |
124 void ProcessEntryL(const TFatDirEntry& aEntry); |
116 TInt CheckEntryClusterL(const TFatDirEntry& aEntry, const TEntryPos& aEntryPos); |
125 TInt CheckEntryClusterL(const TFatDirEntry& aEntry, const TEntryPos& aEntryPos); |
117 void WriteClusterChainL(TInt aCluster,TInt aSizeInBytes); |
126 void WriteClusterChainL(TInt aCluster,TInt aSizeInBytes); |
118 TBool MoveToVFatEndL(TEntryPos& aPos,TFatDirEntry& aEntry,TInt& aDirLength); |
127 TBool MoveToVFatEndL(TEntryPos& aPos,TFatDirEntry& aEntry,TInt& aDirLength); |
119 TBool IsValidVFatEntry(const TFatDirEntry& aEntry,TInt prevNum)const; |
128 TBool IsValidVFatEntry(const TFatDirEntry& aEntry,TInt prevNum)const; |
120 TBool IsDosEntry(const TFatDirEntry& aEntry)const; |
129 TBool IsDosEntry(const TFatDirEntry& aEntry)const; |
121 void AddPartialVFatL(const TEntryPos& aStartPos, const TFatDirEntry& aEntry); |
130 void AddPartialVFatL(const TEntryPos& aStartPos, const TFatDirEntry& aEntry); |
122 TBool AddMatchingEntryL(const TEntryPos& aEntryPos); |
131 TBool AddMatchingEntryL(const TEntryPos& aEntryPos); |
123 TInt GetReservedidL(const TEntryPos aVFatPos); |
132 TInt GetReservedidL(const TEntryPos aVFatPos); |
124 void WriteNewFatsL(); |
133 void WriteNewFatsL(); |
125 void FixPartEntryL(); |
134 void FixPartEntryL(); |
126 void FixMatchingEntryL(); |
135 void FixMatchingEntryL(); |
127 void MovePastEntriesL(TEntryPos& aEntryPos,TFatDirEntry& aEntry,TInt aToMove,TInt& aDirEntries); |
136 void MovePastEntriesL(TEntryPos& aEntryPos,TFatDirEntry& aEntry,TInt aToMove,TInt& aDirEntries); |
128 void AddToClusterListL(TInt aCluster); |
137 void AddToClusterListL(TInt aCluster); |
129 inline TBool AlreadyExistsL(TInt aCluster)const; |
138 inline TBool AlreadyExistsL(TInt aCluster)const; |
130 inline TBool IsEndOfRootDir(const TEntryPos& aPos)const; |
139 inline TBool IsEndOfRootDir(const TEntryPos& aPos)const; |
131 inline TBool IsEofF(TInt aVal)const; |
140 inline TBool IsEofF(TInt aVal)const; |
132 inline TBool IsDirError()const; |
141 inline TBool IsDirError()const; |
133 void IndicateErrorsFound(); |
142 void IndicateErrorsFound(); |
134 |
143 |
135 private: |
144 private: |
136 CFatMountCB* iMount; |
145 CFatMountCB* iMount; |
137 CCheckFatTable* iNewFat; |
146 CCheckFatTable* iNewFat; |
138 TPartVFatEntry iPartEntry; |
147 TPartVFatEntry iPartEntry; |
139 TMatchingStartCluster iMatching; |
148 TMatchingStartCluster iMatching; |
140 TDirError iDirError; |
149 TDirError iDirError; |
141 TInt iDirsChecked; |
150 TInt iDirsChecked; |
142 TInt iRecursiveDepth; |
151 TInt iRecursiveDepth; |
143 RArray<TInt>* iClusterListArray[KMaxArrayDepth]; |
152 RArray<TInt>* iClusterListArray[KMaxArrayDepth]; |
144 TInt iListArrayIndex; |
153 TInt iListArrayIndex; |
145 TBool iFoundProblems; ///< if ETrue after finish, it means that there where some problems FS structure and they were probably fixed; |
154 TBool iFoundProblems; ///< if ETrue after finish, it means that there where some problems FS structure and they were probably fixed; |
146 }; |
155 }; |
147 |
156 |
148 |
157 |
149 |
158 |
150 |
159 |
151 |
160 |