equal
deleted
inserted
replaced
131 |
131 |
132 |
132 |
133 ComputeClusterSizeInBytes(); |
133 ComputeClusterSizeInBytes(); |
134 ComputeRootDirSectors(); |
134 ComputeRootDirSectors(); |
135 ComputeBytesPerSector(); |
135 ComputeBytesPerSector(); |
136 MessageHandler::ReportMessage (INFORMATION,BOOTSECTORCREATEMSG, const_cast<char *>("FAT16")); |
136 MessageHandler::ReportMessage (INFORMATION,BOOTSECTORCREATEMSG,"FAT16"); |
137 } |
137 } |
138 |
138 |
139 /** |
139 /** |
140 Writes the boot sector of a FAT 16 volume |
140 Writes the boot sector of a FAT 16 volume |
141 @param aOutPutStream handle to file stream |
141 @param aOutPutStream handle to file stream |
143 @internalComponent |
143 @internalComponent |
144 @released |
144 @released |
145 */ |
145 */ |
146 void CFat16FileSystem::WriteBootSector(ofstream& aOutPutStream) |
146 void CFat16FileSystem::WriteBootSector(ofstream& aOutPutStream) |
147 { |
147 { |
148 MessageHandler::ReportMessage (INFORMATION,BOOTSECTORWRITEMSG,const_cast<char *>("FAT16")); |
148 MessageHandler::ReportMessage (INFORMATION,BOOTSECTORWRITEMSG,"FAT16"); |
149 aOutPutStream.write(reinterpret_cast<char*>(&iData[0]),iFAT16BootSector.BytesPerSector()); |
149 aOutPutStream.write(reinterpret_cast<char*>(&iData[0]),iFAT16BootSector.BytesPerSector()); |
150 aOutPutStream.flush(); |
150 aOutPutStream.flush(); |
151 } |
151 } |
152 /** |
152 /** |
153 Creates the FAT Table |
153 Creates the FAT Table |
194 { |
194 { |
195 // Each FAT16 entries occupies 2 bytes, hence multiply by 2 |
195 // Each FAT16 entries occupies 2 bytes, hence multiply by 2 |
196 aFatString.append((totalFatEntries - clusterCounter)*2, 0); |
196 aFatString.append((totalFatEntries - clusterCounter)*2, 0); |
197 } |
197 } |
198 |
198 |
199 MessageHandler::ReportMessage (INFORMATION,FATTABLEWRITEMSG,const_cast<char *>("FAT16")); |
199 MessageHandler::ReportMessage (INFORMATION,FATTABLEWRITEMSG,"FAT16"); |
200 |
200 |
201 // Write FAT table multiple times depending upon the No of FATS set. |
201 // Write FAT table multiple times depending upon the No of FATS set. |
202 unsigned int noOfFats = iFAT16BootSector.NumberOfFats(); |
202 unsigned int noOfFats = iFAT16BootSector.NumberOfFats(); |
203 for(unsigned int i=0; i<noOfFats; i++) |
203 for(unsigned int i=0; i<noOfFats; i++) |
204 { |
204 { |
256 ((iFAT16BootSector.NumberOfFats() * iFAT16BootSector.FatSectors()) + |
256 ((iFAT16BootSector.NumberOfFats() * iFAT16BootSector.FatSectors()) + |
257 iRootDirSectors + iFAT16BootSector.ReservedSectors()); |
257 iRootDirSectors + iFAT16BootSector.ReservedSectors()); |
258 iTotalClusters = iTotalDataSectors / iFAT16BootSector.SectorsPerCluster(); |
258 iTotalClusters = iTotalDataSectors / iFAT16BootSector.SectorsPerCluster(); |
259 if(iTotalClusters < KMinimumFat16Clusters) |
259 if(iTotalClusters < KMinimumFat16Clusters) |
260 { |
260 { |
261 throw ErrorHandler(BOOTSECTORERROR, |
261 throw ErrorHandler(BOOTSECTORERROR,"Low Partition Size",__FILE__,__LINE__); |
262 const_cast<char *>("Low Partition Size"), |
|
263 const_cast<char *>(__FILE__),__LINE__); |
|
264 } |
262 } |
265 if(iTotalClusters > KMaximumFat16Clusters) |
263 if(iTotalClusters > KMaximumFat16Clusters) |
266 { |
264 { |
267 throw ErrorHandler(BOOTSECTORERROR, |
265 throw ErrorHandler(BOOTSECTORERROR,"High Partition Size",__FILE__,__LINE__); |
268 const_cast<char *>("High Partition Size"), |
|
269 const_cast<char *>(__FILE__),__LINE__); |
|
270 } |
266 } |
271 |
267 |
272 } |
268 } |
273 |
269 |
274 /** |
270 /** |
315 on heap. |
311 on heap. |
316 */ |
312 */ |
317 catch(...) |
313 catch(...) |
318 { |
314 { |
319 delete dirRegionPtr; |
315 delete dirRegionPtr; |
320 throw ErrorHandler(UNKNOWNERROR, const_cast<char *>(__FILE__), __LINE__); |
316 throw ErrorHandler(UNKNOWNERROR,__FILE__,__LINE__); |
321 } |
317 } |
322 } |
318 } |