Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst Fix free space accounting for partition siz...



details:   https://anonhg.NetBSD.org/src/rev/b0c3b1f21914
branches:  trunk
changeset: 367676:b0c3b1f21914
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jun 21 15:42:43 2022 +0000

description:
Fix free space accounting for partition size changes and deletions.
Part of PR 56886.

diffstat:

 usr.sbin/sysinst/disklabel.c |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r e889b68d0a4f -r b0c3b1f21914 usr.sbin/sysinst/disklabel.c
--- a/usr.sbin/sysinst/disklabel.c      Tue Jun 21 15:41:29 2022 +0000
+++ b/usr.sbin/sysinst/disklabel.c      Tue Jun 21 15:42:43 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.46 2022/06/21 15:41:29 martin Exp $    */
+/*     $NetBSD: disklabel.c,v 1.47 2022/06/21 15:42:43 martin 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;
@@ -822,6 +824,15 @@
                        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
+#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);



Home | Main Index | Thread Index | Old Index