Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst PR 56354: all actions to set up swap space ...
details: https://anonhg.NetBSD.org/src/rev/76d12e2791a4
branches: trunk
changeset: 1022889:76d12e2791a4
user: martin <martin%NetBSD.org@localhost>
date: Thu Aug 12 09:33:59 2021 +0000
description:
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).
diffstat:
usr.sbin/sysinst/defs.h | 11 +++--------
usr.sbin/sysinst/disks.c | 19 +++++++------------
usr.sbin/sysinst/upgrade.c | 5 ++---
3 files changed, 12 insertions(+), 23 deletions(-)
diffs (97 lines):
diff -r 18d43846b2e6 -r 76d12e2791a4 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h Wed Aug 11 23:02:39 2021 +0000
+++ b/usr.sbin/sysinst/defs.h Thu Aug 12 09:33:59 2021 +0000
@@ -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 @@
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 *);
diff -r 18d43846b2e6 -r 76d12e2791a4 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c Wed Aug 11 23:02:39 2021 +0000
+++ b/usr.sbin/sysinst/disks.c Thu Aug 12 09:33:59 2021 +0000
@@ -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 @@
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 @@
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
diff -r 18d43846b2e6 -r 76d12e2791a4 usr.sbin/sysinst/upgrade.c
--- a/usr.sbin/sysinst/upgrade.c Wed Aug 11 23:02:39 2021 +0000
+++ b/usr.sbin/sysinst/upgrade.c Thu Aug 12 09:33:59 2021 +0000
@@ -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 @@
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;
Home |
Main Index |
Thread Index |
Old Index