Source-Changes-HG archive

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

[src/netbsd-2-0]: src/sys/dev Pull up revision 1.28 (requested by dbj in tick...



details:   https://anonhg.NetBSD.org/src/rev/4e4963dc4477
branches:  netbsd-2-0
changeset: 562252:4e4963dc4477
user:      tron <tron%NetBSD.org@localhost>
date:      Wed Jul 28 11:27:00 2004 +0000

description:
Pull up revision 1.28 (requested by dbj in ticket #722):
use uint64 instead of int for sc_secperunit

diffstat:

 sys/dev/ld.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r a92471932c91 -r 4e4963dc4477 sys/dev/ld.c
--- a/sys/dev/ld.c      Wed Jul 28 11:26:37 2004 +0000
+++ b/sys/dev/ld.c      Wed Jul 28 11:27:00 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld.c,v 1.27 2004/03/22 17:30:33 tls Exp $      */
+/*     $NetBSD: ld.c,v 1.27.2.1 2004/07/28 11:27:00 tron Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.27 2004/03/22 17:30:33 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.27.2.1 2004/07/28 11:27:00 tron Exp $");
 
 #include "rnd.h"
 
@@ -120,6 +120,8 @@
        /* Build synthetic geometry if necessary. */
        if (sc->sc_nheads == 0 || sc->sc_nsectors == 0 ||
            sc->sc_ncylinders == 0) {
+               uint64_t ncyl;
+
                if (sc->sc_secperunit <= 528 * 2048)            /* 528MB */
                        sc->sc_nheads = 16;
                else if (sc->sc_secperunit <= 1024 * 2048)      /* 1GB */
@@ -132,13 +134,16 @@
                        sc->sc_nheads = 255;
 
                sc->sc_nsectors = 63;
-               sc->sc_ncylinders = sc->sc_secperunit / 
+               sc->sc_ncylinders = INT_MAX;
+               ncyl = sc->sc_secperunit / 
                    (sc->sc_nheads * sc->sc_nsectors);
+               if (ncyl < INT_MAX)
+                       sc->sc_ncylinders = (int)ncyl;
        }
 
-       format_bytes(buf, sizeof(buf), (u_int64_t)sc->sc_secperunit *
+       format_bytes(buf, sizeof(buf), sc->sc_secperunit *
            sc->sc_secsize);
-       printf("%s: %s, %d cyl, %d head, %d sec, %d bytes/sect x %d sectors\n",
+       printf("%s: %s, %d cyl, %d head, %d sec, %d bytes/sect x %"PRIu64" sectors\n",
            sc->sc_dv.dv_xname, buf, sc->sc_ncylinders, sc->sc_nheads,
            sc->sc_nsectors, sc->sc_secsize, sc->sc_secperunit);
 



Home | Main Index | Thread Index | Old Index