diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-05 21:56:05 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-05 21:56:05 +0000 |
commit | 1787be53ace76bc6ac756a0f83d01a083614bb99 (patch) | |
tree | 425d7c6a1ae18bb17e305b60529b460252945177 /sys/arch/arc | |
parent | 613db4b623ad519060cdca0aaba6cc9b87428700 (diff) |
correct DEV_BSIZE vs lp->d_secsize confusion; spotted by hte late night icb gang. Other ports need fixing still
Diffstat (limited to 'sys/arch/arc')
-rw-r--r-- | sys/arch/arc/arc/disksubr.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/arch/arc/arc/disksubr.c b/sys/arch/arc/arc/disksubr.c index 6472fe44dd1..105ba2c8acc 100644 --- a/sys/arch/arc/arc/disksubr.c +++ b/sys/arch/arc/arc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.8 1997/01/24 11:17:12 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.9 1997/04/05 21:56:04 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -412,12 +412,12 @@ bounds_check_with_label(bp, lp, wlabel) { struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); int labelsector = lp->d_partitions[RAW_PART].p_offset + LABELSECTOR; - int sz; + int sz = howmany(bp->b_bcount, DEV_BSIZE); - sz = howmany(bp->b_bcount, lp->d_secsize); +#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) - if (bp->b_blkno + sz > p->p_size) { - sz = p->p_size - bp->b_blkno; + if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) { + sz = blockpersec(p->p_size, lp) - bp->b_blkno; if (sz == 0) { /* If exactly at end of disk, return EOF. */ bp->b_resid = bp->b_bcount; @@ -433,9 +433,9 @@ bounds_check_with_label(bp, lp, wlabel) } /* Overwriting disk label? */ - if (bp->b_blkno + p->p_offset <= labelsector && + if (bp->b_blkno + blockpersec(p->p_offset, lp) <= labelsector && #if LABELSECTOR != 0 - bp->b_blkno + p->p_offset + sz > labelsector && + bp->b_blkno + blockpersec(p->p_offset, lp) + sz > labelsector && #endif (bp->b_flags & B_READ) == 0 && !wlabel) { bp->b_error = EROFS; @@ -443,8 +443,8 @@ bounds_check_with_label(bp, lp, wlabel) } /* calculate cylinder for disksort to order transfers with */ - bp->b_cylin = (bp->b_blkno + p->p_offset) / - (lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl; + bp->b_cylin = (bp->b_blkno + blockpersec(p->p_offset, lp)) / + lp->d_secpercyl; return (1); bad: |