*
* @APPLE_LICENSE_HEADER_START@
*
* The contents of this file constitute Original Code as defined in and
*
* @APPLE_LICENSE_HEADER_START@
*
* The contents of this file constitute Original Code as defined in and
* "License"). You may not use this file except in compliance with the
* License. Please obtain a copy of the License at
* http://www.apple.com/publicsource and read it before using this file.
* "License"). You may not use this file except in compliance with the
* License. Please obtain a copy of the License at
* http://www.apple.com/publicsource and read it before using this file.
unsigned long gCacheHits;
unsigned long gCacheMisses;
unsigned long gCacheEvicts;
unsigned long gCacheHits;
unsigned long gCacheMisses;
unsigned long gCacheEvicts;
long CacheRead( CICell ih, char * buffer, long long offset,
long length, long cache )
{
long CacheRead( CICell ih, char * buffer, long long offset,
long length, long cache )
{
- long cnt, oldestEntry = 0, oldestTime, loadCache = 0;
- CacheEntry *entry;
+ long cnt, oldestEntry = 0, oldestTime, loadCache = 0;
+ CacheEntry *entry;
// If the data was found copy it to the caller.
if (cnt != gCacheNumEntries) {
bcopy(gCacheBuffer + cnt * gCacheBlockSize, buffer, gCacheBlockSize);
// If the data was found copy it to the caller.
if (cnt != gCacheNumEntries) {
bcopy(gCacheBuffer + cnt * gCacheBlockSize, buffer, gCacheBlockSize);
// Read the data from the disk.
Seek(ih, offset);
Read(ih, (long)buffer, length);
// Read the data from the disk.
Seek(ih, offset);
Read(ih, (long)buffer, length);
// If no free entry was found, use the oldest.
if (cnt == gCacheNumEntries) {
cnt = oldestEntry;
// If no free entry was found, use the oldest.
if (cnt == gCacheNumEntries) {
cnt = oldestEntry;