Module Name: src Committed By: martin Date: Tue Jun 21 15:42:44 UTC 2022
Modified Files: src/usr.sbin/sysinst: disklabel.c Log Message: Fix free space accounting for partition size changes and deletions. Part of PR 56886. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/usr.sbin/sysinst/disklabel.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/disklabel.c diff -u src/usr.sbin/sysinst/disklabel.c:1.46 src/usr.sbin/sysinst/disklabel.c:1.47 --- src/usr.sbin/sysinst/disklabel.c:1.46 Tue Jun 21 15:41:29 2022 +++ src/usr.sbin/sysinst/disklabel.c Tue Jun 21 15:42:43 2022 @@ -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 @@ disklabel_delete(struct disk_partitions 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 @@ disklabel_set_part_info(struct disk_part 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);