Module Name: src
Committed By: martin
Date: Thu Aug 12 09:33:59 UTC 2021
Modified Files:
src/usr.sbin/sysinst: defs.h disks.c upgrade.c
Log Message:
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.71 -r1.72 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.74 -r1.75 src/usr.sbin/sysinst/disks.c
cvs rdiff -u -r1.17 -r1.18 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.71 src/usr.sbin/sysinst/defs.h:1.72
--- src/usr.sbin/sysinst/defs.h:1.71 Tue Jul 13 09:13:00 2021
+++ src/usr.sbin/sysinst/defs.h Thu Aug 12 09:33:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.71 2021/07/13 09:13:00 martin Exp $ */
+/* $NetBSD: defs.h,v 1.72 2021/08/12 09:33:59 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -713,13 +713,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.74 src/usr.sbin/sysinst/disks.c:1.75
--- src/usr.sbin/sysinst/disks.c:1.74 Sun Aug 8 21:50:10 2021
+++ src/usr.sbin/sysinst/disks.c Thu Aug 12 09:33:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: disks.c,v 1.74 2021/08/08 21:50:10 andvar Exp $ */
+/* $NetBSD: disks.c,v 1.75 2021/08/12 09:33:59 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -1921,16 +1921,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;
@@ -1942,20 +1941,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.17 src/usr.sbin/sysinst/upgrade.c:1.18
--- src/usr.sbin/sysinst/upgrade.c:1.17 Wed Nov 4 14:29:40 2020
+++ src/usr.sbin/sysinst/upgrade.c Thu Aug 12 09:33:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: upgrade.c,v 1.17 2020/11/04 14:29:40 martin Exp $ */
+/* $NetBSD: upgrade.c,v 1.18 2021/08/12 09:33:59 martin 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;