summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>1999-07-03 21:14:45 +0000
committermjacob <mjacob@FreeBSD.org>1999-07-03 21:14:45 +0000
commit2d5908293e194e265c75dfc50c2bdf2170c45fba (patch)
treeb52c35473b3e18cbb6d6048214809864003fc7e4 /sys/cam
parent28a5174c43ea7e285367bd73f57e1a75ff3ccc65 (diff)
downloadFreeBSD-src-2d5908293e194e265c75dfc50c2bdf2170c45fba.zip
FreeBSD-src-2d5908293e194e265c75dfc50c2bdf2170c45fba.tar.gz
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).
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/scsi/scsi_da.c7
1 files changed, 4 insertions, 3 deletions
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 {
OpenPOWER on IntegriCloud