Module Name:    src
Committed By:   riz
Date:           Fri Jul 18 02:51:52 UTC 2014

Modified Files:
        src/distrib/utils/sysinst/arch/alpha [netbsd-6-1]: md.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1080):
        distrib/utils/sysinst/arch/alpha/md.c: revision 1.53
Apply patch in PR port-alpha/48697 (with some tweaks).
Tru64 UNIX's disklabel is the same format as BSD disklabel,
and it seems Tru64 stores incorrect geometry values in
d_nsectors (sectors/track) and d_secpercyl (sectors/cylinder).
d_secperunit seems always reliable so use it to get
dlsec (sectors/track) and dlcylsize (sectors/cylinder) values.
Should be pulled up to netbsd-6 branches.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.51.16.1 src/distrib/utils/sysinst/arch/alpha/md.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/sysinst/arch/alpha/md.c
diff -u src/distrib/utils/sysinst/arch/alpha/md.c:1.51 src/distrib/utils/sysinst/arch/alpha/md.c:1.51.16.1
--- src/distrib/utils/sysinst/arch/alpha/md.c:1.51	Fri Nov  4 11:27:01 2011
+++ src/distrib/utils/sysinst/arch/alpha/md.c	Fri Jul 18 02:51:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.51 2011/11/04 11:27:01 martin Exp $ */
+/*	$NetBSD: md.c,v 1.51.16.1 2014/07/18 02:51:52 riz Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -85,19 +85,19 @@ md_get_info(void)
 
 	dlcyl = disklabel.d_ncylinders;
 	dlhead = disklabel.d_ntracks;
-	dlsec = disklabel.d_nsectors;
 	sectorsize = disklabel.d_secsize;
-	dlcylsize = disklabel.d_secpercyl;
+	dlsize = disklabel.d_secperunit;
 
 	/*
-	 * Compute whole disk size. Take max of (dlcyl*dlhead*dlsec)
-	 * and secperunit,  just in case the disk is already labelled.
-	 * (If our new label's RAW_PART size ends up smaller than the
-	 * in-core RAW_PART size  value, updating the label will fail.)
+	 * Tru64 UNIX's disklabel is the same format as BSD disklabel,
+	 * and it seems Tru64 stores incorrect geometry values in
+	 * d_nsectors (sectors/track) and d_secpercyl (sectors/cylinder).
+	 * d_secperunit seems always reliable so use it to get
+	 * dlsec (sectors/track) and dlcylsize (sectors/cylinder) values.
+	 * See PR/48697 for details.
 	 */
-	dlsize = dlcyl*dlhead*dlsec;
-	if (disklabel.d_secperunit > dlsize)
-		dlsize = disklabel.d_secperunit;
+	dlsec = dlsize / (dlhead * dlcyl);
+	dlcylsize = dlsec * dlhead;
 
 	return 1;
 }

Reply via email to