diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index dbfef16b9093..b00ae1589884 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: spec_vnops.c,v 1.58 2001/09/21 08:02:55 chs Exp $ */ +/* $NetBSD: spec_vnops.c,v 1.59 2001/09/23 04:39:25 chs Exp $ */ /* * Copyright (c) 1989, 1993 @@ -263,7 +263,7 @@ spec_read(v) struct proc *p = uio->uio_procp; struct buf *bp; daddr_t bn; - int bsize, bscale, ssize; + int bsize, bscale; struct partinfo dpart; int n, on, majordev; int (*ioctl) __P((dev_t, u_long, caddr_t, int, struct proc *)); @@ -291,7 +291,6 @@ spec_read(v) if (uio->uio_offset < 0) return (EINVAL); bsize = BLKDEV_IOSIZE; - ssize = DEV_BSIZE; if ((majordev = major(vp->v_rdev)) < nblkdev && (ioctl = bdevsw[majordev].d_ioctl) != NULL && (*ioctl)(vp->v_rdev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0) { @@ -299,12 +298,10 @@ spec_read(v) dpart.part->p_frag != 0 && dpart.part->p_fsize != 0) bsize = dpart.part->p_frag * dpart.part->p_fsize; - if (dpart.disklab->d_secsize != 0) - ssize = dpart.disklab->d_secsize; } - bscale = bsize / ssize; + bscale = bsize >> DEV_BSHIFT; do { - bn = (uio->uio_offset / ssize) &~ (bscale - 1); + bn = (uio->uio_offset >> DEV_BSHIFT) &~ (bscale - 1); on = uio->uio_offset % bsize; n = min((unsigned)(bsize - on), uio->uio_resid); error = bread(vp, bn, bsize, NOCRED, &bp); @@ -343,7 +340,7 @@ spec_write(v) struct proc *p = uio->uio_procp; struct buf *bp; daddr_t bn; - int bsize, bscale, ssize; + int bsize, bscale; struct partinfo dpart; int n, on, majordev; int (*ioctl) __P((dev_t, u_long, caddr_t, int, struct proc *)); @@ -371,7 +368,6 @@ spec_write(v) if (uio->uio_offset < 0) return (EINVAL); bsize = BLKDEV_IOSIZE; - ssize = DEV_BSIZE; if ((majordev = major(vp->v_rdev)) < nblkdev && (ioctl = bdevsw[majordev].d_ioctl) != NULL && (*ioctl)(vp->v_rdev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0) { @@ -379,12 +375,10 @@ spec_write(v) dpart.part->p_frag != 0 && dpart.part->p_fsize != 0) bsize = dpart.part->p_frag * dpart.part->p_fsize; - if (dpart.disklab->d_secsize != 0) - ssize = dpart.disklab->d_secsize; } - bscale = bsize / ssize; + bscale = bsize >> DEV_BSHIFT; do { - bn = (uio->uio_offset / ssize) &~ (bscale - 1); + bn = (uio->uio_offset >> DEV_BSHIFT) &~ (bscale - 1); on = uio->uio_offset % bsize; n = min((unsigned)(bsize - on), uio->uio_resid); if (n == bsize)