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 57100: fix install flag handling for new...
details: https://anonhg.NetBSD.org/src/rev/e10e752e2cb8
branches: trunk
changeset: 372642:e10e752e2cb8
user: martin <martin%NetBSD.org@localhost>
date: Thu Dec 15 14:54:27 2022 +0000
description:
PR 57100: fix install flag handling for newly added GPT partitions,
fix multiple install flags when updating existing partitions.
diffstat:
usr.sbin/sysinst/gpt.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diffs (61 lines):
diff -r 6020cc41dd48 -r e10e752e2cb8 usr.sbin/sysinst/gpt.c
--- a/usr.sbin/sysinst/gpt.c Wed Dec 14 18:59:03 2022 +0000
+++ b/usr.sbin/sysinst/gpt.c Thu Dec 15 14:54:27 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpt.c,v 1.29 2022/06/11 15:41:19 martin Exp $ */
+/* $NetBSD: gpt.c,v 1.30 2022/12/15 14:54:27 martin Exp $ */
/*
* Copyright 2018 The NetBSD Foundation, Inc.
@@ -622,7 +622,6 @@
struct gpt_part_entry *p = parts->partitions, *n;
part_id no;
daddr_t lendiff;
- bool was_target;
for (no = 0; p != NULL && no < id; no++)
p = p->gp_next;
@@ -631,15 +630,14 @@
return false;
/* update target mark - we can only have one */
- was_target = (p->gp_flags & GPEF_TARGET) != 0;
- if (info->flags & PTI_INSTALL_TARGET)
+ if (info->flags & PTI_INSTALL_TARGET) {
p->gp_flags |= GPEF_TARGET;
- else
- p->gp_flags &= ~GPEF_TARGET;
- if (was_target)
for (n = parts->partitions; n != NULL; n = n->gp_next)
if (n != p)
n->gp_flags &= ~GPEF_TARGET;
+ } else {
+ p->gp_flags &= ~GPEF_TARGET;
+ }
if ((p->gp_flags & GPEF_ON_DISK)) {
if (info->start != p->gp_start) {
@@ -1077,7 +1075,7 @@
(struct gpt_disk_partitions*)arg;
struct disk_part_free_space space;
struct disk_part_info data = *info;
- struct gpt_part_entry *p;
+ struct gpt_part_entry *p, *n;
bool ok;
if (err_msg != NULL)
@@ -1111,6 +1109,14 @@
p->gp_flags |= GPEF_MODIFIED;
ok = gpt_insert_part_into_list(parts, &parts->partitions, p, err_msg);
if (ok) {
+ if (info->flags & PTI_INSTALL_TARGET) {
+ /* update target mark - we can only have one */
+ p->gp_flags |= GPEF_TARGET;
+ for (n = parts->partitions; n != NULL; n = n->gp_next)
+ if (n != p)
+ n->gp_flags &= ~GPEF_TARGET;
+ }
+
parts->dp.num_part++;
parts->dp.free_space -= p->gp_size;
return parts->dp.num_part-1;
Home |
Main Index |
Thread Index |
Old Index