Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/libi386/biosdisk.c
Show First 20 Lines • Show All 1,026 Lines • ▼ Show 20 Lines | bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, | ||||
if (dev->dd.d_dev->dv_type == DEVT_DISK) { | if (dev->dd.d_dev->dv_type == DEVT_DISK) { | ||||
if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks) == 0) { | if (disk_ioctl(dev, DIOCGMEDIASIZE, &disk_blocks) == 0) { | ||||
/* DIOCGMEDIASIZE does return bytes. */ | /* DIOCGMEDIASIZE does return bytes. */ | ||||
disk_blocks /= bd->bd_sectorsize; | disk_blocks /= bd->bd_sectorsize; | ||||
} | } | ||||
d_offset = dev->d_offset; | d_offset = dev->d_offset; | ||||
} | } | ||||
if (disk_blocks == 0) | if (disk_blocks == 0) | ||||
disk_blocks = bd->bd_sectors - d_offset; | disk_blocks = bd->bd_sectors * (bd->bd_sectorsize / | ||||
BIOSDISK_SECSIZE) - d_offset; | |||||
/* Validate source block address. */ | /* Validate source block address. */ | ||||
if (dblk < d_offset || dblk >= d_offset + disk_blocks) | if (dblk < d_offset || dblk >= d_offset + disk_blocks) | ||||
return (EIO); | return (EIO); | ||||
/* | /* | ||||
* Truncate if we are crossing disk or partition end. | * Truncate if we are crossing disk or partition end. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 356 Lines • Show Last 20 Lines |