Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst When merging existing partitions into the p...



details:   https://anonhg.NetBSD.org/src/rev/1a1e7af26c30
branches:  trunk
changeset: 452949:1a1e7af26c30
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jul 28 16:03:00 2019 +0000

description:
When merging existing partitions into the planned installation partitions,
keep the separation between the original planned partitions and the
pre-exiting partitions.
Also do not call found partitions "outer" if they are not (but could be)

diffstat:

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

diffs (66 lines):

diff -r 003a97c0bd4c -r 1a1e7af26c30 usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Sun Jul 28 15:20:45 2019 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Sun Jul 28 16:03:00 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.21 2019/07/15 19:13:05 martin Exp $ */
+/*     $NetBSD: bsddisklabel.c,v 1.22 2019/07/28 16:03:00 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -904,17 +904,18 @@
 static void
 merge_part_with_wanted(struct disk_partitions *parts, part_id pno,
     const struct disk_part_info *info, struct partition_usage_set *wanted,
-    bool is_outer)
+    size_t wanted_num, bool is_outer)
 {
        struct part_usage_info *infos;
 
        /*
         * does this partition match something in the wanted set?
         */
-       for (size_t i = 0; i < wanted->num; i++) {
+       for (size_t i = 0; i < wanted_num; i++) {
                if (wanted->infos[i].type != info->nat_type->generic_ptype)
                        continue;
-               if (info->last_mounted != NULL && info->last_mounted[0] != 0 &&
+               if (wanted->infos[i].type == PT_root &&
+                   info->last_mounted != NULL && info->last_mounted[0] != 0 &&
                    strcmp(info->last_mounted, wanted->infos[i].mount) != 0)
                        continue;
                if (wanted->infos[i].cur_part_id != NO_PART)
@@ -929,6 +930,8 @@
                        wanted->infos[i].instflags |= PUIINST_MOUNT;
                if (is_outer)
                        wanted->infos[i].flags |= PUIFLG_IS_OUTER;
+               else
+                       wanted->infos[i].flags &= ~PUIFLG_IS_OUTER;
                return;
        }
 
@@ -1050,6 +1053,7 @@
         * The only thing outside of target range that we care for
         * is a potential swap partition - we assume one is enough.
         */
+       size_t num = wanted->num;
        if (parts->parent) {
                for (part_id pno = 0; pno < parts->parent->num_part; pno++) {
                        struct disk_part_info info;
@@ -1060,7 +1064,7 @@
                        if (info.nat_type->generic_ptype != PT_swap)
                                continue;
                        merge_part_with_wanted(parts->parent, pno, &info,
-                           wanted, true);
+                           wanted, num, true);
                        break;
                }
        }
@@ -1079,7 +1083,7 @@
                        continue;
 
                merge_part_with_wanted(parts, pno, &info,
-                   wanted, false);
+                   wanted, num, false);
        }
 
        daddr_t align = parts->pscheme->get_part_alignment(parts);



Home | Main Index | Thread Index | Old Index