Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/scsipi try to dtrt for sector sizes <DEV_BSIZE (at l...



details:   https://anonhg.NetBSD.org/src/rev/6c021abf01f9
branches:  trunk
changeset: 481298:6c021abf01f9
user:      drochner <drochner%NetBSD.org@localhost>
date:      Tue Jan 25 20:42:33 2000 +0000

description:
try to dtrt for sector sizes <DEV_BSIZE (at least, don't divide by 0)

diffstat:

 sys/dev/scsipi/sd.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 46609c7c7f8a -r 6c021abf01f9 sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c       Tue Jan 25 20:19:14 2000 +0000
+++ b/sys/dev/scsipi/sd.c       Tue Jan 25 20:42:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sd.c,v 1.155 2000/01/21 23:40:00 thorpej Exp $ */
+/*     $NetBSD: sd.c,v 1.156 2000/01/25 20:42:33 drochner Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -694,7 +694,10 @@
                 * First, translate the block to absolute and put it in terms
                 * of the logical blocksize of the device.
                 */
-               blkno = bp->b_blkno / (lp->d_secsize / DEV_BSIZE);
+               if (lp->d_secsize >= DEV_BSIZE)
+                       blkno = bp->b_blkno / (lp->d_secsize / DEV_BSIZE);
+               else
+                       blkno = bp->b_blkno * (DEV_BSIZE / lp->d_secsize);
                if (SDPART(bp->b_dev) != RAW_PART) {
                        p = &lp->d_partitions[SDPART(bp->b_dev)];
                        blkno += p->p_offset;



Home | Main Index | Thread Index | Old Index