Module Name: src
Committed By: martin
Date: Fri Jan 24 07:31:15 UTC 2020
Modified Files:
src/usr.sbin/sysinst: bsddisklabel.c defs.h disks.c
Log Message:
Factor out all RAM size thresholds as defines to avoid magic numbers.
To work around PR misc/54886 bump the threshold for a tmpfs /tmp mount
up to 256 MB.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/sysinst/bsddisklabel.c
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.60 -r1.61 src/usr.sbin/sysinst/disks.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/bsddisklabel.c
diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.36 src/usr.sbin/sysinst/bsddisklabel.c:1.37
--- src/usr.sbin/sysinst/bsddisklabel.c:1.36 Mon Jan 20 21:26:35 2020
+++ src/usr.sbin/sysinst/bsddisklabel.c Fri Jan 24 07:31:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bsddisklabel.c,v 1.36 2020/01/20 21:26:35 martin Exp $ */
+/* $NetBSD: bsddisklabel.c,v 1.37 2020/01/24 07:31:15 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -929,7 +929,7 @@ fill_defaults(struct partition_usage_set
memcpy(wanted->infos, default_parts_init, sizeof(default_parts_init));
#ifdef HAVE_TMPFS
- if (get_ramsize() > 96) {
+ if (get_ramsize() >= SMALL_RAM_SIZE) {
for (i = 0; i < wanted->num; i++) {
if (wanted->infos[i].type != PT_root ||
wanted->infos[i].fs_type != FS_TMPFS)
Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.52 src/usr.sbin/sysinst/defs.h:1.53
--- src/usr.sbin/sysinst/defs.h:1.52 Mon Jan 20 21:26:35 2020
+++ src/usr.sbin/sysinst/defs.h Fri Jan 24 07:31:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.52 2020/01/20 21:26:35 martin Exp $ */
+/* $NetBSD: defs.h,v 1.53 2020/01/24 07:31:15 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -59,9 +59,21 @@ const char *getfslabelname(uint, uint);
#define MENUSTRSIZE 80
#define SSTRSIZE 30
+/* these are used for different alignment defaults */
#define HUGE_DISK_SIZE (daddr_t)(128 * (GIG / 512))
#define TINY_DISK_SIZE (daddr_t)(1800 * (MEG / 512))
+/*
+ * if a system does not have more ram (in MB) than this, swap will be enabled
+ * very early (as soon as the swap partition has been created)
+ */
+#define TINY_RAM_SIZE 32
+/*
+ * if a system has less ram (in MB) than this, we will not create a
+ * tmpfs /tmp by default (to workaround PR misc/54886)
+ */
+#define SMALL_RAM_SIZE 256
+
/* helper macros to create unique internal error messages */
#define STR_NO(STR) #STR
#define TO_STR(NO) STR_NO(NO)
Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.60 src/usr.sbin/sysinst/disks.c:1.61
--- src/usr.sbin/sysinst/disks.c:1.60 Thu Jan 16 16:47:19 2020
+++ src/usr.sbin/sysinst/disks.c Fri Jan 24 07:31:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: disks.c,v 1.60 2020/01/16 16:47:19 martin Exp $ */
+/* $NetBSD: disks.c,v 1.61 2020/01/24 07:31:15 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -1889,7 +1889,7 @@ mount_disks(struct install_partition_des
int
set_swap_if_low_ram(struct install_partition_desc *install)
{
- if (get_ramsize() <= 32)
+ if (get_ramsize() <= TINY_RAM_SIZE)
return set_swap(install);
return 0;
}