Module Name:    src
Committed By:   tsutsui
Date:           Mon Jun  2 15:03:47 UTC 2014

Modified Files:
        src/distrib/utils/sysinst/arch/alpha: md.c

Log Message:
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.52 -r1.53 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.52 src/distrib/utils/sysinst/arch/alpha/md.c:1.53
--- src/distrib/utils/sysinst/arch/alpha/md.c:1.52	Sat Feb 15 19:45:43 2014
+++ src/distrib/utils/sysinst/arch/alpha/md.c	Mon Jun  2 15:03:47 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.52 2014/02/15 19:45:43 tsutsui Exp $ */
+/*	$NetBSD: md.c,v 1.53 2014/06/02 15:03:47 tsutsui 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