Module Name: src
Committed By: martin
Date: Tue Nov 11 10:42:22 UTC 2014
Modified Files:
src/sys/dev [netbsd-7]: ccd.c dksubr.c ld.c vnd.c
src/sys/dev/raidframe [netbsd-7]: rf_netbsdkintf.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.151.2.1 -r1.151.2.2 src/sys/dev/ccd.c
cvs rdiff -u -r1.51.2.1 -r1.51.2.2 src/sys/dev/dksubr.c
cvs rdiff -u -r1.75.2.1 -r1.75.2.2 src/sys/dev/ld.c
cvs rdiff -u -r1.232.2.1 -r1.232.2.2 src/sys/dev/vnd.c
cvs rdiff -u -r1.312.2.1 -r1.312.2.2 src/sys/dev/raidframe/rf_netbsdkintf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ccd.c
diff -u src/sys/dev/ccd.c:1.151.2.1 src/sys/dev/ccd.c:1.151.2.2
--- src/sys/dev/ccd.c:1.151.2.1 Mon Aug 18 12:40:36 2014
+++ src/sys/dev/ccd.c Tue Nov 11 10:42:22 2014
@@ -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 @@ ccdgetdefaultlabel(struct ccd_softc *cs,
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 @@ ccdgetdefaultlabel(struct ccd_softc *cs,
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 @@ ccdgetdisklabel(dev_t dev)
* 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,
Index: src/sys/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.51.2.1 src/sys/dev/dksubr.c:1.51.2.2
--- src/sys/dev/dksubr.c:1.51.2.1 Tue Nov 11 10:36:41 2014
+++ src/sys/dev/dksubr.c Tue Nov 11 10:42:22 2014
@@ -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 @@ dk_getdefaultlabel(struct dk_intf *di, s
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 @@ dk_getdefaultlabel(struct dk_intf *di, s
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 @@ dk_getdisklabel(struct dk_intf *di, stru
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);
}
}
Index: src/sys/dev/ld.c
diff -u src/sys/dev/ld.c:1.75.2.1 src/sys/dev/ld.c:1.75.2.2
--- src/sys/dev/ld.c:1.75.2.1 Tue Nov 11 10:36:41 2014
+++ src/sys/dev/ld.c Tue Nov 11 10:42:22 2014
@@ -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 @@ ldgetdefaultlabel(struct ld_softc *sc, s
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;
Index: src/sys/dev/vnd.c
diff -u src/sys/dev/vnd.c:1.232.2.1 src/sys/dev/vnd.c:1.232.2.2
--- src/sys/dev/vnd.c:1.232.2.1 Tue Nov 11 10:36:41 2014
+++ src/sys/dev/vnd.c Tue Nov 11 10:42:22 2014
@@ -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 @@ vndgetdefaultlabel(struct vnd_softc *sc,
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;
Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.312.2.1 src/sys/dev/raidframe/rf_netbsdkintf.c:1.312.2.2
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.312.2.1 Tue Nov 11 10:36:41 2014
+++ src/sys/dev/raidframe/rf_netbsdkintf.c Tue Nov 11 10:42:22 2014
@@ -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 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr,
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 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr,
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 @@ raidgetdisklabel(dev_t dev)
* 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);
}
}