2 * Copyright (c) 1997-1999 Erez Zadok
3 * Copyright (c) 1989 Jan-Simon Pendry
4 * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
5 * Copyright (c) 1989 The Regents of the University of California.
8 * This code is derived from software contributed to Berkeley by
9 * Jan-Simon Pendry at Imperial College, London.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgment:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 * $Id: fsi_gram.y,v 1.3 1999/04/16 14:21:14 ezk Exp $
48 #endif /* HAVE_CONFIG_H */
53 /* AIX requires this to be the first thing in the file. */
57 # else /* not HAVE_ALLOCA_H */
62 /* predefined by HP cc +Olibcalls */
64 # endif /* not alloca */
65 # endif /* not _AIX */
66 # endif /* not HAVE_ALLOCA_H */
67 #endif /* not __GNUC__ */
69 extern qelem *list_of_hosts, *list_of_automounts;
115 %type <q> automount_tree
117 %type <m> dir_tree_info
118 %type <d> filesystem fs_info_list
119 %type <h> host host_attr host_attr_list
120 %type <q> list_of_hosts list_of_filesystems list_of_mounts dir_tree
121 %type <f> localinfo_list
122 %type <s> opt_auto_opts
131 { if ($2) ins_que((qelem *) $2, list_of_hosts->q_back);
134 | list_of_hosts automount
135 { if ($2) ins_que((qelem *) $2, list_of_automounts->q_back);
145 tHOST host_attr list_of_filesystems list_of_mounts
146 { $$ = $2; $$->h_disk_fs = $3; $$->h_mount = $4; }
148 | error tHOST host_attr list_of_filesystems list_of_mounts
149 { $$ = $3; $$->h_disk_fs = $4; $$->h_mount = $5; }
155 { $$ = new_host(); set_host($$, HF_HOST, $1); }
157 | '{' host_attr_list '}' tSTR
158 { $$ = $2; set_host($$, HF_HOST, $4); }
166 | host_attr_list tNETIF tSTR '{' ether_attr '}'
169 $$ = $1; set_host($$, HF_ETHER, (char *) $5); }
172 | host_attr_list tCONFIG tSTR
173 { $$ = $1; set_host($$, HF_CONFIG, $3); }
175 | host_attr_list tARCH '=' tSTR
176 { $$ = $1; set_host($$, HF_ARCH, $4); }
178 | host_attr_list tOS '=' tSTR
179 { $$ = $1; set_host($$, HF_OS, $4); }
181 | host_attr_list tCLUSTER '=' tSTR
182 { $$ = $1; set_host($$, HF_CLUSTER, $4); }
184 | host_attr_list error '=' tSTR
185 { yyerror("unknown host attribute"); }
190 { $$ = new_ether_if(); }
192 | ether_attr tINADDR '=' tSTR
193 { $$ = $1; set_ether_if($$, EF_INADDR, $4); }
194 | ether_attr tNETMASK '=' tSTR
195 { $$ = $1; set_ether_if($$, EF_NETMASK, $4); }
196 | ether_attr tHWADDR '=' tSTR
197 { $$ = $1; set_ether_if($$, EF_HWADDR, $4); }
201 * A new automount tree:
203 * automount /mountpoint { ... }
206 tAUTOMOUNT opt_auto_opts automount_tree
208 $$ = new_auto_tree($2, $3);
226 list_of_filesystems :
230 | list_of_filesystems filesystem
236 ins_que(&$2->d_q, $$->q_back);
246 * fs /dev/whatever { ... }
249 tFS tSTR '{' fs_info_list '}'
250 { $4->d_dev = $2; $$ = $4; }
253 { $$ = (disk_fs *) 0; }
257 * Per-filesystem information:
259 * fstype - the type of the filesystem (4.2, nfs, swap, export)
260 * opts - the mount options ("rw,grpid")
261 * passno - fsck pass number
262 * freq - dump frequency
263 * dumpset - tape set for filesystem dumps
264 * mount - where to mount this filesystem
269 { $$ = new_disk_fs(); }
271 | fs_info_list tFSTYPE '=' tSTR
272 { $$ = $1; set_disk_fs($$, DF_FSTYPE, $4); }
274 | fs_info_list tOPTS '=' tSTR
275 { $$ = $1; set_disk_fs($$, DF_OPTS, $4); }
277 | fs_info_list tPASSNO '=' tSTR
278 { $$ = $1; set_disk_fs($$, DF_PASSNO, $4); }
280 | fs_info_list tFREQ '=' tSTR
281 { $$ = $1; set_disk_fs($$, DF_FREQ, $4); }
283 | fs_info_list tMOUNT dir_tree
284 { $$ = $1; set_disk_fs($$, DF_MOUNT, (char *) $3); }
286 | fs_info_list tDUMPSET '=' tSTR
287 { $$ = $1; set_disk_fs($$, DF_DUMPSET, $4); }
289 | fs_info_list tLOG '=' tSTR
290 { $$ = $1; set_disk_fs($$, DF_LOG, $4); }
292 | fs_info_list error '=' tSTR
293 { yyerror("unknown filesystem attribute"); }
299 * name = "volname" name is a reference to volname
300 * name -> "string" name is a link to "string"
301 * name nfsalias "string" name is a link to "string", string parsed as NFS
303 * name { ... } name is an automount tree
309 | automount_tree tSTR opt_auto_opts '=' tSTR
310 { automount *a = new_automount($2);
317 ins_que(&a->a_q, $$->q_back);
319 | automount_tree tSTR opt_auto_opts tNFSEQ tSTR
320 { automount *a = new_automount($2);
321 a->a_hardwiredfs = $5;
327 ins_que(&a->a_q, $$->q_back);
330 | automount_tree tSTR tEQ tSTR
331 { automount *a = new_automount($2);
337 ins_que(&a->a_q, $$->q_back);
340 | automount_tree tSTR opt_auto_opts '{' automount_tree '}'
341 { automount *a = new_automount($2);
348 ins_que(&a->a_q, $$->q_back);
356 | dir_tree tSTR '{' dir_tree_info dir_tree '}'
359 if ($2[0] != '/' && $2[1] && strchr($2+1, '/'))
360 yyerror("not allowed '/' in a directory name");
365 ins_que(&$4->m_q, $$->q_back);
371 { $$ = new_mount(); }
373 | dir_tree_info tEXPORTFS tSTR
374 { $$ = $1; set_mount($$, DM_EXPORTFS, $3); }
376 | dir_tree_info tVOLNAME tSTR
377 { $$ = $1; set_mount($$, DM_VOLNAME, $3); }
379 | dir_tree_info tSEL tSTR
380 { $$ = $1; set_mount($$, DM_SEL, $3); }
382 | dir_tree_info error '=' tSTR
383 { yyerror("unknown directory attribute"); }
387 * Additional mounts on a host
389 * mount "volname" ...
395 | list_of_mounts tMOUNT tSTR localinfo_list
396 { set_fsmount($4, FM_VOLNAME, $3);
401 ins_que(&$4->f_q, $$->q_back);
408 * from "hostname" - obtain the object from the named host
409 * as "string" - where to mount, if different from the volname
410 * opts "string" - mount options
411 * fstype "type" - type of filesystem mount, if not nfs
412 * direct - mount entry, no need to create ad-hoc hosts file
416 { $$ = new_fsmount(); }
418 | localinfo_list tDIRECT
419 { $$ = $1; set_fsmount($$, FM_DIRECT, ""); }
421 | localinfo_list tAS tSTR
422 { $$ = $1; set_fsmount($$, FM_LOCALNAME, $3); }
424 | localinfo_list tFROM tSTR
425 { $$ = $1; set_fsmount($$, FM_FROM, $3); }
427 | localinfo_list tFSTYPE tSTR
428 { $$ = $1; set_fsmount($$, FM_FSTYPE, $3); }
430 | localinfo_list tOPTS tSTR
431 { $$ = $1; set_fsmount($$, FM_OPTS, $3); }
433 | localinfo_list error '=' tSTR
434 { yyerror("unknown mount attribute"); }