Subject: Re: UserKernelConfig (PR 10057)
To: None <thorpej@zembu.com>
From: None <itojun@iijlab.net>
List: tech-kern
Date: 05/09/2000 08:53:33
> > 	yup, we need to deal with the above case (current userconf_change seems
> > 	to fail on the case you mention).  i think we can update it.
>One of the first things that needs to happen is that config(8) needs to be
>changed to not pack the locators.
>This was done by a Japanese developer who ported the NetBSD config mechanism
>to FreeBSD, was it not?

	Yes it was (by furuta-san).  but after testing it myself,
	I found that the locator tables (loc[] and pv[]) become 5 times bigger
	than packed one.
	It may be better if we just malloc and copy, only when we make
	changes in UKC, given the frequency we may use UKC (I think I use it
	as workaround, though I can be wrong).

itojun


-- packed
static int loc[321] = {
static short pv[183] = {

-- non-packed
static int loc[806] = {
static short pv[1084] = {


Index: Makefile
===================================================================
RCS file: /cvsroot/syssrc/usr.sbin/config/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- Makefile	1998/05/01 13:02:09	1.21
+++ Makefile	2000/05/08 23:51:54
@@ -6,7 +6,7 @@
 SRCS=	files.c gram.y hash.c main.c mkheaders.c mkioconf.c mkmakefile.c \
 	mkswap.c pack.c scan.l sem.c util.c
 YFLAGS=
-CPPFLAGS+=-I${.CURDIR} -I.
+CPPFLAGS+=-I${.CURDIR} -I. -DNOPACK
 CLEANFILES+=gram.h
 
 # This program actually requires "flex" (not just any old lex).
Index: pack.c
===================================================================
RCS file: /cvsroot/syssrc/usr.sbin/config/pack.c,v
retrieving revision 1.8
diff -u -r1.8 pack.c
--- pack.c	1999/12/20 17:19:13	1.8
+++ pack.c	2000/05/08 23:51:54
@@ -118,6 +118,12 @@
 static int pvlencmp __P((const void *, const void *));
 static void resettails __P((void));
 
+#ifdef NOPACK
+static const int packloc = 0;
+#else
+static const int packloc = 1;
+#endif
+
 void
 pack()
 {
@@ -217,7 +223,7 @@
 				/* try to find an equivalent for l */
 				for (j = m; j < n; j++) {
 					p = packed[j];
-					if (sameas(l, p)) {
+					if (packloc && sameas(l, p)) {
 						l->i_collapsed = 1;
 						l->i_cfindex = p->i_cfindex;
 						goto nextalias;
@@ -364,7 +370,7 @@
 	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,
-				    samelocs, locators.used);
+				    packloc ? samelocs : NULL, locators.used);
 			i->i_locoff = o < 0 ? addlocs(i->i_locs, l) : o;
 		} else
 			i->i_locoff = -1;
@@ -389,7 +395,7 @@
 			vec[v] = par[v]->i_cfindex;
 		if (l == 0 ||
 		    (o = findvec(vec, PVHASH(vec[l - 1]), l,
-			    samepv, parents.used)) < 0)
+			    packloc ? samepv : NULL, parents.used)) < 0)
 		    	o = addpv(vec, l);
 		i->i_pvoff = o;
 	}
@@ -416,7 +422,7 @@
 	hp = &tails[hash];
 	for (t = *hp; t != NULL; t = t->t_next) {
 		off = t->t_ends_at - len;
-		if (off >= 0 && (*cmp)(ptr, off, len))
+		if (off >= 0 && cmp && (*cmp)(ptr, off, len))
 			return (off);
 	}
 	t = emalloc(sizeof(*t));