Chameleon

Chameleon Commit Details

Date:2010-08-16 23:54:04 (10 years 3 months ago)
Author:Azimutz
Commit:368
Parents: 367
Message:Trunk it, rev 367.
Changes:
M/branches/azimutz/CleanCut/i386/libsaio/saio_types.h
M/branches/azimutz/CleanCut/i386/libsaio/msdos.c
M/branches/azimutz/CleanCut/i386/libsaio/disk.c

File differences

branches/azimutz/CleanCut/i386/libsaio/disk.c
7777
7878
7979
80
8180
8281
8382
......
16971696
16981697
16991698
1700
1699
17011700
17021701
17031702
#include "efi.h"
#include "efi_tables.h"
#define BPS 512 /* sector size of the device */
#define PROBEFS_SIZE BPS * 4 /* buffer size for filesystem probe */
#define CD_BPS 2048 /* CD-ROM block size */
#define N_CACHE_SECS (BIOS_LEN / BPS) /* Must be a multiple of 4 for CD-ROMs */
if(!p || !(*p)) return 0; // this volume must not be renamed, or option is malformed
p+= strlen(str); // skip the "hd(n,m) " field
// multiple aliases can be found separated by a semicolon
// multiple aliases can be found separated by a semicolon.
while(*p && *p != ';' && q<(szAlias+MAX_ALIAS_SIZE)) *q++=*p++;
*q='\0';
branches/azimutz/CleanCut/i386/libsaio/saio_types.h
147147
148148
149149
150
150151
151152
152153
char * i_buf; /* file load address */
};
#define BPS 512 /* sector size of the device */
#define F_READ 0x1 /* file opened for reading */
#define F_WRITE 0x2 /* file opened for writing */
#define F_ALLOC 0x4 /* buffer allocated */
branches/azimutz/CleanCut/i386/libsaio/msdos.c
5454
5555
5656
57
58
57
5958
6059
6160
......
152151
153152
154153
155
154
156155
157156
158157
......
222221
223222
224223
225
226
224
225
227226
228227
229228
230229
231230
232
231
233232
234
235
236
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
237250
238
239
240
241
242
243
251
244252
245253
246254
......
279287
280288
281289
282
290
291
283292
284293
285294
......
289298
290299
291300
292
301
293302
294303
295304
#include "msdos.h"
#define LABEL_LENGTH11
#define MAX_DOS_BLOCKSIZE2048
#define MAX_CACHE_BLOCKSIZE 32768
#define MSDOS_CACHE_BLOCKSIZE BPS * 2
#defineCLUST_FIRST2/* reserved cluster range */
#defineCLUST_RSRVD320x0ffffff8/* reserved cluster range */
if (msdoscurrent == ih)
{
CacheInit(ih, msdosclustersize);
CacheInit(ih, MSDOS_CACHE_BLOCKSIZE);
return 0;
}
msdosclustersize = msdosbps * spc;
msdoscurrent = ih;
CacheInit(ih, msdosclustersize);
CacheInit(ih, MSDOS_CACHE_BLOCKSIZE);
free (buf);
return 0;
}
static int
readSectorAligned(CICell ih, off_t readOffset, char *buf, int size)
readSector(CICell ih, off_t readOffset, char *buf, int size)
{
long long sectorOffset = (uint64_t)readOffset / msdosclustersize * msdosclustersize;
long relOffset = readOffset % msdosclustersize;
char *cacheBuffer;
// Caching only FAT entries (4 bytes) by utlizing the cache with sector aligned read requests.
if (size < BPS)
{
long long sectorOffset = (uint64_t)readOffset / BPS * BPS;
long relOffset = readOffset % BPS;
char *cacheBuffer;
cacheBuffer = malloc(MSDOS_CACHE_BLOCKSIZE);
CacheRead(ih, cacheBuffer, sectorOffset, MSDOS_CACHE_BLOCKSIZE, true);
bcopy(cacheBuffer + relOffset, buf, size);
free(cacheBuffer);
}
else
{
Seek(ih, readOffset);
Read(ih, (long)buf, size);
}
cacheBuffer = malloc(msdosclustersize);
CacheRead(ih, cacheBuffer, sectorOffset, msdosclustersize, true);
bcopy(cacheBuffer + relOffset, buf, size);
free(cacheBuffer);
return 0;
return 0;
}
static int
/* Read in "cluster" */
if (buf)
{
readSectorAligned(ih, readOffset, (char *)buf, size);
Seek(ih, readOffset);
Read(ih, (long)buf, size);
}
/* Find first sector of FAT */
readOffset += ((uint64_t)*cluster * (uint64_t)msdosfatbits) / 8;
/* Read one sector of the FAT */
readSectorAligned(ih, readOffset, tmpbuf, 4);
readSector(ih, readOffset, tmpbuf, 4);
switch (msdosfatbits) {
case 32:

Archive Download the corresponding diff file

Revision: 368