* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Jan-Simon Pendry at Imperial College, London.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 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
* @(#)fsi_gram.y 5.3 (Berkeley) 5/12/91
* $Id: fsi_gram.y,v 5.2.1.3 91/05/07 22:19:02 jsp Alpha $
#include "../fsinfo/fsinfo.h"
extern qelem *list_of_hosts, *list_of_automounts;
%type <d> filesystem fs_info_list
%type <h> host host_attr host_attr_list
%type <q> list_of_hosts list_of_filesystems list_of_mounts dir_tree
{ if ($2) ins_que((qelem *) $2, list_of_hosts->q_back);
| list_of_hosts automount
{ if ($2) ins_que((qelem *) $2, list_of_automounts->q_back);
tHOST host_attr list_of_filesystems list_of_mounts
{ $$ = $2; $$->h_disk_fs = $3; $$->h_mount = $4; }
| error tHOST host_attr list_of_filesystems list_of_mounts
{ $$ = $3; $$->h_disk_fs = $4; $$->h_mount = $5; }
{ $$ = new_host(); set_host($$, HF_HOST, $1); }
| '{' host_attr_list '}' tSTR
{ $$ = $2; set_host($$, HF_HOST, $4); }
| host_attr_list tNETIF tSTR '{' ether_attr '}'
$$ = $1; set_host($$, HF_ETHER, $5); }
| host_attr_list tCONFIG tSTR
{ $$ = $1; set_host($$, HF_CONFIG, $3); }
| host_attr_list tARCH '=' tSTR
{ $$ = $1; set_host($$, HF_ARCH, $4); }
| host_attr_list tOS '=' tSTR
{ $$ = $1; set_host($$, HF_OS, $4); }
| host_attr_list tCLUSTER '=' tSTR
{ $$ = $1; set_host($$, HF_CLUSTER, $4); }
| host_attr_list error '=' tSTR
{ yyerror("unknown host attribute"); }
| ether_attr tINADDR '=' tSTR
{ $$ = $1; set_ether_if($$, EF_INADDR, $4); }
| ether_attr tNETMASK '=' tSTR
{ $$ = $1; set_ether_if($$, EF_NETMASK, $4); }
| ether_attr tHWADDR '=' tSTR
{ $$ = $1; set_ether_if($$, EF_HWADDR, $4); }
* automount /mountpoint { ... }
tAUTOMOUNT opt_auto_opts automount_tree
$$ = new_auto_tree($2, $3);
| list_of_filesystems filesystem
ins_que(&$2->d_q, $$->q_back);
* fs /dev/whatever { ... }
tFS tSTR '{' fs_info_list '}'
{ $4->d_dev = $2; $$ = $4; }
* Per-filesystem information:
* fstype - the type of the filesystem (4.2, nfs, swap, export)
* opts - the mount options ("rw,grpid")
* passno - fsck pass number
* dumpset - tape set for filesystem dumps
* mount - where to mount this filesystem
| fs_info_list tFSTYPE '=' tSTR
{ $$ = $1; set_disk_fs($$, DF_FSTYPE, $4); }
| fs_info_list tOPTS '=' tSTR
{ $$ = $1; set_disk_fs($$, DF_OPTS, $4); }
| fs_info_list tPASSNO '=' tSTR
{ $$ = $1; set_disk_fs($$, DF_PASSNO, $4); }
| fs_info_list tFREQ '=' tSTR
{ $$ = $1; set_disk_fs($$, DF_FREQ, $4); }
| fs_info_list tMOUNT dir_tree
{ $$ = $1; set_disk_fs($$, DF_MOUNT, (char *) $3); }
| fs_info_list tDUMPSET '=' tSTR
{ $$ = $1; set_disk_fs($$, DF_DUMPSET, $4); }
| fs_info_list tLOG '=' tSTR
{ $$ = $1; set_disk_fs($$, DF_LOG, $4); }
| fs_info_list error '=' tSTR
{ yyerror("unknown filesystem attribute"); }
* name = "volname" name is a reference to volname
* name -> "string" name is a link to "string"
* name { ... } name is an automount tree
| automount_tree tSTR '=' tSTR
{ automount *a = new_automount($2);
ins_que(&a->a_q, $$->q_back);
| automount_tree tSTR tEQ tSTR
{ automount *a = new_automount($2);
ins_que(&a->a_q, $$->q_back);
| automount_tree tSTR '{' automount_tree '}'
{ automount *a = new_automount($2);
ins_que(&a->a_q, $$->q_back);
| dir_tree tSTR '{' dir_tree_info dir_tree '}'
if ($2[0] != '/' && $2[1] && strchr($2+1, '/'))
yyerror("not allowed '/' in a directory name");
ins_que(&$4->m_q, $$->q_back);
| dir_tree_info tEXPORTFS tSTR
{ $$ = $1; set_mount($$, DM_EXPORTFS, $3); }
| dir_tree_info tVOLNAME tSTR
{ $$ = $1; set_mount($$, DM_VOLNAME, $3); }
| dir_tree_info tSEL tSTR
{ $$ = $1; set_mount($$, DM_SEL, $3); }
| dir_tree_info error '=' tSTR
{ yyerror("unknown directory attribute"); }
* Additional mounts on a host
| list_of_mounts tMOUNT tSTR localinfo_list
{ set_fsmount($4, FM_VOLNAME, $3);
ins_que(&$4->f_q, $$->q_back);
* from "hostname" - obtain the object from the named host
* as "string" - where to mount, if different from the volname
* opts "string" - mount options
* fstype "type" - type of filesystem mount, if not nfs
| localinfo_list tAS tSTR
{ $$ = $1; set_fsmount($$, FM_LOCALNAME, $3); }
| localinfo_list tFROM tSTR
{ $$ = $1; set_fsmount($$, FM_FROM, $3); }
| localinfo_list tFSTYPE tSTR
{ $$ = $1; set_fsmount($$, FM_FSTYPE, $3); }
| localinfo_list tOPTS tSTR
{ $$ = $1; set_fsmount($$, FM_OPTS, $3); }
| localinfo_list error '=' tSTR
{ yyerror("unknown mount attribute"); }