1995-04-28 10:54:58 +04:00
|
|
|
%{
|
2006-02-11 23:15:53 +03:00
|
|
|
/* $NetBSD: gram.y,v 1.5 2006/02/11 20:15:53 cube Exp $ */
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1992, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* This software was developed by the Computer Systems Engineering group
|
|
|
|
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
|
|
|
* contributed to Berkeley.
|
|
|
|
*
|
|
|
|
* All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Lawrence Berkeley Laboratories.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
2003-08-07 15:25:11 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1995-04-28 10:54:58 +04:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* from: @(#)gram.y 8.1 (Berkeley) 6/6/93
|
|
|
|
*/
|
|
|
|
|
1996-09-01 00:58:16 +04:00
|
|
|
#include <sys/types.h>
|
1996-11-12 02:54:17 +03:00
|
|
|
#include <sys/param.h>
|
1995-04-28 10:54:58 +04:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
1996-09-01 00:58:16 +04:00
|
|
|
#include <errno.h>
|
2002-01-29 13:20:28 +03:00
|
|
|
#include "defs.h"
|
1995-04-28 10:54:58 +04:00
|
|
|
#include "sem.h"
|
|
|
|
|
2003-11-19 21:06:13 +03:00
|
|
|
#define FORMAT(n) (((n).fmt == 8 && (n).val != 0) ? "0%llo" : \
|
|
|
|
((n).fmt == 16) ? "0x%llx" : "%lld")
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
#define stop(s) error(s), exit(1)
|
|
|
|
|
|
|
|
static struct config conf; /* at most one active at a time */
|
|
|
|
|
|
|
|
/* the following is used to recover nvlist space after errors */
|
|
|
|
static struct nvlist *alloc[1000];
|
|
|
|
static int adepth;
|
1996-03-17 14:50:09 +03:00
|
|
|
#define new0(n,s,p,i,x) (alloc[adepth++] = newnv(n, s, p, i, x))
|
|
|
|
#define new_n(n) new0(n, NULL, NULL, 0, NULL)
|
|
|
|
#define new_nx(n, x) new0(n, NULL, NULL, 0, x)
|
|
|
|
#define new_ns(n, s) new0(n, s, NULL, 0, NULL)
|
|
|
|
#define new_si(s, i) new0(NULL, s, NULL, i, NULL)
|
|
|
|
#define new_nsi(n,s,i) new0(n, s, NULL, i, NULL)
|
|
|
|
#define new_np(n, p) new0(n, NULL, p, 0, NULL)
|
|
|
|
#define new_s(s) new0(NULL, s, NULL, 0, NULL)
|
|
|
|
#define new_p(p) new0(NULL, NULL, p, 0, NULL)
|
|
|
|
#define new_px(p, x) new0(NULL, NULL, p, 0, x)
|
1999-01-21 16:10:08 +03:00
|
|
|
#define new_sx(s, x) new0(NULL, s, NULL, 0, x)
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1996-03-17 16:18:15 +03:00
|
|
|
#define fx_atom(s) new0(s, NULL, NULL, FX_ATOM, NULL)
|
|
|
|
#define fx_not(e) new0(NULL, NULL, NULL, FX_NOT, e)
|
|
|
|
#define fx_and(e1, e2) new0(NULL, NULL, e1, FX_AND, e2)
|
|
|
|
#define fx_or(e1, e2) new0(NULL, NULL, e1, FX_OR, e2)
|
|
|
|
|
2000-10-02 23:48:34 +04:00
|
|
|
static void cleanup(void);
|
2001-06-08 16:47:06 +04:00
|
|
|
static void setmachine(const char *, const char *, struct nvlist *);
|
2000-10-02 23:48:34 +04:00
|
|
|
static void check_maxpart(void);
|
1995-04-28 10:54:58 +04:00
|
|
|
|
2000-10-02 23:48:34 +04:00
|
|
|
static void app(struct nvlist *, struct nvlist *);
|
1999-01-21 16:10:08 +03:00
|
|
|
|
2000-10-02 23:48:34 +04:00
|
|
|
static struct nvlist *mk_nsis(const char *, int, struct nvlist *, int);
|
|
|
|
static struct nvlist *mk_ns(const char *, struct nvlist *);
|
1999-01-21 16:10:08 +03:00
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
%}
|
|
|
|
|
|
|
|
%union {
|
|
|
|
struct attr *attr;
|
|
|
|
struct devbase *devb;
|
1996-03-17 05:08:22 +03:00
|
|
|
struct deva *deva;
|
1995-04-28 10:54:58 +04:00
|
|
|
struct nvlist *list;
|
|
|
|
const char *str;
|
2003-11-19 21:06:13 +03:00
|
|
|
struct numconst num;
|
2003-11-18 21:47:36 +03:00
|
|
|
int64_t val;
|
1995-04-28 10:54:58 +04:00
|
|
|
}
|
|
|
|
|
2004-06-03 22:37:59 +04:00
|
|
|
%token AND AT ATTACH
|
|
|
|
%token BLOCK BUILD
|
2005-09-10 19:38:46 +04:00
|
|
|
%token CHAR COMPILE_WITH CONFIG
|
2004-06-03 22:37:59 +04:00
|
|
|
%token DEFFS DEFINE DEFOPT DEFPARAM DEFFLAG DEFPSEUDO DEVICE DEVCLASS DUMPS
|
|
|
|
%token DEVICE_MAJOR
|
|
|
|
%token ENDFILE
|
|
|
|
%token XFILE FILE_SYSTEM FLAGS
|
2005-09-10 19:38:46 +04:00
|
|
|
%token IDENT
|
2004-06-03 22:37:59 +04:00
|
|
|
%token XMACHINE MAJOR MAKEOPTIONS MAXUSERS MAXPARTITIONS MINOR
|
|
|
|
%token NEEDS_COUNT NEEDS_FLAG NO
|
|
|
|
%token XOBJECT ON OPTIONS
|
2004-06-04 08:38:27 +04:00
|
|
|
%token PACKAGE PLUSEQ PREFIX PSEUDO_DEVICE
|
2004-06-03 22:37:59 +04:00
|
|
|
%token ROOT
|
|
|
|
%token SOURCE
|
|
|
|
%token TYPE
|
Introduce versioning to config(1). This will allow us to provide a way to
error out in a bit more friendly way when the user is trying to use
config(1) on a too old or too recent source tree.
To achieve that, introduce the "version NUMBER" statement which can be use
about anywhere in the config files. Also, use two defines, CONFIG_VERSION
(which is the actual version of binary), and CONFIG_MINVERSION, which is
the minimum version the binary supports.
Allowing a range of versions serves several purposes: first it allows me
to introduce the versioning without requiring it to be used right away in
the kernel tree, which means it will be possible to introduce new features
of config(1) rather progressively in the future. E.g., using 'no pci' in
a config file could only require the new version in that config file, so
that the rest remains compatible.
In the end, an actual bump of the main config system (i.e., in conf/files)
will only be required when e.g., ioconf.c semantics change.
(Mostly-)silently accepted on tech-kern. Error messages turned into
correct and meaningful English thanks to Tracy and Perry.
2005-10-12 05:17:43 +04:00
|
|
|
%token VERSION
|
2004-06-03 22:37:59 +04:00
|
|
|
%token WITH
|
2003-11-19 21:06:13 +03:00
|
|
|
%token <num> NUMBER
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
%token <str> PATHNAME QSTRING WORD EMPTY
|
2001-06-08 16:47:06 +04:00
|
|
|
%token ENDDEFS
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1996-11-12 02:54:17 +03:00
|
|
|
%left '|'
|
|
|
|
%left '&'
|
|
|
|
|
1996-03-17 16:18:15 +03:00
|
|
|
%type <list> fopts fexpr fatom
|
1997-01-31 06:12:30 +03:00
|
|
|
%type <str> fs_spec
|
1997-10-10 14:27:53 +04:00
|
|
|
%type <val> fflgs fflag oflgs oflag
|
1995-04-28 10:54:58 +04:00
|
|
|
%type <str> rule
|
|
|
|
%type <attr> attr
|
|
|
|
%type <devb> devbase
|
1996-03-17 05:08:22 +03:00
|
|
|
%type <deva> devattach_opt
|
1995-04-28 10:54:58 +04:00
|
|
|
%type <list> atlist interface_opt
|
|
|
|
%type <str> atname
|
|
|
|
%type <list> loclist_opt loclist locdef
|
|
|
|
%type <str> locdefault
|
1999-01-21 16:10:08 +03:00
|
|
|
%type <list> values locdefaults
|
1995-04-28 10:54:58 +04:00
|
|
|
%type <list> attrs_opt attrs
|
|
|
|
%type <list> locators locator
|
1997-06-12 19:03:09 +04:00
|
|
|
%type <list> dev_spec
|
1995-04-28 10:54:58 +04:00
|
|
|
%type <str> device_instance
|
|
|
|
%type <str> attachment
|
|
|
|
%type <str> value
|
2003-11-19 21:06:13 +03:00
|
|
|
%type <val> major_minor npseudo
|
|
|
|
%type <num> signed_number
|
1995-04-28 10:54:58 +04:00
|
|
|
%type <val> flags_opt
|
1998-02-19 03:27:00 +03:00
|
|
|
%type <str> deffs
|
|
|
|
%type <list> deffses
|
|
|
|
%type <str> fsoptfile_opt
|
1998-01-12 10:37:40 +03:00
|
|
|
%type <str> defopt
|
|
|
|
%type <list> defopts
|
2002-10-11 05:48:25 +04:00
|
|
|
%type <str> optdep
|
|
|
|
%type <list> optdeps
|
1998-06-10 08:33:31 +04:00
|
|
|
%type <list> defoptdeps
|
1998-01-12 10:37:40 +03:00
|
|
|
%type <str> optfile_opt
|
2001-06-08 16:47:06 +04:00
|
|
|
%type <list> subarches_opt subarches
|
2005-06-01 16:32:57 +04:00
|
|
|
%type <str> filename stringvalue locname mkvarname
|
2002-09-06 17:18:43 +04:00
|
|
|
%type <val> device_major_block device_major_char
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A configuration consists of a machine type, followed by the machine
|
|
|
|
* definition files (via the include() mechanism), followed by the
|
|
|
|
* configuration specification(s) proper. In effect, this is two
|
|
|
|
* separate grammars, with some shared terminals and nonterminals.
|
1996-11-12 02:54:17 +03:00
|
|
|
* Note that we do not have sufficient keywords to enforce any order
|
|
|
|
* between elements of "topthings" without introducing shift/reduce
|
|
|
|
* conflicts. Instead, check order requirements in the C code.
|
1995-04-28 10:54:58 +04:00
|
|
|
*/
|
|
|
|
Configuration:
|
1996-11-12 02:54:17 +03:00
|
|
|
topthings /* dirspecs, include "std.arch" */
|
|
|
|
machine_spec /* "machine foo" from machine descr. */
|
2001-06-08 16:47:06 +04:00
|
|
|
dev_defs ENDDEFS /* all machine definition files */
|
Introduce versioning to config(1). This will allow us to provide a way to
error out in a bit more friendly way when the user is trying to use
config(1) on a too old or too recent source tree.
To achieve that, introduce the "version NUMBER" statement which can be use
about anywhere in the config files. Also, use two defines, CONFIG_VERSION
(which is the actual version of binary), and CONFIG_MINVERSION, which is
the minimum version the binary supports.
Allowing a range of versions serves several purposes: first it allows me
to introduce the versioning without requiring it to be used right away in
the kernel tree, which means it will be possible to introduce new features
of config(1) rather progressively in the future. E.g., using 'no pci' in
a config file could only require the new version in that config file, so
that the rest remains compatible.
In the end, an actual bump of the main config system (i.e., in conf/files)
will only be required when e.g., ioconf.c semantics change.
(Mostly-)silently accepted on tech-kern. Error messages turned into
correct and meaningful English thanks to Tracy and Perry.
2005-10-12 05:17:43 +04:00
|
|
|
{ check_maxpart(); check_version(); }
|
1995-04-28 10:54:58 +04:00
|
|
|
specs; /* rest of machine description */
|
|
|
|
|
1996-11-12 02:54:17 +03:00
|
|
|
topthings:
|
|
|
|
topthings topthing |
|
1996-09-01 00:58:16 +04:00
|
|
|
/* empty */;
|
|
|
|
|
1996-11-12 02:54:17 +03:00
|
|
|
topthing:
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
SOURCE filename '\n' { if (!srcdir) srcdir = $2; } |
|
|
|
|
BUILD filename '\n' { if (!builddir) builddir = $2; } |
|
1995-04-28 10:54:58 +04:00
|
|
|
'\n';
|
|
|
|
|
|
|
|
machine_spec:
|
2001-06-08 16:47:06 +04:00
|
|
|
XMACHINE WORD '\n' { setmachine($2,NULL,NULL); } |
|
|
|
|
XMACHINE WORD WORD subarches_opt '\n' { setmachine($2,$3,$4); } |
|
1996-11-12 02:54:17 +03:00
|
|
|
error { stop("cannot proceed without machine specifier"); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
2001-06-08 16:47:06 +04:00
|
|
|
subarches_opt:
|
|
|
|
subarches |
|
|
|
|
/* empty */ { $$ = NULL; };
|
|
|
|
|
|
|
|
subarches:
|
|
|
|
subarches WORD { $$ = new_nx($2, $1); } |
|
|
|
|
WORD { $$ = new_n($1); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Various nonterminals shared between the grammars.
|
|
|
|
*/
|
|
|
|
file:
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
XFILE filename fopts fflgs rule { addfile($2, $3, $4, $5); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1997-10-10 14:27:53 +04:00
|
|
|
object:
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
XOBJECT filename fopts oflgs { addobject($2, $3, $4); };
|
1997-10-10 14:27:53 +04:00
|
|
|
|
2002-09-06 17:18:43 +04:00
|
|
|
device_major:
|
|
|
|
DEVICE_MAJOR WORD device_major_char device_major_block fopts
|
|
|
|
{ adddevm($2, $3, $4, $5); };
|
|
|
|
|
|
|
|
device_major_block:
|
2003-11-19 21:06:13 +03:00
|
|
|
BLOCK NUMBER { $$ = $2.val; } |
|
2002-09-06 17:18:43 +04:00
|
|
|
/* empty */ { $$ = -1; };
|
|
|
|
|
|
|
|
device_major_char:
|
2003-11-19 21:06:13 +03:00
|
|
|
CHAR NUMBER { $$ = $2.val; } |
|
2003-01-23 18:05:45 +03:00
|
|
|
/* empty */ { $$ = -1; };
|
2002-09-06 17:18:43 +04:00
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
/* order of options is important, must use right recursion */
|
|
|
|
fopts:
|
1996-11-12 02:54:17 +03:00
|
|
|
fexpr { $$ = $1; } |
|
|
|
|
/* empty */ { $$ = NULL; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1996-03-17 16:18:15 +03:00
|
|
|
fexpr:
|
1996-11-12 02:54:17 +03:00
|
|
|
fatom { $$ = $1; } |
|
|
|
|
'!' fatom { $$ = fx_not($2); } |
|
|
|
|
fexpr '&' fexpr { $$ = fx_and($1, $3); } |
|
|
|
|
fexpr '|' fexpr { $$ = fx_or($1, $3); } |
|
|
|
|
'(' fexpr ')' { $$ = $2; };
|
1996-03-17 16:18:15 +03:00
|
|
|
|
|
|
|
fatom:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD { $$ = fx_atom($1); };
|
1996-03-17 16:18:15 +03:00
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
fflgs:
|
1996-11-12 02:54:17 +03:00
|
|
|
fflgs fflag { $$ = $1 | $2; } |
|
|
|
|
/* empty */ { $$ = 0; };
|
|
|
|
|
|
|
|
fflag:
|
|
|
|
NEEDS_COUNT { $$ = FI_NEEDSCOUNT; } |
|
|
|
|
NEEDS_FLAG { $$ = FI_NEEDSFLAG; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1997-10-10 14:27:53 +04:00
|
|
|
oflgs:
|
|
|
|
oflgs oflag { $$ = $1 | $2; } |
|
|
|
|
/* empty */ { $$ = 0; };
|
|
|
|
|
|
|
|
oflag:
|
|
|
|
NEEDS_FLAG { $$ = OI_NEEDSFLAG; };
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
rule:
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
COMPILE_WITH stringvalue { $$ = $2; } |
|
1996-11-12 02:54:17 +03:00
|
|
|
/* empty */ { $$ = NULL; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1999-07-09 10:44:58 +04:00
|
|
|
prefix:
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
PREFIX filename { prefix_push($2); } |
|
1999-07-09 10:44:58 +04:00
|
|
|
PREFIX { prefix_pop(); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The machine definitions grammar.
|
|
|
|
*/
|
|
|
|
dev_defs:
|
|
|
|
dev_defs dev_def |
|
2001-06-08 16:47:06 +04:00
|
|
|
dev_defs ENDFILE { enddefs(); checkfiles(); } |
|
1995-04-28 10:54:58 +04:00
|
|
|
/* empty */;
|
|
|
|
|
|
|
|
dev_def:
|
1996-11-12 02:54:17 +03:00
|
|
|
one_def '\n' { adepth = 0; } |
|
1995-04-28 10:54:58 +04:00
|
|
|
'\n' |
|
1996-11-12 02:54:17 +03:00
|
|
|
error '\n' { cleanup(); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
one_def:
|
|
|
|
file |
|
1997-10-10 14:27:53 +04:00
|
|
|
object |
|
2002-09-11 10:20:09 +04:00
|
|
|
device_major { do_devsw = 1; } |
|
1999-07-09 10:44:58 +04:00
|
|
|
prefix |
|
2002-10-10 00:17:00 +04:00
|
|
|
DEVCLASS WORD { (void)defattr($2, NULL, NULL, 1); } |
|
1998-02-19 03:27:00 +03:00
|
|
|
DEFFS fsoptfile_opt deffses { deffilesystem($2, $3); } |
|
2002-10-10 00:17:00 +04:00
|
|
|
DEFINE WORD interface_opt attrs_opt
|
|
|
|
{ (void)defattr($2, $3, $4, 0); } |
|
1998-06-10 08:33:31 +04:00
|
|
|
DEFOPT optfile_opt defopts defoptdeps
|
|
|
|
{ defoption($2, $3, $4); } |
|
1998-06-24 15:20:54 +04:00
|
|
|
DEFFLAG optfile_opt defopts defoptdeps
|
|
|
|
{ defflag($2, $3, $4); } |
|
|
|
|
DEFPARAM optfile_opt defopts defoptdeps
|
|
|
|
{ defparam($2, $3, $4); } |
|
1998-02-17 01:05:35 +03:00
|
|
|
DEVICE devbase interface_opt attrs_opt
|
|
|
|
{ defdev($2, $3, $4, 0); } |
|
1996-09-01 01:15:05 +04:00
|
|
|
ATTACH devbase AT atlist devattach_opt attrs_opt
|
1996-11-12 02:54:17 +03:00
|
|
|
{ defdevattach($5, $2, $4, $6); } |
|
2003-11-19 21:06:13 +03:00
|
|
|
MAXPARTITIONS NUMBER { maxpartitions = $2.val; } |
|
|
|
|
MAXUSERS NUMBER NUMBER NUMBER { setdefmaxusers($2.val, $3.val, $4.val); } |
|
2004-06-05 07:21:53 +04:00
|
|
|
MAKEOPTIONS condmkopt_list |
|
2003-01-27 08:00:54 +03:00
|
|
|
DEFPSEUDO devbase interface_opt attrs_opt
|
|
|
|
{ defdev($2, $3, $4, 1); } |
|
Introduce versioning to config(1). This will allow us to provide a way to
error out in a bit more friendly way when the user is trying to use
config(1) on a too old or too recent source tree.
To achieve that, introduce the "version NUMBER" statement which can be use
about anywhere in the config files. Also, use two defines, CONFIG_VERSION
(which is the actual version of binary), and CONFIG_MINVERSION, which is
the minimum version the binary supports.
Allowing a range of versions serves several purposes: first it allows me
to introduce the versioning without requiring it to be used right away in
the kernel tree, which means it will be possible to introduce new features
of config(1) rather progressively in the future. E.g., using 'no pci' in
a config file could only require the new version in that config file, so
that the rest remains compatible.
In the end, an actual bump of the main config system (i.e., in conf/files)
will only be required when e.g., ioconf.c semantics change.
(Mostly-)silently accepted on tech-kern. Error messages turned into
correct and meaningful English thanks to Tracy and Perry.
2005-10-12 05:17:43 +04:00
|
|
|
MAJOR '{' majorlist '}' |
|
|
|
|
VERSION NUMBER { setversion($2.val); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
atlist:
|
1996-11-12 02:54:17 +03:00
|
|
|
atlist ',' atname { $$ = new_nx($3, $1); } |
|
|
|
|
atname { $$ = new_n($1); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
atname:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD { $$ = $1; } |
|
|
|
|
ROOT { $$ = NULL; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1998-02-19 03:27:00 +03:00
|
|
|
deffses:
|
|
|
|
deffses deffs { $$ = new_nx($2, $1); } |
|
|
|
|
deffs { $$ = new_n($1); };
|
|
|
|
|
|
|
|
deffs:
|
|
|
|
WORD { $$ = $1; };
|
|
|
|
|
1998-06-10 08:33:31 +04:00
|
|
|
defoptdeps:
|
2002-10-11 05:48:25 +04:00
|
|
|
':' optdeps { $$ = $2; } |
|
1998-06-10 08:33:31 +04:00
|
|
|
/* empty */ { $$ = NULL; };
|
|
|
|
|
2002-10-11 05:48:25 +04:00
|
|
|
optdeps:
|
|
|
|
optdeps ',' optdep { $$ = new_nx($3, $1); } |
|
|
|
|
optdep { $$ = new_n($1); };
|
|
|
|
|
|
|
|
optdep:
|
|
|
|
WORD { $$ = $1; };
|
|
|
|
|
1998-01-12 10:37:40 +03:00
|
|
|
defopts:
|
|
|
|
defopts defopt { $$ = new_nx($2, $1); } |
|
1998-02-19 03:27:00 +03:00
|
|
|
defopt { $$ = new_n($1); };
|
1998-01-12 10:37:40 +03:00
|
|
|
|
|
|
|
defopt:
|
1998-02-19 03:27:00 +03:00
|
|
|
WORD { $$ = $1; };
|
1998-01-12 10:37:40 +03:00
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
devbase:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD { $$ = getdevbase($1); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1996-03-17 05:08:22 +03:00
|
|
|
devattach_opt:
|
1996-11-12 02:54:17 +03:00
|
|
|
WITH WORD { $$ = getdevattach($2); } |
|
|
|
|
/* empty */ { $$ = NULL; };
|
1996-03-17 05:08:22 +03:00
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
interface_opt:
|
1996-11-12 02:54:17 +03:00
|
|
|
'{' loclist_opt '}' { $$ = new_nx("", $2); } |
|
|
|
|
/* empty */ { $$ = NULL; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
loclist_opt:
|
1996-11-12 02:54:17 +03:00
|
|
|
loclist { $$ = $1; } |
|
|
|
|
/* empty */ { $$ = NULL; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
/* loclist order matters, must use right recursion */
|
|
|
|
loclist:
|
1999-01-21 16:10:08 +03:00
|
|
|
locdef ',' loclist { $$ = $1; app($1, $3); } |
|
1996-11-12 02:54:17 +03:00
|
|
|
locdef { $$ = $1; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
/* "[ WORD locdefault ]" syntax may be unnecessary... */
|
|
|
|
locdef:
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
locname locdefault { $$ = new_nsi($1, $2, 0); } |
|
|
|
|
locname { $$ = new_nsi($1, NULL, 0); } |
|
|
|
|
'[' locname locdefault ']' { $$ = new_nsi($2, $3, 1); } |
|
2003-11-19 21:06:13 +03:00
|
|
|
locname '[' NUMBER ']' { $$ = mk_nsis($1, $3.val, NULL, 0); } |
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
locname '[' NUMBER ']' locdefaults
|
2003-11-19 21:06:13 +03:00
|
|
|
{ $$ = mk_nsis($1, $3.val, $5, 0); } |
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
'[' locname '[' NUMBER ']' locdefaults ']'
|
2003-11-19 21:06:13 +03:00
|
|
|
{ $$ = mk_nsis($2, $4.val, $6, 1); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
locname:
|
|
|
|
WORD { $$ = $1; } |
|
|
|
|
QSTRING { $$ = $1; };
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
locdefault:
|
1996-11-12 02:54:17 +03:00
|
|
|
'=' value { $$ = $2; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1999-01-21 16:10:08 +03:00
|
|
|
locdefaults:
|
|
|
|
'=' '{' values '}' { $$ = $3; };
|
|
|
|
|
1998-02-19 03:27:00 +03:00
|
|
|
fsoptfile_opt:
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
filename { $$ = $1; } |
|
1998-02-19 03:27:00 +03:00
|
|
|
/* empty */ { $$ = NULL; };
|
|
|
|
|
1998-01-12 10:37:40 +03:00
|
|
|
optfile_opt:
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
filename { $$ = $1; } |
|
1998-01-12 10:37:40 +03:00
|
|
|
/* empty */ { $$ = NULL; };
|
|
|
|
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
filename:
|
|
|
|
QSTRING { $$ = $1; } |
|
|
|
|
PATHNAME { $$ = $1; };
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
value:
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
QSTRING { $$ = $1; } |
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD { $$ = $1; } |
|
1997-10-10 13:32:03 +04:00
|
|
|
EMPTY { $$ = $1; } |
|
1996-11-12 02:54:17 +03:00
|
|
|
signed_number { char bf[40];
|
2003-07-13 16:39:08 +04:00
|
|
|
(void)snprintf(bf, sizeof(bf),
|
2003-11-20 00:10:27 +03:00
|
|
|
FORMAT($1), (long long)$1.val);
|
2003-07-13 16:39:08 +04:00
|
|
|
$$ = intern(bf); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
stringvalue:
|
|
|
|
QSTRING { $$ = $1; } |
|
|
|
|
WORD { $$ = $1; };
|
|
|
|
|
1999-01-21 16:10:08 +03:00
|
|
|
values:
|
|
|
|
value ',' values { $$ = new_sx($1, $3); } |
|
|
|
|
value { $$ = new_s($1); };
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
signed_number:
|
1996-11-12 02:54:17 +03:00
|
|
|
NUMBER { $$ = $1; } |
|
2003-11-19 21:06:13 +03:00
|
|
|
'-' NUMBER { $$.fmt = $2.fmt; $$.val = -$2.val; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
attrs_opt:
|
1996-11-12 02:54:17 +03:00
|
|
|
':' attrs { $$ = $2; } |
|
|
|
|
/* empty */ { $$ = NULL; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
attrs:
|
1996-11-12 02:54:17 +03:00
|
|
|
attrs ',' attr { $$ = new_px($3, $1); } |
|
|
|
|
attr { $$ = new_p($1); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
attr:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD { $$ = getattr($1); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
majorlist:
|
|
|
|
majorlist ',' majordef |
|
|
|
|
majordef;
|
|
|
|
|
|
|
|
majordef:
|
2003-11-19 21:06:13 +03:00
|
|
|
devbase '=' NUMBER { setmajor($1, $3.val); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The configuration grammar.
|
|
|
|
*/
|
|
|
|
specs:
|
|
|
|
specs spec |
|
|
|
|
/* empty */;
|
|
|
|
|
|
|
|
spec:
|
1996-11-12 02:54:17 +03:00
|
|
|
config_spec '\n' { adepth = 0; } |
|
1995-04-28 10:54:58 +04:00
|
|
|
'\n' |
|
1996-11-12 02:54:17 +03:00
|
|
|
error '\n' { cleanup(); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
config_spec:
|
1999-07-07 04:02:09 +04:00
|
|
|
one_def |
|
2002-06-05 14:56:17 +04:00
|
|
|
NO FILE_SYSTEM no_fs_list |
|
1997-01-31 06:12:30 +03:00
|
|
|
FILE_SYSTEM fs_list |
|
2002-06-05 14:56:17 +04:00
|
|
|
NO MAKEOPTIONS no_mkopt_list |
|
1995-04-28 10:54:58 +04:00
|
|
|
MAKEOPTIONS mkopt_list |
|
2002-06-05 14:56:17 +04:00
|
|
|
NO OPTIONS no_opt_list |
|
|
|
|
OPTIONS opt_list |
|
2003-11-19 21:06:13 +03:00
|
|
|
MAXUSERS NUMBER { setmaxusers($2.val); } |
|
Revise handling of pathnames and quoted strings. Previously, some
filenames had to be unquoted and also had to contain a / or .,
while others had to have no / and no . or be quoted, whereas
arbitrary machine symbols could always be optionally quoted,
which was kind of backwards.
Now, all filesnames use the same rules: quoted, or with a / or .
Arbitrary words can no longer be quoted unless the grammar specifically
allows it, which it now does for filenames, locator values, locator
defaults, compile-with, ident, makeoptions, and options.
Also, locator name symbols can be quoted, so mac68k's "no drq" locator
still works. ("no drq" doesn't appear in any machine description so I
presume it's just for the dmesg. )
2002-06-22 06:09:12 +04:00
|
|
|
IDENT stringvalue { setident($2); } |
|
1997-01-31 06:12:30 +03:00
|
|
|
CONFIG conf root_spec sysparam_list
|
|
|
|
{ addconf(&conf); } |
|
2006-02-11 23:15:53 +03:00
|
|
|
NO CONFIG WORD { delconf($3); } |
|
2002-06-05 14:56:17 +04:00
|
|
|
NO PSEUDO_DEVICE WORD { delpseudo($3); } |
|
1996-11-12 02:54:17 +03:00
|
|
|
PSEUDO_DEVICE WORD npseudo { addpseudo($2, $3); } |
|
2002-06-05 14:56:17 +04:00
|
|
|
NO device_instance AT attachment
|
2005-10-01 02:51:46 +04:00
|
|
|
{ deldevi($2, $4); } |
|
|
|
|
NO DEVICE AT attachment { deldeva($4); } |
|
|
|
|
NO device_instance { deldev($2); } |
|
1995-04-28 10:54:58 +04:00
|
|
|
device_instance AT attachment locators flags_opt
|
1996-11-12 02:54:17 +03:00
|
|
|
{ adddev($1, $3, $4, $5); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
2002-06-05 14:56:17 +04:00
|
|
|
fs_list:
|
|
|
|
fs_list ',' fsoption |
|
|
|
|
fsoption;
|
|
|
|
|
|
|
|
fsoption:
|
|
|
|
WORD { addfsoption($1); };
|
|
|
|
|
|
|
|
no_fs_list:
|
|
|
|
no_fs_list ',' no_fsoption |
|
|
|
|
no_fsoption;
|
|
|
|
|
|
|
|
no_fsoption:
|
|
|
|
WORD { delfsoption($1); };
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
mkopt_list:
|
|
|
|
mkopt_list ',' mkoption |
|
|
|
|
mkoption;
|
|
|
|
|
2005-06-01 16:32:57 +04:00
|
|
|
mkvarname:
|
|
|
|
QSTRING { $$ = $1; } |
|
|
|
|
WORD { $$ = $1; };
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
mkoption:
|
2005-06-01 16:32:57 +04:00
|
|
|
mkvarname '=' value { addmkoption($1, $3); } |
|
|
|
|
mkvarname PLUSEQ value { appendmkoption($1, $3); };
|
2004-06-05 07:21:53 +04:00
|
|
|
|
|
|
|
condmkopt_list:
|
|
|
|
condmkopt_list ',' condmkoption |
|
|
|
|
condmkoption;
|
|
|
|
|
|
|
|
condmkoption:
|
2005-06-01 16:32:57 +04:00
|
|
|
WORD mkvarname PLUSEQ value { appendcondmkoption($1, $2, $4); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
2002-06-05 14:56:17 +04:00
|
|
|
no_mkopt_list:
|
|
|
|
no_mkopt_list ',' no_mkoption |
|
|
|
|
no_mkoption;
|
|
|
|
|
|
|
|
no_mkoption:
|
|
|
|
WORD { delmkoption($1); }
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
opt_list:
|
|
|
|
opt_list ',' option |
|
|
|
|
option;
|
|
|
|
|
|
|
|
option:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD { addoption($1, NULL); } |
|
|
|
|
WORD '=' value { addoption($1, $3); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
2002-06-05 14:56:17 +04:00
|
|
|
no_opt_list:
|
|
|
|
no_opt_list ',' no_option |
|
|
|
|
no_option;
|
1997-01-31 06:12:30 +03:00
|
|
|
|
2002-06-05 14:56:17 +04:00
|
|
|
no_option:
|
|
|
|
WORD { deloption($1); };
|
1997-01-31 06:12:30 +03:00
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
conf:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD { conf.cf_name = $1;
|
1995-04-28 10:54:58 +04:00
|
|
|
conf.cf_lineno = currentline();
|
1997-01-31 06:12:30 +03:00
|
|
|
conf.cf_fstype = NULL;
|
1995-04-28 10:54:58 +04:00
|
|
|
conf.cf_root = NULL;
|
|
|
|
conf.cf_dump = NULL; };
|
|
|
|
|
1997-01-31 06:12:30 +03:00
|
|
|
root_spec:
|
|
|
|
ROOT on_opt dev_spec fs_spec_opt
|
|
|
|
{ setconf(&conf.cf_root, "root", $3); };
|
|
|
|
|
|
|
|
fs_spec_opt:
|
|
|
|
TYPE fs_spec { setfstype(&conf.cf_fstype, $2); } |
|
|
|
|
/* empty */;
|
|
|
|
|
|
|
|
fs_spec:
|
|
|
|
'?' { $$ = intern("?"); } |
|
1998-01-12 10:37:40 +03:00
|
|
|
WORD { $$ = $1; };
|
1997-01-31 06:12:30 +03:00
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
sysparam_list:
|
|
|
|
sysparam_list sysparam |
|
1997-01-31 06:12:30 +03:00
|
|
|
/* empty */;
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
sysparam:
|
1996-11-12 02:54:17 +03:00
|
|
|
DUMPS on_opt dev_spec { setconf(&conf.cf_dump, "dumps", $3); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
dev_spec:
|
1997-01-31 06:12:30 +03:00
|
|
|
'?' { $$ = new_si(intern("?"), NODEV); } |
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD { $$ = new_si($1, NODEV); } |
|
|
|
|
major_minor { $$ = new_si(NULL, $1); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
major_minor:
|
2003-11-19 21:06:13 +03:00
|
|
|
MAJOR NUMBER MINOR NUMBER { $$ = makedev($2.val, $4.val); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
on_opt:
|
|
|
|
ON | /* empty */;
|
|
|
|
|
|
|
|
npseudo:
|
2003-11-19 21:06:13 +03:00
|
|
|
NUMBER { $$ = $1.val; } |
|
1996-11-12 02:54:17 +03:00
|
|
|
/* empty */ { $$ = 1; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
device_instance:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD '*' { $$ = starref($1); } |
|
|
|
|
WORD { $$ = $1; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
attachment:
|
1996-11-12 02:54:17 +03:00
|
|
|
ROOT { $$ = NULL; } |
|
|
|
|
WORD '?' { $$ = wildref($1); } |
|
|
|
|
WORD { $$ = $1; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
locators:
|
1999-01-21 16:10:08 +03:00
|
|
|
locators locator { $$ = $2; app($2, $1); } |
|
1996-11-12 02:54:17 +03:00
|
|
|
/* empty */ { $$ = NULL; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
locator:
|
1999-01-21 16:10:08 +03:00
|
|
|
WORD values { $$ = mk_ns($1, $2); } |
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD '?' { $$ = new_ns($1, NULL); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
flags_opt:
|
2003-11-19 21:06:13 +03:00
|
|
|
FLAGS NUMBER { $$ = $2.val; } |
|
1996-11-12 02:54:17 +03:00
|
|
|
/* empty */ { $$ = 0; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
void
|
2000-10-02 23:48:34 +04:00
|
|
|
yyerror(const char *s)
|
1995-04-28 10:54:58 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
error("%s", s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Cleanup procedure after syntax error: release any nvlists
|
|
|
|
* allocated during parsing the current line.
|
|
|
|
*/
|
|
|
|
static void
|
2000-10-02 23:48:34 +04:00
|
|
|
cleanup(void)
|
1995-04-28 10:54:58 +04:00
|
|
|
{
|
1997-10-18 11:58:56 +04:00
|
|
|
struct nvlist **np;
|
|
|
|
int i;
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
for (np = alloc, i = adepth; --i >= 0; np++)
|
|
|
|
nvfree(*np);
|
|
|
|
adepth = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-06-08 16:47:06 +04:00
|
|
|
setmachine(const char *mch, const char *mcharch, struct nvlist *mchsubarches)
|
1995-04-28 10:54:58 +04:00
|
|
|
{
|
1996-09-01 00:58:16 +04:00
|
|
|
char buf[MAXPATHLEN];
|
2001-06-08 16:47:06 +04:00
|
|
|
struct nvlist *nv;
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
machine = mch;
|
|
|
|
machinearch = mcharch;
|
2001-06-08 16:47:06 +04:00
|
|
|
machinesubarches = mchsubarches;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up the file inclusion stack. This empty include tells
|
|
|
|
* the parser there are no more device definitions coming.
|
|
|
|
*/
|
2003-07-13 16:29:20 +04:00
|
|
|
strlcpy(buf, _PATH_DEVNULL, sizeof(buf));
|
2001-12-17 18:39:43 +03:00
|
|
|
if (include(buf, ENDDEFS, 0, 0) != 0)
|
2001-06-08 16:47:06 +04:00
|
|
|
exit(1);
|
1996-09-01 00:58:16 +04:00
|
|
|
|
2001-06-08 16:47:06 +04:00
|
|
|
/* Include arch/${MACHINE}/conf/files.${MACHINE} */
|
2003-07-13 16:39:08 +04:00
|
|
|
(void)snprintf(buf, sizeof(buf), "arch/%s/conf/files.%s",
|
|
|
|
machine, machine);
|
2001-12-17 18:39:43 +03:00
|
|
|
if (include(buf, ENDFILE, 0, 0) != 0)
|
1996-09-01 00:58:16 +04:00
|
|
|
exit(1);
|
|
|
|
|
2001-06-08 16:47:06 +04:00
|
|
|
/* Include any arch/${MACHINE_SUBARCH}/conf/files.${MACHINE_SUBARCH} */
|
|
|
|
for (nv = machinesubarches; nv != NULL; nv = nv->nv_next) {
|
2003-07-13 16:39:08 +04:00
|
|
|
(void)snprintf(buf, sizeof(buf), "arch/%s/conf/files.%s",
|
2001-06-08 16:47:06 +04:00
|
|
|
nv->nv_name, nv->nv_name);
|
2001-12-17 18:39:43 +03:00
|
|
|
if (include(buf, ENDFILE, 0, 0) != 0)
|
2001-06-08 16:47:06 +04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Include any arch/${MACHINE_ARCH}/conf/files.${MACHINE_ARCH} */
|
1995-04-28 10:54:58 +04:00
|
|
|
if (machinearch != NULL)
|
2003-07-13 16:39:08 +04:00
|
|
|
(void)snprintf(buf, sizeof(buf), "arch/%s/conf/files.%s",
|
1995-04-28 10:54:58 +04:00
|
|
|
machinearch, machinearch);
|
|
|
|
else
|
2003-07-13 16:29:20 +04:00
|
|
|
strlcpy(buf, _PATH_DEVNULL, sizeof(buf));
|
2001-12-17 18:39:43 +03:00
|
|
|
if (include(buf, ENDFILE, 0, 0) != 0)
|
1996-09-01 00:58:16 +04:00
|
|
|
exit(1);
|
1995-04-28 10:54:58 +04:00
|
|
|
|
2001-06-08 16:47:06 +04:00
|
|
|
/*
|
|
|
|
* Include the global conf/files. As the last thing
|
|
|
|
* pushed on the stack, it will be processed first.
|
|
|
|
*/
|
2001-12-17 18:39:43 +03:00
|
|
|
if (include("conf/files", ENDFILE, 0, 0) != 0)
|
1995-04-28 10:54:58 +04:00
|
|
|
exit(1);
|
2005-09-10 19:38:46 +04:00
|
|
|
|
|
|
|
oktopackage = 1;
|
1995-04-28 10:54:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-10-02 23:48:34 +04:00
|
|
|
check_maxpart(void)
|
1995-04-28 10:54:58 +04:00
|
|
|
{
|
2000-10-02 23:48:34 +04:00
|
|
|
|
1996-11-12 02:54:17 +03:00
|
|
|
if (maxpartitions <= 0) {
|
|
|
|
stop("cannot proceed without maxpartitions specifier");
|
|
|
|
}
|
1995-04-28 10:54:58 +04:00
|
|
|
}
|
1999-01-21 16:10:08 +03:00
|
|
|
|
Introduce versioning to config(1). This will allow us to provide a way to
error out in a bit more friendly way when the user is trying to use
config(1) on a too old or too recent source tree.
To achieve that, introduce the "version NUMBER" statement which can be use
about anywhere in the config files. Also, use two defines, CONFIG_VERSION
(which is the actual version of binary), and CONFIG_MINVERSION, which is
the minimum version the binary supports.
Allowing a range of versions serves several purposes: first it allows me
to introduce the versioning without requiring it to be used right away in
the kernel tree, which means it will be possible to introduce new features
of config(1) rather progressively in the future. E.g., using 'no pci' in
a config file could only require the new version in that config file, so
that the rest remains compatible.
In the end, an actual bump of the main config system (i.e., in conf/files)
will only be required when e.g., ioconf.c semantics change.
(Mostly-)silently accepted on tech-kern. Error messages turned into
correct and meaningful English thanks to Tracy and Perry.
2005-10-12 05:17:43 +04:00
|
|
|
static void
|
|
|
|
check_version(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* In essence, version is 0 and is not supported anymore
|
|
|
|
*/
|
|
|
|
if (version < CONFIG_MINVERSION)
|
|
|
|
stop("your sources are out of date -- please update.");
|
|
|
|
}
|
|
|
|
|
1999-01-21 16:10:08 +03:00
|
|
|
static void
|
2000-10-02 23:48:34 +04:00
|
|
|
app(struct nvlist *p, struct nvlist *q)
|
1999-01-21 16:10:08 +03:00
|
|
|
{
|
|
|
|
while (p->nv_next)
|
|
|
|
p = p->nv_next;
|
|
|
|
p->nv_next = q;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct nvlist *
|
2000-10-02 23:48:34 +04:00
|
|
|
mk_nsis(const char *name, int count, struct nvlist *adefs, int opt)
|
1999-01-21 16:10:08 +03:00
|
|
|
{
|
|
|
|
struct nvlist *defs = adefs;
|
|
|
|
struct nvlist **p;
|
|
|
|
char buf[200];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (count <= 0) {
|
|
|
|
fprintf(stderr, "config: array with <= 0 size: %s\n", name);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
p = &defs;
|
|
|
|
for(i = 0; i < count; i++) {
|
|
|
|
if (*p == NULL)
|
|
|
|
*p = new_s("0");
|
2003-07-13 16:39:08 +04:00
|
|
|
snprintf(buf, sizeof(buf), "%s%c%d", name, ARRCHR, i);
|
1999-01-21 16:10:08 +03:00
|
|
|
(*p)->nv_name = i == 0 ? name : intern(buf);
|
|
|
|
(*p)->nv_int = i > 0 || opt;
|
|
|
|
p = &(*p)->nv_next;
|
|
|
|
}
|
|
|
|
*p = 0;
|
|
|
|
return defs;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static struct nvlist *
|
2000-10-02 23:48:34 +04:00
|
|
|
mk_ns(const char *name, struct nvlist *vals)
|
1999-01-21 16:10:08 +03:00
|
|
|
{
|
|
|
|
struct nvlist *p;
|
|
|
|
char buf[200];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0, p = vals; p; i++, p = p->nv_next) {
|
2003-07-13 16:39:08 +04:00
|
|
|
snprintf(buf, sizeof(buf), "%s%c%d", name, ARRCHR, i);
|
1999-01-21 16:10:08 +03:00
|
|
|
p->nv_name = i == 0 ? name : intern(buf);
|
|
|
|
}
|
|
|
|
return vals;
|
|
|
|
}
|
|
|
|
|