61 |
59 |
62 private: |
60 private: |
63 CMassStorageMountCB(const RArray<TInt>& aDriveMapping); |
61 CMassStorageMountCB(const RArray<TInt>& aDriveMapping); |
64 void WritePasswordData(); |
62 void WritePasswordData(); |
65 TInt DriveNumberToLun(TInt aDriveNumber); |
63 TInt DriveNumberToLun(TInt aDriveNumber); |
66 TBool ValidateBootSector(); |
|
67 TInt ReadBootSector(TFatBootSector& aBootSector); |
|
68 TInt DetermineFatType(TFatBootSector& aBootSector); |
|
69 TInt CheckDriveNumberL(); |
64 TInt CheckDriveNumberL(); |
70 |
65 |
71 private: |
66 private: |
72 TBool iIs16BitFat; |
|
73 TBool iIs32BitFat; |
|
74 const RArray<TInt>& iDriveMapping; |
67 const RArray<TInt>& iDriveMapping; |
75 }; |
68 }; |
76 |
69 |
77 const TInt KSizeOfFatBootSector = 90; |
|
78 const TInt KVendorIdSize = 8; |
|
79 const TInt KVolumeLabelSize = 11; |
|
80 const TInt KFileSysTypeSize = 8; |
|
81 const TInt KBootSectorSignature = 0xAA55; |
|
82 const TInt KSizeOfFatDirEntry = 32; |
|
83 |
|
84 /** |
|
85 Boot sector parameter block, enables access to all file system parameters. |
|
86 Data is populated at mount time from the BPB sector |
|
87 @internalTechnology |
|
88 */ |
|
89 class TFatBootSector |
|
90 { |
|
91 public: |
|
92 inline const TPtrC8 VendorId() const; |
|
93 inline TUint16 BytesPerSector() const; |
|
94 inline TInt SectorsPerCluster() const; |
|
95 inline TInt ReservedSectors() const; |
|
96 inline TInt NumberOfFats() const; |
|
97 inline TInt RootDirEntries() const; |
|
98 inline TInt TotalSectors() const; |
|
99 inline TUint8 MediaDescriptor() const; |
|
100 inline TInt FatSectors() const; |
|
101 inline TInt SectorsPerTrack() const; |
|
102 inline TInt NumberOfHeads() const; |
|
103 inline TInt HiddenSectors() const; |
|
104 inline TInt HugeSectors() const; |
|
105 inline TInt PhysicalDriveNumber() const; |
|
106 inline TInt ExtendedBootSignature() const; |
|
107 inline TUint32 UniqueID() const; |
|
108 inline const TPtrC8 VolumeLabel() const; |
|
109 inline const TPtrC8 FileSysType() const; |
|
110 inline TInt BootSectorSignature() const; |
|
111 inline void SetJumpInstruction(); |
|
112 inline void SetVendorID(const TDesC8& aDes); |
|
113 inline void SetBytesPerSector(TInt aBytesPerSector); |
|
114 inline void SetSectorsPerCluster(TInt aSectorsPerCluster); |
|
115 inline void SetReservedSectors(TInt aReservedSectors); |
|
116 inline void SetNumberOfFats(TInt aNumberOfFats); |
|
117 inline void SetRootDirEntries(TInt aRootDirEntries); |
|
118 inline void SetTotalSectors(TInt aTotalSectors); |
|
119 inline void SetMediaDescriptor(TUint8 aMediaDescriptor); |
|
120 inline void SetFatSectors(TInt aFatSectors); |
|
121 inline void SetSectorsPerTrack(TInt aSectorsPerTrack); |
|
122 inline void SetNumberOfHeads(TInt aNumberOfHeads); |
|
123 inline void SetHiddenSectors(TUint32 aHiddenSectors); |
|
124 inline void SetHugeSectors(TUint32 aTotalSectors); |
|
125 inline void SetPhysicalDriveNumber(TInt aPhysicalDriveNumber); |
|
126 inline void SetReservedByte(TUint8 aReservedByte); |
|
127 inline void SetExtendedBootSignature(TInt anExtendedBootSignature); |
|
128 inline void SetUniqueID(TUint32 anUniqueID); |
|
129 inline void SetVolumeLabel(const TDesC8& aDes); |
|
130 inline void SetFileSysType(const TDesC8& aDes); |
|
131 |
|
132 inline void SetFatSectors32(TUint32 aFatSectors32); |
|
133 inline void SetFATFlags(TUint16 aFATFlags); |
|
134 inline void SetVersionNumber(TUint16 aVersionNumber); |
|
135 inline void SetRootClusterNum(TUint32 aRootCusterNum); |
|
136 inline void SetFSInfoSectorNum(TUint16 aFSInfoSectorNum); |
|
137 inline void SetBkBootRecSector(TUint16 aBkBootRecSector); |
|
138 inline TUint32 FatSectors32() const; |
|
139 inline TUint16 FATFlags() const; |
|
140 inline TUint16 VersionNumber() const; |
|
141 inline TUint32 RootClusterNum() const; |
|
142 inline TUint16 FSInfoSectorNum() const; |
|
143 inline TUint16 BkBootRecSector() const; |
|
144 public: |
|
145 inline TBool Is16BitFat(); |
|
146 inline TBool Is32BitFat(); |
|
147 inline TInt FirstFatSectorPos(); |
|
148 inline TInt RootDirStartSector(); |
|
149 inline TInt FirstFreeSector(); |
|
150 public: |
|
151 /** |
|
152 Jump instruction used for bootable volumes |
|
153 */ |
|
154 TUint8 iJumpInstruction[3]; |
|
155 /** |
|
156 Vendor ID of the file system that formatted the volume |
|
157 */ |
|
158 TUint8 iVendorId[KVendorIdSize]; |
|
159 /** |
|
160 Bytes per sector |
|
161 */ |
|
162 TUint16 iBytesPerSector; |
|
163 /** |
|
164 Sectors per cluster ratio |
|
165 */ |
|
166 TUint8 iSectorsPerCluster; |
|
167 /** |
|
168 Number of reserved sectors on the volume |
|
169 */ |
|
170 TUint16 iReservedSectors; |
|
171 /** |
|
172 Number of Fats on the volume |
|
173 */ |
|
174 TUint8 iNumberOfFats; |
|
175 /** |
|
176 Number of entries allowed in the root directory, specific to Fat12/16, zero for FAT32 |
|
177 */ |
|
178 TUint16 iRootDirEntries; |
|
179 /** |
|
180 Total sectors on the volume, zero for FAT32 |
|
181 */ |
|
182 TUint16 iTotalSectors; |
|
183 /** |
|
184 Media descriptor |
|
185 */ |
|
186 TUint8 iMediaDescriptor; |
|
187 /** |
|
188 Sectors used for the Fat table, zero for FAT32 |
|
189 */ |
|
190 TUint16 iFatSectors; |
|
191 /** |
|
192 Sectors per track |
|
193 */ |
|
194 TUint16 iSectorsPerTrack; |
|
195 /** |
|
196 Number of heads |
|
197 */ |
|
198 TUint16 iNumberOfHeads; |
|
199 /** |
|
200 Number of hidden sectors in the volume |
|
201 */ |
|
202 TUint32 iHiddenSectors; |
|
203 /** |
|
204 Total sectors in the volume, Used if totalSectors > 65535 |
|
205 */ |
|
206 TUint32 iHugeSectors; |
|
207 |
|
208 /** |
|
209 Start of additional elements @ offset 36 for FAT32 |
|
210 Sectors in Fat table for 32 bit volume |
|
211 */ |
|
212 TUint32 iFatSectors32; |
|
213 /** |
|
214 Fat flags |
|
215 */ |
|
216 TUint16 iFATFlags; |
|
217 /** |
|
218 Version number of the file system |
|
219 */ |
|
220 TUint16 iVersionNumber; |
|
221 /** |
|
222 Cluster number of the root directory |
|
223 */ |
|
224 TUint32 iRootClusterNum; |
|
225 /** |
|
226 Sector number containing the FSIInfo structure |
|
227 */ |
|
228 TUint16 iFSInfoSectorNum; |
|
229 /** |
|
230 Backup boot sector |
|
231 */ |
|
232 TUint16 iBkBootRecSector; |
|
233 /** |
|
234 Reserved space |
|
235 End of Fat32 Only parameters section |
|
236 */ |
|
237 TUint8 iReserved2[12]; |
|
238 |
|
239 /** |
|
240 Physical drive number, not used in Symbian OS |
|
241 */ |
|
242 TUint8 iPhysicalDriveNumber; |
|
243 /** |
|
244 Reserved byte |
|
245 */ |
|
246 TUint8 iReserved; |
|
247 /** |
|
248 Extended boot signiture |
|
249 */ |
|
250 TUint8 iExtendedBootSignature; |
|
251 /** |
|
252 Unique volume ID |
|
253 */ |
|
254 TUint32 iUniqueID; |
|
255 /** |
|
256 The volume's label |
|
257 */ |
|
258 TUint8 iVolumeLabel[KVolumeLabelSize]; |
|
259 /** |
|
260 File system type |
|
261 */ |
|
262 TUint8 iFileSysType[KFileSysTypeSize]; |
|
263 }; |
|
264 |
|
265 #include "tfatbootsector.inl" |
|
266 |
70 |
267 #endif //__CMASSSTORAGEMOUNTCB_H__ |
71 #endif //__CMASSSTORAGEMOUNTCB_H__ |