78 |
86 |
79 @param aEntry position on volume being queried |
87 @param aEntry position on volume being queried |
80 @return Whether Root dir position or not |
88 @return Whether Root dir position or not |
81 */ |
89 */ |
82 TBool CFatMountCB::IsRootDir(const TEntryPos &aEntry) const |
90 TBool CFatMountCB::IsRootDir(const TEntryPos &aEntry) const |
83 {return((aEntry.iCluster==0) ? (TBool)ETrue : (TBool)EFalse);} |
91 {return((aEntry.iCluster==0) ? (TBool)ETrue : (TBool)EFalse);} |
84 |
92 |
85 /** |
93 /** |
86 Indicates the root directory cluster, For Fat12/16 root is always indicated by cluster number zero |
94 Indicates the root directory cluster, For Fat12/16 root is always indicated by cluster number zero |
87 @return The root cluster indicator |
95 @return The root cluster indicator |
88 */ |
96 */ |
89 TInt CFatMountCB::RootIndicator() const |
97 TInt CFatMountCB::RootIndicator() const |
90 {return 0;} |
98 {return 0;} |
91 |
99 |
92 |
100 |
93 TBool CFatMountCB::Is16BitFat() const |
101 TBool CFatMountCB::Is16BitFat() const |
94 {return(iFatType == EFat16);} |
102 {return(iFatType == EFat16);} |
95 |
103 |
96 /** @return Log2 of cluster size on volume */ |
104 /** @return Log2 of cluster size on volume */ |
97 TInt CFatMountCB::ClusterSizeLog2() const |
105 TInt CFatMountCB::ClusterSizeLog2() const |
98 {return(iVolParam.ClusterSizeLog2());} |
106 {return(iVolParam.ClusterSizeLog2());} |
99 |
107 |
132 TUint32 CFatMountCB::FirstFatSector() const |
140 TUint32 CFatMountCB::FirstFatSector() const |
133 {return iVolParam.FirstFatSector();} |
141 {return iVolParam.FirstFatSector();} |
134 |
142 |
135 /** @return the byte offset of the Fat */ |
143 /** @return the byte offset of the Fat */ |
136 TInt CFatMountCB::StartOfFatInBytes() const |
144 TInt CFatMountCB::StartOfFatInBytes() const |
137 {return(FirstFatSector()<<SectorSizeLog2());} |
145 {return(FirstFatSector()<<SectorSizeLog2());} |
138 |
146 |
139 /** @return Number of Fats used by the volume */ |
147 /** @return Number of Fats used by the volume */ |
140 TInt CFatMountCB::NumberOfFats() const |
148 TInt CFatMountCB::NumberOfFats() const |
141 {return iVolParam.NumberOfFats();} |
149 {return iVolParam.NumberOfFats();} |
142 |
150 |
143 |
151 |
144 /** @return refrence to the fat table owned by the mount */ |
152 /** @return refrence to the fat table owned by the mount */ |
145 CFatTable& CFatMountCB::FAT() const |
153 CFatTable& CFatMountCB::FAT() const |
146 {return(*iFatTable);} |
154 {return(*iFatTable);} |
147 /** |
155 /** |
148 Returns a refrence to the file system object owned by the coresponding TDrive for a drive used for creating subsession objects |
156 Returns a refrence to the file system object owned by the coresponding TDrive for a drive used for creating subsession objects |
149 @return refrence to file system object |
157 @return refrence to file system object |
150 */ |
158 */ |
151 CFatFileSystem& CFatMountCB::FatFileSystem() const |
159 CFatFileSystem& CFatMountCB::FatFileSystem() const |
152 {return((CFatFileSystem&)Drive().FSys());} |
160 {return((CFatFileSystem&)Drive().FSys());} |
153 |
161 |
154 |
162 |
155 /** @return refrence to a raw disk object owned by the mount */ |
163 /** @return refrence to a raw disk object owned by the mount */ |
156 CRawDisk& CFatMountCB::RawDisk() const |
164 CRawDisk& CFatMountCB::RawDisk() const |
157 {return(*iRawDisk);} |
165 {return(*iRawDisk);} |
158 |
166 |
159 /** |
167 /** |
160 @return ETrue if aCluster value is bad cluster marker defined in FAT specification |
168 @return ETrue if aCluster value is bad cluster marker defined in FAT specification |
161 */ |
169 */ |
162 TBool CFatMountCB::IsBadCluster(TInt aCluster) const |
170 TBool CFatMountCB::IsBadCluster(TInt aCluster) const |
163 {return Is16BitFat() ? aCluster==0xFFF7 : aCluster==0xFF7;} |
171 {return Is16BitFat() ? aCluster==0xFFF7 : aCluster==0xFF7;} |
164 |
172 |
165 /** |
173 /** |
166 Returns whether the current mount is running as rugged Fat or not, this is held in the file system object |
174 Returns whether the current mount is running as rugged Fat or not, this is held in the file system object |
167 @return Is rugged fat flag |
175 @return Is rugged fat flag |
168 */ |
176 */ |
169 TBool CFatMountCB::IsRuggedFSys() const |
177 TBool CFatMountCB::IsRuggedFSys() const |
170 {return Drive().IsRugged();} |
178 {return Drive().IsRugged();} |
171 |
179 |
172 /** |
180 /** |
173 Sets the rugged flag in the file system object |
181 Sets the rugged flag in the file system object |
174 @param Flag to set or clear the rugged flag |
182 @param Flag to set or clear the rugged flag |
175 */ |
183 */ |
176 void CFatMountCB::SetRuggedFSys(TBool aVal) |
184 void CFatMountCB::SetRuggedFSys(TBool aVal) |
177 {Drive().SetRugged(aVal);} |
185 {Drive().SetRugged(aVal);} |
178 |
186 |
179 /** @return the usable clusters count for a volume */ |
187 /** @return the usable clusters count for a volume */ |
180 TUint32 CFatMountCB::UsableClusters() const |
188 TUint32 CFatMountCB::UsableClusters() const |
181 {return(iUsableClusters);} |
189 {return(iUsableClusters);} |
182 |
190 |
183 |
191 |
184 TUint CFatMountCB::StartOfRootDirInBytes() const |
192 TUint CFatMountCB::StartOfRootDirInBytes() const |
185 {return iVolParam.RootDirectorySector()<<SectorSizeLog2();} |
193 {return iVolParam.RootDirectorySector()<<SectorSizeLog2();} |
186 |
194 |
243 //--------------------------------------------------------------------------------------------------------------------------------- |
251 //--------------------------------------------------------------------------------------------------------------------------------- |
244 /** |
252 /** |
245 Check if the XFileCreationHelper object is initialised. |
253 Check if the XFileCreationHelper object is initialised. |
246 */ |
254 */ |
247 TBool CFatMountCB::XFileCreationHelper::IsInitialised() const |
255 TBool CFatMountCB::XFileCreationHelper::IsInitialised() const |
248 { |
256 { |
249 return isInitialised; |
257 return isInitialised; |
250 } |
258 } |
251 |
259 |
252 /** |
260 /** |
253 Get number of new entries for file creation. |
261 Get number of new entries for file creation. |
254 */ |
262 */ |
255 TUint16 CFatMountCB::XFileCreationHelper::NumOfAddingEntries() const |
263 TUint16 CFatMountCB::XFileCreationHelper::NumOfAddingEntries() const |
256 { |
264 { |
257 ASSERT(isInitialised); |
265 ASSERT(isInitialised); |
258 return iNumOfAddingEntries; |
266 return iNumOfAddingEntries; |
259 } |
267 } |
260 |
268 |
261 /** |
269 /** |
262 Get position of new entries for file creation. |
270 Get position of new entries for file creation. |
263 */ |
271 */ |
264 TEntryPos CFatMountCB::XFileCreationHelper::EntryAddingPos() const |
272 TEntryPos CFatMountCB::XFileCreationHelper::EntryAddingPos() const |
265 { |
273 { |
266 ASSERT(isInitialised); |
274 ASSERT(isInitialised); |
267 return iEntryAddingPos; |
275 return iEntryAddingPos; |
268 } |
276 } |
269 |
277 |
270 /** |
278 /** |
271 Check if position of new entries has been found. |
279 Check if position of new entries has been found. |
272 */ |
280 */ |
273 TBool CFatMountCB::XFileCreationHelper::IsNewEntryPosFound() const |
281 TBool CFatMountCB::XFileCreationHelper::IsNewEntryPosFound() const |
274 { |
282 { |
275 ASSERT(isInitialised); |
283 ASSERT(isInitialised); |
276 return isNewEntryPosFound; |
284 return isNewEntryPosFound; |
277 } |
285 } |
278 |
286 |
279 /** |
287 /** |
280 Check if file name of the new file is a legal dos name. |
288 Check if file name of the new file is a legal dos name. |
281 */ |
289 */ |
282 TBool CFatMountCB::XFileCreationHelper::IsTrgNameLegalDosName() const |
290 TBool CFatMountCB::XFileCreationHelper::IsTrgNameLegalDosName() const |
283 { |
291 { |
284 ASSERT(isInitialised); |
292 ASSERT(isInitialised); |
285 return isTrgNameLegalDosName; |
293 return isTrgNameLegalDosName; |
286 } |
294 } |
287 |
295 |
288 /** |
296 /** |
289 Set entry position for new entries to be added. |
297 Set entry position for new entries to be added. |
290 */ |
298 */ |
291 void CFatMountCB::XFileCreationHelper::SetEntryAddingPos(const TEntryPos& aEntryPos) |
299 void CFatMountCB::XFileCreationHelper::SetEntryAddingPos(const TEntryPos& aEntryPos) |
292 { |
300 { |
293 iEntryAddingPos = aEntryPos; |
301 iEntryAddingPos = aEntryPos; |
294 } |
302 } |
295 |
303 |
296 /** |
304 /** |
297 Set condition if position of new entries has been found. |
305 Set condition if position of new entries has been found. |
298 */ |
306 */ |
299 void CFatMountCB::XFileCreationHelper::SetIsNewEntryPosFound(TBool aFound) |
307 void CFatMountCB::XFileCreationHelper::SetIsNewEntryPosFound(TBool aFound) |
300 { |
308 { |
301 isNewEntryPosFound = aFound; |
309 isNewEntryPosFound = aFound; |
302 } |
310 } |
303 |
311 |
304 |
312 |
305 |
313 |
306 //------- debug methods |
314 //------- debug methods |
307 #ifdef _DEBUG |
315 #ifdef _DEBUG |
308 /** |
316 /** |
309 Debug function indicates whether write fails are active or not, for test |
317 Debug function indicates whether write fails are active or not, for test |
310 @return ETrue if write fails on or not |
318 @return ETrue if write fails on or not |
311 */ |
319 */ |
312 TBool CFatMountCB::IsWriteFail()const |
320 TBool CFatMountCB::IsWriteFail()const |
313 {return(iIsWriteFail);} |
321 {return(iIsWriteFail);} |
314 /** |
322 /** |
315 Switches write fails on or off, for test |
323 Switches write fails on or off, for test |
316 @param aIsWriteFail set true or false to set write fails on or off |
324 @param aIsWriteFail set true or false to set write fails on or off |
317 */ |
325 */ |
318 void CFatMountCB::SetWriteFail(TBool aIsWriteFail) |
326 void CFatMountCB::SetWriteFail(TBool aIsWriteFail) |
319 {iIsWriteFail=aIsWriteFail;} |
327 {iIsWriteFail=aIsWriteFail;} |
320 |
328 |
321 /** @return number of write fails to occur, for test */ |
329 /** @return number of write fails to occur, for test */ |
322 TInt CFatMountCB::WriteFailCount()const |
330 TInt CFatMountCB::WriteFailCount()const |
323 {return(iWriteFailCount);} |
331 {return(iWriteFailCount);} |
324 |
332 |
325 /** |
333 /** |
326 Set the number of Write fails |
334 Set the number of Write fails |
327 @param aFailCount number of write fails, for test |
335 @param aFailCount number of write fails, for test |
328 */ |
336 */ |
329 void CFatMountCB::SetWriteFailCount(TInt aFailCount) |
337 void CFatMountCB::SetWriteFailCount(TInt aFailCount) |
330 {iWriteFailCount=aFailCount;} |
338 {iWriteFailCount=aFailCount;} |
331 |
339 |
332 /** Decrement the number of write fails, for test */ |
340 /** Decrement the number of write fails, for test */ |
333 void CFatMountCB::DecWriteFailCount() |
341 void CFatMountCB::DecWriteFailCount() |
334 {--iWriteFailCount;} |
342 {--iWriteFailCount;} |
335 |
343 |
336 /** @return Error for a write failure, for test */ |
344 /** @return Error for a write failure, for test */ |
337 TInt CFatMountCB::WriteFailError()const |
345 TInt CFatMountCB::WriteFailError()const |
338 {return iWriteFailError;} |
346 {return iWriteFailError;} |
339 |
347 |
340 /** |
348 /** |
341 Set the write fail error code, for test |
349 Set the write fail error code, for test |
342 @param aErrorValue The Error for a write fails |
350 @param aErrorValue The Error for a write fails |
343 */ |
351 */ |
344 void CFatMountCB::SetWriteFailError(TInt aErrorValue) |
352 void CFatMountCB::SetWriteFailError(TInt aErrorValue) |
345 {iWriteFailError=aErrorValue;} |
353 {iWriteFailError=aErrorValue;} |
346 |
354 |
347 #endif |
355 #endif |
348 |
356 |
349 |
357 |
350 //--------------------------------------------------------------------------------------------------------------------------------- |
358 //--------------------------------------------------------------------------------------------------------------------------------- |
371 Returns the owning mount from file object |
379 Returns the owning mount from file object |
372 |
380 |
373 @return pointer to the owning mount object |
381 @return pointer to the owning mount object |
374 */ |
382 */ |
375 CFatMountCB& CFatFileCB::FatMount() const |
383 CFatMountCB& CFatFileCB::FatMount() const |
376 {return((CFatMountCB&)Mount());} |
384 {return((CFatMountCB&)Mount());} |
377 |
385 |
378 /** |
386 /** |
379 Returns the fat table used by the file system for this mount |
387 Returns the fat table used by the file system for this mount |
380 |
388 |
381 @return Refrence to the Fat table owned by the mount |
389 @return Refrence to the Fat table owned by the mount |
382 */ |
390 */ |
383 CFatTable& CFatFileCB::FAT() |
391 CFatTable& CFatFileCB::FAT() |
384 {return(FatMount().FAT());} |
392 {return(FatMount().FAT());} |
385 |
393 |
386 /** |
394 /** |
387 Position with in a cluster for a given address |
395 Position with in a cluster for a given address |
388 |
396 |
389 @param aPos Byte position |
397 @param aPos Byte position |
390 */ |
398 */ |
391 TInt CFatFileCB::ClusterRelativePos(TInt aPos) |
399 TInt CFatFileCB::ClusterRelativePos(TInt aPos) |
392 {return(FatMount().ClusterRelativePos(aPos));} |
400 {return(FatMount().ClusterRelativePos(aPos));} |
393 /** |
401 /** |
394 Returns Log2 of cluster size from mount |
402 Returns Log2 of cluster size from mount |
395 |
403 |
396 @return cluster size |
404 @return cluster size |
397 */ |
405 */ |
398 TInt CFatFileCB::ClusterSizeLog2() |
406 TInt CFatFileCB::ClusterSizeLog2() |
399 {return(FatMount().ClusterSizeLog2());} |
407 {return(FatMount().ClusterSizeLog2());} |
400 |
408 |
401 /* |
409 /* |
402 Note: this replaces SeekIndex() which was only used in sl_mnt |
410 Note: this replaces SeekIndex() which was only used in sl_mnt |
403 to verify whether the seek index had been created/initialised |
411 to verify whether the seek index had been created/initialised |
404 */ |
412 */ |