From 2d5908293e194e265c75dfc50c2bdf2170c45fba Mon Sep 17 00:00:00 2001 From: mjacob Date: Sat, 3 Jul 1999 21:14:45 +0000 Subject: Make the change similar to that suggested by Nick Hibma to avoid divide by zero traps. I actually can't believe that this compiler is *sooooo* stupid that it did a divide when there was 1024L*1024L instead of a right shift by 20. When we get quad type modifiers in kernel printf we can change to this too (to avoid overflow on > terabyte disk sizes). --- sys/cam/scsi/scsi_da.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/cam') diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index a8b8541..3369109 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_da.c,v 1.26 1999/05/30 16:51:02 phk Exp $ + * $Id: scsi_da.c,v 1.27 1999/05/31 11:24:02 phk Exp $ */ #include "opt_hw_wdog.h" @@ -1310,8 +1310,9 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) dasetgeom(periph, rdcap); dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), - "%ldMB (%d %d byte sectors: %dH %dS/T %dC)", - dp->sectors / ((1024L * 1024L) / dp->secsize), + "%luMB (%u %u byte sectors: %dH %dS/T %dC)", + (((unsigned long) dp->secsize) * + ((unsigned long) dp->sectors)) >> 20ul, dp->sectors, dp->secsize, dp->heads, dp->secs_per_track, dp->cylinders); } else { -- cgit v1.1