Re: include directive in config(8) (was: Two Junior Kernel Hacker tasks..)

2001-06-27 Thread Warner Losh

In message [EMAIL PROTECTED] Dima Dorfman writes:
: I thought about this, too.  Right now there isn't a way to do that,
: and neither OpenBSD nor NetBSD have one AFAIK.  That said, I think it
: would be trivial to implement.  The list of options and devices is a
: simple linked list (mind you, it's a home-grown one, not queue(3)); it
: shouldn't be too hard to implement unoption and undevice
: directives.

I could have sworn that NetBSD and/or OpenBSD had this feature.  But
if they do, I've been unable to find it in my searches.  Maybe they
just talked about it.

Go forward with include after usenix.  I've seen less objection to it
than my $MACHINE/compile proposal (so far two against: obrien who
wants it compile/$MACHINE and bde who wants something too weird for me
to understand).

Warner
 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: include directive in config(8) (was: Two Junior Kernel Hacker tasks..)

2001-06-25 Thread Peter Pentchev

On Mon, Jun 25, 2001 at 08:27:35AM +0300, Valentin Nechayev wrote:
  Mon, Jun 25, 2001 at 00:05:36, clefevre-lists (Cyrille Lefevre) wrote about Re: 
include directive in config(8) (was: Two Junior Kernel Hacker tasks..): 
 
  how about undef options XXX and undef device XXX, etc. ?
 
 s/undef/no/
 I like Cisco style ;)))

This sounds nice.

G'luck,
Peter

-- 
This inert sentence is my body, but my soul is alive, dancing in the sparks of your 
brain.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: include directive in config(8) (was: Two Junior Kernel Hacker tasks..)

2001-06-24 Thread Warner Losh

Is there a way to undef an option?

Warner

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: include directive in config(8) (was: Two Junior Kernel Hacker tasks..)

2001-06-24 Thread Dima Dorfman

Warner Losh [EMAIL PROTECTED] writes:
 Is there a way to undef an option?

I thought about this, too.  Right now there isn't a way to do that,
and neither OpenBSD nor NetBSD have one AFAIK.  That said, I think it
would be trivial to implement.  The list of options and devices is a
simple linked list (mind you, it's a home-grown one, not queue(3)); it
shouldn't be too hard to implement unoption and undevice
directives.

Dima Dorfman
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: include directive in config(8) (was: Two Junior Kernel Hacker tasks..)

2001-06-24 Thread Cyrille Lefevre

Dima Dorfman [EMAIL PROTECTED] writes:

 Warner Losh [EMAIL PROTECTED] writes:
  Is there a way to undef an option?
 
 I thought about this, too.  Right now there isn't a way to do that,
 and neither OpenBSD nor NetBSD have one AFAIK.  That said, I think it
 would be trivial to implement.  The list of options and devices is a
 simple linked list (mind you, it's a home-grown one, not queue(3)); it
 shouldn't be too hard to implement unoption and undevice
 directives.

how about undef options XXX and undef device XXX, etc. ?

Cyrille.
--
home: mailto:[EMAIL PROTECTED]   UNIX is user-friendly; it's just particular
work: mailto:[EMAIL PROTECTED]   about who it chooses to be friends with.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: include directive in config(8) (was: Two Junior Kernel Hacker tasks..)

2001-06-24 Thread Valentin Nechayev

 Mon, Jun 25, 2001 at 00:05:36, clefevre-lists (Cyrille Lefevre) wrote about Re: 
include directive in config(8) (was: Two Junior Kernel Hacker tasks..): 

 how about undef options XXX and undef device XXX, etc. ?

s/undef/no/
I like Cisco style ;)))


/netch

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



include directive in config(8) (was: Two Junior Kernel Hacker tasks..)

2001-06-23 Thread Dima Dorfman

[ peter@ cc'd because he's done a lot of work with config(8) ]

John Baldwin [EMAIL PROTECTED] writes:
 On 22-Jun-01 Dima Dorfman wrote:
  John Baldwin [EMAIL PROTECTED] writes:
  1) Split sys/i386/conf/NOTES up into MI and MD parts.  The MI portion would
 become sys/conf/NOTES and would contain all the machine independent
 options and devices.  The MD options and devices would live in
 sys/${MACHINE_ARCH}/conf/NOTES.  This would include altering the
 sys/${MACHINE_ARCH}/conf/Makefile's (based on the LINT: target in the
 i386 Makefile) to concatenate the MI and MD NOTES files together to
 feed to makelint.pl to build LINT.  This addresses problems with not
 having
 a place for non-i386 kernel options/devices that aren't in GENERIC for
 example.
  
  OpenBSD (and I think NetBSD) solve this problem by having an 'include'
  directive in the kernel config file.  E.g., in
  sys/arch/i386/conf/GENRIC (the MD config file):
  
machine i386
...
include ../../../conf/GENREIC # -- MI config file
...
  
  I think this is much more general than just splitting NOTES.  Is there
  any reason we shouldn't do this?  I'd be willing to implement
  'include' in config(8).
 
 That's fine.  LINT is still special, because we do extra processing to convert
 NOTES to LINT, but that would make updating GENERIC easier.

Okay, attached is a patch to config(8) that implements an 'include'
directive.  The include()/endinclude() routines are mostly from
OpenBSD.  I can't say I've done excessive testing on this, but it
works pretty well from what I can tell.

Comments?  Suggestions?  Reviews?

Thanks,

Dima Dorfman
[EMAIL PROTECTED]

Index: config.h
===
RCS file: /stl/src/FreeBSD/src/usr.sbin/config/config.h,v
retrieving revision 1.48
diff -u -r1.48 config.h
--- config.h2001/02/28 02:55:15 1.48
+++ config.h2001/06/24 06:11:11
@@ -142,6 +142,7 @@
 
 extern charerrbuf[80];
 extern int yyline;
+extern const   char *yyfile;
 
 extern struct  file_list *ftab;
 
Index: config.y
===
RCS file: /stl/src/FreeBSD/src/usr.sbin/config/config.y,v
retrieving revision 1.54
diff -u -r1.54 config.y
--- config.y2001/02/22 04:00:29 1.54
+++ config.y2001/06/24 06:11:11
@@ -17,6 +17,7 @@
 %token OPTIONS
 %token MAKEOPTIONS
 %token SEMICOLON
+%token INCLUDE
 
 %token str   ID
 %token val   NUMBER
@@ -77,14 +78,15 @@
 char   *hints;
 inthintmode;
 intyyline;
+const  char *yyfile;
 struct  file_list *ftab;
 char   errbuf[80];
 intmaxusers;
 
 #define ns(s)  strdup(s)
+int include(const char *, int);
+void yyerror(const char *s);
 
-static void yyerror(const char *s);
-
 static char *
 devopt(char *dev)
 {
@@ -147,11 +149,14 @@
  = {
  hints = $2;
  hintmode = 1;
-   };
+   } |
+   INCLUDE ID
+ = { include($2, 0); };
 
 System_spec:
CONFIG System_id System_parameter_list
- = { errx(1, line %d: root/dump/swap specifications obsolete, yyline);}
+ = { errx(1, %s:%d: root/dump/swap specifications obsolete,
+ yyfile, yyline);}
  |
CONFIG System_id
  ;
@@ -178,7 +183,8 @@
 
newopt(opt, $1, NULL);
if ((s = strchr($1, '=')))
-   errx(1, line %d: The `=' in options should not be quoted, 
yyline);
+   errx(1, %s:%d: The `=' in options should not be 
+   quoted, yyfile, yyline);
  } |
Save_id EQUALS Opt_value
  = {
@@ -229,16 +235,17 @@
/* and the device part */
newdev($2, $3);
if ($3 == 0)
-   errx(1, line %d: devices with zero units are not likely to be 
correct, yyline);
+   errx(1, %s:%d: devices with zero units are not 
+   likely to be correct, yyfile, yyline);
} ;
 
 %%
 
-static void
+void
 yyerror(const char *s)
 {
 
-   errx(1, line %d: %s, yyline + 1, s);
+   errx(1, %s:%d: %s, yyfile, yyline + 1, s);
 }
 
 /*
Index: lang.l
===
RCS file: /stl/src/FreeBSD/src/usr.sbin/config/lang.l,v
retrieving revision 1.30
diff -u -r1.30 lang.l
--- lang.l  2001/02/19 04:43:21 1.30
+++ lang.l  2001/06/24 06:11:11
@@ -35,6 +35,7 @@
  * $FreeBSD: src/usr.sbin/config/lang.l,v 1.30 2001/02/19 04:43:21 peter Exp $
  */
 
+#include assert.h
 #include ctype.h
 #include string.h
 #include y.tab.h
@@ -43,6 +44,19 @@
 #define YY_NO_UNPUT
 
 /*
+ * Data for returning to previous files from include files.
+ */
+struct incl {
+   struct  incl *in_prev;  /* previous includes in