diff options
author | phk <phk@FreeBSD.org> | 2003-10-18 17:51:26 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-10-18 17:51:26 +0000 |
commit | 5a1c5c9c133e6203cc6a02b83c76730842c39948 (patch) | |
tree | 6dd8b4e0842295c60c66ee9264f9a862629057b3 /sys/isa | |
parent | 42120d22ead76258f3a3435c06d03782daa9d7ad (diff) | |
download | FreeBSD-src-5a1c5c9c133e6203cc6a02b83c76730842c39948.zip FreeBSD-src-5a1c5c9c133e6203cc6a02b83c76730842c39948.tar.gz |
Eliminate use bio_blkno.
Diffstat (limited to 'sys/isa')
-rw-r--r-- | sys/isa/fd.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 8699bb8..0c0d59c 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -1707,10 +1707,10 @@ fdstrategy(struct bio *bp) bp->bio_flags |= BIO_ERROR; goto bad; } - if (bp->bio_blkno < 0) { + if (bp->bio_offset < 0) { printf( - "fd%d: fdstrat: bad request blkno = %lu, bcount = %ld\n", - fdu, (u_long)bp->bio_blkno, bp->bio_bcount); + "fd%d: fdstrat: bad request offset = %ju, bcount = %ld\n", + fdu, (intmax_t)bp->bio_offset, bp->bio_bcount); bp->bio_error = EINVAL; bp->bio_flags |= BIO_ERROR; goto bad; @@ -1725,16 +1725,12 @@ fdstrategy(struct bio *bp) /* * Set up block calculations. */ - if (bp->bio_blkno > 20000000) { - /* - * Reject unreasonably high block number, prevent the - * multiplication below from overflowing. - */ + if (bp->bio_offset >= ((off_t)128 << fd->ft->secsize) * fd->ft->size) { bp->bio_error = EINVAL; bp->bio_flags |= BIO_ERROR; goto bad; } - blknum = bp->bio_blkno * DEV_BSIZE / fdblk; + blknum = bp->bio_offset / fdblk; nblocks = fd->ft->size; if (blknum + bp->bio_bcount / fdblk > nblocks) { if (blknum >= nblocks) { @@ -2593,23 +2589,21 @@ fdmisccmd(dev_t dev, u_int cmd, void *data) bp = malloc(sizeof(struct bio), M_TEMP, M_WAITOK | M_ZERO); /* - * Set up a bio request for fdstrategy(). bio_blkno is faked + * Set up a bio request for fdstrategy(). bio_offset is faked * so that fdstrategy() will seek to the the requested * cylinder, and use the desired head. */ bp->bio_cmd = cmd; if (cmd == FDBIO_FORMAT) { - bp->bio_blkno = + bp->bio_offset = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads) + - finfo->head * fd->ft->sectrac) * - fdblk / DEV_BSIZE; + finfo->head * fd->ft->sectrac) * fdblk; bp->bio_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs; } else if (cmd == FDBIO_RDSECTID) { - bp->bio_blkno = + bp->bio_offset = (idfield->cyl * (fd->ft->sectrac * fd->ft->heads) + - idfield->head * fd->ft->sectrac) * - fdblk / DEV_BSIZE; + idfield->head * fd->ft->sectrac) * fdblk; bp->bio_bcount = sizeof(struct fdc_readid); } else panic("wrong cmd in fdmisccmd()"); |