debuggers.hg

view tools/libxl/libxlu_cfg_y.y @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents 71af69a9d393
children
line source
1 /* -*- fundamental -*- */
3 %{
4 #define YYLEX_PARAM ctx->scanner
5 #include "libxlu_cfg_i.h"
6 #include "libxlu_cfg_l.h"
7 %}
9 %union {
10 char *string;
11 XLU_ConfigSetting *setting;
12 }
14 %locations
15 %pure-parser
16 %defines
17 %error-verbose
18 %name-prefix="xlu__cfg_yy"
19 %parse-param { CfgParseContext *ctx }
20 %lex-param { void *scanner }
22 %token <string> IDENT STRING NUMBER NEWLINE
23 %type <string> atom
24 %destructor { free($$); } atom IDENT STRING NUMBER
26 %type <setting> value valuelist values
27 %destructor { xlu__cfg_set_free($$); } value valuelist values
29 %%
31 file: /* empty */
32 | file setting
34 setting: IDENT '=' value { xlu__cfg_set_store(ctx,$1,$3,@3.first_line); }
35 endstmt
36 | endstmt
37 | error NEWLINE
39 endstmt: NEWLINE
40 | ';'
42 value: atom { $$= xlu__cfg_set_mk(ctx,1,$1); }
43 | '[' nlok valuelist ']' { $$= $3; }
45 atom: STRING { $$= $1; }
46 | NUMBER { $$= $1; }
48 valuelist: /* empty */ { $$= xlu__cfg_set_mk(ctx,0,0); }
49 | values { $$= $1; }
50 | values ',' nlok { $$= $1; }
52 values: atom nlok { $$= xlu__cfg_set_mk(ctx,2,$1); }
53 | values ',' nlok atom nlok { xlu__cfg_set_add(ctx,$1,$4); $$= $1; }
55 nlok:
56 /* nothing */
57 | nlok NEWLINE