Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Factor out all RAM size thresholds as defin...



details:   https://anonhg.NetBSD.org/src/rev/ff103a171f56
branches:  trunk
changeset: 848300:ff103a171f56
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jan 24 07:31:15 2020 +0000

description:
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.

diffstat:

 usr.sbin/sysinst/bsddisklabel.c |   4 ++--
 usr.sbin/sysinst/defs.h         |  14 +++++++++++++-
 usr.sbin/sysinst/disks.c        |   4 ++--
 3 files changed, 17 insertions(+), 5 deletions(-)

diffs (67 lines):

diff -r 34be41974a0c -r ff103a171f56 usr.sbin/sysinst/bsddisklabel.c
--- a/usr.sbin/sysinst/bsddisklabel.c   Fri Jan 24 06:34:19 2020 +0000
+++ b/usr.sbin/sysinst/bsddisklabel.c   Fri Jan 24 07:31:15 2020 +0000
@@ -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 @@
        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)
diff -r 34be41974a0c -r ff103a171f56 usr.sbin/sysinst/defs.h
--- a/usr.sbin/sysinst/defs.h   Fri Jan 24 06:34:19 2020 +0000
+++ b/usr.sbin/sysinst/defs.h   Fri Jan 24 07:31:15 2020 +0000
@@ -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 @@
 #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)
diff -r 34be41974a0c -r ff103a171f56 usr.sbin/sysinst/disks.c
--- a/usr.sbin/sysinst/disks.c  Fri Jan 24 06:34:19 2020 +0000
+++ b/usr.sbin/sysinst/disks.c  Fri Jan 24 07:31:15 2020 +0000
@@ -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 @@
 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;
 }



Home | Main Index | Thread Index | Old Index