static int readBytes( int biosdev, unsigned int blkno, unsigned int byteCount, void * buffer ) { char * cbuf = (char *) buffer; int error; int copy_len; DEBUG_DISK(("%s: dev %x block %x [%d] -> 0x%x...", __FUNCTION__, biosdev, blkno, byteCount, (unsigned)cbuf)); for ( ; byteCount; cbuf += BPS, blkno++ ) { error = Biosread( biosdev, blkno ); if ( error ) { DEBUG_DISK(("error\n")); return (-1); } copy_len = (byteCount > BPS) ? BPS : byteCount; bcopy( biosbuf, cbuf, copy_len ); byteCount -= copy_len; } DEBUG_DISK(("done\n")); return 0; }
static int readBytes(int biosdev, unsigned long long blkno, unsigned int byteoff, unsigned int byteCount, void * buffer) { #if RAMDISK_SUPPORT // ramdisks require completely different code for reading. if (p_ramdiskReadBytes != NULL && biosdev >= 0x100) { return (*p_ramdiskReadBytes)(biosdev, blkno, byteoff, byteCount, buffer); } #endif char * cbuf = (char *) buffer; int error; int copy_len; // _DISK_DEBUG_DUMP("%s: dev %x block %x [%d] -> 0x%x...", __FUNCTION__, biosdev, blkno, byteCount, (unsigned)cbuf); for (; byteCount; cbuf += copy_len, blkno++) { error = Biosread(biosdev, blkno); if (error) { _DISK_DEBUG_DUMP(("error\n")); return (-1); } copy_len = ((byteCount + byteoff) > BPS) ? (BPS - byteoff) : byteCount; bcopy( biosbuf + byteoff, cbuf, copy_len ); byteCount -= copy_len; byteoff = 0; } // _DISK_DEBUG_DUMP(("done\n")); return 0; }
int testBiosread(int biosdev, unsigned long long secno) { return Biosread(biosdev, secno); }