1995-04-28 10:54:58 +04:00
|
|
|
%{
|
1997-06-12 19:03:09 +04:00
|
|
|
/* $NetBSD: gram.y,v 1.15 1997/06/12 15:03:09 mrg 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.
|
|
|
|
* 3. 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, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* 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>
|
1995-04-28 10:54:58 +04:00
|
|
|
#include "config.h"
|
|
|
|
#include "sem.h"
|
|
|
|
|
|
|
|
#define FORMAT(n) ((n) > -10 && (n) < 10 ? "%d" : "0x%x")
|
|
|
|
|
|
|
|
#define stop(s) error(s), exit(1)
|
|
|
|
|
|
|
|
int include __P((const char *, int));
|
|
|
|
void yyerror __P((const char *));
|
|
|
|
int yylex __P((void));
|
|
|
|
|
|
|
|
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)
|
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)
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
static void cleanup __P((void));
|
|
|
|
static void setmachine __P((const char *, const char *));
|
1996-11-12 02:54:17 +03:00
|
|
|
static void check_maxpart __P((void));
|
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;
|
|
|
|
int val;
|
|
|
|
}
|
|
|
|
|
1997-02-03 00:12:30 +03:00
|
|
|
%token AND AT ATTACH BUILD COMPILE_WITH CONFIG DEFINE DEFOPT DEVICE DUMPS
|
|
|
|
%token ENDFILE XFILE FILE_SYSTEM FLAGS INCLUDE XMACHINE MAJOR MAKEOPTIONS
|
1997-01-31 06:12:30 +03:00
|
|
|
%token MAXUSERS MAXPARTITIONS MINOR ON OPTIONS PSEUDO_DEVICE ROOT SOURCE
|
1997-06-12 19:03:09 +04:00
|
|
|
%token TYPE WITH NEEDS_COUNT NEEDS_FLAG
|
1996-11-12 02:54:17 +03:00
|
|
|
%token <val> NUMBER
|
1995-04-28 10:54:58 +04:00
|
|
|
%token <str> PATHNAME WORD
|
|
|
|
|
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
|
1996-11-12 02:54:17 +03:00
|
|
|
%type <val> fflgs fflag
|
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
|
|
|
|
%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
|
|
|
|
%type <val> major_minor signed_number npseudo
|
|
|
|
%type <val> flags_opt
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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. */
|
1996-11-02 04:00:14 +03:00
|
|
|
dev_defs dev_eof /* sys/conf/files */
|
|
|
|
dev_defs dev_eof /* sys/arch/${MACHINE_ARCH}/... */
|
1996-11-12 02:54:17 +03:00
|
|
|
dev_defs dev_eof /* sys/arch/${MACHINE}/... */
|
|
|
|
{ check_maxpart(); }
|
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:
|
|
|
|
SOURCE PATHNAME '\n' { if (!srcdir) srcdir = $2; } |
|
|
|
|
BUILD PATHNAME '\n' { if (!builddir) builddir = $2; } |
|
|
|
|
include '\n' |
|
1995-04-28 10:54:58 +04:00
|
|
|
'\n';
|
|
|
|
|
|
|
|
machine_spec:
|
1996-11-12 02:54:17 +03:00
|
|
|
XMACHINE WORD '\n' { setmachine($2,NULL); } |
|
|
|
|
XMACHINE WORD WORD '\n' { setmachine($2,$3); } |
|
|
|
|
error { stop("cannot proceed without machine specifier"); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
dev_eof:
|
1996-11-12 02:54:17 +03:00
|
|
|
ENDFILE { enddefs(); checkfiles(); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Various nonterminals shared between the grammars.
|
|
|
|
*/
|
|
|
|
file:
|
1996-11-12 02:54:17 +03:00
|
|
|
XFILE PATHNAME fopts fflgs rule { addfile($2, $3, $4, $5); };
|
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
|
|
|
|
|
|
|
rule:
|
1996-11-12 02:54:17 +03:00
|
|
|
COMPILE_WITH WORD { $$ = $2; } |
|
|
|
|
/* empty */ { $$ = NULL; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
include:
|
1996-11-12 02:54:17 +03:00
|
|
|
INCLUDE WORD { include($2, 0); };
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The machine definitions grammar.
|
|
|
|
*/
|
|
|
|
dev_defs:
|
|
|
|
dev_defs dev_def |
|
|
|
|
/* 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 |
|
|
|
|
include |
|
1996-11-12 02:54:17 +03:00
|
|
|
DEFINE WORD interface_opt { (void)defattr($2, $3); } |
|
1997-02-03 00:12:30 +03:00
|
|
|
DEFOPT WORD { defoption($2); } |
|
1996-03-17 05:08:22 +03:00
|
|
|
DEVICE devbase interface_opt attrs_opt
|
1996-11-12 02:54:17 +03:00
|
|
|
{ defdev($2, 0, $3, $4); } |
|
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); } |
|
|
|
|
MAXPARTITIONS NUMBER { maxpartitions = $2; } |
|
|
|
|
MAXUSERS NUMBER NUMBER NUMBER { setdefmaxusers($2, $3, $4); } |
|
|
|
|
PSEUDO_DEVICE devbase attrs_opt { defdev($2,1,NULL,$3); } |
|
1995-04-28 10:54:58 +04:00
|
|
|
MAJOR '{' majorlist '}';
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
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:
|
1996-11-12 02:54:17 +03:00
|
|
|
locdef ',' loclist { ($$ = $1)->nv_next = $3; } |
|
|
|
|
locdef { $$ = $1; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
/* "[ WORD locdefault ]" syntax may be unnecessary... */
|
|
|
|
locdef:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD locdefault { $$ = new_nsi($1, $2, 0); } |
|
|
|
|
WORD { $$ = new_nsi($1, NULL, 0); } |
|
|
|
|
'[' WORD locdefault ']' { $$ = new_nsi($2, $3, 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
|
|
|
|
|
|
|
value:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD { $$ = $1; } |
|
|
|
|
signed_number { char bf[40];
|
1995-04-28 10:54:58 +04:00
|
|
|
(void)sprintf(bf, FORMAT($1), $1);
|
|
|
|
$$ = intern(bf); };
|
|
|
|
|
|
|
|
signed_number:
|
1996-11-12 02:54:17 +03:00
|
|
|
NUMBER { $$ = $1; } |
|
|
|
|
'-' NUMBER { $$ = -$2; };
|
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:
|
1996-11-12 02:54:17 +03:00
|
|
|
devbase '=' NUMBER { setmajor($1, $3); };
|
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:
|
|
|
|
file |
|
|
|
|
include |
|
1997-01-31 06:12:30 +03:00
|
|
|
FILE_SYSTEM fs_list |
|
1995-04-28 10:54:58 +04:00
|
|
|
OPTIONS opt_list |
|
|
|
|
MAKEOPTIONS mkopt_list |
|
1996-11-12 02:54:17 +03:00
|
|
|
MAXUSERS NUMBER { setmaxusers($2); } |
|
1997-01-31 06:12:30 +03:00
|
|
|
CONFIG conf root_spec sysparam_list
|
|
|
|
{ addconf(&conf); } |
|
1996-11-12 02:54:17 +03:00
|
|
|
PSEUDO_DEVICE WORD npseudo { addpseudo($2, $3); } |
|
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
|
|
|
|
|
|
|
mkopt_list:
|
|
|
|
mkopt_list ',' mkoption |
|
|
|
|
mkoption;
|
|
|
|
|
|
|
|
mkoption:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD '=' value { addmkoption($1, $3); }
|
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
|
|
|
|
1997-01-31 06:12:30 +03:00
|
|
|
fs_list:
|
|
|
|
fs_list ',' fsoption |
|
|
|
|
fsoption;
|
|
|
|
|
|
|
|
fsoption:
|
|
|
|
WORD { addfsoption($1); };
|
|
|
|
|
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("?"); } |
|
|
|
|
WORD { $$ = intern($1); };
|
|
|
|
|
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:
|
1996-11-12 02:54:17 +03:00
|
|
|
MAJOR NUMBER MINOR NUMBER { $$ = makedev($2, $4); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
on_opt:
|
|
|
|
ON | /* empty */;
|
|
|
|
|
|
|
|
npseudo:
|
1996-11-12 02:54:17 +03:00
|
|
|
NUMBER { $$ = $1; } |
|
|
|
|
/* 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:
|
1996-11-12 02:54:17 +03:00
|
|
|
locators locator { ($$ = $2)->nv_next = $1; } |
|
|
|
|
/* empty */ { $$ = NULL; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
locator:
|
1996-11-12 02:54:17 +03:00
|
|
|
WORD value { $$ = new_ns($1, $2); } |
|
|
|
|
WORD '?' { $$ = new_ns($1, NULL); };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
flags_opt:
|
1996-11-12 02:54:17 +03:00
|
|
|
FLAGS NUMBER { $$ = $2; } |
|
|
|
|
/* empty */ { $$ = 0; };
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
void
|
|
|
|
yyerror(s)
|
|
|
|
const char *s;
|
|
|
|
{
|
|
|
|
|
|
|
|
error("%s", s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Cleanup procedure after syntax error: release any nvlists
|
|
|
|
* allocated during parsing the current line.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
cleanup()
|
|
|
|
{
|
|
|
|
register struct nvlist **np;
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
for (np = alloc, i = adepth; --i >= 0; np++)
|
|
|
|
nvfree(*np);
|
|
|
|
adepth = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
setmachine(mch, mcharch)
|
|
|
|
const char *mch;
|
|
|
|
const char *mcharch;
|
|
|
|
{
|
1996-09-01 00:58:16 +04:00
|
|
|
char buf[MAXPATHLEN];
|
1995-04-28 10:54:58 +04:00
|
|
|
|
|
|
|
machine = mch;
|
|
|
|
machinearch = mcharch;
|
1996-09-01 00:58:16 +04:00
|
|
|
|
|
|
|
(void)sprintf(buf, "arch/%s/conf/files.%s", machine, machine);
|
|
|
|
if (include(buf, ENDFILE) != 0)
|
|
|
|
exit(1);
|
|
|
|
|
1995-04-28 10:54:58 +04:00
|
|
|
if (machinearch != NULL)
|
1996-09-01 00:58:16 +04:00
|
|
|
(void)sprintf(buf, "arch/%s/conf/files.%s",
|
1995-04-28 10:54:58 +04:00
|
|
|
machinearch, machinearch);
|
|
|
|
else
|
1996-09-01 00:58:16 +04:00
|
|
|
strcpy(buf, _PATH_DEVNULL);
|
|
|
|
if (include(buf, ENDFILE) != 0)
|
|
|
|
exit(1);
|
1995-04-28 10:54:58 +04:00
|
|
|
|
1996-09-01 00:58:16 +04:00
|
|
|
if (include("conf/files", ENDFILE) != 0)
|
1995-04-28 10:54:58 +04:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
1996-11-12 02:54:17 +03:00
|
|
|
check_maxpart()
|
1995-04-28 10:54:58 +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
|
|
|
}
|