Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/dev Pull up following revision(s) (requested by mlels...



details:   https://anonhg.NetBSD.org/src/rev/bafbcb46b0a7
branches:  netbsd-7
changeset: 798540:bafbcb46b0a7
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Nov 11 10:42:22 2014 +0000

description:
Pull up following revision(s) (requested by mlelstv in ticket #202):
        sys/dev/ccd.c: revision 1.153
        sys/dev/ccd.c: revision 1.154
        sys/dev/raidframe/rf_netbsdkintf.c: revision 1.313
        sys/dev/raidframe/rf_netbsdkintf.c: revision 1.314
        sys/dev/ld.c: revision 1.77
        sys/dev/vnd.c: revision 1.233
        sys/dev/dksubr.c: revision 1.52
        sys/dev/dksubr.c: revision 1.53
clamp total number of sectors to UINT32_MAX instead of providing the
lower 32bit of the 64bit number.
No longer warn about differences bewteen disk size and total sector count
in disklabel when the latter is just clamped to the maximum.

diffstat:

 sys/dev/ccd.c                      |  15 ++++++++++-----
 sys/dev/dksubr.c                   |  27 +++++++++++++++++----------
 sys/dev/ld.c                       |  12 +++++++-----
 sys/dev/raidframe/rf_netbsdkintf.c |  27 +++++++++++++++++----------
 sys/dev/vnd.c                      |   9 ++++++---
 5 files changed, 57 insertions(+), 33 deletions(-)

diffs (252 lines):

diff -r 44a0b70a3d93 -r bafbcb46b0a7 sys/dev/ccd.c
--- a/sys/dev/ccd.c     Tue Nov 11 10:36:40 2014 +0000
+++ b/sys/dev/ccd.c     Tue Nov 11 10:42:22 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.151.2.1 2014/08/18 12:40:36 martin Exp $     */
+/*     $NetBSD: ccd.c,v 1.151.2.2 2014/11/11 10:42:22 martin Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.151.2.1 2014/08/18 12:40:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.151.2.2 2014/11/11 10:42:22 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1479,7 +1479,10 @@
 
        memset(lp, 0, sizeof(*lp));
 
-       lp->d_secperunit = cs->sc_size;
+       if (cs->sc_size > UINT32_MAX)
+               lp->d_secperunit = UINT32_MAX;
+       else
+               lp->d_secperunit = cs->sc_size;
        lp->d_secsize = ccg->ccg_secsize;
        lp->d_nsectors = ccg->ccg_nsectors;
        lp->d_ntracks = ccg->ccg_ntracks;
@@ -1494,7 +1497,7 @@
        lp->d_flags = 0;
 
        lp->d_partitions[RAW_PART].p_offset = 0;
-       lp->d_partitions[RAW_PART].p_size = cs->sc_size;
+       lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
        lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
        lp->d_npartitions = RAW_PART + 1;
 
@@ -1549,7 +1552,9 @@
                 * same componets are used, and old disklabel may used
                 * if that is found.
                 */
-               if (lp->d_secperunit != cs->sc_size)
+               if (lp->d_secperunit < UINT32_MAX ?
+                       lp->d_secperunit != cs->sc_size :
+                       lp->d_secperunit > cs->sc_size)
                        printf("WARNING: %s: "
                            "total sector size in disklabel (%ju) != "
                            "the size of ccd (%ju)\n", cs->sc_xname,
diff -r 44a0b70a3d93 -r bafbcb46b0a7 sys/dev/dksubr.c
--- a/sys/dev/dksubr.c  Tue Nov 11 10:36:40 2014 +0000
+++ b/sys/dev/dksubr.c  Tue Nov 11 10:42:22 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.51.2.1 2014/11/11 10:36:41 martin Exp $ */
+/* $NetBSD: dksubr.c,v 1.51.2.2 2014/11/11 10:42:22 martin Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.51.2.1 2014/11/11 10:36:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.51.2.2 2014/11/11 10:42:22 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -540,7 +540,10 @@
 
        memset(lp, 0, sizeof(*lp));
 
-       lp->d_secperunit = dg->dg_secperunit;
+       if (dg->dg_secperunit > UINT32_MAX)
+               lp->d_secperunit = UINT32_MAX;
+       else
+               lp->d_secperunit = dg->dg_secperunit;
        lp->d_secsize = dg->dg_secsize;
        lp->d_nsectors = dg->dg_nsectors;
        lp->d_ntracks = dg->dg_ntracks;
@@ -555,7 +558,7 @@
        lp->d_flags = 0;
 
        lp->d_partitions[RAW_PART].p_offset = 0;
-       lp->d_partitions[RAW_PART].p_size = dg->dg_secperunit;
+       lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
        lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
        lp->d_npartitions = RAW_PART + 1;
 
@@ -590,17 +593,21 @@
                return;
 
        /* Sanity check */
-       if (lp->d_secperunit != dg->dg_secperunit)
-               printf("WARNING: %s: total sector size in disklabel (%d) "
-                   "!= the size of %s (%" PRId64 ")\n", dksc->sc_xname,
-                   lp->d_secperunit, di->di_dkname, dg->dg_secperunit);
+       if (lp->d_secperunit < UINT32_MAX ?
+               lp->d_secperunit != dg->dg_secperunit :
+               lp->d_secperunit > dg->dg_secperunit)
+               printf("WARNING: %s: total sector size in disklabel (%ju) "
+                   "!= the size of %s (%ju)\n", dksc->sc_xname,
+                   (uintmax_t)lp->d_secperunit, di->di_dkname,
+                   (uintmax_t)dg->dg_secperunit);
 
        for (i=0; i < lp->d_npartitions; i++) {
                pp = &lp->d_partitions[i];
                if (pp->p_offset + pp->p_size > dg->dg_secperunit)
                        printf("WARNING: %s: end of partition `%c' exceeds "
-                           "the size of %s (%" PRId64 ")\n", dksc->sc_xname,
-                           'a' + i, di->di_dkname, dg->dg_secperunit);
+                           "the size of %s (%ju)\n", dksc->sc_xname,
+                           'a' + i, di->di_dkname,
+                           (uintmax_t)dg->dg_secperunit);
        }
 }
 
diff -r 44a0b70a3d93 -r bafbcb46b0a7 sys/dev/ld.c
--- a/sys/dev/ld.c      Tue Nov 11 10:36:40 2014 +0000
+++ b/sys/dev/ld.c      Tue Nov 11 10:42:22 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld.c,v 1.75.2.1 2014/11/11 10:36:41 martin Exp $       */
+/*     $NetBSD: ld.c,v 1.75.2.2 2014/11/11 10:42:22 martin Exp $       */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.75.2.1 2014/11/11 10:36:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.75.2.2 2014/11/11 10:42:22 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -824,14 +824,16 @@
        lp->d_type = DTYPE_LD;
        strlcpy(lp->d_typename, "unknown", sizeof(lp->d_typename));
        strlcpy(lp->d_packname, "fictitious", sizeof(lp->d_packname));
-       lp->d_secperunit = sc->sc_secperunit;
+       if (sc->sc_secperunit > UINT32_MAX)
+               lp->d_secperunit = UINT32_MAX;
+       else
+               lp->d_secperunit = sc->sc_secperunit;
        lp->d_rpm = 7200;
        lp->d_interleave = 1;
        lp->d_flags = 0;
 
        lp->d_partitions[RAW_PART].p_offset = 0;
-       lp->d_partitions[RAW_PART].p_size =
-           lp->d_secperunit * (lp->d_secsize / DEV_BSIZE);
+       lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
        lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
        lp->d_npartitions = RAW_PART + 1;
 
diff -r 44a0b70a3d93 -r bafbcb46b0a7 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Tue Nov 11 10:36:40 2014 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Tue Nov 11 10:42:22 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.312.2.1 2014/11/11 10:36:41 martin Exp $  */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.312.2.2 2014/11/11 10:42:22 martin Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.312.2.1 2014/11/11 10:36:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.312.2.2 2014/11/11 10:42:22 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -2370,7 +2370,10 @@
        memset(lp, 0, sizeof(*lp));
 
        /* fabricate a label... */
-       lp->d_secperunit = raidPtr->totalSectors;
+       if (raidPtr->totalSectors > UINT32_MAX)
+               lp->d_secperunit = UINT32_MAX;
+       else
+               lp->d_secperunit = raidPtr->totalSectors;
        lp->d_secsize = raidPtr->bytesPerSector;
        lp->d_nsectors = raidPtr->Layout.dataSectorsPerStripe;
        lp->d_ntracks = 4 * raidPtr->numCol;
@@ -2386,7 +2389,7 @@
        lp->d_flags = 0;
 
        lp->d_partitions[RAW_PART].p_offset = 0;
-       lp->d_partitions[RAW_PART].p_size = raidPtr->totalSectors;
+       lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
        lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
        lp->d_npartitions = RAW_PART + 1;
 
@@ -2442,17 +2445,21 @@
                 * same components are used, and old disklabel may used
                 * if that is found.
                 */
-               if (lp->d_secperunit != rs->sc_size)
+               if (lp->d_secperunit < UINT32_MAX ?
+                   lp->d_secperunit != rs->sc_size :
+                   lp->d_secperunit > rs->sc_size)
                        printf("raid%d: WARNING: %s: "
-                           "total sector size in disklabel (%" PRIu32 ") != "
-                           "the size of raid (%" PRIu64 ")\n", unit, rs->sc_xname,
-                           lp->d_secperunit, rs->sc_size);
+                           "total sector size in disklabel (%ju) != "
+                           "the size of raid (%ju)\n", unit, rs->sc_xname,
+                           (uintmax_t)lp->d_secperunit,
+                           (uintmax_t)rs->sc_size);
                for (i = 0; i < lp->d_npartitions; i++) {
                        pp = &lp->d_partitions[i];
                        if (pp->p_offset + pp->p_size > rs->sc_size)
                                printf("raid%d: WARNING: %s: end of partition `%c' "
-                                      "exceeds the size of raid (%" PRIu64 ")\n",
-                                      unit, rs->sc_xname, 'a' + i, rs->sc_size);
+                                      "exceeds the size of raid (%ju)\n",
+                                      unit, rs->sc_xname, 'a' + i,
+                                      (uintmax_t)rs->sc_size);
                }
        }
 
diff -r 44a0b70a3d93 -r bafbcb46b0a7 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Tue Nov 11 10:36:40 2014 +0000
+++ b/sys/dev/vnd.c     Tue Nov 11 10:42:22 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.232.2.1 2014/11/11 10:36:41 martin Exp $     */
+/*     $NetBSD: vnd.c,v 1.232.2.2 2014/11/11 10:42:22 martin Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.232.2.1 2014/11/11 10:36:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.232.2.2 2014/11/11 10:42:22 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -1796,7 +1796,10 @@
 
        memset(lp, 0, sizeof(*lp));
 
-       lp->d_secperunit = sc->sc_size / (vng->vng_secsize / DEV_BSIZE);
+       if (sc->sc_size > UINT32_MAX)
+               lp->d_secperunit = UINT32_MAX;
+       else
+               lp->d_secperunit = sc->sc_size;
        lp->d_secsize = vng->vng_secsize;
        lp->d_nsectors = vng->vng_nsectors;
        lp->d_ntracks = vng->vng_ntracks;



Home | Main Index | Thread Index | Old Index