Re: Change default dumpdir to /usr/crash?

From: Lukas Ertl <le_at_FreeBSD.org>
Date: Sun, 2 May 2004 18:55:40 +0200 (CEST)
On Sun, 2 May 2004, Scott Long wrote:

> Thomas Quinot wrote:
> > What about computing a default /var size as a function of the available
> > RAM? Would that be workable within sysinstall?
>
> I believe that sysinstall already computes the swap partition size based
> on RAM, so computing /var also should be easy.  Patches are happily
> accecpted =-)

How about this one?  Makes /var = physical RAM + some extra 64MB
(VAR_NOMINAL_SIZE).  Untested, so don't beat me. :-)

---8<---
Index: label.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sysinstall/label.c,v
retrieving revision 1.143
diff -u -r1.143 label.c
--- label.c	16 Mar 2004 17:07:06 -0000	1.143
+++ label.c	2 May 2004 16:53:09 -0000
_at__at_ -1452,8 +1452,21 _at__at_
 	record_label_chunks(devs, dev);
     }
     if (!vardev) {
-	sz = requested_part_size(VAR_VAR_SIZE, VAR_NOMINAL_SIZE, VAR_DEFAULT_SIZE, perc);
+	sz = requested_part_size(VAR_VAR_SIZE, 0, 0, perc);
+	if (sz == 0) {
+	    daddr_t nom;
+	    daddr_t def;

+	    mib[0] = CTL_HW;
+	    mib[1] = HW_PHYSMEM;
+	    size = sizeof physmem;
+	    sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0);
+	    def = (int)(physmem / 512);
+	    if (def < VAR_MIN_SIZE * ONE_MEG)
+		def = VAR_MIN_SIZE * ONE_MEG;
+	    nom = (int)(physmem / 512) / 8;
+	    sz = VAR_NOMINAL_SIZE * ONE_MEG + nom + (def - nom) * perc / 100;
+	}
 	var_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
 				label_chunk_info[here].c, sz, part,
 				FS_BSDFFS, CHUNK_AUTO_SIZE);
---8<---

cheers,
le

-- 
Lukas Ertl                           http://mailbox.univie.ac.at/~le/
le_at_FreeBSD.org                       http://people.freebsd.org/~le/
Received on Sun May 02 2004 - 07:55:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:52 UTC