Module Name:    src
Committed By:   tsutsui
Date:           Tue Jan 15 17:23:39 UTC 2013

Modified Files:
        src/sys/arch/luna68k/luna68k: disksubr.c

Log Message:
Make the default disklabel (for disks without label) have saner value.
I.e. use d_secperunit for RAW_PART rather than 0x1fffffff for part a.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/luna68k/luna68k/disksubr.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/arch/luna68k/luna68k/disksubr.c
diff -u src/sys/arch/luna68k/luna68k/disksubr.c:1.29 src/sys/arch/luna68k/luna68k/disksubr.c:1.30
--- src/sys/arch/luna68k/luna68k/disksubr.c:1.29	Mon Oct 26 19:16:56 2009
+++ src/sys/arch/luna68k/luna68k/disksubr.c	Tue Jan 15 17:23:39 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.29 2009/10/26 19:16:56 cegger Exp $ */
+/* $NetBSD: disksubr.c,v 1.30 2013/01/15 17:23:39 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -103,7 +103,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.29 2009/10/26 19:16:56 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.30 2013/01/15 17:23:39 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -180,14 +180,20 @@ readdisklabel(dev_t dev, void (*strat)(s
 	struct disklabel *dlp;
 	struct sun_disklabel *slp;
 	int error;
+	int i;
 
 	/* minimal requirements for archtypal disk label */
 	if (lp->d_secperunit == 0)
 		lp->d_secperunit = 0x1fffffff;
-	lp->d_npartitions = 1;
-	if (lp->d_partitions[0].p_size == 0)
-		lp->d_partitions[0].p_size = 0x1fffffff;
-	lp->d_partitions[0].p_offset = 0;
+	if (lp->d_npartitions < RAW_PART + 1)
+		lp->d_npartitions = RAW_PART + 1;
+	for (i = 0; i < RAW_PART; i++) {
+		lp->d_partitions[i].p_size = 0;
+		lp->d_partitions[i].p_offset = 0;
+	}
+	if (lp->d_partitions[RAW_PART].p_size == 0)
+		lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
+	lp->d_partitions[RAW_PART].p_offset = 0;
 
 	/* obtain buffer to probe drive with */
 	bp = geteblk((int)lp->d_secsize);

Reply via email to