static CICell msdoscurrent = 0;␊ |
static int msdosrootcluster = 0;␊ |
static int msdosfatbits = 0;␊ |
static int msdosCacheBlockSize = 0;␊ |
␊ |
#if UNUSED␊ |
/*␊ |
|
␉␊ |
␉if (msdoscurrent == ih)␊ |
␉{␊ |
␉␉CacheInit(ih, msdosCacheBlockSize);␊ |
␉␉CacheInit(ih, msdosclustersize);␊ |
␉␉return 0;␊ |
␉}␊ |
␉␊ |
|
␉msdosclustersize = msdosbps * spc;␊ |
␉msdoscurrent = ih;␊ |
␉␊ |
␉msdosCacheBlockSize = (msdosclustersize > MAX_CACHE_BLOCKSIZE) ? msdosclustersize : MAX_CACHE_BLOCKSIZE;␊ |
␉CacheInit(ih, msdosCacheBlockSize);␊ |
␉CacheInit(ih, msdosclustersize);␊ |
␉free (buf);␊ |
␉return 0;␊ |
}␊ |
|
static int␊ |
readSectorAligned(CICell ih, off_t readOffset, char *buf, int size)␊ |
{␊ |
long long sectorOffset = (uint64_t)readOffset / msdosCacheBlockSize * msdosCacheBlockSize;␊ |
long relOffset = readOffset % msdosCacheBlockSize;␊ |
long long sectorOffset = (uint64_t)readOffset / msdosclustersize * msdosclustersize;␊ |
long relOffset = readOffset % msdosclustersize;␊ |
char *cacheBuffer;␊ |
␊ |
cacheBuffer = malloc(msdosCacheBlockSize);␊ |
CacheRead(ih, cacheBuffer, sectorOffset, msdosCacheBlockSize, true);␊ |
cacheBuffer = malloc(msdosclustersize);␊ |
CacheRead(ih, cacheBuffer, sectorOffset, msdosclustersize, true);␊ |
bcopy(cacheBuffer + relOffset, buf, size);␊ |
free(cacheBuffer);␊ |
␊ |