Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst PR install/54787: when trying to derive pro...



details:   https://anonhg.NetBSD.org/src/rev/d8218dd0020f
branches:  trunk
changeset: 467134:d8218dd0020f
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jan 14 19:28:31 2020 +0000

description:
PR install/54787: when trying to derive proper alignement and first offset
from exisiting partitions, use the first partition offset if it is already
closer to the start of the disk than the prefered alignment - we can not
move existing partitions around.

diffstat:

 usr.sbin/sysinst/mbr.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 8eae2ceb81e9 -r d8218dd0020f usr.sbin/sysinst/mbr.c
--- a/usr.sbin/sysinst/mbr.c    Tue Jan 14 18:18:59 2020 +0000
+++ b/usr.sbin/sysinst/mbr.c    Tue Jan 14 19:28:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mbr.c,v 1.25 2020/01/09 19:51:49 martin Exp $ */
+/*     $NetBSD: mbr.c,v 1.26 2020/01/14 19:28:31 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -982,9 +982,16 @@
                if (!(ptn_0_limit & 2047)) {
                        /* Partition ends on a 1MB boundary, align to 1MB */
                        parts->ptn_alignment = 2048;
-                       if (ptn_0_base <= 2048
-                           && !(ptn_0_base & (ptn_0_base - 1))) {
-                               /* ptn_base is a power of 2, use it */
+                       if ((ptn_0_base <= 2048
+                           && !(ptn_0_base & (ptn_0_base - 1)))
+                           || (ptn_0_base < parts->ptn_0_offset)) {
+                               /*
+                                * If ptn_base is a power of 2, use it.
+                                * Also use it if the first partition
+                                * already is close to the begining
+                                * of the disk and we can't enforce
+                                * better alignment.
+                                */
                                parts->ptn_0_offset = ptn_0_base;
                        }
                }



Home | Main Index | Thread Index | Old Index