Index: branches/ErmaC/Enoch/i386/libsaio/exfat.c =================================================================== --- branches/ErmaC/Enoch/i386/libsaio/exfat.c (revision 2535) +++ branches/ErmaC/Enoch/i386/libsaio/exfat.c (revision 2536) @@ -227,7 +227,7 @@ #pragma mark - static -int FATCacheInit(void) +int FATCacheInit(int invalidate) { if (!gFATCacheBuffer) { @@ -236,8 +236,12 @@ { return -1; } + invalidate = 1; } - gCachedFATBlockAddress = INVALID_FAT_ADDRESS; + if (invalidate) + { + gCachedFATBlockAddress = INVALID_FAT_ADDRESS; + } return 0; } @@ -273,8 +277,11 @@ lcba = cluster >> shift; if (lcba != gCachedFATBlockAddress) { - Seek(gCurrentIH, (((long long) gFATOffset) << gBPSShift) + (((long long) lcba) << gBPCBShift)); - Read(gCurrentIH, (long) gFATCacheBuffer, CacheBlockSize()); + CacheRead(gCurrentIH, + (char*) gFATCacheBuffer, + (((long long) gFATOffset) << gBPSShift) + (((long long) lcba) << gBPCBShift), + CacheBlockSize(), + 1); gCachedFATBlockAddress = lcba; } lcba = cluster + 1; @@ -375,8 +382,11 @@ toRead = (uint16_t) (1 << (gBPCBShift - gBPSShift)); if (pIter->lsa + toRead > pIter->lsa_end) toRead = (uint16_t) (pIter->lsa_end - pIter->lsa); - Seek(gCurrentIH, (long long) (pIter->lsa << gBPSShift)); - Read(gCurrentIH, (long) pIter->buffer, ((long) toRead) << gBPSShift); + CacheRead(gCurrentIH, + (char*) pIter->buffer, + (long long) (pIter->lsa << gBPSShift), + ((uint32_t) toRead) << gBPSShift, + 1); pIter->lsa += toRead; pIter->entry_offset = 0; } @@ -630,7 +640,10 @@ if (!ih) return -1; if (gCurrentIH == ih) - return FATCacheInit(); + { + CacheInit(ih, CacheBlockSize()); + return FATCacheInit(0); + } buffer = (uint8_t*) malloc(BPS); if (!buffer) @@ -667,7 +680,8 @@ return -1; } - if (FATCacheInit() < 0) { + if (FATCacheInit(1) < 0) + { free(buffer); return -1; } @@ -685,6 +699,8 @@ gCurrentIH = ih; + CacheInit(ih, CacheBlockSize()); + free(buffer); return 0; } Index: branches/ErmaC/Enoch/CHANGES =================================================================== --- branches/ErmaC/Enoch/CHANGES (revision 2535) +++ branches/ErmaC/Enoch/CHANGES (revision 2536) @@ -1,3 +1,4 @@ +- Zenith432 : Use caching with ExFat filesystem - Zenith432 : Add turning off USB legacy for XHCI (XHCILegacyOff) - Zenith432 : saio_types.h, biosfn.c - minor typo in bios-defined data structure that isn't actually used. fake_efi.c - eliminate redundant scan of bt(0,0) in setupSmbiosConfigFile. loadConfigFile already does a fall-back scan of bt(0,0), so another scan isn't needed.