Source-Changes-HG archive

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

[src/trunk]: src/distrib/utils/sysinst Give the option to use tmpfs for /tmp ...



details:   https://anonhg.NetBSD.org/src/rev/aecf06a99301
branches:  trunk
changeset: 748248:aecf06a99301
user:      ahoka <ahoka%NetBSD.org@localhost>
date:      Sun Oct 18 12:09:48 2009 +0000

description:
Give the option to use tmpfs for /tmp in sysinst instead of the older
mfs on i386 and amd64. Should be enabled on other platforms with reliable
tmpfs too.

diffstat:

 distrib/utils/sysinst/arch/amd64/md.h |   5 ++++-
 distrib/utils/sysinst/arch/i386/md.h  |   5 ++++-
 distrib/utils/sysinst/bsddisklabel.c  |  24 ++++++++++++++----------
 distrib/utils/sysinst/defs.h          |   4 ++--
 distrib/utils/sysinst/disks.c         |  13 +++++++++----
 distrib/utils/sysinst/main.c          |   4 ++--
 6 files changed, 35 insertions(+), 20 deletions(-)

diffs (172 lines):

diff -r 6764fceb6d02 -r aecf06a99301 distrib/utils/sysinst/arch/amd64/md.h
--- a/distrib/utils/sysinst/arch/amd64/md.h     Sun Oct 18 11:54:37 2009 +0000
+++ b/distrib/utils/sysinst/arch/amd64/md.h     Sun Oct 18 12:09:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.h,v 1.25 2009/04/07 10:45:05 tsutsui Exp $  */
+/*     $NetBSD: md.h,v 1.26 2009/10/18 12:09:48 ahoka Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -62,6 +62,9 @@
 /* have support for booting form UFS2 */
 #define        HAVE_UFS2_BOOT
 
+/* allow using tmpfs for /tmp instead of mfs */
+#define HAVE_TMPFS
+
 /* have file system specific primary boot loader */
 #define        HAVE_BOOTXX_xFS
 #define        BOOTXXDIR       "/usr/mdec"
diff -r 6764fceb6d02 -r aecf06a99301 distrib/utils/sysinst/arch/i386/md.h
--- a/distrib/utils/sysinst/arch/i386/md.h      Sun Oct 18 11:54:37 2009 +0000
+++ b/distrib/utils/sysinst/arch/i386/md.h      Sun Oct 18 12:09:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.h,v 1.66 2009/04/07 10:45:05 tsutsui Exp $  */
+/*     $NetBSD: md.h,v 1.67 2009/10/18 12:09:48 ahoka Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -63,6 +63,9 @@
 /* have support for booting from UFS2 */
 #define        HAVE_UFS2_BOOT
 
+/* allow using tmpfs for /tmp instead of mfs */
+#define HAVE_TMPFS
+
 /* have file system specific primary boot loader */
 #define        HAVE_BOOTXX_xFS
 #define        BOOTXXDIR       "/usr/mdec"
diff -r 6764fceb6d02 -r aecf06a99301 distrib/utils/sysinst/bsddisklabel.c
--- a/distrib/utils/sysinst/bsddisklabel.c      Sun Oct 18 11:54:37 2009 +0000
+++ b/distrib/utils/sysinst/bsddisklabel.c      Sun Oct 18 12:09:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bsddisklabel.c,v 1.52 2009/05/14 16:23:38 sborrill Exp $       */
+/*     $NetBSD: bsddisklabel.c,v 1.53 2009/10/18 12:09:48 ahoka Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -61,9 +61,9 @@
 /* For the current state of this file blame abs%NetBSD.org@localhost */
 /* Even though he wasn't the last to hack it, but he did admit doing so :-) */
 
-#define        PART_ANY        -1
-#define        PART_EXTRA      -2
-#define        PART_TMP_MFS    -3
+#define        PART_ANY                -1
+#define        PART_EXTRA              -2
+#define        PART_TMP_RAMDISK        -3
 
 /* Defaults for things that might be defined in md.h */
 #ifndef PART_ROOT
@@ -290,7 +290,7 @@
        }
 
        size = NUMSEC(size, mult, dlcylsize);
-       if (p->ptn_id == PART_TMP_MFS) {
+       if (p->ptn_id == PART_TMP_RAMDISK) {
                p->size = size;
                return 0;
        }
@@ -357,9 +357,13 @@
 #define PI_SWAP 1
                { PART_SWAP,    { 's', 'w', 'a', 'p', '\0' },
                  DEFSWAPSIZE,  DEFSWAPSIZE, 0, 0 },
-               { PART_TMP_MFS, 
+               { PART_TMP_RAMDISK,
+#ifdef HAVE_TMPFS
+                 { 't', 'm', 'p', ' ', '(', 't', 'm', 'p', 'f', 's', ')', '\0' },
+#else
                  { 't', 'm', 'p', ' ', '(', 'm', 'f', 's', ')', '\0' },
-                   64, 0, 0, 0 },
+#endif
+                 64, 0, 0, 0 },
 #define PI_USR 3
                { PART_USR,     { '/', 'u', 's', 'r', '\0' },   DEFUSRSIZE,
                  0, 0, 0 },
@@ -495,7 +499,7 @@
                                        break;
                                continue;
                        }
-                       if (p->ptn_id == PART_TMP_MFS)
+                       if (p->ptn_id == PART_TMP_RAMDISK)
                                continue;
                        p->size += pi.free_space % dlcylsize;
                        break;
@@ -510,8 +514,8 @@
                                size = p->limit;
                }
                i = p->ptn_id;
-               if (i == PART_TMP_MFS) {
-                       tmp_mfs_size = size;
+               if (i == PART_TMP_RAMDISK) {
+                       tmp_ramdisk_size = size;
                        size = 0;
                        continue;
                }
diff -r 6764fceb6d02 -r aecf06a99301 distrib/utils/sysinst/defs.h
--- a/distrib/utils/sysinst/defs.h      Sun Oct 18 11:54:37 2009 +0000
+++ b/distrib/utils/sysinst/defs.h      Sun Oct 18 12:09:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.145 2009/09/19 14:57:27 abs Exp $   */
+/*     $NetBSD: defs.h,v 1.146 2009/10/18 12:09:48 ahoka Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -257,7 +257,7 @@
 #define partition_name(x)      ('a' + (x))
 partinfo oldlabel[MAXPARTITIONS];      /* What we found on the disk */
 partinfo bsdlabel[MAXPARTITIONS];      /* What we want it to look like */
-int tmp_mfs_size;
+daddr_t tmp_ramdisk_size;
 
 #define DISKNAME_SIZE 16
 char bsddiskname[DISKNAME_SIZE];
diff -r 6764fceb6d02 -r aecf06a99301 distrib/utils/sysinst/disks.c
--- a/distrib/utils/sysinst/disks.c     Sun Oct 18 11:54:37 2009 +0000
+++ b/distrib/utils/sysinst/disks.c     Sun Oct 18 12:09:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disks.c,v 1.108 2009/10/03 12:00:00 martin Exp $ */
+/*     $NetBSD: disks.c,v 1.109 2009/10/18 12:09:48 ahoka Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -746,13 +746,18 @@
                   dump_freq, fsck_pass);
        }
 
-       if (tmp_mfs_size != 0) {
+       if (tmp_ramdisk_size != 0) {
+#ifdef HAVE_TMPFS
+               scripting_fprintf(f, "tmpfs\t\t/tmp\ttmpfs\trw,-m=1777,-s=%d\n",
+                   tmp_ramdisk_size * 512);
+#else
                if (swap_dev != -1)
                        scripting_fprintf(f, "/dev/%s%c\t\t/tmp\tmfs\trw,-s=%d\n",
-                               diskdev, 'a' + swap_dev, tmp_mfs_size);
+                               diskdev, 'a' + swap_dev, tmp_ramdisk_size);
                else
                        scripting_fprintf(f, "swap\t\t/tmp\tmfs\trw,-s=%d\n",
-                               tmp_mfs_size);
+                               tmp_ramdisk_size);
+#endif
        }
 
        /* Add /kern, /proc and /dev/pts to fstab and make mountpoint. */
diff -r 6764fceb6d02 -r aecf06a99301 distrib/utils/sysinst/main.c
--- a/distrib/utils/sysinst/main.c      Sun Oct 18 11:54:37 2009 +0000
+++ b/distrib/utils/sysinst/main.c      Sun Oct 18 12:09:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.53 2008/12/21 11:02:41 martin Exp $ */
+/*     $NetBSD: main.c,v 1.54 2009/10/18 12:09:48 ahoka Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -114,7 +114,7 @@
 
        sizemult = 1;
        disktype = "unknown";
-       tmp_mfs_size = 0;
+       tmp_ramdisk_size = 0;
        doessf = "";
        clean_xfer_dir = 0;
        mnt2_mounted = 0;



Home | Main Index | Thread Index | Old Index