Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/usr.sbin/sysinst Pull up following revision(s) (requested...
details: https://anonhg.NetBSD.org/src/rev/5666bac0f69f
branches: netbsd-9
changeset: 372862:5666bac0f69f
user: snj <snj%NetBSD.org@localhost>
date: Sat Dec 31 05:03:14 2022 +0000
description:
Pull up following revision(s) (requested by martin in ticket #1558):
usr.sbin/sysinst/disklabel.c: 1.46-1.48
usr.sbin/sysinst/label.c: 1.40-1.41
disklabel_can_add_partition() did not consider additional partitions
(while there still is space in the disklabel). Part of PR 56886.
Fix free space accounting for partition size changes and deletions.
Part of PR 56886.
renumber_partitions() needs to deal with removed/added partitions.
Fix free space accounting when partitions change size or are deleted.
Part of PR 56886.
Fix inverted condition in previous and only apply special handling for
the "all of NetBSD" partition when we have an outer MBR label.
Pointed out by Izumi Tsutsui. Hopefully the last fix needed for PR 56886.
diffstat:
usr.sbin/sysinst/disklabel.c | 17 +++++++++++++++--
usr.sbin/sysinst/label.c | 16 ++++++++++------
2 files changed, 25 insertions(+), 8 deletions(-)
diffs (103 lines):
diff -r 5f01866bbde4 -r 5666bac0f69f usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c Fri Dec 30 14:40:05 2022 +0000
+++ b/usr.sbin/sysinst/disklabel.c Sat Dec 31 05:03:14 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disklabel.c,v 1.10.2.10 2020/10/15 19:36:50 bouyer Exp $ */
+/* $NetBSD: disklabel.c,v 1.10.2.11 2022/12/31 05:03:14 snj Exp $ */
/*
* Copyright 2018 The NetBSD Foundation, Inc.
@@ -520,6 +520,8 @@
if (parts->install_target ==
parts->l.d_partitions[part].p_offset)
parts->install_target = -1;
+ parts->dp.free_space +=
+ parts->l.d_partitions[part].p_size;
parts->l.d_partitions[part].p_size = 0;
parts->l.d_partitions[part].p_offset = 0;
parts->l.d_partitions[part].p_fstype = FS_UNUSED;
@@ -821,6 +823,16 @@
was_inst_target = parts->l.d_partitions[part].p_offset
== parts->install_target;
parts->l.d_partitions[part].p_offset = info->start;
+ if (part != RAW_PART
+#if RAW_PART == 3
+ && (part != RAW_PART-1 ||
+ parts->dp.parent == NULL)
+#endif
+ ) {
+ parts->dp.free_space +=
+ parts->l.d_partitions[part].p_size -
+ info->size;
+ }
parts->l.d_partitions[part].p_size = info->size;
parts->l.d_partitions[part].p_fstype =
dl_part_type_from_generic(info->nat_type);
@@ -939,7 +951,8 @@
if (disklabel_get_free_spaces_internal(parts, &space, 1,
parts->ptn_alignment, parts->ptn_alignment, 0, -1) < 1)
return false;
-
+ if (parts->l.d_npartitions < dl_maxpart)
+ return true;
for (i = 0; i < parts->l.d_npartitions; i++) {
if (i == RAW_PART)
continue;
diff -r 5f01866bbde4 -r 5666bac0f69f usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c Fri Dec 30 14:40:05 2022 +0000
+++ b/usr.sbin/sysinst/label.c Sat Dec 31 05:03:14 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: label.c,v 1.10.2.8 2022/06/22 23:48:54 msaitoh Exp $ */
+/* $NetBSD: label.c,v 1.10.2.9 2022/12/31 05:03:14 snj Exp $ */
/*
* Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.10.2.8 2022/06/22 23:48:54 msaitoh Exp $");
+__RCSID("$NetBSD: label.c,v 1.10.2.9 2022/12/31 05:03:14 snj Exp $");
#endif
#include <sys/types.h>
@@ -505,7 +505,7 @@
if (!pset->parts->pscheme->get_part_info(pset->parts, pno,
&info))
continue;
- for (i = 0; i < pset->parts->num_part; i++) {
+ for (i = 0; i < pset->num; i++) {
if (pset->infos[i].cur_start != info.start)
continue;
if (pset->infos[i].cur_flags != info.flags)
@@ -522,8 +522,9 @@
}
}
- memcpy(pset->infos, ninfos, sizeof(*pset->infos)*pset->parts->num_part);
- free(ninfos);
+ free(pset->infos);
+ pset->infos = ninfos;
+ pset->num = pset->parts->num_part;
}
/*
@@ -980,6 +981,9 @@
if (!pset->parts->pscheme->set_part_info(pset->parts,
edit.id, &edit.info, &err))
err_msg_win(err);
+ else
+ pset->cur_free_space += edit.old_info.size -
+ edit.info.size;
}
/*
@@ -1009,7 +1013,7 @@
}
remember_deleted(pset,
pset->infos[edit.index].parts);
- pset->cur_free_space += pset->infos[edit.index].size;
+ pset->cur_free_space += edit.info.size;
memmove(pset->infos+edit.index,
pset->infos+edit.index+1,
sizeof(*pset->infos)*(pset->num-edit.index));
Home |
Main Index |
Thread Index |
Old Index