Module Name:    src
Committed By:   mlelstv
Date:           Sat Oct 11 12:36:25 UTC 2014

Modified Files:
        src/sys/dev: ccd.c dksubr.c
        src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
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.153 -r1.154 src/sys/dev/ccd.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/dksubr.c
cvs rdiff -u -r1.313 -r1.314 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.153 src/sys/dev/ccd.c:1.154
--- src/sys/dev/ccd.c:1.153	Sat Oct 11 12:01:27 2014
+++ src/sys/dev/ccd.c	Sat Oct 11 12:36:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd.c,v 1.153 2014/10/11 12:01:27 mlelstv Exp $	*/
+/*	$NetBSD: ccd.c,v 1.154 2014/10/11 12:36:25 mlelstv 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.153 2014/10/11 12:01:27 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.154 2014/10/11 12:36:25 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1552,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.52 src/sys/dev/dksubr.c:1.53
--- src/sys/dev/dksubr.c:1.52	Sat Oct 11 12:01:27 2014
+++ src/sys/dev/dksubr.c	Sat Oct 11 12:36:25 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.52 2014/10/11 12:01:27 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.53 2014/10/11 12:36:25 mlelstv 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.52 2014/10/11 12:01:27 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.53 2014/10/11 12:36:25 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -583,17 +583,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/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.313 src/sys/dev/raidframe/rf_netbsdkintf.c:1.314
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.313	Sat Oct 11 12:01:27 2014
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sat Oct 11 12:36:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.313 2014/10/11 12:01:27 mlelstv Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.314 2014/10/11 12:36:25 mlelstv 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.313 2014/10/11 12:01:27 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.314 2014/10/11 12:36:25 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -2440,17 +2440,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);
 		}
 	}
 

Reply via email to