equal
deleted
inserted
replaced
118 { |
118 { |
119 ASSERT(0); |
119 ASSERT(0); |
120 User::Leave(KErrCorrupt); |
120 User::Leave(KErrCorrupt); |
121 } |
121 } |
122 |
122 |
123 iMaxFatEntries = aOwner->UsableClusters()+KFatFirstSearchCluster; //-- FAT[0] & FAT[1] are not in use |
|
124 |
|
125 //-- create FAT bit supercache if it is enabled in config |
123 //-- create FAT bit supercache if it is enabled in config |
126 ASSERT(!iBitCache); |
124 ASSERT(!iBitCache); |
127 if(aOwner->FatConfig().FAT32_UseBitSupercache()) |
125 if(aOwner->FatConfig().FAT32_UseBitSupercache()) |
128 { |
126 { |
129 iBitCache = CFatBitCache::New(*this); |
127 iBitCache = CFatBitCache::New(*this); |
305 */ |
303 */ |
306 TUint32 CFat32LruCache::ReadEntryL(TUint32 aIndex) |
304 TUint32 CFat32LruCache::ReadEntryL(TUint32 aIndex) |
307 { |
305 { |
308 // __PRINT1(_L("#-CFat32LruCache::ReadEntryL() FAT idx:%d"), aIndex); |
306 // __PRINT1(_L("#-CFat32LruCache::ReadEntryL() FAT idx:%d"), aIndex); |
309 |
307 |
310 ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat32EntrySzLog2)); |
308 ASSERT(FatIndexValid(aIndex)); |
311 |
309 |
312 //-- firstly try to locate required entry in cache |
310 //-- firstly try to locate required entry in cache |
313 TFat32Entry entry; |
311 TFat32Entry entry; |
314 if(ReadCachedEntryL(aIndex, entry)) |
312 if(ReadCachedEntryL(aIndex, entry)) |
315 return entry; //-- the requested entry found in cache |
313 return entry; //-- the requested entry found in cache |
333 */ |
331 */ |
334 void CFat32LruCache::WriteEntryL(TUint32 aIndex, TUint32 aEntry) |
332 void CFat32LruCache::WriteEntryL(TUint32 aIndex, TUint32 aEntry) |
335 { |
333 { |
336 //__PRINT2(_L("#-CFat32LruCache::WriteEntryL() FAT idx:%d, val:%d"), aIndex, aEntry); |
334 //__PRINT2(_L("#-CFat32LruCache::WriteEntryL() FAT idx:%d, val:%d"), aIndex, aEntry); |
337 |
335 |
338 ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat32EntrySzLog2)); |
336 ASSERT(FatIndexValid(aIndex)); |
339 |
337 |
340 SetDirty(ETrue); |
338 SetDirty(ETrue); |
341 |
339 |
342 //-- 1. try to locate entry in the cache and overwrite it there if it is cached |
340 //-- 1. try to locate entry in the cache and overwrite it there if it is cached |
343 if(WriteCachedEntryL(aIndex, aEntry)) |
341 if(WriteCachedEntryL(aIndex, aEntry)) |
455 @return always KErrNone |
453 @return always KErrNone |
456 */ |
454 */ |
457 TInt CFat32LruCache::InvalidateRegion(TUint32 aStartIndex, TUint32 aNumEntries) |
455 TInt CFat32LruCache::InvalidateRegion(TUint32 aStartIndex, TUint32 aNumEntries) |
458 { |
456 { |
459 __PRINT2(_L("#-CFat32LruCache::InvalidateRegion() startIndex:%d, entries:%d"),aStartIndex, aNumEntries); |
457 __PRINT2(_L("#-CFat32LruCache::InvalidateRegion() startIndex:%d, entries:%d"),aStartIndex, aNumEntries); |
460 ASSERT(aStartIndex >= KFatFirstSearchCluster && aStartIndex < (FatSize() >> KFat32EntrySzLog2)); |
458 ASSERT(FatIndexValid(aStartIndex)); |
|
459 ASSERT(FatIndexValid(aStartIndex+aNumEntries-1)); |
|
460 |
461 |
461 |
462 if(!aNumEntries) |
462 if(!aNumEntries) |
463 { |
463 { |
464 ASSERT(0); |
464 ASSERT(0); |
465 return KErrNone; |
465 return KErrNone; |
522 {//-- correct values if this is the first FAT sector; FAT[0] & FAT[1] are reserved |
522 {//-- correct values if this is the first FAT sector; FAT[0] & FAT[1] are reserved |
523 MinIdx += KFatFirstSearchCluster; |
523 MinIdx += KFatFirstSearchCluster; |
524 } |
524 } |
525 |
525 |
526 //-- actual number of usable FAT entries can be less than deducted from number of FAT sectors. |
526 //-- actual number of usable FAT entries can be less than deducted from number of FAT sectors. |
527 MaxIdx = Min(MaxIdx, iMaxFatEntries-1); |
527 MaxIdx = Min(MaxIdx, MaxFatEntries()-1); |
528 |
528 |
529 //-- look in both directions starting from the aFatEntryIndex |
529 //-- look in both directions starting from the aFatEntryIndex |
530 //-- but in one FAT cache page sector only |
530 //-- but in one FAT cache page sector only |
531 TBool canGoRight = ETrue; |
531 TBool canGoRight = ETrue; |
532 TBool canGoLeft = ETrue; |
532 TBool canGoLeft = ETrue; |