Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Previously we abused pm->ptstart / pm->ptsi...



details:   https://anonhg.NetBSD.org/src/rev/2a7cc7840af9
branches:  trunk
changeset: 977027:2a7cc7840af9
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Oct 12 12:17:29 2020 +0000

description:
Previously we abused pm->ptstart / pm->ptsize to pass the bounds of the
NetBSD outer partition to the inner partition editor - but now this is
not a valid assumption any more, so explicitly fix the bounds if an
outer partition exists.

diffstat:

 usr.sbin/sysinst/bsddisklabel.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r d34717ce639d -r 2a7cc7840af9 usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Mon Oct 12 12:11:03 2020 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Mon Oct 12 12:17:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.50 2020/10/09 18:33:00 martin Exp $ */
+/*     $NetBSD: bsddisklabel.c,v 1.51 2020/10/12 12:17:29 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1701,6 +1701,7 @@
        struct disk_partitions *parts = pm->parts;
        const struct disk_partitioning_scheme *pscheme;
        struct partition_usage_set wanted;
+       daddr_t p_start, p_size;
        enum layout_type layoutkind = LY_SETSIZES;
        bool have_existing;
 
@@ -1777,11 +1778,20 @@
                layoutkind = ask_layout(parts, have_existing);
        }
 
+       if (layoutkind == LY_USEDEFAULT || layoutkind == LY_SETSIZES) {
+               /* calc available disk area for the NetBSD partitions */
+               p_start = pm->ptstart;
+               p_size = pm->ptsize;
+               if (parts->parent != NULL && 
+                   parts->parent->pscheme->guess_install_target != NULL)
+                       parts->parent->pscheme->guess_install_target(
+                           parts->parent, &p_start, &p_size);
+       }
        if (layoutkind == LY_USEDEFAULT) {
-               replace_by_default(parts, pm->ptstart, pm->ptsize,
+               replace_by_default(parts, p_start, p_size,
                    &wanted);
        } else if (layoutkind == LY_SETSIZES) {
-               if (!edit_with_defaults(parts, pm->ptstart, pm->ptsize,
+               if (!edit_with_defaults(parts, p_start, p_size,
                    &wanted)) {
                        free_usage_set(&wanted);
                        return false;



Home | Main Index | Thread Index | Old Index