Module Name: src
Committed By: martin
Date: Sun Jul 28 16:03:00 UTC 2019
Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c
Log Message:
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)
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/sysinst/bsddisklabel.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/sysinst/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.21 src/usr.sbin/sysinst/bsddisklabel.c:1.22
--- src/usr.sbin/sysinst/bsddisklabel.c:1.21 Mon Jul 15 19:13:05 2019
+++ src/usr.sbin/sysinst/bsddisklabel.c Sun Jul 28 16:03:00 2019
@@ -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 @@ ask_layout(struct disk_partitions *parts
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 @@ merge_part_with_wanted(struct disk_parti
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 @@ fill_defaults(struct partition_usage_set
* 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 @@ fill_defaults(struct partition_usage_set
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 @@ fill_defaults(struct partition_usage_set
continue;
merge_part_with_wanted(parts, pno, &info,
- wanted, false);
+ wanted, num, false);
}
daddr_t align = parts->pscheme->get_part_alignment(parts);