Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/config Don't pack locators. Introduce a new comman...



details:   https://anonhg.NetBSD.org/src/rev/cf34be8db683
branches:  trunk
changeset: 511965:cf34be8db683
user:      gmcgarry <gmcgarry%NetBSD.org@localhost>
date:      Sun Jul 01 02:46:47 2001 +0000

description:
Don't pack locators.  Introduce a new commandline option to
restore the previous behaviour of packing locators.

Results in a 2.5KB increase in size for the current i386 GENERIC
kernel.  My custom kernel resulted in a 12-byte increase.

diffstat:

 usr.sbin/config/config.8 |   8 +++++++-
 usr.sbin/config/main.c   |  11 ++++++++---
 usr.sbin/config/pack.c   |  14 ++++++++++----
 3 files changed, 25 insertions(+), 8 deletions(-)

diffs (101 lines):

diff -r 833331e69fc0 -r cf34be8db683 usr.sbin/config/config.8
--- a/usr.sbin/config/config.8  Sun Jul 01 02:16:33 2001 +0000
+++ b/usr.sbin/config/config.8  Sun Jul 01 02:46:47 2001 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: config.8,v 1.15 1999/03/22 18:43:51 garbled Exp $
+.\"    $NetBSD: config.8,v 1.16 2001/07/01 02:46:47 gmcgarry Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -139,6 +139,12 @@
 .Nm
 to be somewhat more verbose by enabling certain warning messages.
 .Pp
+The
+.Fl P
+option causes
+.Nm
+to pack locators, conserving some kernel memory.
+.Pp
 The old undocumented
 .Fl g
 flag is no longer supported.
diff -r 833331e69fc0 -r cf34be8db683 usr.sbin/config/main.c
--- a/usr.sbin/config/main.c    Sun Jul 01 02:16:33 2001 +0000
+++ b/usr.sbin/config/main.c    Sun Jul 01 02:46:47 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.56 2001/06/08 12:47:06 fredette Exp $       */
+/*     $NetBSD: main.c,v 1.57 2001/07/01 02:46:47 gmcgarry Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -69,6 +69,7 @@
 #include "sem.h"
 
 int    vflag;                          /* verbose output */
+int    Pflag;                          /* pack locators */
 
 int    yyparse(void);
 
@@ -112,7 +113,7 @@
        setprogname(argv[0]);
 
        pflag = 0;
-       while ((ch = getopt(argc, argv, "Dgpvb:s:")) != -1) {
+       while ((ch = getopt(argc, argv, "DPgpvb:s:")) != -1) {
                switch (ch) {
 
 #ifndef MAKE_BOOTSTRAP
@@ -121,6 +122,10 @@
                        break;
 #endif
 
+               case 'P':
+                       Pflag = 1;
+                       break;
+
                case 'g':
                        /*
                         * In addition to DEBUG, you probably wanted to
@@ -169,7 +174,7 @@
        argv += optind;
        if (argc > 1) {
 usage:
-               (void)fputs("usage: config [-pv] [-s srcdir] [-b builddir] sysname\n", stderr);
+               (void)fputs("usage: config [-Ppv] [-s srcdir] [-b builddir] sysname\n", stderr);
                exit(1);
        }
        conffile = (argc == 1) ? argv[0] : "CONFIG";
diff -r 833331e69fc0 -r cf34be8db683 usr.sbin/config/pack.c
--- a/usr.sbin/config/pack.c    Sun Jul 01 02:16:33 2001 +0000
+++ b/usr.sbin/config/pack.c    Sun Jul 01 02:46:47 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pack.c,v 1.9 2000/10/02 19:48:35 cgd Exp $     */
+/*     $NetBSD: pack.c,v 1.10 2001/07/01 02:46:47 gmcgarry Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -353,14 +353,20 @@
 packlocs(void)
 {
        struct devi **p, *i;
-       int l, o;
+       int l,o;
+       extern int Pflag;
 
        qsort(packed, npacked, sizeof *packed, loclencmp);
        for (p = packed; (i = *p) != NULL; p++) {
                if ((l = i->i_atattr->a_loclen) > 0) {
-                       o = findvec(i->i_locs, LOCHASH(i->i_locs[l - 1]), l,
+                       if (Pflag) {
+                               o = findvec(i->i_locs, 
+                                   LOCHASH(i->i_locs[l - 1]), l,
                                    samelocs, locators.used);
-                       i->i_locoff = o < 0 ? addlocs(i->i_locs, l) : o;
+                               i->i_locoff = o < 0 ?
+                                   addlocs(i->i_locs, l) : o;
+                       } else
+                               i->i_locoff = addlocs(i->i_locs, l);
                } else
                        i->i_locoff = -1;
        }



Home | Main Index | Thread Index | Old Index