Module Name: src Committed By: snj Date: Thu Aug 19 04:52:10 UTC 2021
Modified Files: src/usr.sbin/sysinst [netbsd-9]: defs.h disks.c upgrade.c Log Message: Pull up following revision(s) (requested by martin in ticket #1333): usr.sbin/sysinst/defs.h: revision 1.72 usr.sbin/sysinst/disks.c: revision 1.75 usr.sbin/sysinst/upgrade.c: revision 1.18 PR 56354: all actions to set up swap space are not guaranteed to gain us enough virtual memory anyway, so drop return codes from set_swap*. The state for cleanup (which swap dev to unuse) has been made global some time ago anyway. Previously use of the return values was inconsistent. Error reporting will only confuse users and sometimes the situation is hard to fix or even impossible (like in miniroots copide to swap space for booting). To generate a diff of this commit: cvs rdiff -u -r1.42.2.8 -r1.42.2.9 src/usr.sbin/sysinst/defs.h cvs rdiff -u -r1.44.2.15 -r1.44.2.16 src/usr.sbin/sysinst/disks.c cvs rdiff -u -r1.12.2.3 -r1.12.2.4 src/usr.sbin/sysinst/upgrade.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/defs.h diff -u src/usr.sbin/sysinst/defs.h:1.42.2.8 src/usr.sbin/sysinst/defs.h:1.42.2.9 --- src/usr.sbin/sysinst/defs.h:1.42.2.8 Thu Oct 15 19:36:51 2020 +++ src/usr.sbin/sysinst/defs.h Thu Aug 19 04:52:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: defs.h,v 1.42.2.8 2020/10/15 19:36:51 bouyer Exp $ */ +/* $NetBSD: defs.h,v 1.42.2.9 2021/08/19 04:52:10 snj Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -696,13 +696,8 @@ void disp_cur_fspart(int, int); int make_filesystems(struct install_partition_desc *); int make_fstab(struct install_partition_desc *); int mount_disks(struct install_partition_desc *); -/* - * set_swap_if_low_ram and set_swap return -1 on error, - * 0 if no swap was added on purpose and - * 1 if swap has been added (and needs to be cleared later). - */ -int set_swap_if_low_ram(struct install_partition_desc *); -int set_swap(struct install_partition_desc *); +void set_swap_if_low_ram(struct install_partition_desc *); +void set_swap(struct install_partition_desc *); void clear_swap(void); int check_swap(const char *, int); char *bootxx_name(struct install_partition_desc *); Index: src/usr.sbin/sysinst/disks.c diff -u src/usr.sbin/sysinst/disks.c:1.44.2.15 src/usr.sbin/sysinst/disks.c:1.44.2.16 --- src/usr.sbin/sysinst/disks.c:1.44.2.15 Thu Oct 15 19:36:50 2020 +++ src/usr.sbin/sysinst/disks.c Thu Aug 19 04:52:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.44.2.15 2020/10/15 19:36:50 bouyer Exp $ */ +/* $NetBSD: disks.c,v 1.44.2.16 2021/08/19 04:52:10 snj Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1915,16 +1915,15 @@ mount_disks(struct install_partition_des static char swap_dev[PATH_MAX]; -int +void set_swap_if_low_ram(struct install_partition_desc *install) { swap_dev[0] = 0; if (get_ramsize() <= TINY_RAM_SIZE) - return set_swap(install); - return 0; + set_swap(install); } -int +void set_swap(struct install_partition_desc *install) { size_t i; @@ -1936,20 +1935,16 @@ set_swap(struct install_partition_desc * break; } if (i >= install->num) - return 0; + return; if (!install->infos[i].parts->pscheme->get_part_device( install->infos[i].parts, install->infos[i].cur_part_id, swap_dev, sizeof swap_dev, NULL, plain_name, true, true)) - return -1; + return; rval = swapctl(SWAP_ON, swap_dev, 0); - if (rval != 0) { + if (rval != 0) swap_dev[0] = 0; - return -1; - } - - return 1; } void Index: src/usr.sbin/sysinst/upgrade.c diff -u src/usr.sbin/sysinst/upgrade.c:1.12.2.3 src/usr.sbin/sysinst/upgrade.c:1.12.2.4 --- src/usr.sbin/sysinst/upgrade.c:1.12.2.3 Mon Feb 10 21:39:37 2020 +++ src/usr.sbin/sysinst/upgrade.c Thu Aug 19 04:52:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: upgrade.c,v 1.12.2.3 2020/02/10 21:39:37 bouyer Exp $ */ +/* $NetBSD: upgrade.c,v 1.12.2.4 2021/08/19 04:52:10 snj Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -81,8 +81,7 @@ do_upgrade(void) install.cur_system = true; } - if (set_swap_if_low_ram(&install) < 0) - return; + set_swap_if_low_ram(&install); if (md_pre_update(&install) < 0) goto free_install;