All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC 00/14] libxl: disk configuration handling
@ 2011-05-12 14:36 Ian Jackson
  2011-05-12 14:36 ` [PATCH 01/14] libxl: add missing copyright notices to some files Ian Jackson
  2011-05-13 10:33 ` [PATCH/RFC 00/14] libxl: disk configuration handling Ian Campbell
  0 siblings, 2 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

This is the latest version of my disk config parsing patch series.

00-04  Hopefully uncontroversial cleanups and minor features.
05-07  Preparatory work.
08-10  The new parser and its documentation.
11-12  Replace old parsers with calls to the new one.
13-14  Two features, one of them essential.

The use of the pcre library is gone; everything is done with flex now.
The result is reasonably clean.

You can see how it improves the approach needed for addition of new
features to the disk config syntax by looking at patch 13, which is
precisely such a new feature.  In patch 13 everything but the change
to libxlu_disk_l.l is autogenerated, so it is that subset that is the
relevant change.

I'd like to apply as many of these as I can get acks for :-).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 01/14] libxl: add missing copyright notices to some files
  2011-05-12 14:36 [PATCH/RFC 00/14] libxl: disk configuration handling Ian Jackson
@ 2011-05-12 14:36 ` Ian Jackson
  2011-05-12 14:36   ` [PATCH 02/14] libxl: add missing copyright notices to autogenerated files Ian Jackson
  2011-05-13 10:33 ` [PATCH/RFC 00/14] libxl: disk configuration handling Ian Campbell
  1 sibling, 1 reply; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Jackson

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxl/libxlu_cfg.c   |   18 ++++++++++++++++++
 tools/libxl/libxlu_cfg_i.h |   17 +++++++++++++++++
 tools/libxl/libxlu_cfg_l.l |   16 ++++++++++++++++
 tools/libxl/libxlu_cfg_y.y |   16 ++++++++++++++++
 4 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c
index 1ea1b0a..a895940 100644
--- a/tools/libxl/libxlu_cfg.c
+++ b/tools/libxl/libxlu_cfg.c
@@ -1,3 +1,21 @@
+/*
+ * libxlu_cfg.c - xl configuration file parsing: setup and helper functions
+ *
+ * Copyright (C) 2010      Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+
 #include <limits.h>
 
 #include "libxlu_internal.h"
diff --git a/tools/libxl/libxlu_cfg_i.h b/tools/libxl/libxlu_cfg_i.h
index 88d2a02..eaac208 100644
--- a/tools/libxl/libxlu_cfg_i.h
+++ b/tools/libxl/libxlu_cfg_i.h
@@ -1,3 +1,20 @@
+/*
+ * libxlu_cfg_i.h - xl configuration file parsing: parser-internal declarations
+ *
+ * Copyright (C) 2010      Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
 #ifndef LIBXLU_CFG_I_H
 #define LIBXLU_CFG_I_H
 
diff --git a/tools/libxl/libxlu_cfg_l.l b/tools/libxl/libxlu_cfg_l.l
index 21c11ff..efac884 100644
--- a/tools/libxl/libxlu_cfg_l.l
+++ b/tools/libxl/libxlu_cfg_l.l
@@ -1,4 +1,20 @@
 /* -*- fundamental -*- */
+/*
+ * libxlu_cfg_l.l - xl configuration file parsing: lexer
+ *
+ * Copyright (C) 2010      Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
 
 %{
 #include "libxlu_cfg_i.h"
diff --git a/tools/libxl/libxlu_cfg_y.y b/tools/libxl/libxlu_cfg_y.y
index cdf8e0b..3c0a9fa 100644
--- a/tools/libxl/libxlu_cfg_y.y
+++ b/tools/libxl/libxlu_cfg_y.y
@@ -1,4 +1,20 @@
 /* -*- fundamental -*- */
+/*
+ * libxlu_cfg_l.y - xl configuration file parsing: parser
+ *
+ * Copyright (C) 2010      Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
 
 %{
 #define YYLEX_PARAM ctx->scanner
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 02/14] libxl: add missing copyright notices to autogenerated files
  2011-05-12 14:36 ` [PATCH 01/14] libxl: add missing copyright notices to some files Ian Jackson
@ 2011-05-12 14:36   ` Ian Jackson
  2011-05-12 14:36     ` [PATCH 03/14] libxl: provide TOSTRING in libxl_internal.h and libxlu_internal.h Ian Jackson
  0 siblings, 1 reply; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Jackson

Copyright notices in libxlu_cfg_[ly].[ly] end up in the .[ch] files,
copied there by flex and bison.  Regenerate those files (flex 2.5.35
and bison 2.3, from Debian lenny i386).

No manual edits in this patch.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxl/libxlu_cfg_l.c |   60 +++++++++++++++++++++++++++----------------
 tools/libxl/libxlu_cfg_l.h |    2 +-
 tools/libxl/libxlu_cfg_y.c |   44 ++++++++++++++++----------------
 tools/libxl/libxlu_cfg_y.h |    2 +-
 4 files changed, 62 insertions(+), 46 deletions(-)

diff --git a/tools/libxl/libxlu_cfg_l.c b/tools/libxl/libxlu_cfg_l.c
index e063461..e906ff9 100644
--- a/tools/libxl/libxlu_cfg_l.c
+++ b/tools/libxl/libxlu_cfg_l.c
@@ -479,7 +479,23 @@ static yyconst flex_int32_t yy_rule_can_match_eol[17] =
 #define YY_RESTORE_YY_MORE_OFFSET
 #line 1 "libxlu_cfg_l.l"
 /* -*- fundamental -*- */
-#line 4 "libxlu_cfg_l.l"
+/*
+ * libxlu_cfg_l.l - xl configuration file parsing: lexer
+ *
+ * Copyright (C) 2010      Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+#line 20 "libxlu_cfg_l.l"
 #include "libxlu_cfg_i.h"
 
 #define ctx ((CfgParseContext*)yyextra)
@@ -498,7 +514,7 @@ int xlu__cfg_yyget_column(yyscan_t yyscanner);
 void xlu__cfg_yyset_column(int  column_no, yyscan_t yyscanner);
 
 
-#line 502 "libxlu_cfg_l.c"
+#line 518 "libxlu_cfg_l.c"
 
 #define INITIAL 0
 #define lexerr 1
@@ -743,10 +759,10 @@ YY_DECL
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 37 "libxlu_cfg_l.l"
+#line 53 "libxlu_cfg_l.l"
 
 
-#line 750 "libxlu_cfg_l.c"
+#line 766 "libxlu_cfg_l.c"
 
     yylval = yylval_param;
 
@@ -849,7 +865,7 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 39 "libxlu_cfg_l.l"
+#line 55 "libxlu_cfg_l.l"
 {
                           yylval->string= xlu__cfgl_strdup(ctx,yytext);
                           GOT(IDENT);
@@ -857,7 +873,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 43 "libxlu_cfg_l.l"
+#line 59 "libxlu_cfg_l.l"
 {
                           yylval->string= xlu__cfgl_strdup(ctx,yytext);
                           GOT(NUMBER);
@@ -865,43 +881,43 @@ YY_RULE_SETUP
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 48 "libxlu_cfg_l.l"
+#line 64 "libxlu_cfg_l.l"
 
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 50 "libxlu_cfg_l.l"
+#line 66 "libxlu_cfg_l.l"
 { GOT(','); }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 51 "libxlu_cfg_l.l"
+#line 67 "libxlu_cfg_l.l"
 { GOT('['); }
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 52 "libxlu_cfg_l.l"
+#line 68 "libxlu_cfg_l.l"
 { GOT(']'); }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 53 "libxlu_cfg_l.l"
+#line 69 "libxlu_cfg_l.l"
 { GOT('='); }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 54 "libxlu_cfg_l.l"
+#line 70 "libxlu_cfg_l.l"
 { GOT(';'); }
 	YY_BREAK
 case 9:
 /* rule 9 can match eol */
 YY_RULE_SETUP
-#line 56 "libxlu_cfg_l.l"
+#line 72 "libxlu_cfg_l.l"
 { yylloc->first_line= yylineno-1; return NEWLINE; }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 58 "libxlu_cfg_l.l"
+#line 74 "libxlu_cfg_l.l"
 {
                           yylval->string= xlu__cfgl_dequote(ctx,yytext);
                           GOT(STRING);
@@ -909,7 +925,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 62 "libxlu_cfg_l.l"
+#line 78 "libxlu_cfg_l.l"
 {
                           yylval->string= xlu__cfgl_dequote(ctx,yytext);
                           GOT(STRING);
@@ -917,7 +933,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 67 "libxlu_cfg_l.l"
+#line 83 "libxlu_cfg_l.l"
 {
                           ctx->likely_python= 1;
                           BEGIN(lexerr);
@@ -926,7 +942,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 73 "libxlu_cfg_l.l"
+#line 89 "libxlu_cfg_l.l"
 {
                           BEGIN(lexerr);
                           yymore();
@@ -934,7 +950,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 78 "libxlu_cfg_l.l"
+#line 94 "libxlu_cfg_l.l"
 {
                           xlu__cfgl_lexicalerror(ctx,"lexical error");
                           BEGIN(0);
@@ -943,7 +959,7 @@ YY_RULE_SETUP
 case 15:
 /* rule 15 can match eol */
 YY_RULE_SETUP
-#line 83 "libxlu_cfg_l.l"
+#line 99 "libxlu_cfg_l.l"
 {
                           xlu__cfgl_lexicalerror(ctx,"lexical error");
                           BEGIN(0);
@@ -952,10 +968,10 @@ YY_RULE_SETUP
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 88 "libxlu_cfg_l.l"
+#line 104 "libxlu_cfg_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 959 "libxlu_cfg_l.c"
+#line 975 "libxlu_cfg_l.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(lexerr):
 	yyterminate();
@@ -2105,4 +2121,4 @@ void xlu__cfg_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 88 "libxlu_cfg_l.l"
+#line 104 "libxlu_cfg_l.l"
diff --git a/tools/libxl/libxlu_cfg_l.h b/tools/libxl/libxlu_cfg_l.h
index 02a0803..4078302 100644
--- a/tools/libxl/libxlu_cfg_l.h
+++ b/tools/libxl/libxlu_cfg_l.h
@@ -350,7 +350,7 @@ extern int xlu__cfg_yylex \
 #undef YY_DECL
 #endif
 
-#line 88 "libxlu_cfg_l.l"
+#line 104 "libxlu_cfg_l.l"
 
 #line 356 "libxlu_cfg_l.h"
 #undef xlu__cfg_yyIN_HEADER
diff --git a/tools/libxl/libxlu_cfg_y.c b/tools/libxl/libxlu_cfg_y.c
index f009f2d..737b1f6 100644
--- a/tools/libxl/libxlu_cfg_y.c
+++ b/tools/libxl/libxlu_cfg_y.c
@@ -90,7 +90,7 @@
 
 
 /* Copy the first part of user declarations.  */
-#line 3 "libxlu_cfg_y.y"
+#line 19 "libxlu_cfg_y.y"
 
 #define YYLEX_PARAM ctx->scanner
 #include "libxlu_cfg_i.h"
@@ -117,7 +117,7 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 9 "libxlu_cfg_y.y"
+#line 25 "libxlu_cfg_y.y"
 {
   char *string;
   XLU_ConfigSetting *setting;
@@ -439,9 +439,9 @@ static const yytype_int8 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    31,    31,    32,    34,    34,    36,    37,    39,    40,
-      42,    43,    45,    46,    48,    49,    50,    52,    53,    55,
-      57
+       0,    47,    47,    48,    50,    50,    52,    53,    55,    56,
+      58,    59,    61,    62,    64,    65,    66,    68,    69,    71,
+      73
 };
 #endif
 
@@ -1062,37 +1062,37 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, ctx)
   switch (yytype)
     {
       case 3: /* "IDENT" */
-#line 24 "libxlu_cfg_y.y"
+#line 40 "libxlu_cfg_y.y"
 	{ free((yyvaluep->string)); };
 #line 1068 "libxlu_cfg_y.c"
 	break;
       case 4: /* "STRING" */
-#line 24 "libxlu_cfg_y.y"
+#line 40 "libxlu_cfg_y.y"
 	{ free((yyvaluep->string)); };
 #line 1073 "libxlu_cfg_y.c"
 	break;
       case 5: /* "NUMBER" */
-#line 24 "libxlu_cfg_y.y"
+#line 40 "libxlu_cfg_y.y"
 	{ free((yyvaluep->string)); };
 #line 1078 "libxlu_cfg_y.c"
 	break;
       case 17: /* "value" */
-#line 27 "libxlu_cfg_y.y"
+#line 43 "libxlu_cfg_y.y"
 	{ xlu__cfg_set_free((yyvaluep->setting)); };
 #line 1083 "libxlu_cfg_y.c"
 	break;
       case 18: /* "atom" */
-#line 24 "libxlu_cfg_y.y"
+#line 40 "libxlu_cfg_y.y"
 	{ free((yyvaluep->string)); };
 #line 1088 "libxlu_cfg_y.c"
 	break;
       case 19: /* "valuelist" */
-#line 27 "libxlu_cfg_y.y"
+#line 43 "libxlu_cfg_y.y"
 	{ xlu__cfg_set_free((yyvaluep->setting)); };
 #line 1093 "libxlu_cfg_y.c"
 	break;
       case 20: /* "values" */
-#line 27 "libxlu_cfg_y.y"
+#line 43 "libxlu_cfg_y.y"
 	{ xlu__cfg_set_free((yyvaluep->setting)); };
 #line 1098 "libxlu_cfg_y.c"
 	break;
@@ -1417,52 +1417,52 @@ yyreduce:
   switch (yyn)
     {
         case 4:
-#line 34 "libxlu_cfg_y.y"
+#line 50 "libxlu_cfg_y.y"
     { xlu__cfg_set_store(ctx,(yyvsp[(1) - (3)].string),(yyvsp[(3) - (3)].setting),(yylsp[(3) - (3)]).first_line); ;}
     break;
 
   case 10:
-#line 42 "libxlu_cfg_y.y"
+#line 58 "libxlu_cfg_y.y"
     { (yyval.setting)= xlu__cfg_set_mk(ctx,1,(yyvsp[(1) - (1)].string)); ;}
     break;
 
   case 11:
-#line 43 "libxlu_cfg_y.y"
+#line 59 "libxlu_cfg_y.y"
     { (yyval.setting)= (yyvsp[(3) - (4)].setting); ;}
     break;
 
   case 12:
-#line 45 "libxlu_cfg_y.y"
+#line 61 "libxlu_cfg_y.y"
     { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
     break;
 
   case 13:
-#line 46 "libxlu_cfg_y.y"
+#line 62 "libxlu_cfg_y.y"
     { (yyval.string)= (yyvsp[(1) - (1)].string); ;}
     break;
 
   case 14:
-#line 48 "libxlu_cfg_y.y"
+#line 64 "libxlu_cfg_y.y"
     { (yyval.setting)= xlu__cfg_set_mk(ctx,0,0); ;}
     break;
 
   case 15:
-#line 49 "libxlu_cfg_y.y"
+#line 65 "libxlu_cfg_y.y"
     { (yyval.setting)= (yyvsp[(1) - (1)].setting); ;}
     break;
 
   case 16:
-#line 50 "libxlu_cfg_y.y"
+#line 66 "libxlu_cfg_y.y"
     { (yyval.setting)= (yyvsp[(1) - (3)].setting); ;}
     break;
 
   case 17:
-#line 52 "libxlu_cfg_y.y"
+#line 68 "libxlu_cfg_y.y"
     { (yyval.setting)= xlu__cfg_set_mk(ctx,2,(yyvsp[(1) - (2)].string)); ;}
     break;
 
   case 18:
-#line 53 "libxlu_cfg_y.y"
+#line 69 "libxlu_cfg_y.y"
     { xlu__cfg_set_add(ctx,(yyvsp[(1) - (5)].setting),(yyvsp[(4) - (5)].string)); (yyval.setting)= (yyvsp[(1) - (5)].setting); ;}
     break;
 
diff --git a/tools/libxl/libxlu_cfg_y.h b/tools/libxl/libxlu_cfg_y.h
index 6d9fd64..52233a7 100644
--- a/tools/libxl/libxlu_cfg_y.h
+++ b/tools/libxl/libxlu_cfg_y.h
@@ -56,7 +56,7 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
-#line 9 "libxlu_cfg_y.y"
+#line 25 "libxlu_cfg_y.y"
 {
   char *string;
   XLU_ConfigSetting *setting;
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 03/14] libxl: provide TOSTRING in libxl_internal.h and libxlu_internal.h
  2011-05-12 14:36   ` [PATCH 02/14] libxl: add missing copyright notices to autogenerated files Ian Jackson
@ 2011-05-12 14:36     ` Ian Jackson
  2011-05-12 14:36       ` [PATCH 04/14] libxl: make libxl_ctx_free tolerate NULL ctx argument Ian Jackson
  0 siblings, 1 reply; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

From: Ian Jackson <ijackson@chiark.greenend.org.uk>

Provide a copy of the standard TOSTRING macro in libxlu_internal.h,
for the benefit of patches later in this series.

Also, move TOSTRING to libxl_internal.h from a .c file for the
benefit of future other callers in libxl proper.

(These cannot be combined because libxlu cannot include
libxl_internal.h and libxl should not include libxlu_internal.h.)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
 tools/libxl/libxl.c           |    2 --
 tools/libxl/libxl_internal.h  |    3 +++
 tools/libxl/libxlu_internal.h |    4 ++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index ccf6518..fabad4a 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -38,8 +38,6 @@
 
 #define PAGE_TO_MEMKB(pages) ((pages) * 4)
 #define BACKEND_STRING_SIZE 5
-#define STRINGIFY(x) #x
-#define TOSTRING(x) STRINGIFY(x)
 
 int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger * lg)
 {
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 64e1d56..5b97583 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -362,4 +362,7 @@ _hidden int libxl__error_set(libxl__gc *gc, int code);
 _hidden int libxl__file_reference_map(libxl_file_reference *f);
 _hidden int libxl__file_reference_unmap(libxl_file_reference *f);
 
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+
 #endif
diff --git a/tools/libxl/libxlu_internal.h b/tools/libxl/libxlu_internal.h
index e251a63..9c609b1 100644
--- a/tools/libxl/libxlu_internal.h
+++ b/tools/libxl/libxlu_internal.h
@@ -45,4 +45,8 @@ typedef struct {
     void *scanner;
 } CfgParseContext;
 
+
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+
 #endif /*LIBXLU_INTERNAL_H*/
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 04/14] libxl: make libxl_ctx_free tolerate NULL ctx argument
  2011-05-12 14:36     ` [PATCH 03/14] libxl: provide TOSTRING in libxl_internal.h and libxlu_internal.h Ian Jackson
@ 2011-05-12 14:36       ` Ian Jackson
  2011-05-12 14:36         ` [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts Ian Jackson
  0 siblings, 1 reply; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

This is purely for convenience (eg, when debugging).

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl.c |    1 +
 tools/libxl/libxl.h |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index fabad4a..d4a47f2 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -85,6 +85,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger * lg)
 
 int libxl_ctx_free(libxl_ctx *ctx)
 {
+    if (!ctx) return 0;
     if (ctx->xch) xc_interface_close(ctx->xch);
     libxl_version_info_destroy(&ctx->version_info);
     if (ctx->xsh) xs_daemon_close(ctx->xsh); 
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 95a7ba3..18a01c6 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -232,7 +232,7 @@ typedef struct {
 
 /* context functions */
 int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger *lg);
-int libxl_ctx_free(libxl_ctx *ctx);
+int libxl_ctx_free(libxl_ctx *ctx /* 0 is OK */);
 int libxl_ctx_postfork(libxl_ctx *ctx);
 
 /* domain related functions */
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts
  2011-05-12 14:36       ` [PATCH 04/14] libxl: make libxl_ctx_free tolerate NULL ctx argument Ian Jackson
@ 2011-05-12 14:36         ` Ian Jackson
  2011-05-12 14:36           ` [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable" Ian Jackson
  2011-05-13 10:35           ` [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts Ian Campbell
  0 siblings, 2 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Jackson

This is not currently implemented.  Applications setting it to
anything but NULL will cause an error.  Code to set it from xl
configuration files will appear later in this series.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxl/libxl.c   |    7 +++++++
 tools/libxl/libxl.idl |    1 +
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index d4a47f2..ac7b68a 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -968,6 +968,13 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
         goto out_free;
     }
 
+    if (disk->script) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "External block scripts"
+                   " not yet supported, sorry");
+        rc = ERROR_INVAL;
+        goto out_free;
+    }
+
     devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
     if (devid==-1) {
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Invalid or unsupported"
diff --git a/tools/libxl/libxl.idl b/tools/libxl/libxl.idl
index a5be66f..546cd3c 100644
--- a/tools/libxl/libxl.idl
+++ b/tools/libxl/libxl.idl
@@ -261,6 +261,7 @@ libxl_device_disk = Struct("device_disk", [
     ("vdev", string),
     ("backend", libxl_disk_backend),
     ("format", libxl_disk_format),
+    ("script", string),
     ("unpluggable", integer),
     ("readwrite", integer),
     ("is_cdrom", integer),
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable"
  2011-05-12 14:36         ` [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts Ian Jackson
@ 2011-05-12 14:36           ` Ian Jackson
  2011-05-12 14:36             ` [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Ian Jackson
  2011-05-13 10:36             ` [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable" Ian Campbell
  2011-05-13 10:35           ` [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts Ian Campbell
  1 sibling, 2 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

This property corresponds to what is called "removable" in xenstore,
and is the conventional meaning of "removable": ie, the _media_ can be
removed even as the _device_ remains present.

"unpluggable" is a misleading name for this.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl.c       |    6 +++---
 tools/libxl/libxl.idl     |    2 +-
 tools/libxl/libxl_utils.c |    2 +-
 tools/libxl/xl_cmdimpl.c  |    6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index ac7b68a..fe012cb 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -705,7 +705,7 @@ int libxl_event_get_disk_eject_info(libxl_ctx *ctx, uint32_t domid, libxl_event
     disk->format = LIBXL_DISK_FORMAT_EMPTY;
     /* this value is returned to the user: do not free right away */
     disk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/dev", backend), NULL);
-    disk->unpluggable = 1;
+    disk->removable = 1;
     disk->readwrite = 0;
     disk->is_cdrom = 1;
 
@@ -1045,7 +1045,7 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
     flexarray_append(back, "online");
     flexarray_append(back, "1");
     flexarray_append(back, "removable");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", (disk->unpluggable) ? 1 : 0));
+    flexarray_append(back, libxl__sprintf(&gc, "%d", (disk->removable) ? 1 : 0));
     flexarray_append(back, "bootable");
     flexarray_append(back, libxl__sprintf(&gc, "%d", 1));
     flexarray_append(back, "state");
@@ -1588,7 +1588,7 @@ static unsigned int libxl__append_disk_list_of_type(libxl__gc *gc,
                 libxl__sprintf(gc, "%s/%s/type", be_path, *dir)), 
                 &(pdisk->backend));
             pdisk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(gc, "%s/%s/dev", be_path, *dir), &len);
-            pdisk->unpluggable = atoi(libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s/removable", be_path, *dir)));
+            pdisk->removable = atoi(libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s/removable", be_path, *dir)));
             if (!strcmp(libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s/mode", be_path, *dir)), "w"))
                 pdisk->readwrite = 1;
             else
diff --git a/tools/libxl/libxl.idl b/tools/libxl/libxl.idl
index 546cd3c..74c82f4 100644
--- a/tools/libxl/libxl.idl
+++ b/tools/libxl/libxl.idl
@@ -262,7 +262,7 @@ libxl_device_disk = Struct("device_disk", [
     ("backend", libxl_disk_backend),
     ("format", libxl_disk_format),
     ("script", string),
-    ("unpluggable", integer),
+    ("removable", integer),
     ("readwrite", integer),
     ("is_cdrom", integer),
     ])
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index 68b5a9a..b23cf25 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -556,7 +556,7 @@ int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
     libxl_string_to_backend(ctx, val, &(disk->backend));
     disk->vdev = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev", be_path));
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/removable", be_path));
-    disk->unpluggable = !strcmp(val, "1");
+    disk->removable = !strcmp(val, "1");
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mode", be_path));
     disk->readwrite = !!strcmp(val, "w");
     val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/device-type", diskpath));
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 28e810c..97a1241 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -385,7 +385,7 @@ static void printf_info(int domid,
         printf("\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path);
         printf("\t\t\t(phystype %d)\n", d_config->disks[i].backend);
         printf("\t\t\t(virtpath %s)\n", d_config->disks[i].vdev);
-        printf("\t\t\t(unpluggable %d)\n", d_config->disks[i].unpluggable);
+        printf("\t\t\t(unpluggable %d)\n", d_config->disks[i].removable);
         printf("\t\t\t(readwrite %d)\n", d_config->disks[i].readwrite);
         printf("\t\t\t(is_cdrom %d)\n", d_config->disks[i].is_cdrom);
         printf("\t\t)\n");
@@ -583,7 +583,7 @@ static int parse_disk_config(libxl_device_disk *disk, char *buf2)
                 *p = '\0';
                 if ( !strcmp(tok, "cdrom") ) {
                     disk->is_cdrom = 1;
-                    disk->unpluggable = 1;
+                    disk->removable = 1;
                 }else{
                     fprintf(stderr, "Unknown virtual disk type: %s\n", tok);
                     return 0;
@@ -4093,7 +4093,7 @@ int main_blockattach(int argc, char **argv)
         return 1;
     }
     disk.vdev = argv[optind+2];
-    disk.unpluggable = 1;
+    disk.removable = 1;
     disk.readwrite = ((argc-optind <= 3) || (argv[optind+3][0] == 'w'));
 
     if (domain_qualifier_to_domid(argv[optind], &fe_domid, 0) < 0) {
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work
  2011-05-12 14:36           ` [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable" Ian Jackson
@ 2011-05-12 14:36             ` Ian Jackson
  2011-05-12 14:36               ` [PATCH 08/14] libxl: disks: new xlu_disk_parse function Ian Jackson
  2011-05-13 10:38               ` [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Ian Campbell
  2011-05-13 10:36             ` [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable" Ian Campbell
  1 sibling, 2 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

libxl callers should not be required to specify the backend if they
don't want to.  So LIBXL_DISK_BACKEND_UNKNOWN should instruct libxl to
choose the backend for itself.

More thorough fixes for the disk handling will follow.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index fe012cb..73fc3e9 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -989,6 +989,21 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
     device.domid = domid;
     device.kind = DEVICE_VBD;
 
+
+    /*
+     * Fixing the incoming backend type to try to decide on which
+     * backend to use.  Unfortunately at the moment this code is
+     * utterly broken, but it more or less works.
+     */
+
+    /*
+     * Backend type UNKNOWN should mean "caller does not want to specify",
+     * not "break pointlessely".  (Callers should not be required to
+     * specify the backend if they don't want to.)
+     */
+    if (disk->backend == LIBXL_DISK_BACKEND_UNKNOWN)
+        disk->backend = LIBXL_DISK_BACKEND_TAP;
+
     /* If blktap is not available then fallback to qdisk */
     if (disk->backend == LIBXL_DISK_BACKEND_TAP && !libxl__blktap_enabled(&gc))
         disk->backend = LIBXL_DISK_BACKEND_QDISK;
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 08/14] libxl: disks: new xlu_disk_parse function
  2011-05-12 14:36             ` [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Ian Jackson
@ 2011-05-12 14:36               ` Ian Jackson
  2011-05-12 14:36                 ` [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output Ian Jackson
  2011-05-13 10:48                 ` [PATCH 08/14] libxl: disks: new xlu_disk_parse function Ian Campbell
  2011-05-13 10:38               ` [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Ian Campbell
  1 sibling, 2 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Jackson

From: Ian Jackson <ijackson@chiark.greenend.org.uk>

Introduce new flex/regexp-based parser for disk configuration strings.
Callers will be updated in following patches.

The existing xm command line syntax for block-attach expects multiple
arguments containing different parameters for different parts of the
disk specification, so we supply a parser function which can take
multiple strings and scan them in sequence.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxl/Makefile        |    3 +-
 tools/libxl/libxlu_disk.c   |   91 ++++++++++++++++++
 tools/libxl/libxlu_disk_i.h |   21 ++++
 tools/libxl/libxlu_disk_l.l |  217 +++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxlutil.h     |   23 +++++
 5 files changed, 354 insertions(+), 1 deletions(-)
 create mode 100644 tools/libxl/libxlu_disk.c
 create mode 100644 tools/libxl/libxlu_disk_i.h
 create mode 100644 tools/libxl/libxlu_disk_l.l

diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 538cd16..3c10051 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -41,7 +41,8 @@ $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_lib
 
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h
 AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
-LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o
+LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \
+	libxlu_disk_l.o libxlu_disk.o
 $(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
 
 CLIENTS = xl
diff --git a/tools/libxl/libxlu_disk.c b/tools/libxl/libxlu_disk.c
new file mode 100644
index 0000000..52780e6
--- /dev/null
+++ b/tools/libxl/libxlu_disk.c
@@ -0,0 +1,91 @@
+#include "libxlu_internal.h"
+#include "libxlu_disk_l.h"
+#include "libxlu_disk_i.h"
+#include "libxlu_cfg_i.h"
+
+void xlu__disk_err(DiskParseContext *dpc, const char *erroneous,
+                   const char *message) {
+    fprintf(dpc->cfg->report,
+	    "%s: config parsing error in disk specification: %s"
+            "%s%s%s"
+            " in `%s'\n",
+	    dpc->cfg->filename, message,
+            erroneous?": near `":"", erroneous?erroneous:"", erroneous?"'":"",
+            dpc->spec);
+    if (!dpc->err) dpc->err= EINVAL;
+}
+
+static int dpc_prep(DiskParseContext *dpc, const char *spec) {
+    int e;
+
+    dpc->spec = spec;
+    
+    e = xlu__disk_yylex_init_extra(dpc, &dpc->scanner);
+    if (e) goto fail;
+
+    dpc->buf = xlu__disk_yy_scan_bytes(spec, strlen(spec), dpc->scanner);
+    if (!dpc->buf) { e = ENOMEM; goto fail; }
+
+    return 0;
+
+ fail:
+    fprintf(dpc->cfg->report, "cannot init disk scanner: %s\n",
+            strerror(errno));
+    return e;
+}
+
+static void dpc_dispose(DiskParseContext *dpc) {
+    if (dpc->buf) {
+        xlu__disk_yy_delete_buffer(dpc->buf, dpc->scanner);
+        dpc->buf = 0;
+    }
+    if (dpc->scanner) {
+        xlu__disk_yylex_destroy(dpc->scanner);
+        dpc->scanner = 0;
+    }
+}
+
+int xlu_disk_parse(XLU_Config *cfg,
+                   int nspecs, const char *const *specs,
+                   libxl_device_disk *disk) {
+    DiskParseContext dpc;
+    int i, e;
+
+    memset(&dpc,0,sizeof(dpc));
+    dpc.cfg = cfg;
+    dpc.scanner = 0;
+    dpc.disk = disk;
+
+    for (i=0; i<nspecs; i++) {
+        e = dpc_prep(&dpc, specs[i]);
+        if (e) { dpc.err = e; goto x_err; }
+
+        xlu__disk_yylex(dpc.scanner);
+        assert(!e);
+        if (dpc.err) goto x_err;
+
+        dpc_dispose(&dpc);
+    }
+
+    if (disk->format == LIBXL_DISK_FORMAT_UNKNOWN) {
+        disk->format = LIBXL_DISK_FORMAT_RAW;
+    }
+    if (disk->is_cdrom) {
+        disk->removable = 1;
+        disk->readwrite = 0;
+    }
+
+    if (!disk->vdev) {
+        xlu__disk_err(&dpc,0, "no vdev specified");
+        goto x_err;
+    }
+    if (!disk->pdev_path && !disk->removable) {
+        xlu__disk_err(&dpc,0,"no target specified (and device not removable)");
+        goto x_err;
+    }
+
+ x_err:
+    dpc_dispose(&dpc);
+    return dpc.err;
+}
+
diff --git a/tools/libxl/libxlu_disk_i.h b/tools/libxl/libxlu_disk_i.h
new file mode 100644
index 0000000..578920a
--- /dev/null
+++ b/tools/libxl/libxlu_disk_i.h
@@ -0,0 +1,21 @@
+#ifndef LIBXLU_DISK_I_H
+#define LIBXLU_DISK_I_H
+
+#include "libxlu_internal.h"
+
+
+typedef struct {
+    XLU_Config *cfg;
+    int err;
+    void *scanner;
+    YY_BUFFER_STATE buf;
+    libxl_device_disk *disk;
+    int access_set, had_depr_prefix;
+    const char *spec;
+} DiskParseContext;
+
+void xlu__disk_err(DiskParseContext *dpc, const char *erroneous,
+                   const char *message);
+
+
+#endif /*LIBXLU_DISK_I_H*/
diff --git a/tools/libxl/libxlu_disk_l.l b/tools/libxl/libxlu_disk_l.l
new file mode 100644
index 0000000..8e511ea
--- /dev/null
+++ b/tools/libxl/libxlu_disk_l.l
@@ -0,0 +1,217 @@
+/* -*- fundamental -*- */
+/*
+ * libxlu_disk_l.l - parser for disk specification strings
+ *
+ * Copyright (C) 2011      Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+
+/*
+ * Parsing the old xm/xend/xl-4.1 disk specs is a tricky problem,
+ * because the target string might in theory contain "," which is the
+ * delimiter we use for stripping off things on the RHS, and ":",
+ * which is the delimiter we use for stripping off things on the LHS.
+ *
+ * In this parser we do not support such target strings in the old
+ * syntax; if the target string has to contain "," or ":" the new
+ * syntax's "target=" should be used.
+ */
+
+%{
+#include "libxlu_disk_i.h"
+
+#define YY_NO_INPUT
+
+/* Some versions of flex have a bug (Fedora bugzilla 612465) which causes
+ * it to fail to declare these functions, which it defines.  So declare
+ * them ourselves.  Hopefully we won't have to simultaneously support
+ * a flex version which declares these differently somehow. */
+int xlu__disk_yyget_column(yyscan_t yyscanner);
+void xlu__disk_yyset_column(int  column_no, yyscan_t yyscanner);
+
+
+/*----- useful macros and functions used in actions -----
+ * we use macros in the actual rules to keep the actions short
+ * and particularly to avoid repeating boilerplate values such as
+ * DPC->disk, yytext, etc. */
+
+#define DPC ((DiskParseContext*)yyextra)
+
+/* Sets an enum, checking it hasn't already been set to a different value  */
+#define DSET(dpc,member,enumname,str,valname) do{			\
+	if (dpc->disk->member != LIBXL_DISK_##enumname##_UNKNOWN &&	\
+	    dpc->disk->member != LIBXL_DISK_##enumname##_##valname) {	\
+	    xlu__disk_err(dpc, str, TOSTRING(member) " respecified");	\
+	} else {							\
+	    dpc->disk->member = LIBXL_DISK_##enumname##_##valname;	\
+	}								\
+    }while(0)
+
+/* For actions whose patterns contain '=', finds the start of the value */
+#define FROMEQUALS (strchr(yytext,'=')+1)
+
+/* Chops the delimiter off, modifying yytext and yyleng. */
+#define STRIP(delim) do{                                                \
+	if (yyleng>0 && yytext[yyleng-1]==(delim))                      \
+	    yytext[--yyleng] = 0;                                       \
+    }while(0)
+
+/* Sets a string value, checking it hasn't been set already. */
+#define SAVESTRING(what,loc,val) do{					\
+	savestring(DPC, what " respecified", &DPC->disk->loc, (val));	\
+    }while(0)
+static void savestring(DiskParseContext *dpc, const char *what_respecified,
+		       char **update, const char *value) {
+    if (*update) {
+        if (**update) { xlu__disk_err(dpc,value,what_respecified); return; }
+        free(*update); /* do not complain about overwriting empty strings */
+    }
+    *update = strdup(value);
+}
+
+/* Sets ->readwrite based on the string value.  This ought to be an enum. */
+static void setaccess(DiskParseContext *dpc, const char *str) {
+    if (!strcmp(str, "r") || !strcmp(str, "ro")) {
+        dpc->disk->readwrite = 0;
+    } else if (!strcmp(str, "rw") || !strcmp(str, "w") || !strcmp(str,"")) {
+	dpc->disk->readwrite = 1;
+    } else {
+	xlu__disk_err(dpc,str,"unknown value for access");
+    }
+}
+
+/* Sets ->format based on the string value.  This ought to be an enum. */
+static void setformat(DiskParseContext *dpc, const char *str) {
+    if (!strcmp(str,"") ||
+             !strcmp(str,"raw"))    DSET(dpc,format,FORMAT,str,RAW);
+    else if (!strcmp(str,"qcow"))   DSET(dpc,format,FORMAT,str,QCOW);
+    else if (!strcmp(str,"qcow2"))  DSET(dpc,format,FORMAT,str,QCOW2);
+    else if (!strcmp(str,"vhd"))    DSET(dpc,format,FORMAT,str,VHD);
+    else xlu__disk_err(dpc,str,"unknown value for format");
+}
+ 
+#define DEPRECATE(usewhatinstead) /* not currently reported */
+
+%}
+
+%option warn
+%option nodefault
+%option batch
+%option 8bit
+%option noyywrap
+%option reentrant
+%option prefix="xlu__disk_yy"
+%option nounput
+
+%x LEXERR
+
+%%
+
+ /*----- the scanner rules which do the parsing -----*/
+
+[ \t\n]+/([^ \t\n].*)? { /* ignore whitespace before parameters */ }
+
+ /* ordinary parameters setting enums or strings */
+
+format=[^,]*,?	{ STRIP(','); setformat(DPC, FROMEQUALS); }
+
+cdrom,?		{ DPC->disk->is_cdrom = 1; }
+devtype=cdrom,?	{ DPC->disk->is_cdrom = 1; }
+devtype=disk,?	{ DPC->disk->is_cdrom = 0; }
+devtype=[^,]*,?	{ xlu__disk_err(DPC,yytext,"unknown value for type"); }
+
+access=[^,]*,?	{ STRIP(','); setaccess(DPC, FROMEQUALS); }
+
+vdev=[^,]*,?	{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
+script=[^,]*,?	{ STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
+
+ /* the target magic parameter, eats the rest of the string */
+
+target=.*	{ STRIP(','); SAVESTRING("target", pdev_path, FROMEQUALS); }
+
+ /* unknown parameters */
+
+[a-z][-a-z0-9]*=[^,],? { xlu__disk_err(DPC,yytext,"unknown parameter"); }
+
+ /* deprecated prefixes */
+
+  /* the "/.*" in these patterns ensures that they count as if they
+   * matched the whole string, so these patterns take precedence */
+
+(raw|qcow2?|vhd):/.* {
+                    STRIP(':');
+                    DPC->had_depr_prefix=1; DEPRECATE("use `[format=]...,'");
+                    setformat(DPC, yytext);
+                 }
+
+iscsi:|e?nbd:drbd:/.* {
+		    STRIP(':');
+                    DPC->had_depr_prefix=1; DEPRECATE("use `script=...'");
+		    SAVESTRING("script", script, yytext);
+		}
+
+tapdisk:/.*	{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+tap2?:/.*	{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+aio:/.*		{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+ioemu:/.*	{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+file:/.*	{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+phy:/.*		{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+
+[a-z][a-z0-9]*:/([^a-z0-9].*)? {
+		  xlu__disk_err(DPC,yytext,"unknown deprecated disk prefix");
+		  return 0;
+		}
+
+ /* positional parameters */
+
+[^=,]*,|[^=,]+,?  {
+    char *colon;
+    STRIP(',');
+
+    if (DPC->err) {
+        /* previous errors may just lead to subsequent ones */
+    } else if (!DPC->disk->pdev_path) {
+        SAVESTRING("target", pdev_path, yytext);
+    } else if (!DPC->had_depr_prefix &&
+               DPC->disk->format == LIBXL_DISK_FORMAT_UNKNOWN) {
+        setformat(DPC,yytext);
+    } else if (!DPC->disk->vdev) {
+        colon = strrchr(yytext, ':');
+        if (colon) {
+            DEPRECATE("use `devtype=...'");
+            *colon++ = 0;
+            if (!strcmp(colon,"cdrom")) {
+                DPC->disk->is_cdrom = 1;
+            } else if (!strcmp(colon,"disk")) {
+                DPC->disk->is_cdrom = 0;
+            } else {
+                xlu__disk_err(DPC,colon,"unknown deprecated type");
+            }
+        }
+        SAVESTRING("vdev", vdev, yytext);
+    } else if (!DPC->access_set) {
+        DPC->access_set = 1;
+        setaccess(DPC,yytext);
+    } else {
+        xlu__disk_err(DPC,yytext,"too many positional parameters");
+        return 0; /* don't print any more errors */
+    }
+}
+
+. {
+    BEGIN(LEXERR);
+    yymore();
+}
+<LEXERR>.* {
+    xlu__disk_err(DPC,yytext,"bad disk syntax"); return 0;
+}
diff --git a/tools/libxl/libxlutil.h b/tools/libxl/libxlutil.h
index 8a6fcbd..80c8753 100644
--- a/tools/libxl/libxlutil.h
+++ b/tools/libxl/libxlutil.h
@@ -58,4 +58,27 @@ const char *xlu_cfg_get_listitem(const XLU_ConfigList*, int entry);
   /* xlu_cfg_get_listitem cannot fail, except that if entry is
    * out of range it returns 0 (not setting errno) */
 
+
+/*
+ * Disk specification parsing.
+ */
+
+int xlu_disk_parse(XLU_Config *cfg, int nspecs, const char *const *specs,
+		   libxl_device_disk *disk);
+  /* disk must have been initialised.
+   *
+   * On error, returns errno value.  Bad strings cause EINVAL and
+   * print a message to cfg's report (that's all cfg is used for).
+   *
+   * Normally one would pass nspecs==1 and only specs[0].  But it is
+   * permitted to pass more strings in which case each is parsed as a
+   * string containing a collection of parameters (but they all refer
+   * to of the configuration for a single disk).
+   *
+   * nspecs==0 is permitted but since it does not specify some mandatory
+   * properties, it produces a run-time configuration error if the
+   * resulting disk struct is used with libxl.
+   */
+
+
 #endif /* LIBXLUTIL_H */
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output
  2011-05-12 14:36               ` [PATCH 08/14] libxl: disks: new xlu_disk_parse function Ian Jackson
@ 2011-05-12 14:36                 ` Ian Jackson
  2011-05-12 14:36                   ` [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax Ian Jackson
  2011-05-13 10:49                   ` [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output Ian Campbell
  2011-05-13 10:48                 ` [PATCH 08/14] libxl: disks: new xlu_disk_parse function Ian Campbell
  1 sibling, 2 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Jackson

Commit the flex output into revision control, for the benefit of those
without flex or with only very old flex.  This change is split into a
separate patch for ease of review.  Generated with flex 2.5.35-10 on
Debian squeeze i386, by running "make" in the libxl directory.  No
manual changes in this commit.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxl/libxlu_disk_l.c | 2477 +++++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxlu_disk_l.h |  346 ++++++
 2 files changed, 2823 insertions(+), 0 deletions(-)
 create mode 100644 tools/libxl/libxlu_disk_l.c
 create mode 100644 tools/libxl/libxlu_disk_l.h

diff --git a/tools/libxl/libxlu_disk_l.c b/tools/libxl/libxlu_disk_l.c
new file mode 100644
index 0000000..30515e9
--- /dev/null
+++ b/tools/libxl/libxlu_disk_l.c
@@ -0,0 +1,2477 @@
+#line 2 "libxlu_disk_l.c"
+
+#line 4 "libxlu_disk_l.c"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif	/* defined (__STDC__) */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* An opaque pointer. */
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+
+/* For convenience, these vars (plus the bison vars far below)
+   are macros in the reentrant scanner. */
+#define yyin yyg->yyin_r
+#define yyout yyg->yyout_r
+#define yyextra yyg->yyextra_r
+#define yyleng yyg->yyleng_r
+#define yytext yyg->yytext_r
+#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+#define yy_flex_debug yyg->yy_flex_debug_r
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yyg->yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yyg->yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE xlu__disk_yyrestart(yyin ,yyscanner )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    #define YY_LESS_LINENO(n)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		*yy_cp = yyg->yy_hold_char; \
+		YY_RESTORE_YY_MORE_OFFSET \
+		yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+	FILE *yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via xlu__disk_yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
+                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
+
+void xlu__disk_yyrestart (FILE *input_file ,yyscan_t yyscanner );
+void xlu__disk_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+YY_BUFFER_STATE xlu__disk_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
+void xlu__disk_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void xlu__disk_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void xlu__disk_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+void xlu__disk_yypop_buffer_state (yyscan_t yyscanner );
+
+static void xlu__disk_yyensure_buffer_stack (yyscan_t yyscanner );
+static void xlu__disk_yy_load_buffer_state (yyscan_t yyscanner );
+static void xlu__disk_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
+
+#define YY_FLUSH_BUFFER xlu__disk_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
+
+YY_BUFFER_STATE xlu__disk_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
+YY_BUFFER_STATE xlu__disk_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
+YY_BUFFER_STATE xlu__disk_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+
+void *xlu__disk_yyalloc (yy_size_t ,yyscan_t yyscanner );
+void *xlu__disk_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
+void xlu__disk_yyfree (void * ,yyscan_t yyscanner );
+
+#define yy_new_buffer xlu__disk_yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){ \
+        xlu__disk_yyensure_buffer_stack (yyscanner); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            xlu__disk_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){\
+        xlu__disk_yyensure_buffer_stack (yyscanner); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            xlu__disk_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+#define xlu__disk_yywrap(n) 1
+#define YY_SKIP_YYWRAP
+
+typedef unsigned char YY_CHAR;
+
+typedef int yy_state_type;
+
+#define yytext_ptr yytext_r
+
+static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
+static int yy_get_next_buffer (yyscan_t yyscanner );
+static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	yyg->yytext_ptr = yy_bp; \
+	yyleng = (size_t) (yy_cp - yy_bp); \
+	yyg->yy_hold_char = *yy_cp; \
+	*yy_cp = '\0'; \
+	yyg->yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 23
+#define YY_END_OF_BUFFER 24
+/* This struct is not used in this scanner,
+   but its presence is necessary. */
+struct yy_trans_info
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static yyconst flex_int16_t yy_acclist[547] =
+    {   0,
+       24,   21,   22,   23, 8193,   21,   22,   23,16385, 8193,
+       21,   23,16385,   21,   22,   23,   22,   23,   21,   22,
+       23,   21,   22,   23,   21,   22,   23,   21,   22,   23,
+       21,   22,   23,   21,   22,   23,   21,   22,   23,   21,
+       22,   23,   21,   22,   23,   21,   22,   23,   21,   22,
+       23,   21,   22,   23,   21,   22,   23,   21,   22,   23,
+       21,   22,   21,   22,   21,   22,   22, 8193,   21,   22,
+     8193,   21,   22,16385, 8193,   21,   22, 8193,   21,   22,
+     8193,   22, 8193,   21, 8193,   21,16385, 8193,   21, 8193,
+       22,   21,   22,   21,   22, 8212,   21,   22,16404,   22,
+
+       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
+       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
+       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
+       21,   22,   21,   22,   21,   21, 8193,   21,   22, 8193,
+       21,   22, 8193,   21,   22, 8193,   22, 8193, 8193,   21,
+     8193,   21, 8212,   21, 8212,   21, 8212,   11,   21,   22,
+       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
+       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
+       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
+     8212,   21, 8212,   21, 8212,   11,   21,   22,   16, 8212,
+
+       21,   22,16404,   21,   22,   21,   22,   21,   22,   21,
+       22,   21,   22,   21,   22, 8212,   21,   22,16404,   19,
+     8212,   21,   22,16404,   21,   22, 8204, 8212,   21,   22,
+    16396,16404,   21,   22,   21,   22, 8207, 8212,   21,   22,
+    16399,16404,   21,   22,   21,   22,   21,   22,   21,   22,
+       16, 8212,   21,   16, 8212,   21,   16,   21,   16, 8212,
+        3,   21,   22,   21,   22,   18, 8212,   21,   22,16404,
+       21,   22,   21,   22,   21,   22,   21,   19, 8212,   21,
+       19, 8212,   21,   19,   21,   19, 8212, 8204, 8212,   21,
+     8204, 8212,   21, 8204,   21, 8204, 8212,   21,   22, 8207,
+
+     8212,   21, 8207, 8212,   21, 8207,   21, 8207, 8212,   21,
+       22,   21,   22,    8,   22,   21,   22,   16, 8212,   21,
+       16, 8212,   21,   16, 8212,   16,   21,   16,    3,   21,
+       22,   21,   22,   18, 8212,   21,   18, 8212,   21,   18,
+       21,   18, 8212,   21,   22,   17, 8212,   21,   22,16404,
+     8205, 8212,   21,   22,16397,16404,   21,   19, 8212,   21,
+       19, 8212,   21,   19, 8212,   19,   21,   19, 8204, 8212,
+       21, 8204, 8212,   21, 8204, 8212, 8204,   21, 8204,   21,
+       22, 8207, 8212,   21, 8207, 8212,   21, 8207, 8212, 8207,
+       21, 8207,   21,   22,   21,   22,    8,   11,    8,    7,
+
+       22,   21,   22,   18, 8212,   21,   18, 8212,   21,   18,
+     8212,   18,   21,   18,    2,   22,   17, 8212,   21,   17,
+     8212,   21,   17,   21,   17, 8212, 8205, 8212,   21, 8205,
+     8212,   21, 8205,   21, 8205, 8212,   21,    9,   22,   21,
+       22,   10,   22,    8,    8,   11,    7,   11,    7,    6,
+       22,    2,   11,    2,   17, 8212,   21,   17, 8212,   21,
+       17, 8212,   17,   21,   17, 8205, 8212,   21, 8205, 8212,
+       21, 8205, 8212, 8205,   21, 8205,   21,    9,   11,    9,
+       14, 8212,   21,   22,16404,   10,   11,   10,    7,    7,
+       11,    6,   11,    6,    6,   11,    6,   11,    2,    2,
+
+       11, 8205,   21,16397,    9,    9,   11,   14, 8212,   21,
+       14, 8212,   21,   14,   21,   14, 8212,   10,   11,    6,
+        6,   11,    6,    6,   14, 8212,   21,   14, 8212,   21,
+       14, 8212,   14,   21,   14,    6,    6,    6,    5,    6,
+        4,    6,    5,    6,    4,    6
+    } ;
+
+static yyconst flex_int16_t yy_accept[250] =
+    {   0,
+        1,    1,    1,    2,    5,   10,   14,   17,   19,   22,
+       25,   28,   31,   34,   37,   40,   43,   46,   49,   52,
+       55,   58,   61,   63,   65,   67,   68,   71,   75,   78,
+       81,   83,   85,   88,   90,   91,   92,   94,   96,  100,
+      101,  103,  105,  107,  109,  111,  113,  115,  117,  119,
+      121,  123,  125,  127,  129,  131,  133,  135,  136,  137,
+      140,  143,  146,  148,  149,  151,  153,  155,  157,  158,
+      159,  161,  163,  165,  167,  169,  171,  173,  175,  177,
+      179,  181,  183,  185,  187,  189,  191,  193,  195,  196,
+      197,  199,  204,  206,  208,  210,  212,  214,  216,  220,
+
+      225,  227,  233,  235,  237,  243,  245,  247,  249,  251,
+      254,  257,  259,  261,  264,  266,  271,  273,  275,  277,
+      278,  281,  284,  286,  288,  291,  294,  296,  298,  300,
+      303,  306,  308,  310,  312,  314,  316,  318,  321,  324,
+      326,  328,  329,  332,  334,  337,  340,  342,  344,  346,
+      351,  357,  358,  361,  364,  366,  368,  369,  372,  375,
+      377,  379,  380,  382,  385,  388,  390,  392,  393,  395,
+      397,  399,  400,  402,  404,  407,  410,  412,  414,  415,
+      417,  420,  423,  425,  427,  430,  433,  435,  437,  438,
+      440,  442,  444,  445,  447,  449,  450,  452,  454,  455,
+
+      458,  461,  463,  465,  466,  469,  472,  474,  476,  477,
+      478,  480,  481,  486,  488,  489,  490,  492,  494,  495,
+      497,  499,  500,  502,  505,  506,  508,  511,  514,  516,
+      518,  520,  521,  523,  524,  525,  528,  531,  533,  535,
+      536,  537,  538,  539,  541,  543,  545,  547,  547
+    } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    4,    5,    1,    1,    6,    6,    7,
+        6,    6,    6,    6,    6,    6,    6,    8,    1,    1,
+        9,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,   10,   11,   12,   13,
+
+       14,   15,   16,   17,   18,   19,   20,   21,   22,   23,
+       24,   25,   26,   27,   28,   29,   30,   31,   32,   19,
+       33,   19,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int32_t yy_meta[34] =
+    {   0,
+        1,    1,    2,    3,    1,    1,    1,    1,    4,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1
+    } ;
+
+static yyconst flex_int16_t yy_base[306] =
+    {   0,
+        0,    0,  590,   30,   38,   41,   44,   47,   56,   74,
+      576,  574,  564,   45,   38,  575,  568,  572,  573,  570,
+      571,   54,   76,  591,  576,  591,   83,   91,    0,   93,
+        0,  100,  103,    0,    0,  106,  115,    0,  124,    0,
+      567,  554,  550,  545,  564,  553,  546,  558,  559,  557,
+      536,  544,  535,  539,   10,  551,  551,  559,  591,  127,
+        0,  134,    0,    0,  136,    0,  138,    0,    0,  558,
+      547,  552,  535,  529,  543,  534,  533,  526,  545,  544,
+      519,  542,  531,  141,  532,  516,  147,    0,    0,  591,
+      518,  156,  523,  511,  533,  527,  495,  495,  496,  165,
+
+       65,  174,  460,  469,  183,  447,  439,  440,  417,  186,
+        0,  190,    0,  429,  400,  199,  388,  401,  393,   84,
+      202,    0,  206,    0,  209,    0,  213,    0,  360,  216,
+        0,  220,    0,  337,  329,  341,  306,  223,    0,    0,
+        0,    0,  591,  300,  227,    0,  230,    0,  304,  239,
+      248,   97,  251,    0,    0,    0,    0,  255,    0,    0,
+        0,    0,  299,  258,    0,    0,    0,    0,  271,  275,
+      273,  591,  259,  237,  262,    0,    0,    0,    0,  241,
+      265,    0,  269,    0,  272,    0,  276,    0,   77,  234,
+      229,  117,  231,  591,  193,  591,  140,  192,  591,  279,
+
+        0,    0,    0,    0,  283,    0,    0,    0,    0,  285,
+      177,  591,  293,  168,    0,  167,  591,  159,  591,   85,
+      210,  151,  591,  296,  130,  591,  300,    0,  303,    0,
+        0,  109,  591,  194,  118,  307,    0,    0,    0,    0,
+      266,   50,  158,   45,   32,  591,  591,  591,  316,  320,
+      324,  328,  332,  336,  339,  343,  347,  351,  355,  359,
+      363,  367,  371,  375,  379,  383,  387,  391,  395,  399,
+      403,  407,  411,  415,  419,  423,  427,  431,  435,  439,
+      443,  447,  451,  455,  459,  463,  467,  471,  475,  479,
+      483,  487,  491,  495,  499,  503,  507,  511,  515,  519,
+
+      523,  527,  531,  535,  539
+    } ;
+
+static yyconst flex_int16_t yy_def[306] =
+    {   0,
+      248,    1,  248,  249,  250,  251,  252,  252,  253,  253,
+       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
+       10,   10,  249,  248,  254,  248,  255,  250,  256,  257,
+      256,  257,  251,  256,  256,  252,  258,   10,  254,  259,
+       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
+       10,   10,   10,   10,   10,   10,   10,  254,  248,  255,
+      256,  257,  256,  256,  257,  256,  260,  261,  261,  248,
+       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
+       10,   10,   10,   10,   10,   10,  260,  261,  261,  248,
+       10,  262,   10,   10,   10,   10,   10,   10,   39,  263,
+
+       10,  264,   10,   10,  265,   10,   10,   10,   10,  266,
+      267,  262,  267,   10,   10,  268,   10,   10,   10,  254,
+      269,  270,  263,  270,  271,  272,  264,  272,   10,  273,
+      274,  265,  274,   10,   10,  275,   10,  266,  267,  267,
+      276,  276,  248,   10,  277,  278,  268,  278,   10,  279,
+      280,  254,  269,  270,  270,  281,  281,  271,  272,  272,
+      282,  282,   10,  273,  274,  274,  283,  283,   10,   10,
+      284,  248,  285,   10,  277,  278,  278,  286,  286,  287,
+      288,  289,  279,  289,  290,  291,  280,  291,  254,  292,
+       10,  293,  284,  248,  294,  248,  295,  296,  248,  288,
+
+      289,  289,  297,  297,  290,  291,  291,  298,  298,  254,
+      299,  248,  300,  301,  301,  294,  248,  302,  248,  302,
+      302,  296,  248,  280,  299,  248,  303,  304,  300,  304,
+      301,  302,  248,  302,  302,  303,  304,  304,  305,  305,
+      302,  302,  302,  302,  302,  248,  248,    0,  248,  248,
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+
+      248,  248,  248,  248,  248
+    } ;
+
+static yyconst flex_int16_t yy_nxt[625] =
+    {   0,
+        4,    5,    6,    7,    4,    4,    4,    4,    8,    9,
+       10,   11,   12,   13,   14,   10,   10,   15,   10,   10,
+       10,   10,   16,   10,   17,   18,   19,   20,   21,   10,
+       22,   10,   10,   24,   84,  247,   85,   25,   26,   28,
+       28,   29,   33,   33,   34,   30,   31,   26,  246,   35,
+       26,   26,   26,  219,   26,   26,   23,   23,   23,   24,
+       37,   48,   46,   39,   40,   49,   56,   41,   47,  244,
+       57,   82,  102,   42,   23,   23,   23,   24,   37,   24,
+       59,   39,   40,   25,   26,   23,   61,   59,  233,  210,
+       62,   63,   28,   28,   29,   58,   66,  234,   30,   31,
+
+       59,   64,   58,   66,   33,   33,   34,  189,   64,   26,
+      152,   35,  219,   26,   26,   23,   23,   23,   24,   70,
+      215,  219,   25,   40,   67,   67,   67,   68,   67,   23,
+       61,   67,   69,  212,   62,   63,   58,   66,   58,   66,
+       58,   88,   64,  219,   64,  242,   89,  104,  105,   58,
+       88,  220,  221,  106,  199,   89,  110,  110,   67,  111,
+      110,  219,  233,  110,  113,  121,  121,   67,  122,  121,
+      196,  231,  121,  124,  125,  125,   67,  126,  125,  245,
+      226,  125,  128,  130,  130,   67,  131,  130,   58,  139,
+      130,  133,   58,  141,  140,  223,  217,  219,  142,  145,
+
+      145,   67,  146,  145,   58,  154,  145,  148,   58,  156,
+      155,   58,  159,  233,  157,   58,  161,  160,   58,  165,
+      241,  162,   58,  167,  166,   58,  139,  235,  168,   58,
+      176,  140,   58,  178,  172,  177,  213,  212,  179,  181,
+      181,   67,  182,  181,  199,  197,  181,  184,  185,  185,
+       67,  186,  185,   58,  154,  185,  188,   58,  159,  155,
+       58,  165,  196,  160,   58,  176,  166,   58,  201,  219,
+      177,   58,  203,  202,   58,  206,  194,  204,   58,  208,
+      207,   58,  201,  192,  209,   58,  206,  202,   59,  243,
+      191,  207,  224,  227,  227,   67,  228,  227,   58,  208,
+
+      227,  230,   58,  237,  209,   58,  239,  190,  238,   58,
+      237,  240,  180,  174,  173,  238,   23,   23,   23,   23,
+       27,   27,   27,   27,   32,   32,   32,   32,   36,   36,
+       36,   36,   38,   38,   38,   38,   58,   58,   58,   60,
+       60,   60,   60,   64,  172,   64,   64,   65,   65,   65,
+       65,   37,   37,   37,   37,   70,   70,  170,   70,   87,
+       87,   87,   87,   89,  169,   89,   89,  112,  112,  112,
+      112,  123,  123,  123,  123,  127,  127,  127,  127,  132,
+      132,  132,  132,  138,  138,  138,  138,  140,  163,  140,
+      140,  147,  147,  147,  147,  153,  153,  153,  153,  155,
+
+      151,  155,  155,  158,  158,  158,  158,  160,  150,  160,
+      160,  164,  164,  164,  164,  166,  149,  166,  166,  171,
+      171,  171,  171,  142,  144,  142,  142,  175,  175,  175,
+      175,  177,  143,  177,  177,  183,  183,  183,  183,  187,
+      187,  187,  187,  157,  137,  157,  157,  162,  136,  162,
+      162,  168,  135,  168,  168,  193,  193,  193,  193,  195,
+      195,  195,  195,  179,  134,  179,  179,  198,  198,  198,
+      198,  200,  200,  200,  200,  202,  105,  202,  202,  205,
+      205,  205,  205,  207,  129,  207,  207,  211,  211,  211,
+      211,  214,  214,  214,  214,  216,  216,  216,  216,  218,
+
+      218,  218,  218,  222,  222,  222,  222,  204,  120,  204,
+      204,  209,  119,  209,  209,  225,  225,  225,  225,  229,
+      229,  229,  229,  215,  118,  215,  215,  232,  232,  232,
+      232,  236,  236,  236,  236,  238,  117,  238,  238,  240,
+      116,  240,  240,  115,  114,  109,  108,  107,  103,  102,
+      101,  100,   99,   98,   97,   96,   95,   94,   93,   92,
+       91,   90,   59,   82,   86,   83,   82,   81,   80,   79,
+       78,   77,   76,   75,   50,   74,   73,   72,   71,   59,
+       55,   54,   53,   52,   51,   50,   45,   44,   43,  248,
+        3,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+      248,  248,  248,  248
+    } ;
+
+static yyconst flex_int16_t yy_chk[625] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    4,   55,  245,   55,    4,    4,    5,
+        5,    5,    6,    6,    6,    5,    5,    7,  244,    6,
+        8,    7,    7,  242,    8,    8,    9,    9,    9,    9,
+        9,   15,   14,    9,    9,   15,   22,    9,   14,  242,
+       22,  101,  101,    9,   10,   10,   10,   10,   10,   23,
+      189,   10,   10,   23,   23,   27,   27,  120,  220,  189,
+       27,   27,   28,   28,   28,   30,   30,  220,   28,   28,
+
+      152,   30,   32,   32,   33,   33,   33,  152,   32,   36,
+      120,   33,  232,   36,   36,   37,   37,   37,   37,  192,
+      192,  235,   37,   37,   39,   39,   39,   39,   39,   60,
+       60,   39,   39,  225,   60,   60,   62,   62,   65,   65,
+       67,   67,   62,  197,   65,  235,   67,   84,   84,   87,
+       87,  197,  197,   84,  222,   87,   92,   92,   92,   92,
+       92,  243,  218,   92,   92,  100,  100,  100,  100,  100,
+      216,  214,  100,  100,  102,  102,  102,  102,  102,  243,
+      211,  102,  102,  105,  105,  105,  105,  105,  110,  110,
+      105,  105,  112,  112,  110,  198,  195,  234,  112,  116,
+
+      116,  116,  116,  116,  121,  121,  116,  116,  123,  123,
+      121,  125,  125,  221,  123,  127,  127,  125,  130,  130,
+      234,  127,  132,  132,  130,  138,  138,  221,  132,  145,
+      145,  138,  147,  147,  193,  145,  191,  190,  147,  150,
+      150,  150,  150,  150,  180,  174,  150,  150,  151,  151,
+      151,  151,  151,  153,  153,  151,  151,  158,  158,  153,
+      164,  164,  173,  158,  175,  175,  164,  181,  181,  241,
+      175,  183,  183,  181,  185,  185,  171,  183,  187,  187,
+      185,  200,  200,  170,  187,  205,  205,  200,  210,  241,
+      169,  205,  210,  213,  213,  213,  213,  213,  224,  224,
+
+      213,  213,  227,  227,  224,  229,  229,  163,  227,  236,
+      236,  229,  149,  144,  137,  236,  249,  249,  249,  249,
+      250,  250,  250,  250,  251,  251,  251,  251,  252,  252,
+      252,  252,  253,  253,  253,  253,  254,  254,  254,  255,
+      255,  255,  255,  256,  136,  256,  256,  257,  257,  257,
+      257,  258,  258,  258,  258,  259,  259,  135,  259,  260,
+      260,  260,  260,  261,  134,  261,  261,  262,  262,  262,
+      262,  263,  263,  263,  263,  264,  264,  264,  264,  265,
+      265,  265,  265,  266,  266,  266,  266,  267,  129,  267,
+      267,  268,  268,  268,  268,  269,  269,  269,  269,  270,
+
+      119,  270,  270,  271,  271,  271,  271,  272,  118,  272,
+      272,  273,  273,  273,  273,  274,  117,  274,  274,  275,
+      275,  275,  275,  276,  115,  276,  276,  277,  277,  277,
+      277,  278,  114,  278,  278,  279,  279,  279,  279,  280,
+      280,  280,  280,  281,  109,  281,  281,  282,  108,  282,
+      282,  283,  107,  283,  283,  284,  284,  284,  284,  285,
+      285,  285,  285,  286,  106,  286,  286,  287,  287,  287,
+      287,  288,  288,  288,  288,  289,  104,  289,  289,  290,
+      290,  290,  290,  291,  103,  291,  291,  292,  292,  292,
+      292,  293,  293,  293,  293,  294,  294,  294,  294,  295,
+
+      295,  295,  295,  296,  296,  296,  296,  297,   99,  297,
+      297,  298,   98,  298,  298,  299,  299,  299,  299,  300,
+      300,  300,  300,  301,   97,  301,  301,  302,  302,  302,
+      302,  303,  303,  303,  303,  304,   96,  304,  304,  305,
+       95,  305,  305,   94,   93,   91,   86,   85,   83,   82,
+       81,   80,   79,   78,   77,   76,   75,   74,   73,   72,
+       71,   70,   58,   57,   56,   54,   53,   52,   51,   50,
+       49,   48,   47,   46,   45,   44,   43,   42,   41,   25,
+       21,   20,   19,   18,   17,   16,   13,   12,   11,    3,
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
+      248,  248,  248,  248
+    } ;
+
+#define YY_TRAILING_MASK 0x2000
+#define YY_TRAILING_HEAD_MASK 0x4000
+#define REJECT \
+{ \
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ \
+yy_cp = yyg->yy_full_match; /* restore poss. backed-over text */ \
+yyg->yy_lp = yyg->yy_full_lp; /* restore orig. accepting pos. */ \
+yyg->yy_state_ptr = yyg->yy_full_state; /* restore orig. state */ \
+yy_current_state = *yyg->yy_state_ptr; /* restore curr. state */ \
+++yyg->yy_lp; \
+goto find_rule; \
+}
+
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+#line 1 "libxlu_disk_l.l"
+/* -*- fundamental -*- */
+/*
+ * libxlu_disk_l.l - parser for disk specification strings
+ *
+ * Copyright (C) 2011      Citrix Ltd.
+ * Author Ian Jackson <ian.jackson@eu.citrix.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ */
+/*
+ * Parsing the old xm/xend/xl-4.1 disk specs is a tricky problem,
+ * because the target string might in theory contain "," which is the
+ * delimiter we use for stripping off things on the RHS, and ":",
+ * which is the delimiter we use for stripping off things on the LHS.
+ *
+ * In this parser we do not support such target strings in the old
+ * syntax; if the target string has to contain "," or ":" the new
+ * syntax's "target=" should be used.
+ */
+#line 31 "libxlu_disk_l.l"
+#include "libxlu_disk_i.h"
+
+#define YY_NO_INPUT
+
+/* Some versions of flex have a bug (Fedora bugzilla 612465) which causes
+ * it to fail to declare these functions, which it defines.  So declare
+ * them ourselves.  Hopefully we won't have to simultaneously support
+ * a flex version which declares these differently somehow. */
+int xlu__disk_yyget_column(yyscan_t yyscanner);
+void xlu__disk_yyset_column(int  column_no, yyscan_t yyscanner);
+
+
+/*----- useful macros and functions used in actions -----
+ * we use macros in the actual rules to keep the actions short
+ * and particularly to avoid repeating boilerplate values such as
+ * DPC->disk, yytext, etc. */
+
+#define DPC ((DiskParseContext*)yyextra)
+
+/* Sets an enum, checking it hasn't already been set to a different value  */
+#define DSET(dpc,member,enumname,str,valname) do{			\
+	if (dpc->disk->member != LIBXL_DISK_##enumname##_UNKNOWN &&	\
+	    dpc->disk->member != LIBXL_DISK_##enumname##_##valname) {	\
+	    xlu__disk_err(dpc, str, TOSTRING(member) " respecified");	\
+	} else {							\
+	    dpc->disk->member = LIBXL_DISK_##enumname##_##valname;	\
+	}								\
+    }while(0)
+
+/* For actions whose patterns contain '=', finds the start of the value */
+#define FROMEQUALS (strchr(yytext,'=')+1)
+
+/* Chops the delimiter off, modifying yytext and yyleng. */
+#define STRIP(delim) do{                                                \
+	if (yyleng>0 && yytext[yyleng-1]==(delim))                      \
+	    yytext[--yyleng] = 0;                                       \
+    }while(0)
+
+/* Sets a string value, checking it hasn't been set already. */
+#define SAVESTRING(what,loc,val) do{					\
+	savestring(DPC, what "respecified", &DPC->disk->loc, (val));	\
+    }while(0)
+static void savestring(DiskParseContext *dpc, const char *what_respecified,
+		       char **update, const char *value) {
+    if (*update) {
+        if (**update) { xlu__disk_err(dpc,value,what_respecified); return; }
+        free(*update); /* do not complain about overwriting empty strings */
+    }
+    *update = strdup(value);
+}
+
+/* Sets ->readwrite based on the string value.  This ought to be an enum. */
+static void setaccess(DiskParseContext *dpc, const char *str) {
+    if (!strcmp(str, "r")) {
+        dpc->disk->readwrite = 0;
+    } else if (!strcmp(str, "rw") || !strcmp(str, "w") || !strcmp(str,"")) {
+	dpc->disk->readwrite = 1;
+    } else {
+	xlu__disk_err(dpc,str,"unknown value for access");
+    }
+}
+
+/* Sets ->format based on the string value.  This ought to be an enum. */
+static void setformat(DiskParseContext *dpc, const char *str) {
+    if (!strcmp(str,"") ||
+             !strcmp(str,"raw"))    DSET(dpc,format,FORMAT,str,RAW);
+    else if (!strcmp(str,"qcow"))   DSET(dpc,format,FORMAT,str,QCOW);
+    else if (!strcmp(str,"qcow2"))  DSET(dpc,format,FORMAT,str,QCOW2);
+    else if (!strcmp(str,"vhd"))    DSET(dpc,format,FORMAT,str,VHD);
+    else xlu__disk_err(dpc,str,"unknown value for format");
+}
+ 
+#define DEPRECATE(usewhatinstead) /* not currently reported */
+
+#line 845 "libxlu_disk_l.c"
+
+#define INITIAL 0
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+/* Holds the entire state of the reentrant scanner. */
+struct yyguts_t
+    {
+
+    /* User-defined. Not touched by flex. */
+    YY_EXTRA_TYPE yyextra_r;
+
+    /* The rest are the same as the globals declared in the non-reentrant scanner. */
+    FILE *yyin_r, *yyout_r;
+    size_t yy_buffer_stack_top; /**< index of top of stack. */
+    size_t yy_buffer_stack_max; /**< capacity of stack. */
+    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
+    char yy_hold_char;
+    int yy_n_chars;
+    int yyleng_r;
+    char *yy_c_buf_p;
+    int yy_init;
+    int yy_start;
+    int yy_did_buffer_switch_on_eof;
+    int yy_start_stack_ptr;
+    int yy_start_stack_depth;
+    int *yy_start_stack;
+    yy_state_type yy_last_accepting_state;
+    char* yy_last_accepting_cpos;
+
+    int yylineno_r;
+    int yy_flex_debug_r;
+
+    yy_state_type *yy_state_buf;
+    yy_state_type *yy_state_ptr;
+    char *yy_full_match;
+    int yy_lp;
+
+    /* These are only needed for trailing context rules,
+     * but there's no conditional variable for that yet. */
+    int yy_looking_for_trail_begin;
+    int yy_full_lp;
+    int *yy_full_state;
+
+    char *yytext_r;
+    int yy_more_flag;
+    int yy_more_len;
+
+    }; /* end struct yyguts_t */
+
+static int yy_init_globals (yyscan_t yyscanner );
+
+int xlu__disk_yylex_init (yyscan_t* scanner);
+
+int xlu__disk_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int xlu__disk_yylex_destroy (yyscan_t yyscanner );
+
+int xlu__disk_yyget_debug (yyscan_t yyscanner );
+
+void xlu__disk_yyset_debug (int debug_flag ,yyscan_t yyscanner );
+
+YY_EXTRA_TYPE xlu__disk_yyget_extra (yyscan_t yyscanner );
+
+void xlu__disk_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+
+FILE *xlu__disk_yyget_in (yyscan_t yyscanner );
+
+void xlu__disk_yyset_in  (FILE * in_str ,yyscan_t yyscanner );
+
+FILE *xlu__disk_yyget_out (yyscan_t yyscanner );
+
+void xlu__disk_yyset_out  (FILE * out_str ,yyscan_t yyscanner );
+
+int xlu__disk_yyget_leng (yyscan_t yyscanner );
+
+char *xlu__disk_yyget_text (yyscan_t yyscanner );
+
+int xlu__disk_yyget_lineno (yyscan_t yyscanner );
+
+void xlu__disk_yyset_lineno (int line_number ,yyscan_t yyscanner );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int xlu__disk_yywrap (yyscan_t yyscanner );
+#else
+extern int xlu__disk_yywrap (yyscan_t yyscanner );
+#endif
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (yyscan_t yyscanner );
+#else
+static int input (yyscan_t yyscanner );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+		{ \
+		int c = '*'; \
+		size_t n; \
+		for ( n = 0; n < max_size && \
+			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( yyin ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else \
+		{ \
+		errno=0; \
+		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+			{ \
+			if( errno != EINTR) \
+				{ \
+				YY_FATAL_ERROR( "input in flex scanner failed" ); \
+				break; \
+				} \
+			errno=0; \
+			clearerr(yyin); \
+			} \
+		}\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int xlu__disk_yylex (yyscan_t yyscanner);
+
+#define YY_DECL int xlu__disk_yylex (yyscan_t yyscanner)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+#line 116 "libxlu_disk_l.l"
+
+
+ /*----- the scanner rules which do the parsing -----*/
+
+#line 1085 "libxlu_disk_l.c"
+
+	if ( !yyg->yy_init )
+		{
+		yyg->yy_init = 1;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+        /* Create the reject buffer large enough to save one state per allowed character. */
+        if ( ! yyg->yy_state_buf )
+            yyg->yy_state_buf = (yy_state_type *)xlu__disk_yyalloc(YY_STATE_BUF_SIZE  ,yyscanner);
+            if ( ! yyg->yy_state_buf )
+                YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yylex()" );
+
+		if ( ! yyg->yy_start )
+			yyg->yy_start = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = stdin;
+
+		if ( ! yyout )
+			yyout = stdout;
+
+		if ( ! YY_CURRENT_BUFFER ) {
+			xlu__disk_yyensure_buffer_stack (yyscanner);
+			YY_CURRENT_BUFFER_LVALUE =
+				xlu__disk_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+		}
+
+		xlu__disk_yy_load_buffer_state(yyscanner );
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = yyg->yy_c_buf_p;
+
+		/* Support of yytext. */
+		*yy_cp = yyg->yy_hold_char;
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = yyg->yy_start;
+
+		yyg->yy_state_ptr = yyg->yy_state_buf;
+		*yyg->yy_state_ptr++ = yy_current_state;
+
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 249 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			*yyg->yy_state_ptr++ = yy_current_state;
+			++yy_cp;
+			}
+		while ( yy_current_state != 248 );
+
+yy_find_action:
+		yy_current_state = *--yyg->yy_state_ptr;
+		yyg->yy_lp = yy_accept[yy_current_state];
+find_rule: /* we branch to this label when backing up */
+		for ( ; ; ) /* until we find what rule we matched */
+			{
+			if ( yyg->yy_lp && yyg->yy_lp < yy_accept[yy_current_state + 1] )
+				{
+				yy_act = yy_acclist[yyg->yy_lp];
+				if ( yy_act & YY_TRAILING_HEAD_MASK ||
+				     yyg->yy_looking_for_trail_begin )
+					{
+					if ( yy_act == yyg->yy_looking_for_trail_begin )
+						{
+						yyg->yy_looking_for_trail_begin = 0;
+						yy_act &= ~YY_TRAILING_HEAD_MASK;
+						break;
+						}
+					}
+				else if ( yy_act & YY_TRAILING_MASK )
+					{
+					yyg->yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
+					yyg->yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
+					}
+				else
+					{
+					yyg->yy_full_match = yy_cp;
+					yyg->yy_full_state = yyg->yy_state_ptr;
+					yyg->yy_full_lp = yyg->yy_lp;
+					break;
+					}
+				++yyg->yy_lp;
+				goto find_rule;
+				}
+			--yy_cp;
+			yy_current_state = *--yyg->yy_state_ptr;
+			yyg->yy_lp = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+do_action:	/* This label is used only to access EOF actions. */
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+case 1:
+/* rule 1 can match eol */
+YY_RULE_SETUP
+#line 120 "libxlu_disk_l.l"
+{ /* ignore whitespace before parameters */ }
+	YY_BREAK
+/* ordinary parameters setting enums or strings */
+case 2:
+/* rule 2 can match eol */
+YY_RULE_SETUP
+#line 124 "libxlu_disk_l.l"
+{ STRIP(','); setformat(DPC, FROMEQUALS); }
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 126 "libxlu_disk_l.l"
+{ DPC->disk->is_cdrom = 1; }
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 127 "libxlu_disk_l.l"
+{ DPC->disk->is_cdrom = 1; }
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 128 "libxlu_disk_l.l"
+{ DPC->disk->is_cdrom = 0; }
+	YY_BREAK
+case 6:
+/* rule 6 can match eol */
+YY_RULE_SETUP
+#line 129 "libxlu_disk_l.l"
+{ xlu__disk_err(DPC,yytext,"unknown value for type"); }
+	YY_BREAK
+case 7:
+/* rule 7 can match eol */
+YY_RULE_SETUP
+#line 131 "libxlu_disk_l.l"
+{ STRIP(','); setaccess(DPC,yytext); }
+	YY_BREAK
+case 8:
+/* rule 8 can match eol */
+YY_RULE_SETUP
+#line 133 "libxlu_disk_l.l"
+{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
+	YY_BREAK
+case 9:
+/* rule 9 can match eol */
+YY_RULE_SETUP
+#line 134 "libxlu_disk_l.l"
+{ STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
+	YY_BREAK
+/* the target magic parameter, eats the rest of the string */
+case 10:
+YY_RULE_SETUP
+#line 138 "libxlu_disk_l.l"
+{ STRIP(','); SAVESTRING("target", pdev_path, FROMEQUALS); }
+	YY_BREAK
+/* unknown parameters */
+case 11:
+/* rule 11 can match eol */
+YY_RULE_SETUP
+#line 142 "libxlu_disk_l.l"
+{ xlu__disk_err(DPC,yytext,"unknown parameter"); }
+	YY_BREAK
+/* deprecated prefixes */
+/* the "/.*" in these patterns ensures that they count as if they
+   * matched the whole string, so these patterns take precedence */
+case 12:
+YY_RULE_SETUP
+#line 149 "libxlu_disk_l.l"
+{
+                    STRIP(':');
+                    DPC->had_depr_prefix=1; DEPRECATE("use `[format=]...,'");
+                    setformat(DPC, yytext);
+                 }
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 155 "libxlu_disk_l.l"
+{
+		    STRIP(':');
+                    DPC->had_depr_prefix=1; DEPRECATE("use `script=...'");
+		    SAVESTRING("script", script, yytext);
+		}
+	YY_BREAK
+case 14:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp = yy_bp + 8;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 161 "libxlu_disk_l.l"
+{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 162 "libxlu_disk_l.l"
+{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+	YY_BREAK
+case 16:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 163 "libxlu_disk_l.l"
+{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+	YY_BREAK
+case 17:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp = yy_bp + 6;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 164 "libxlu_disk_l.l"
+{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+	YY_BREAK
+case 18:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp = yy_bp + 5;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 165 "libxlu_disk_l.l"
+{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+	YY_BREAK
+case 19:
+*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
+yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
+YY_DO_BEFORE_ACTION; /* set up yytext again */
+YY_RULE_SETUP
+#line 166 "libxlu_disk_l.l"
+{ DPC->had_depr_prefix=1; DEPRECATE(0); }
+	YY_BREAK
+case 20:
+/* rule 20 can match eol */
+YY_RULE_SETUP
+#line 168 "libxlu_disk_l.l"
+{
+		  xlu__disk_err(DPC,yytext,"unknown deprecated disk prefix");
+		  return 0;
+		}
+	YY_BREAK
+/* positional parameters */
+case 21:
+/* rule 21 can match eol */
+YY_RULE_SETUP
+#line 175 "libxlu_disk_l.l"
+{
+    char *colon;
+    STRIP(',');
+
+    if (DPC->err) {
+        /* previous errors may just lead to subsequent ones */
+    } else if (!DPC->disk->pdev_path) {
+        SAVESTRING("target", pdev_path, yytext);
+    } else if (!DPC->had_depr_prefix &&
+               DPC->disk->format == LIBXL_DISK_FORMAT_UNKNOWN) {
+        setformat(DPC,yytext);
+    } else if (!DPC->disk->vdev) {
+        colon = strrchr(yytext, ':');
+        if (colon) {
+            DEPRECATE("use `devtype=...'");
+            *colon++ = 0;
+            if (!strcmp(colon,"cdrom")) {
+                DPC->disk->is_cdrom = 1;
+            } else if (!strcmp(colon,"disk")) {
+                DPC->disk->is_cdrom = 0;
+            } else {
+                xlu__disk_err(DPC,colon,"unknown deprecated type");
+            }
+        }
+        SAVESTRING("vdev", vdev, yytext);
+    } else if (!DPC->access_set) {
+        DPC->access_set = 1;
+        setaccess(DPC,yytext);
+    } else {
+        xlu__disk_err(DPC,yytext,"too many positional parameters");
+        return 0; /* don't print any more errors */
+    }
+}
+	YY_BREAK
+case 22:
+/* rule 22 can match eol */
+YY_RULE_SETUP
+#line 209 "libxlu_disk_l.l"
+{ xlu__disk_err(DPC,yytext,"bad disk syntax"); return 0; }
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 210 "libxlu_disk_l.l"
+YY_FATAL_ERROR( "flex scanner jammed" );
+	YY_BREAK
+#line 1387 "libxlu_disk_l.c"
+			case YY_STATE_EOF(INITIAL):
+				yyterminate();
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = yyg->yy_hold_char;
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * xlu__disk_yylex().  If so, then we have to assure
+			 * consistency between YY_CURRENT_BUFFER and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state( yyscanner );
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
+
+			yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++yyg->yy_c_buf_p;
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = yyg->yy_c_buf_p;
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer( yyscanner ) )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				yyg->yy_did_buffer_switch_on_eof = 0;
+
+				if ( xlu__disk_yywrap(yyscanner ) )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! yyg->yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				yyg->yy_c_buf_p =
+					yyg->yytext_ptr + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state( yyscanner );
+
+				yy_cp = yyg->yy_c_buf_p;
+				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				yyg->yy_c_buf_p =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
+
+				yy_current_state = yy_get_previous_state( yyscanner );
+
+				yy_cp = yyg->yy_c_buf_p;
+				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+} /* end of xlu__disk_yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	register char *source = yyg->yytext_ptr;
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
+
+	else
+		{
+			int num_to_read =
+			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+
+			YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+			yyg->yy_n_chars, (size_t) num_to_read );
+
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+		}
+
+	if ( yyg->yy_n_chars == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			xlu__disk_yyrestart(yyin  ,yyscanner);
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) xlu__disk_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+	}
+
+	yyg->yy_n_chars += number_to_move;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+	yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+	return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	yy_current_state = yyg->yy_start;
+
+	yyg->yy_state_ptr = yyg->yy_state_buf;
+	*yyg->yy_state_ptr++ = yy_current_state;
+
+	for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 249 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		*yyg->yy_state_ptr++ = yy_current_state;
+		}
+
+	return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
+{
+	register int yy_is_jam;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
+
+	register YY_CHAR yy_c = 1;
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 249 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 248);
+	if ( ! yy_is_jam )
+		*yyg->yy_state_ptr++ = yy_current_state;
+
+	return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+    static int yyinput (yyscan_t yyscanner)
+#else
+    static int input  (yyscan_t yyscanner)
+#endif
+
+{
+	int c;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	*yyg->yy_c_buf_p = yyg->yy_hold_char;
+
+	if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+			/* This was really a NUL. */
+			*yyg->yy_c_buf_p = '\0';
+
+		else
+			{ /* need more input */
+			int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+			++yyg->yy_c_buf_p;
+
+			switch ( yy_get_next_buffer( yyscanner ) )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					xlu__disk_yyrestart(yyin ,yyscanner);
+
+					/*FALLTHROUGH*/
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( xlu__disk_yywrap(yyscanner ) )
+						return EOF;
+
+					if ( ! yyg->yy_did_buffer_switch_on_eof )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput(yyscanner);
+#else
+					return input(yyscanner);
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) yyg->yy_c_buf_p;	/* cast for 8-bit char's */
+	*yyg->yy_c_buf_p = '\0';	/* preserve yytext */
+	yyg->yy_hold_char = *++yyg->yy_c_buf_p;
+
+	return c;
+}
+#endif	/* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * @param yyscanner The scanner object.
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+    void xlu__disk_yyrestart  (FILE * input_file , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	if ( ! YY_CURRENT_BUFFER ){
+        xlu__disk_yyensure_buffer_stack (yyscanner);
+		YY_CURRENT_BUFFER_LVALUE =
+            xlu__disk_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+	}
+
+	xlu__disk_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
+	xlu__disk_yy_load_buffer_state(yyscanner );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * @param yyscanner The scanner object.
+ */
+    void xlu__disk_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	/* TODO. We should be able to replace this entire function body
+	 * with
+	 *		xlu__disk_yypop_buffer_state();
+	 *		xlu__disk_yypush_buffer_state(new_buffer);
+     */
+	xlu__disk_yyensure_buffer_stack (yyscanner);
+	if ( YY_CURRENT_BUFFER == new_buffer )
+		return;
+
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*yyg->yy_c_buf_p = yyg->yy_hold_char;
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+		}
+
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+	xlu__disk_yy_load_buffer_state(yyscanner );
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (xlu__disk_yywrap()) processing, but the only time this flag
+	 * is looked at is after xlu__disk_yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	yyg->yy_did_buffer_switch_on_eof = 1;
+}
+
+static void xlu__disk_yy_load_buffer_state  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+	yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+	yyg->yy_hold_char = *yyg->yy_c_buf_p;
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * @param yyscanner The scanner object.
+ * @return the allocated buffer state.
+ */
+    YY_BUFFER_STATE xlu__disk_yy_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
+{
+	YY_BUFFER_STATE b;
+    
+	b = (YY_BUFFER_STATE) xlu__disk_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) xlu__disk_yyalloc(b->yy_buf_size + 2 ,yyscanner );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	xlu__disk_yy_init_buffer(b,file ,yyscanner);
+
+	return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with xlu__disk_yy_create_buffer()
+ * @param yyscanner The scanner object.
+ */
+    void xlu__disk_yy_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	if ( ! b )
+		return;
+
+	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		xlu__disk_yyfree((void *) b->yy_ch_buf ,yyscanner );
+
+	xlu__disk_yyfree((void *) b ,yyscanner );
+}
+
+#ifndef __cplusplus
+extern int isatty (int );
+#endif /* __cplusplus */
+    
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a xlu__disk_yyrestart() or at EOF.
+ */
+    static void xlu__disk_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
+
+{
+	int oerrno = errno;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	xlu__disk_yy_flush_buffer(b ,yyscanner);
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then xlu__disk_yy_init_buffer was _probably_
+     * called from xlu__disk_yyrestart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+    
+	errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * @param yyscanner The scanner object.
+ */
+    void xlu__disk_yy_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == YY_CURRENT_BUFFER )
+		xlu__disk_yy_load_buffer_state(yyscanner );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  @param yyscanner The scanner object.
+ */
+void xlu__disk_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	if (new_buffer == NULL)
+		return;
+
+	xlu__disk_yyensure_buffer_stack(yyscanner);
+
+	/* This block is copied from xlu__disk_yy_switch_to_buffer. */
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*yyg->yy_c_buf_p = yyg->yy_hold_char;
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
+		}
+
+	/* Only push if top exists. Otherwise, replace top. */
+	if (YY_CURRENT_BUFFER)
+		yyg->yy_buffer_stack_top++;
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+	/* copied from xlu__disk_yy_switch_to_buffer. */
+	xlu__disk_yy_load_buffer_state(yyscanner );
+	yyg->yy_did_buffer_switch_on_eof = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  @param yyscanner The scanner object.
+ */
+void xlu__disk_yypop_buffer_state (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+	if (!YY_CURRENT_BUFFER)
+		return;
+
+	xlu__disk_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
+	YY_CURRENT_BUFFER_LVALUE = NULL;
+	if (yyg->yy_buffer_stack_top > 0)
+		--yyg->yy_buffer_stack_top;
+
+	if (YY_CURRENT_BUFFER) {
+		xlu__disk_yy_load_buffer_state(yyscanner );
+		yyg->yy_did_buffer_switch_on_eof = 1;
+	}
+}
+
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+static void xlu__disk_yyensure_buffer_stack (yyscan_t yyscanner)
+{
+	int num_to_alloc;
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+	if (!yyg->yy_buffer_stack) {
+
+		/* First allocation is just for 2 elements, since we don't know if this
+		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
+		 * immediate realloc on the next call.
+         */
+		num_to_alloc = 1;
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)xlu__disk_yyalloc
+								(num_to_alloc * sizeof(struct yy_buffer_state*)
+								, yyscanner);
+		if ( ! yyg->yy_buffer_stack )
+			YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yyensure_buffer_stack()" );
+								  
+		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+				
+		yyg->yy_buffer_stack_max = num_to_alloc;
+		yyg->yy_buffer_stack_top = 0;
+		return;
+	}
+
+	if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
+
+		/* Increase the buffer to prepare for a possible push. */
+		int grow_size = 8 /* arbitrary grow size */;
+
+		num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
+		yyg->yy_buffer_stack = (struct yy_buffer_state**)xlu__disk_yyrealloc
+								(yyg->yy_buffer_stack,
+								num_to_alloc * sizeof(struct yy_buffer_state*)
+								, yyscanner);
+		if ( ! yyg->yy_buffer_stack )
+			YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yyensure_buffer_stack()" );
+
+		/* zero only the new slots.*/
+		memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
+		yyg->yy_buffer_stack_max = num_to_alloc;
+	}
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object. 
+ */
+YY_BUFFER_STATE xlu__disk_yy_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
+{
+	YY_BUFFER_STATE b;
+    
+	if ( size < 2 ||
+	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
+	     base[size-1] != YY_END_OF_BUFFER_CHAR )
+		/* They forgot to leave room for the EOB's. */
+		return 0;
+
+	b = (YY_BUFFER_STATE) xlu__disk_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yy_scan_buffer()" );
+
+	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_pos = b->yy_ch_buf = base;
+	b->yy_is_our_buffer = 0;
+	b->yy_input_file = 0;
+	b->yy_n_chars = b->yy_buf_size;
+	b->yy_is_interactive = 0;
+	b->yy_at_bol = 1;
+	b->yy_fill_buffer = 0;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	xlu__disk_yy_switch_to_buffer(b ,yyscanner );
+
+	return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to xlu__disk_yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ *       xlu__disk_yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE xlu__disk_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
+{
+    
+	return xlu__disk_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to xlu__disk_yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yyscanner The scanner object.
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE xlu__disk_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
+{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+    
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = _yybytes_len + 2;
+	buf = (char *) xlu__disk_yyalloc(n ,yyscanner );
+	if ( ! buf )
+		YY_FATAL_ERROR( "out of dynamic memory in xlu__disk_yy_scan_bytes()" );
+
+	for ( i = 0; i < _yybytes_len; ++i )
+		buf[i] = yybytes[i];
+
+	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+	b = xlu__disk_yy_scan_buffer(buf,n ,yyscanner);
+	if ( ! b )
+		YY_FATAL_ERROR( "bad buffer in xlu__disk_yy_scan_bytes()" );
+
+	/* It's okay to grow etc. this buffer, and we should throw it
+	 * away when we're done.
+	 */
+	b->yy_is_our_buffer = 1;
+
+	return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
+{
+    	(void) fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		yytext[yyleng] = yyg->yy_hold_char; \
+		yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
+		yyg->yy_hold_char = *yyg->yy_c_buf_p; \
+		*yyg->yy_c_buf_p = '\0'; \
+		yyleng = yyless_macro_arg; \
+		} \
+	while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/** Get the user-defined data for this scanner.
+ * @param yyscanner The scanner object.
+ */
+YY_EXTRA_TYPE xlu__disk_yyget_extra  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yyextra;
+}
+
+/** Get the current line number.
+ * @param yyscanner The scanner object.
+ */
+int xlu__disk_yyget_lineno  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    
+        if (! YY_CURRENT_BUFFER)
+            return 0;
+    
+    return yylineno;
+}
+
+/** Get the current column number.
+ * @param yyscanner The scanner object.
+ */
+int xlu__disk_yyget_column  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    
+        if (! YY_CURRENT_BUFFER)
+            return 0;
+    
+    return yycolumn;
+}
+
+/** Get the input stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *xlu__disk_yyget_in  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yyin;
+}
+
+/** Get the output stream.
+ * @param yyscanner The scanner object.
+ */
+FILE *xlu__disk_yyget_out  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yyout;
+}
+
+/** Get the length of the current token.
+ * @param yyscanner The scanner object.
+ */
+int xlu__disk_yyget_leng  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yyleng;
+}
+
+/** Get the current token.
+ * @param yyscanner The scanner object.
+ */
+
+char *xlu__disk_yyget_text  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yytext;
+}
+
+/** Set the user-defined data. This data is never touched by the scanner.
+ * @param user_defined The data to be associated with this scanner.
+ * @param yyscanner The scanner object.
+ */
+void xlu__disk_yyset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yyextra = user_defined ;
+}
+
+/** Set the current line number.
+ * @param line_number
+ * @param yyscanner The scanner object.
+ */
+void xlu__disk_yyset_lineno (int  line_number , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+        /* lineno is only valid if an input buffer exists. */
+        if (! YY_CURRENT_BUFFER )
+           yy_fatal_error( "xlu__disk_yyset_lineno called with no buffer" , yyscanner); 
+    
+    yylineno = line_number;
+}
+
+/** Set the current column.
+ * @param line_number
+ * @param yyscanner The scanner object.
+ */
+void xlu__disk_yyset_column (int  column_no , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+        /* column is only valid if an input buffer exists. */
+        if (! YY_CURRENT_BUFFER )
+           yy_fatal_error( "xlu__disk_yyset_column called with no buffer" , yyscanner); 
+    
+    yycolumn = column_no;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ * @param yyscanner The scanner object.
+ * @see xlu__disk_yy_switch_to_buffer
+ */
+void xlu__disk_yyset_in (FILE *  in_str , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yyin = in_str ;
+}
+
+void xlu__disk_yyset_out (FILE *  out_str , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yyout = out_str ;
+}
+
+int xlu__disk_yyget_debug  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    return yy_flex_debug;
+}
+
+void xlu__disk_yyset_debug (int  bdebug , yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    yy_flex_debug = bdebug ;
+}
+
+/* Accessor methods for yylval and yylloc */
+
+/* User-visible API */
+
+/* xlu__disk_yylex_init is special because it creates the scanner itself, so it is
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
+ * That's why we explicitly handle the declaration, instead of using our macros.
+ */
+
+int xlu__disk_yylex_init(yyscan_t* ptr_yy_globals)
+
+{
+    if (ptr_yy_globals == NULL){
+        errno = EINVAL;
+        return 1;
+    }
+
+    *ptr_yy_globals = (yyscan_t) xlu__disk_yyalloc ( sizeof( struct yyguts_t ), NULL );
+
+    if (*ptr_yy_globals == NULL){
+        errno = ENOMEM;
+        return 1;
+    }
+
+    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+    return yy_init_globals ( *ptr_yy_globals );
+}
+
+/* xlu__disk_yylex_init_extra has the same functionality as xlu__disk_yylex_init, but follows the
+ * convention of taking the scanner as the last argument. Note however, that
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
+ * is the reason, too, why this function also must handle its own declaration).
+ * The user defined value in the first argument will be available to xlu__disk_yyalloc in
+ * the yyextra field.
+ */
+
+int xlu__disk_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
+
+{
+    struct yyguts_t dummy_yyguts;
+
+    xlu__disk_yyset_extra (yy_user_defined, &dummy_yyguts);
+
+    if (ptr_yy_globals == NULL){
+        errno = EINVAL;
+        return 1;
+    }
+	
+    *ptr_yy_globals = (yyscan_t) xlu__disk_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+	
+    if (*ptr_yy_globals == NULL){
+        errno = ENOMEM;
+        return 1;
+    }
+    
+    /* By setting to 0xAA, we expose bugs in
+    yy_init_globals. Leave at 0x00 for releases. */
+    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+    
+    xlu__disk_yyset_extra (yy_user_defined, *ptr_yy_globals);
+    
+    return yy_init_globals ( *ptr_yy_globals );
+}
+
+static int yy_init_globals (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+    /* Initialization is the same as for the non-reentrant scanner.
+     * This function is called from xlu__disk_yylex_destroy(), so don't allocate here.
+     */
+
+    yyg->yy_buffer_stack = 0;
+    yyg->yy_buffer_stack_top = 0;
+    yyg->yy_buffer_stack_max = 0;
+    yyg->yy_c_buf_p = (char *) 0;
+    yyg->yy_init = 0;
+    yyg->yy_start = 0;
+
+    yyg->yy_start_stack_ptr = 0;
+    yyg->yy_start_stack_depth = 0;
+    yyg->yy_start_stack =  NULL;
+
+    yyg->yy_state_buf = 0;
+    yyg->yy_state_ptr = 0;
+    yyg->yy_full_match = 0;
+    yyg->yy_lp = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+    yyin = stdin;
+    yyout = stdout;
+#else
+    yyin = (FILE *) 0;
+    yyout = (FILE *) 0;
+#endif
+
+    /* For future reference: Set errno on error, since we are called by
+     * xlu__disk_yylex_init()
+     */
+    return 0;
+}
+
+/* xlu__disk_yylex_destroy is for both reentrant and non-reentrant scanners. */
+int xlu__disk_yylex_destroy  (yyscan_t yyscanner)
+{
+    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+    /* Pop the buffer stack, destroying each element. */
+	while(YY_CURRENT_BUFFER){
+		xlu__disk_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+		YY_CURRENT_BUFFER_LVALUE = NULL;
+		xlu__disk_yypop_buffer_state(yyscanner);
+	}
+
+	/* Destroy the stack itself. */
+	xlu__disk_yyfree(yyg->yy_buffer_stack ,yyscanner);
+	yyg->yy_buffer_stack = NULL;
+
+    /* Destroy the start condition stack. */
+        xlu__disk_yyfree(yyg->yy_start_stack ,yyscanner );
+        yyg->yy_start_stack = NULL;
+
+    xlu__disk_yyfree ( yyg->yy_state_buf , yyscanner);
+    yyg->yy_state_buf  = NULL;
+
+    /* Reset the globals. This is important in a non-reentrant scanner so the next time
+     * xlu__disk_yylex() is called, initialization will occur. */
+    yy_init_globals( yyscanner);
+
+    /* Destroy the main struct (reentrant only). */
+    xlu__disk_yyfree ( yyscanner , yyscanner );
+    yyscanner = NULL;
+    return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
+{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
+{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+void *xlu__disk_yyalloc (yy_size_t  size , yyscan_t yyscanner)
+{
+	return (void *) malloc( size );
+}
+
+void *xlu__disk_yyrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
+{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+}
+
+void xlu__disk_yyfree (void * ptr , yyscan_t yyscanner)
+{
+	free( (char *) ptr );	/* see xlu__disk_yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 210 "libxlu_disk_l.l"
diff --git a/tools/libxl/libxlu_disk_l.h b/tools/libxl/libxlu_disk_l.h
new file mode 100644
index 0000000..bc3d9ff
--- /dev/null
+++ b/tools/libxl/libxlu_disk_l.h
@@ -0,0 +1,346 @@
+#ifndef xlu__disk_yyHEADER_H
+#define xlu__disk_yyHEADER_H 1
+#define xlu__disk_yyIN_HEADER 1
+
+#line 6 "libxlu_disk_l.h"
+
+#line 8 "libxlu_disk_l.h"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif	/* defined (__STDC__) */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* An opaque pointer. */
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+
+/* For convenience, these vars (plus the bison vars far below)
+   are macros in the reentrant scanner. */
+#define yyin yyg->yyin_r
+#define yyout yyg->yyout_r
+#define yyextra yyg->yyextra_r
+#define yyleng yyg->yyleng_r
+#define yytext yyg->yytext_r
+#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
+#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
+#define yy_flex_debug yyg->yy_flex_debug_r
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#endif
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+	FILE *yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+void xlu__disk_yyrestart (FILE *input_file ,yyscan_t yyscanner );
+void xlu__disk_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+YY_BUFFER_STATE xlu__disk_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
+void xlu__disk_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void xlu__disk_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
+void xlu__disk_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
+void xlu__disk_yypop_buffer_state (yyscan_t yyscanner );
+
+YY_BUFFER_STATE xlu__disk_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
+YY_BUFFER_STATE xlu__disk_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
+YY_BUFFER_STATE xlu__disk_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
+
+void *xlu__disk_yyalloc (yy_size_t ,yyscan_t yyscanner );
+void *xlu__disk_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
+void xlu__disk_yyfree (void * ,yyscan_t yyscanner );
+
+#define xlu__disk_yywrap(n) 1
+#define YY_SKIP_YYWRAP
+
+#define yytext_ptr yytext_r
+
+#ifdef YY_HEADER_EXPORT_START_CONDITIONS
+#define INITIAL 0
+
+#endif
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+int xlu__disk_yylex_init (yyscan_t* scanner);
+
+int xlu__disk_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int xlu__disk_yylex_destroy (yyscan_t yyscanner );
+
+int xlu__disk_yyget_debug (yyscan_t yyscanner );
+
+void xlu__disk_yyset_debug (int debug_flag ,yyscan_t yyscanner );
+
+YY_EXTRA_TYPE xlu__disk_yyget_extra (yyscan_t yyscanner );
+
+void xlu__disk_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+
+FILE *xlu__disk_yyget_in (yyscan_t yyscanner );
+
+void xlu__disk_yyset_in  (FILE * in_str ,yyscan_t yyscanner );
+
+FILE *xlu__disk_yyget_out (yyscan_t yyscanner );
+
+void xlu__disk_yyset_out  (FILE * out_str ,yyscan_t yyscanner );
+
+int xlu__disk_yyget_leng (yyscan_t yyscanner );
+
+char *xlu__disk_yyget_text (yyscan_t yyscanner );
+
+int xlu__disk_yyget_lineno (yyscan_t yyscanner );
+
+void xlu__disk_yyset_lineno (int line_number ,yyscan_t yyscanner );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int xlu__disk_yywrap (yyscan_t yyscanner );
+#else
+extern int xlu__disk_yywrap (yyscan_t yyscanner );
+#endif
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+#endif
+
+#ifndef YY_NO_INPUT
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int xlu__disk_yylex (yyscan_t yyscanner);
+
+#define YY_DECL int xlu__disk_yylex (yyscan_t yyscanner)
+#endif /* !YY_DECL */
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+#undef YY_NEW_FILE
+#undef YY_FLUSH_BUFFER
+#undef yy_set_bol
+#undef yy_new_buffer
+#undef yy_set_interactive
+#undef YY_DO_BEFORE_ACTION
+
+#ifdef YY_DECL_IS_OURS
+#undef YY_DECL_IS_OURS
+#undef YY_DECL
+#endif
+
+#line 210 "libxlu_disk_l.l"
+
+#line 345 "libxlu_disk_l.h"
+#undef xlu__disk_yyIN_HEADER
+#endif /* xlu__disk_yyHEADER_H */
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax
  2011-05-12 14:36                 ` [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output Ian Jackson
@ 2011-05-12 14:36                   ` Ian Jackson
  2011-05-12 14:36                     ` [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse Ian Jackson
  2011-05-13 12:45                     ` [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax Ian Campbell
  2011-05-13 10:49                   ` [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output Ian Campbell
  1 sibling, 2 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

---
 docs/misc/xl-disk-configuration.txt |  221 +++++++++++++++++++---------------
 1 files changed, 123 insertions(+), 98 deletions(-)

diff --git a/docs/misc/xl-disk-configuration.txt b/docs/misc/xl-disk-configuration.txt
index 58332a9..90ba54e 100644
--- a/docs/misc/xl-disk-configuration.txt
+++ b/docs/misc/xl-disk-configuration.txt
@@ -1,57 +1,99 @@
+                     ---------------------
+                     XL DISK CONFIGURATION
+                     ---------------------
 
+This document specifies the xl config file format disk configuration
+option.  It the following form:
 
-                         ----------------------------
-                         xl Disk Configuration Option
-                         ----------------------------
+    disk = [ '<diskspec>', '<diskspec>', ... ]
 
-This document provides a brief description of xl disk configuration
-option, different attributes that can be passed through it and the
-format in which they need to be specified.
+where each diskspec is in this form:
+    
+   [<key>=<value>|flag]*,
+     [<target>, [<format>, [<vdev>, [<access>]]]],
+     [<key>=<value>]*,
+     [target=<target>]
 
-At a higher level, xl disk configuration option takes the following
-format:
 
-    disk = [ '[format:][path],vdev[:type],attrib',
-             '[format:][path],vdev[:type],attrib', ... ]
+For example, these strings are equivalent:
 
-Not all attributes are required (the attributes enclosed within square
-brackets above are optional) and some are deprecated.  Following is a
-brief description of each of the attribute along with information on
-whether or not they are mandatory.
+  /dev/vg/guest-volume,,hda
+  /dev/vg/guest-volume,raw,hda,rw
+  format=raw, vdev=xvda, access=rw, target=/dev/vg/guest-volume
+  raw:/dev/vg/guest-volume,hda,w   (deprecated, see below)
 
+As are these:
 
-------------------
-Attribute Details
-------------------
+  /root/image.iso,,hdc,cdrom
+  /root/image.iso,,hdc,,cdrom
+  /root/image.iso,raw,hdc,devtype=cdrom
+  format=raw, vdev=hdc, access=ro, devtype=cdrom, target=/root/image.iso
+  raw:/root/image.iso,hdc:cdrom,ro   (deprecated, see below)
 
+These might be specified in the domain config file like this:
 
-format:
-------
+  disk = [ '/dev/vg/guest-volume,,hda', '/root/image.iso,,hdc,cdrom' ]
 
-Description:           Specifies the format of image file.
-Supported values:      raw, qcow, qcow2, vhd
-Deprecated values:     None
-Mandatory:             No.  When not specified raw format is assumed.
-                       For a physical block device the format must be
-                       raw and need not be explicitly specified.  For
-                       an image file the format could be one of the
-                       supported values and when not specified assumed
-                       to be raw.
-path:
-----
 
-Description:           Block  device or image file path.  For a
-                       physical block device a /dev  will be prepended
+More formally, the string is a series of comma-separated keyword/value
+pairs, flags and positional parameters.  Parameters which are not bare
+keywords and which do not contain "=" symbols are assigned to the
+so-far-unspecified positional parameters, in the order below.  The
+positional parameters may also be specified explicitly by name.
+
+Each parameter may be specified at most once, either as a positional
+parameter or a named parameter.  Default values apply if the parameter
+is not specified, or if it is specified with an empty value (whether
+positionally or explicitly).
+
+Whitespace may appear before each parameter and will be ignored.
+
+
+=====================
+POSITIONAL PARAMETERS
+=====================
+
+target
+------
+
+Description:           Block device or image file path.  For a
+                       physical block device a /dev will be prepended
                        when not specified and when the path doesn't
-                       start  with a '/'.
+                       start with a '/'.
 Supported values:      N/A
 Deprecated values:     N/A
-Mandatory:             No.  While a path is provided in most cases
-                       there is an exception.  For a cdrom device, lack
+Default value:         None.  While a path is provided in most cases
+                       there is an exception: for a cdrom device, lack
                        of this attribute would imply an empty cdrom
                        drive.
 
-vdev:
+Special syntax:
+
+   When this parameter is specified by name, ie with the "target="
+   syntax in the configuration file, it consumes the whole rest of the
+   <diskspec>.  Therefore in that case it must come last.  This is
+   permissible even if an empty value for the target was already
+   specifed as a positional parameter.  This is the only way to
+   specify a target string containing metacharacters such as commas
+   and (in some cases) colons, which would otherwise be
+   misinterpreted.
+
+   Future parameter and flag names will start with an ascii letter and
+   contain only ascii alphanumerics, hyphens and underscores, and will
+   not be legal as vdevs.  Targets which might match that syntax
+   should not be specified as positional parameters.
+
+
+format
+------
+
+Description:           Specifies the format of image file.
+Supported values:      raw, qcow, qcow2, vhd
+Deprecated values:     None
+Default value:         raw
+
+
+vdev
 ----
 
 Description:           Virtual device as seen by the guest (also
@@ -60,95 +102,78 @@ Description:           Virtual device as seen by the guest (also
 Supported values:      hd[x], xvd[x], sd[x] etc.  Please refer to the
                        above specification for further details.
 Deprecated values:     None
-Mandatory:             Yes
+Default Value:         None, this parameter is mandatory.
 
-type:
-----
 
-Description:           Qualifies virtual device type.
-Supported values:      cdrom
-Deprecated values:     None
-Mandatory:             No
-
-attrib:
-------
+access
+-------
 
 Description:           Specified access control information.  Whether
                        or not the block device is provided to the
                        guest in read-only or read-write mode depends
                        on this attribute.
-Supported values:      'r', 'w'
+Supported values:      ro, r   (specifies read-only)
+                       rw, w   (specifies read/write)
 Deprecated values:     None
-Mandatory:             Yes
+Default value:         rw
+                       unless devtype=cdrom, in which case r
 
 
---------------
-Example usages
---------------
 
-disk = [ 'vhd:/path/to/dev,hda,w', '/path/to/iso,hdc:cdrom,r' ]
-disk = [ 'path/to/phy/dev,hda,w', '/dev/cdrom,hdc:cdrom,r' ]
-disk = [ 'qcow:/path/to/file,hda,w' ]
-disk = [ 'qcow2:/path/to/file,hda,w', 'raw:/path/to/dev,hdc:cdrom,r' ]
+==========================
+OTHER PARAMETERS AND FLAGS
+==========================
 
 
--------------------------
-Miscellaneous Information
--------------------------
+devtype=<devtype>
+-----------------
 
----------------------
-Deprecated Attributes
----------------------
+Description:           Qualifies virtual device type.
+Supported values:      cdrom
+Deprecated values:     None
+Mandatory:             No
 
-Deprecated values are acceptable and will work the way they did
-earlier except with a warning message printed to the xl log or screen.
-However it's usage is supported purely for backward compatibility
-purpose and not recommended. Also, support for these deprecated
-attributes are likely to be dropped in future versions of xl.
 
-The block-dev-type and access-type deprecated attributes described
-below are prepended to the format attribute.  Example - tap:aio:qcow
-Further details on the deprecated attributes are below:
+cdrom
+-----
 
-block-dev-type:
---------------
+Convenience alias for "devtype=cdrom".
 
-Description:           Specifies the block device type.
-Supported values:      phy,file, tap, tap2
 
-access-type:
------------
+script=<script>
+---------------
+
+Specifies that <target> is not a normal host path, but rather
+information to be interpreted by /etc/xen/scripts/block-<script>.
 
-Description:           Backend implementation option to choose from
-                       while accessing block device.
-                       Example: tap:aio:vhd:/path/to/file
-Supported values:      'aio', 'tapdisk', 'ioemu'
 
----------------------
-Impementation Details
----------------------
 
-Backend Details:
----------------
+==================================
+DEPRECATED PARAMETERS AND PREFIXES
+==================================
 
-For 'phy' block device type, blkback is always used as the backend.
-When the running dom0 instance does not support blkback, block device
-access will fail.  For block device type 'file' with format raw or
-when no format specfied, tapdisk2 is used when present otherwise qemu
-fallback option is used.  For 'file', 'tap' or 'tap2' block device
-type with format 'vhd', only tapdisk2 is used as qemu does not support
-vhd format.  Absence of tapdisk2 support in this case will result in
-failure.  When it comes to image format and how that affects the
-backend choice, for qcow/qcow2 qemu backend is used as tapdisk2 does
-not work with these formats. For raw format image file, tapdisk2 is
-used and when not available qemu backend is used as fallback.  For vhd
-format, as mentioned earlier tapdisk2 is used and tapdisk2
-unavailability will result in failure as qemu fallback option does not
-support vhd file format.
+Deprecated values are acceptable and are intended work compatibly with
+xend and xl from xen 4.1.  In future they may print a warning.
+Support for deprecated parameters and syntaxes are likely to be
+dropped in future versions of xl.
 
+There is also support for a deprecated old syntax for <diskspec>:
 
+  [<format>:][<target>],<vdev>[:<devtype>],<access>   (deprecated)
 
+This syntax also supports deprecated prefixes, described below.  These
+are found prepended to the format parameter - eg "tap:aio:qcow:".
 
+<block-dev-type>:
+-----------------
 
+Description:           Specifies the block device type.
+Supported values:      phy,file, tap, tap2
 
+<access-type>:
+--------------
 
+Description:           Backend implementation option to choose from
+                       while accessing block device.
+                       Example: tap:aio:vhd:/path/to/file
+Supported values:      'aio', 'tapdisk', 'ioemu'
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse
  2011-05-12 14:36                   ` [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax Ian Jackson
@ 2011-05-12 14:36                     ` Ian Jackson
  2011-05-12 14:36                       ` [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk Ian Jackson
  2011-05-13 12:49                       ` [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse Ian Campbell
  2011-05-13 12:45                     ` [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax Ian Campbell
  1 sibling, 2 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Jackson

From: Ian Jackson <ijackson@chiark.greenend.org.uk>

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/xl_cmdimpl.c |  163 ++++++---------------------------------------
 1 files changed, 22 insertions(+), 141 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 97a1241..b083e4d 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -469,148 +469,31 @@ static int parse_action_on_shutdown(const char *buf, libxl_action_on_shutdown *a
 #define DSTATE_RW        5
 #define DSTATE_TERMINAL  6
 
-static int parse_disk_config(libxl_device_disk *disk, char *buf2)
+static void parse_disk_config_multistring(XLU_Config **config,
+                                          int nspecs, const char *const *specs,
+                                          libxl_device_disk *disk)
 {
-    int state = DSTATE_INITIAL;
-    char *p, *end, *tok;
+    int e;
 
     memset(disk, 0, sizeof(*disk));
 
-    for(tok = p = buf2, end = buf2 + strlen(buf2) + 1; p < end; p++) {
-        switch(state){
-        case DSTATE_INITIAL:
-            if ( *p == ':' ) {
-                *p = '\0';
-                if ( !strcmp(tok, "phy") ) {
-                    state = DSTATE_PHYSPATH;
-                    disk->format = LIBXL_DISK_FORMAT_RAW;
-                    disk->backend = LIBXL_DISK_BACKEND_PHY;
-                }else if ( !strcmp(tok, "file") ) {
-                    state = DSTATE_PHYSPATH;
-                    disk->format = LIBXL_DISK_FORMAT_RAW;
-                    disk->backend = LIBXL_DISK_BACKEND_TAP;
-                }else if ((!strcmp(tok, "tap")) ||
-                          (!strcmp(tok, "tap2"))) {
-                    state = DSTATE_TAP;
-                }else{
-                    fprintf(stderr, "Unknown disk type: %s\n", tok);
-                    return 0;
-                }
-                tok = p + 1;
-            } else if (*p == ',') {
-                state = DSTATE_VIRTPATH;
-                disk->format = LIBXL_DISK_FORMAT_EMPTY;
-                disk->backend = LIBXL_DISK_BACKEND_TAP;
-                disk->pdev_path = strdup("");
-                tok = p + 1;
-            }
-            break;
-        case DSTATE_TAP:
-            if (*p == ',') {
-                disk->format = LIBXL_DISK_FORMAT_RAW;
-                disk->backend = LIBXL_DISK_BACKEND_TAP;
-                state = DSTATE_PHYSPATH;
-            } else if ( *p == ':' ) {
-                *p = '\0';
-                if (!strcmp(tok, "aio")) {
-                    tok = p + 1;
-                    break;
-                }
-                if (!strcmp(tok, "vhd")) {
-                    disk->format = LIBXL_DISK_FORMAT_VHD;
-                    disk->backend = LIBXL_DISK_BACKEND_TAP;
-                }else if ( !strcmp(tok, "qcow") ) {
-                    disk->format = LIBXL_DISK_FORMAT_QCOW;
-                    disk->backend = LIBXL_DISK_BACKEND_QDISK;
-                }else if ( !strcmp(tok, "qcow2") ) {
-                    disk->format = LIBXL_DISK_FORMAT_QCOW2;
-                    disk->backend = LIBXL_DISK_BACKEND_QDISK;
-                }else if (!strcmp(tok, "raw")) {
-                    disk->format = LIBXL_DISK_FORMAT_RAW;
-                    disk->backend = LIBXL_DISK_BACKEND_TAP;
-                }
-                else {
-                    fprintf(stderr, "Unknown tapdisk type: %s\n", tok);
-                    return 0;
-                }
-
-                tok = p + 1;
-                state = DSTATE_PHYSPATH;
-                break;
-            } else {
-                break;
-            }
-        case DSTATE_PHYSPATH:
-            if ( *p == ',' ) {
-                int ioemu_len;
-
-                *p = '\0';
-                disk->pdev_path = (*tok) ? strdup(tok) : NULL;
-                tok = p + 1;
-
-                /* hack for ioemu disk spec */
-                ioemu_len = strlen("ioemu:");
-                state = DSTATE_VIRTPATH;
-                if ( tok + ioemu_len < end &&
-                    !strncmp(tok, "ioemu:", ioemu_len)) {
-                    tok += ioemu_len;
-                    p += ioemu_len;
-                }
-            }
-            break;
-        case DSTATE_VIRTPATH:
-            if ( *p == ',' || *p == ':' || *p == '\0' ) {
-                switch(*p) {
-                case ':':
-                    state = DSTATE_VIRTTYPE;
-                    break;
-                case ',':
-                    state = DSTATE_RW;
-                    break;
-                case '\0':
-                    state = DSTATE_TERMINAL;
-                    break;
-                }
-                if ( tok == p )
-                    goto out;
-                *p = '\0';
-                disk->vdev = (*tok) ? strdup(tok) : NULL;
-                tok = p + 1;
-            }
-            break;
-        case DSTATE_VIRTTYPE:
-            if ( *p == ',' || *p == '\0' ) {
-                *p = '\0';
-                if ( !strcmp(tok, "cdrom") ) {
-                    disk->is_cdrom = 1;
-                    disk->removable = 1;
-                }else{
-                    fprintf(stderr, "Unknown virtual disk type: %s\n", tok);
-                    return 0;
-                }
-                tok = p + 1;
-                state = (*p == ',') ? DSTATE_RW : DSTATE_TERMINAL;
-            }
-            break;
-        case DSTATE_RW:
-            if ( *p == '\0' ) {
-                disk->readwrite = (tok[0] == 'w');
-                tok = p + 1;
-                state = DSTATE_TERMINAL;
-            }
-            break;
-        case DSTATE_TERMINAL:
-            goto out;
-        }
+    if (!*config) {
+	*config = xlu_cfg_init(stderr, "command line");
+	if (!*config) { perror("xlu_cfg_init"); exit(-1); }
     }
 
-out:
-    if ( tok != p || state != DSTATE_TERMINAL ) {
-        fprintf(stderr, "parse error in disk config near '%s'\n", tok);
-        return 0;
+    e = xlu_disk_parse(*config, nspecs, specs, disk);
+    if (e == EINVAL) exit(-1);
+    if (e) {
+	fprintf(stderr,"xlu_disk_parse failed: %s\n",strerror(errno));
+	exit(-1);
     }
+}
 
-    return 1;
+static void parse_disk_config(XLU_Config **config, const char *spec,
+                              libxl_device_disk *disk)
+{
+    parse_disk_config_multistring(config, 1,&spec, disk);
 }
 
 static void parse_config_data(const char *configfile_filename_report,
@@ -814,9 +697,7 @@ static void parse_config_data(const char *configfile_filename_report,
 
             d_config->disks = (libxl_device_disk *) realloc(d_config->disks, sizeof (libxl_device_disk) * (d_config->num_disks + 1));
             disk = d_config->disks + d_config->num_disks;
-            if ( !parse_disk_config(disk, buf2) ) {
-                exit(1);
-            }
+            parse_disk_config(&config, buf2, disk);
 
             free(buf2);
             d_config->num_disks++;
@@ -1870,6 +1751,7 @@ static void cd_insert(const char *dom, const char *virtdev, char *phys)
 {
     libxl_device_disk disk; /* we don't free disk's contents */
     char *buf = NULL;
+    XLU_Config *config = 0;
 
     find_domain(dom);
 
@@ -1877,10 +1759,9 @@ static void cd_insert(const char *dom, const char *virtdev, char *phys)
         fprintf(stderr, "out of memory\n");
         return;
     }
-    if (!parse_disk_config(&disk, buf)) {
-        fprintf(stderr, "format error\n");
-        return;
-    }
+
+    parse_disk_config(&config, buf, &disk);
+
     disk.backend_domid = 0;
 
     libxl_cdrom_insert(ctx, domid, &disk);
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk
  2011-05-12 14:36                     ` [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse Ian Jackson
@ 2011-05-12 14:36                       ` Ian Jackson
  2011-05-12 14:36                         ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Jackson
                                           ` (2 more replies)
  2011-05-13 12:49                       ` [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse Ian Campbell
  1 sibling, 3 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

From: Ian Jackson <ijackson@chiark.greenend.org.uk>

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
 tools/libxl/xl_cmdimpl.c  |   50 ++++++--------------------------------------
 tools/libxl/xl_cmdtable.c |    2 +-
 2 files changed, 8 insertions(+), 44 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index b083e4d..ccffd26 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3931,62 +3931,26 @@ int main_networkdetach(int argc, char **argv)
 int main_blockattach(int argc, char **argv)
 {
     int opt;
-    const char *tok;
     uint32_t fe_domid, be_domid = 0;
     libxl_device_disk disk = { 0 };
+    XLU_Config *config = 0;
 
     if ((opt = def_getopt(argc, argv, "", "block-attach", 2)) != -1)
         return opt;
-    if (argc-optind > 5) {
+    if ((argc-optind < 2)) {
         help("block-attach");
         return 2;
     }
 
-    tok = strtok(argv[optind+1], ":");
-    if (!strcmp(tok, "phy")) {
-        disk.backend = LIBXL_DISK_BACKEND_PHY;
-    } else if (!strcmp(tok, "file")) {
-        disk.backend = LIBXL_DISK_BACKEND_TAP;
-    } else if (!strcmp(tok, "tap")) {
-        tok = strtok(NULL, ":");
-        if (!strcmp(tok, "aio")) {
-            disk.backend = LIBXL_DISK_BACKEND_TAP;
-        } else if (!strcmp(tok, "vhd")) {
-            disk.format = LIBXL_DISK_FORMAT_VHD;
-            disk.backend = LIBXL_DISK_BACKEND_TAP;
-        } else if (!strcmp(tok, "qcow")) {
-            disk.format = LIBXL_DISK_FORMAT_QCOW;
-            disk.backend = LIBXL_DISK_BACKEND_QDISK;
-        } else if (!strcmp(tok, "qcow2")) {
-            disk.format = LIBXL_DISK_FORMAT_QCOW2;
-            disk.backend = LIBXL_DISK_BACKEND_QDISK;
-        } else {
-            fprintf(stderr, "Error: `%s' is not a valid disk image.\n", tok);
-            return 1;
-        }
-    } else {
-        fprintf(stderr, "Error: `%s' is not a valid block device.\n", tok);
-        return 1;
-    }
-    disk.pdev_path = strtok(NULL, "\0");
-    if (!disk.pdev_path) {
-        fprintf(stderr, "Error: missing path to disk image.\n");
-        return 1;
-    }
-    disk.vdev = argv[optind+2];
-    disk.removable = 1;
-    disk.readwrite = ((argc-optind <= 3) || (argv[optind+3][0] == 'w'));
-
     if (domain_qualifier_to_domid(argv[optind], &fe_domid, 0) < 0) {
         fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);
         return 1;
     }
-    if (argc-optind == 5) {
-        if (domain_qualifier_to_domid(argv[optind+4], &be_domid, 0) < 0) {
-            fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind+4]);
-            return 1;
-        }
-    }
+    optind++;
+
+    parse_disk_config_multistring
+        (&config, argc-optind, (const char* const*)argv + optind, &disk);
+
     disk.backend_domid = be_domid;
 
     if (libxl_device_disk_add(ctx, fe_domid, &disk)) {
diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
index b14fb37..b7ee0f4 100644
--- a/tools/libxl/xl_cmdtable.c
+++ b/tools/libxl/xl_cmdtable.c
@@ -256,7 +256,7 @@ struct cmd_spec cmd_table[] = {
     { "block-attach",
       &main_blockattach,
       "Create a new virtual block device",
-      "<Domain> <BackDev> <FrontDev> [<Mode>] [BackDomain]",
+      "<Domain> <disk-spec-component(s)>...",
     },
     { "block-list",
       &main_blocklist,
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk"
  2011-05-12 14:36                       ` [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk Ian Jackson
@ 2011-05-12 14:36                         ` Ian Jackson
  2011-05-12 14:36                           ` [PATCH 14/14] xl: xl block-attach -N (dry run) option Ian Jackson
  2011-05-13 12:53                           ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Campbell
  2011-05-12 14:42                         ` [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk Ian Jackson
  2011-05-13 12:50                         ` Ian Campbell
  2 siblings, 2 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Jackson

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxl/libxlu_disk_l.c |  739 +++++++++++++++++++++++--------------------
 tools/libxl/libxlu_disk_l.h |    2 +-
 tools/libxl/libxlu_disk_l.l |    9 +
 3 files changed, 403 insertions(+), 347 deletions(-)

diff --git a/tools/libxl/libxlu_disk_l.c b/tools/libxl/libxlu_disk_l.c
index 30515e9..8275850 100644
--- a/tools/libxl/libxlu_disk_l.c
+++ b/tools/libxl/libxlu_disk_l.c
@@ -356,8 +356,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
 	*yy_cp = '\0'; \
 	yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 23
-#define YY_END_OF_BUFFER 24
+#define YY_NUM_RULES 24
+#define YY_END_OF_BUFFER 25
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -365,99 +365,104 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_acclist[547] =
+static yyconst flex_int16_t yy_acclist[575] =
     {   0,
-       24,   21,   22,   23, 8193,   21,   22,   23,16385, 8193,
-       21,   23,16385,   21,   22,   23,   22,   23,   21,   22,
-       23,   21,   22,   23,   21,   22,   23,   21,   22,   23,
-       21,   22,   23,   21,   22,   23,   21,   22,   23,   21,
-       22,   23,   21,   22,   23,   21,   22,   23,   21,   22,
-       23,   21,   22,   23,   21,   22,   23,   21,   22,   23,
-       21,   22,   21,   22,   21,   22,   22, 8193,   21,   22,
-     8193,   21,   22,16385, 8193,   21,   22, 8193,   21,   22,
-     8193,   22, 8193,   21, 8193,   21,16385, 8193,   21, 8193,
-       22,   21,   22,   21,   22, 8212,   21,   22,16404,   22,
-
-       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
-       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
-       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
-       21,   22,   21,   22,   21,   21, 8193,   21,   22, 8193,
-       21,   22, 8193,   21,   22, 8193,   22, 8193, 8193,   21,
-     8193,   21, 8212,   21, 8212,   21, 8212,   11,   21,   22,
-       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
-       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
-       21,   22,   21,   22,   21,   22,   21,   22,   21,   22,
-     8212,   21, 8212,   21, 8212,   11,   21,   22,   16, 8212,
-
-       21,   22,16404,   21,   22,   21,   22,   21,   22,   21,
-       22,   21,   22,   21,   22, 8212,   21,   22,16404,   19,
-     8212,   21,   22,16404,   21,   22, 8204, 8212,   21,   22,
-    16396,16404,   21,   22,   21,   22, 8207, 8212,   21,   22,
-    16399,16404,   21,   22,   21,   22,   21,   22,   21,   22,
-       16, 8212,   21,   16, 8212,   21,   16,   21,   16, 8212,
-        3,   21,   22,   21,   22,   18, 8212,   21,   22,16404,
-       21,   22,   21,   22,   21,   22,   21,   19, 8212,   21,
-       19, 8212,   21,   19,   21,   19, 8212, 8204, 8212,   21,
-     8204, 8212,   21, 8204,   21, 8204, 8212,   21,   22, 8207,
-
-     8212,   21, 8207, 8212,   21, 8207,   21, 8207, 8212,   21,
-       22,   21,   22,    8,   22,   21,   22,   16, 8212,   21,
-       16, 8212,   21,   16, 8212,   16,   21,   16,    3,   21,
-       22,   21,   22,   18, 8212,   21,   18, 8212,   21,   18,
-       21,   18, 8212,   21,   22,   17, 8212,   21,   22,16404,
-     8205, 8212,   21,   22,16397,16404,   21,   19, 8212,   21,
-       19, 8212,   21,   19, 8212,   19,   21,   19, 8204, 8212,
-       21, 8204, 8212,   21, 8204, 8212, 8204,   21, 8204,   21,
-       22, 8207, 8212,   21, 8207, 8212,   21, 8207, 8212, 8207,
-       21, 8207,   21,   22,   21,   22,    8,   11,    8,    7,
-
-       22,   21,   22,   18, 8212,   21,   18, 8212,   21,   18,
-     8212,   18,   21,   18,    2,   22,   17, 8212,   21,   17,
-     8212,   21,   17,   21,   17, 8212, 8205, 8212,   21, 8205,
-     8212,   21, 8205,   21, 8205, 8212,   21,    9,   22,   21,
-       22,   10,   22,    8,    8,   11,    7,   11,    7,    6,
-       22,    2,   11,    2,   17, 8212,   21,   17, 8212,   21,
-       17, 8212,   17,   21,   17, 8205, 8212,   21, 8205, 8212,
-       21, 8205, 8212, 8205,   21, 8205,   21,    9,   11,    9,
-       14, 8212,   21,   22,16404,   10,   11,   10,    7,    7,
-       11,    6,   11,    6,    6,   11,    6,   11,    2,    2,
-
-       11, 8205,   21,16397,    9,    9,   11,   14, 8212,   21,
-       14, 8212,   21,   14,   21,   14, 8212,   10,   11,    6,
-        6,   11,    6,    6,   14, 8212,   21,   14, 8212,   21,
-       14, 8212,   14,   21,   14,    6,    6,    6,    5,    6,
-        4,    6,    5,    6,    4,    6
+       25,   22,   23,   24, 8193,   22,   23,   24,16385, 8193,
+       22,   24,16385,   22,   23,   24,   23,   24,   22,   23,
+       24,   22,   23,   24,   22,   23,   24,   22,   23,   24,
+       22,   23,   24,   22,   23,   24,   22,   23,   24,   22,
+       23,   24,   22,   23,   24,   22,   23,   24,   22,   23,
+       24,   22,   23,   24,   22,   23,   24,   22,   23,   24,
+       22,   23,   24,   22,   23,   22,   23,   22,   23,   23,
+     8193,   22,   23, 8193,   22,   23,16385, 8193,   22,   23,
+     8193,   22,   23, 8193,   23, 8193,   22, 8193,   22,16385,
+     8193,   22, 8193,   23,   22,   23,   22,   23, 8213,   22,
+
+       23,16405,   23,   22,   23,   22,   23,   22,   23,   22,
+       23,   22,   23,   22,   23,   22,   23,   22,   23,   22,
+       23,   22,   23,   22,   23,   22,   23,   22,   23,   22,
+       23,   22,   23,   22,   23,   22,   23,   22,   23,   22,
+       22, 8193,   22,   23, 8193,   22,   23, 8193,   22,   23,
+     8193,   23, 8193, 8193,   22, 8193,   22, 8213,   22, 8213,
+       22, 8213,   12,   22,   23,   22,   23,   22,   23,   22,
+       23,   22,   23,   22,   23,   22,   23,   22,   23,   22,
+       23,   22,   23,   22,   23,   22,   23,   22,   23,   22,
+       23,   22,   23,   22,   23,   22,   23, 8213,   22, 8213,
+
+       22, 8213,   12,   22,   23,   17, 8213,   22,   23,16405,
+       22,   23,   22,   23,   22,   23,   22,   23,   22,   23,
+       22,   23,   22,   23, 8213,   22,   23,16405,   20, 8213,
+       22,   23,16405,   22,   23, 8205, 8213,   22,   23,16397,
+    16405,   22,   23,   22,   23, 8208, 8213,   22,   23,16400,
+    16405,   22,   23,   22,   23,   22,   23,   22,   23,   17,
+     8213,   22,   17, 8213,   22,   17,   22,   17, 8213,   22,
+       23,    3,   22,   23,   22,   23,   19, 8213,   22,   23,
+    16405,   22,   23,   22,   23,   22,   23,   22,   20, 8213,
+       22,   20, 8213,   22,   20,   22,   20, 8213, 8205, 8213,
+
+       22, 8205, 8213,   22, 8205,   22, 8205, 8213,   22,   23,
+     8208, 8213,   22, 8208, 8213,   22, 8208,   22, 8208, 8213,
+       22,   23,   22,   23,    9,   23,   22,   23,   17, 8213,
+       22,   17, 8213,   22,   17, 8213,   17,   22,   17,   22,
+       23,    3,   22,   23,   22,   23,   19, 8213,   22,   19,
+     8213,   22,   19,   22,   19, 8213,   22,   23,   18, 8213,
+       22,   23,16405, 8206, 8213,   22,   23,16398,16405,   22,
+       20, 8213,   22,   20, 8213,   22,   20, 8213,   20,   22,
+       20, 8205, 8213,   22, 8205, 8213,   22, 8205, 8213, 8205,
+       22, 8205,   22,   23, 8208, 8213,   22, 8208, 8213,   22,
+
+     8208, 8213, 8208,   22, 8208,   22,   23,   22,   23,    9,
+       12,    9,    7,   23,   22,   23,   22,   23,   19, 8213,
+       22,   19, 8213,   22,   19, 8213,   19,   22,   19,    2,
+       23,   18, 8213,   22,   18, 8213,   22,   18,   22,   18,
+     8213, 8206, 8213,   22, 8206, 8213,   22, 8206,   22, 8206,
+     8213,   22,   10,   23,   22,   23,   11,   23,    9,    9,
+       12,    7,   12,    7,   22,   23,    6,   23,    2,   12,
+        2,   18, 8213,   22,   18, 8213,   22,   18, 8213,   18,
+       22,   18, 8206, 8213,   22, 8206, 8213,   22, 8206, 8213,
+     8206,   22, 8206,   22,   10,   12,   10,   15, 8213,   22,
+
+       23,16405,   11,   12,   11,    7,    7,   12,   22,   23,
+        6,   12,    6,    6,   12,    6,   12,    2,    2,   12,
+     8206,   22,16398,   10,   10,   12,   15, 8213,   22,   15,
+     8213,   22,   15,   22,   15, 8213,   11,   12,   22,   23,
+        6,    6,   12,    6,    6,   15, 8213,   22,   15, 8213,
+       22,   15, 8213,   15,   22,   15,   22,   23,    6,    6,
+        8,   23,    6,    5,    6,    8,   12,    4,    6,    5,
+        6,    8,    4,    6
     } ;
 
-static yyconst flex_int16_t yy_accept[250] =
+static yyconst flex_int16_t yy_accept[264] =
     {   0,
         1,    1,    1,    2,    5,   10,   14,   17,   19,   22,
        25,   28,   31,   34,   37,   40,   43,   46,   49,   52,
-       55,   58,   61,   63,   65,   67,   68,   71,   75,   78,
-       81,   83,   85,   88,   90,   91,   92,   94,   96,  100,
-      101,  103,  105,  107,  109,  111,  113,  115,  117,  119,
-      121,  123,  125,  127,  129,  131,  133,  135,  136,  137,
-      140,  143,  146,  148,  149,  151,  153,  155,  157,  158,
-      159,  161,  163,  165,  167,  169,  171,  173,  175,  177,
-      179,  181,  183,  185,  187,  189,  191,  193,  195,  196,
-      197,  199,  204,  206,  208,  210,  212,  214,  216,  220,
-
-      225,  227,  233,  235,  237,  243,  245,  247,  249,  251,
-      254,  257,  259,  261,  264,  266,  271,  273,  275,  277,
-      278,  281,  284,  286,  288,  291,  294,  296,  298,  300,
-      303,  306,  308,  310,  312,  314,  316,  318,  321,  324,
-      326,  328,  329,  332,  334,  337,  340,  342,  344,  346,
-      351,  357,  358,  361,  364,  366,  368,  369,  372,  375,
-      377,  379,  380,  382,  385,  388,  390,  392,  393,  395,
-      397,  399,  400,  402,  404,  407,  410,  412,  414,  415,
-      417,  420,  423,  425,  427,  430,  433,  435,  437,  438,
-      440,  442,  444,  445,  447,  449,  450,  452,  454,  455,
-
-      458,  461,  463,  465,  466,  469,  472,  474,  476,  477,
-      478,  480,  481,  486,  488,  489,  490,  492,  494,  495,
-      497,  499,  500,  502,  505,  506,  508,  511,  514,  516,
-      518,  520,  521,  523,  524,  525,  528,  531,  533,  535,
-      536,  537,  538,  539,  541,  543,  545,  547,  547
+       55,   58,   61,   64,   66,   68,   70,   71,   74,   78,
+       81,   84,   86,   88,   91,   93,   94,   95,   97,   99,
+      103,  104,  106,  108,  110,  112,  114,  116,  118,  120,
+      122,  124,  126,  128,  130,  132,  134,  136,  138,  140,
+      141,  142,  145,  148,  151,  153,  154,  156,  158,  160,
+      162,  163,  164,  166,  168,  170,  172,  174,  176,  178,
+      180,  182,  184,  186,  188,  190,  192,  194,  196,  198,
+      200,  202,  203,  204,  206,  211,  213,  215,  217,  219,
+
+      221,  223,  225,  229,  234,  236,  242,  244,  246,  252,
+      254,  256,  258,  260,  263,  266,  268,  270,  272,  275,
+      277,  282,  284,  286,  288,  289,  292,  295,  297,  299,
+      302,  305,  307,  309,  311,  314,  317,  319,  321,  323,
+      325,  327,  329,  332,  335,  337,  339,  340,  342,  345,
+      347,  350,  353,  355,  357,  359,  364,  370,  371,  374,
+      377,  379,  381,  382,  385,  388,  390,  392,  393,  395,
+      398,  401,  403,  405,  406,  408,  410,  412,  413,  415,
+      417,  419,  422,  425,  427,  429,  430,  432,  435,  438,
+      440,  442,  445,  448,  450,  452,  453,  455,  457,  459,
+
+      460,  462,  464,  465,  467,  469,  471,  472,  475,  478,
+      480,  482,  483,  486,  489,  491,  493,  494,  495,  497,
+      498,  503,  505,  506,  507,  509,  511,  513,  514,  516,
+      518,  519,  521,  524,  525,  527,  530,  533,  535,  537,
+      539,  541,  542,  544,  545,  546,  549,  552,  554,  556,
+      557,  559,  560,  561,  563,  564,  566,  568,  570,  572,
+      573,  575,  575
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -500,226 +505,254 @@ static yyconst flex_int32_t yy_meta[34] =
         1,    1,    1
     } ;
 
-static yyconst flex_int16_t yy_base[306] =
+static yyconst flex_int16_t yy_base[322] =
     {   0,
-        0,    0,  590,   30,   38,   41,   44,   47,   56,   74,
-      576,  574,  564,   45,   38,  575,  568,  572,  573,  570,
-      571,   54,   76,  591,  576,  591,   83,   91,    0,   93,
-        0,  100,  103,    0,    0,  106,  115,    0,  124,    0,
-      567,  554,  550,  545,  564,  553,  546,  558,  559,  557,
-      536,  544,  535,  539,   10,  551,  551,  559,  591,  127,
-        0,  134,    0,    0,  136,    0,  138,    0,    0,  558,
-      547,  552,  535,  529,  543,  534,  533,  526,  545,  544,
-      519,  542,  531,  141,  532,  516,  147,    0,    0,  591,
-      518,  156,  523,  511,  533,  527,  495,  495,  496,  165,
-
-       65,  174,  460,  469,  183,  447,  439,  440,  417,  186,
-        0,  190,    0,  429,  400,  199,  388,  401,  393,   84,
-      202,    0,  206,    0,  209,    0,  213,    0,  360,  216,
-        0,  220,    0,  337,  329,  341,  306,  223,    0,    0,
-        0,    0,  591,  300,  227,    0,  230,    0,  304,  239,
-      248,   97,  251,    0,    0,    0,    0,  255,    0,    0,
-        0,    0,  299,  258,    0,    0,    0,    0,  271,  275,
-      273,  591,  259,  237,  262,    0,    0,    0,    0,  241,
-      265,    0,  269,    0,  272,    0,  276,    0,   77,  234,
-      229,  117,  231,  591,  193,  591,  140,  192,  591,  279,
-
-        0,    0,    0,    0,  283,    0,    0,    0,    0,  285,
-      177,  591,  293,  168,    0,  167,  591,  159,  591,   85,
-      210,  151,  591,  296,  130,  591,  300,    0,  303,    0,
-        0,  109,  591,  194,  118,  307,    0,    0,    0,    0,
-      266,   50,  158,   45,   32,  591,  591,  591,  316,  320,
-      324,  328,  332,  336,  339,  343,  347,  351,  355,  359,
-      363,  367,  371,  375,  379,  383,  387,  391,  395,  399,
-      403,  407,  411,  415,  419,  423,  427,  431,  435,  439,
-      443,  447,  451,  455,  459,  463,  467,  471,  475,  479,
-      483,  487,  491,  495,  499,  503,  507,  511,  515,  519,
-
-      523,  527,  531,  535,  539
+        0,    0,  605,   30,   38,   41,   44,   47,   56,   74,
+       53,   57,   26,   62,  591,   63,   59,   71,   25,  587,
+       80,  575,   83,   90,  704,  573,  704,   98,  106,    0,
+      108,    0,  115,  118,    0,    0,  121,  130,  559,  139,
+        0,   85,   79,  116,  125,  106,   94,  135,  126,  136,
+      139,  144,   52,  145,  148,  149,  150,  151,  153,  557,
+      704,  164,    0,  175,    0,    0,  178,    0,  182,    0,
+        0,  549,  160,  154,  103,  173,  161,  178,  179,  183,
+      184,  188,  192,  185,  196,  189,  201,  200,  193,  216,
+        0,    0,  704,  203,  231,  208,  205,  211,  218,  531,
+
+      213,  219,  504,  244,  247,  257,  231,  259,  269,  220,
+      254,  241,  253,  276,    0,  279,    0,  266,  280,  276,
+      301,  265,  283,  287,  288,  304,    0,  308,    0,  315,
+        0,  317,    0,  304,  319,    0,  326,    0,  288,  315,
+      506,  290,  328,    0,    0,    0,    0,  326,  704,  324,
+      337,    0,  339,    0,  340,  350,  359,  361,  366,    0,
+        0,    0,    0,  370,    0,    0,    0,    0,  347,  373,
+        0,    0,    0,    0,  361,  374,  493,  704,  463,  337,
+      376,  384,    0,    0,    0,    0,  462,  386,    0,  388,
+        0,  395,    0,  397,    0,  283,  461,  370,  399,  460,
+
+      704,  459,  704,  384,  401,  458,  704,  406,    0,    0,
+        0,    0,  415,    0,    0,    0,    0,  403,  457,  704,
+      424,  456,    0,  455,  704,  398,  454,  704,  408,  412,
+      453,  704,  431,  452,  704,  433,    0,  435,    0,    0,
+      431,  451,  704,  416,  418,  444,    0,    0,    0,    0,
+      440,  427,  448,    0,  323,  450,  392,  238,  704,   50,
+      704,  704,  468,  472,  476,  480,  484,  488,  491,  495,
+      499,  503,  507,  511,  515,  519,  523,  527,  531,  535,
+      539,  543,  547,  551,  555,  559,  563,  567,  571,  575,
+      579,  583,  587,  591,  595,  599,  603,  607,  611,  615,
+
+      619,  623,  627,  631,  635,  639,  643,  647,  651,  655,
+      659,  663,  667,  671,  675,  679,  683,  687,  691,  695,
+      699
     } ;
 
-static yyconst flex_int16_t yy_def[306] =
+static yyconst flex_int16_t yy_def[322] =
     {   0,
-      248,    1,  248,  249,  250,  251,  252,  252,  253,  253,
+      262,    1,  262,  263,  264,  265,  266,  266,  267,  267,
        10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
-       10,   10,  249,  248,  254,  248,  255,  250,  256,  257,
-      256,  257,  251,  256,  256,  252,  258,   10,  254,  259,
-       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
-       10,   10,   10,   10,   10,   10,   10,  254,  248,  255,
-      256,  257,  256,  256,  257,  256,  260,  261,  261,  248,
-       10,   10,   10,   10,   10,   10,   10,   10,   10,   10,
-       10,   10,   10,   10,   10,   10,  260,  261,  261,  248,
-       10,  262,   10,   10,   10,   10,   10,   10,   39,  263,
-
-       10,  264,   10,   10,  265,   10,   10,   10,   10,  266,
-      267,  262,  267,   10,   10,  268,   10,   10,   10,  254,
-      269,  270,  263,  270,  271,  272,  264,  272,   10,  273,
-      274,  265,  274,   10,   10,  275,   10,  266,  267,  267,
-      276,  276,  248,   10,  277,  278,  268,  278,   10,  279,
-      280,  254,  269,  270,  270,  281,  281,  271,  272,  272,
-      282,  282,   10,  273,  274,  274,  283,  283,   10,   10,
-      284,  248,  285,   10,  277,  278,  278,  286,  286,  287,
-      288,  289,  279,  289,  290,  291,  280,  291,  254,  292,
-       10,  293,  284,  248,  294,  248,  295,  296,  248,  288,
-
-      289,  289,  297,  297,  290,  291,  291,  298,  298,  254,
-      299,  248,  300,  301,  301,  294,  248,  302,  248,  302,
-      302,  296,  248,  280,  299,  248,  303,  304,  300,  304,
-      301,  302,  248,  302,  302,  303,  304,  304,  305,  305,
-      302,  302,  302,  302,  302,  248,  248,    0,  248,  248,
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-
-      248,  248,  248,  248,  248
+       10,   10,   10,  263,  262,  268,  262,  269,  264,  270,
+      271,  270,  271,  265,  270,  270,  266,  272,   10,  268,
+      273,   10,   10,   10,   10,   10,   10,   10,   10,   10,
+       10,   10,   10,   10,   10,   10,   10,   10,   10,  268,
+      262,  269,  270,  271,  270,  270,  271,  270,  274,  275,
+      275,  262,   10,   10,   10,   10,   10,   10,   10,   10,
+       10,   10,   10,   10,   10,   10,   10,   10,   10,  274,
+      275,  275,  262,   10,  276,   10,   10,   10,   10,   10,
+
+       10,   10,   40,  277,   10,  278,   10,   10,  279,   10,
+       10,   10,   10,  280,  281,  276,  281,   10,   10,   10,
+      282,   10,   10,   10,  268,  283,  284,  277,  284,  285,
+      286,  278,  286,   10,  287,  288,  279,  288,   10,   10,
+      289,   10,  280,  281,  281,  290,  290,   10,  262,   10,
+      291,  292,  282,  292,   10,  293,  294,  268,  283,  284,
+      284,  295,  295,  285,  286,  286,  296,  296,   10,  287,
+      288,  288,  297,  297,   10,   10,  298,  262,  299,   10,
+       10,  291,  292,  292,  300,  300,  301,  302,  303,  293,
+      303,  304,  305,  294,  305,  268,  306,   10,  307,  298,
+
+      262,  308,  262,   10,  309,  310,  262,  302,  303,  303,
+      311,  311,  304,  305,  305,  312,  312,  268,  313,  262,
+      314,  315,  315,  308,  262,   10,  316,  262,  316,  316,
+      310,  262,  294,  313,  262,  317,  318,  314,  318,  315,
+       10,  316,  262,  316,  316,  317,  318,  318,  319,  319,
+       10,  316,  316,  320,  316,  316,  321,  316,  262,  321,
+      262,    0,  262,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+
+      262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      262
     } ;
 
-static yyconst flex_int16_t yy_nxt[625] =
+static yyconst flex_int16_t yy_nxt[738] =
     {   0,
         4,    5,    6,    7,    4,    4,    4,    4,    8,    9,
-       10,   11,   12,   13,   14,   10,   10,   15,   10,   10,
-       10,   10,   16,   10,   17,   18,   19,   20,   21,   10,
-       22,   10,   10,   24,   84,  247,   85,   25,   26,   28,
-       28,   29,   33,   33,   34,   30,   31,   26,  246,   35,
-       26,   26,   26,  219,   26,   26,   23,   23,   23,   24,
-       37,   48,   46,   39,   40,   49,   56,   41,   47,  244,
-       57,   82,  102,   42,   23,   23,   23,   24,   37,   24,
-       59,   39,   40,   25,   26,   23,   61,   59,  233,  210,
-       62,   63,   28,   28,   29,   58,   66,  234,   30,   31,
-
-       59,   64,   58,   66,   33,   33,   34,  189,   64,   26,
-      152,   35,  219,   26,   26,   23,   23,   23,   24,   70,
-      215,  219,   25,   40,   67,   67,   67,   68,   67,   23,
-       61,   67,   69,  212,   62,   63,   58,   66,   58,   66,
-       58,   88,   64,  219,   64,  242,   89,  104,  105,   58,
-       88,  220,  221,  106,  199,   89,  110,  110,   67,  111,
-      110,  219,  233,  110,  113,  121,  121,   67,  122,  121,
-      196,  231,  121,  124,  125,  125,   67,  126,  125,  245,
-      226,  125,  128,  130,  130,   67,  131,  130,   58,  139,
-      130,  133,   58,  141,  140,  223,  217,  219,  142,  145,
-
-      145,   67,  146,  145,   58,  154,  145,  148,   58,  156,
-      155,   58,  159,  233,  157,   58,  161,  160,   58,  165,
-      241,  162,   58,  167,  166,   58,  139,  235,  168,   58,
-      176,  140,   58,  178,  172,  177,  213,  212,  179,  181,
-      181,   67,  182,  181,  199,  197,  181,  184,  185,  185,
-       67,  186,  185,   58,  154,  185,  188,   58,  159,  155,
-       58,  165,  196,  160,   58,  176,  166,   58,  201,  219,
-      177,   58,  203,  202,   58,  206,  194,  204,   58,  208,
-      207,   58,  201,  192,  209,   58,  206,  202,   59,  243,
-      191,  207,  224,  227,  227,   67,  228,  227,   58,  208,
-
-      227,  230,   58,  237,  209,   58,  239,  190,  238,   58,
-      237,  240,  180,  174,  173,  238,   23,   23,   23,   23,
-       27,   27,   27,   27,   32,   32,   32,   32,   36,   36,
-       36,   36,   38,   38,   38,   38,   58,   58,   58,   60,
-       60,   60,   60,   64,  172,   64,   64,   65,   65,   65,
-       65,   37,   37,   37,   37,   70,   70,  170,   70,   87,
-       87,   87,   87,   89,  169,   89,   89,  112,  112,  112,
-      112,  123,  123,  123,  123,  127,  127,  127,  127,  132,
-      132,  132,  132,  138,  138,  138,  138,  140,  163,  140,
-      140,  147,  147,  147,  147,  153,  153,  153,  153,  155,
-
-      151,  155,  155,  158,  158,  158,  158,  160,  150,  160,
-      160,  164,  164,  164,  164,  166,  149,  166,  166,  171,
-      171,  171,  171,  142,  144,  142,  142,  175,  175,  175,
-      175,  177,  143,  177,  177,  183,  183,  183,  183,  187,
-      187,  187,  187,  157,  137,  157,  157,  162,  136,  162,
-      162,  168,  135,  168,  168,  193,  193,  193,  193,  195,
-      195,  195,  195,  179,  134,  179,  179,  198,  198,  198,
-      198,  200,  200,  200,  200,  202,  105,  202,  202,  205,
-      205,  205,  205,  207,  129,  207,  207,  211,  211,  211,
-      211,  214,  214,  214,  214,  216,  216,  216,  216,  218,
-
-      218,  218,  218,  222,  222,  222,  222,  204,  120,  204,
-      204,  209,  119,  209,  209,  225,  225,  225,  225,  229,
-      229,  229,  229,  215,  118,  215,  215,  232,  232,  232,
-      232,  236,  236,  236,  236,  238,  117,  238,  238,  240,
-      116,  240,  240,  115,  114,  109,  108,  107,  103,  102,
-      101,  100,   99,   98,   97,   96,   95,   94,   93,   92,
-       91,   90,   59,   82,   86,   83,   82,   81,   80,   79,
-       78,   77,   76,   75,   50,   74,   73,   72,   71,   59,
-       55,   54,   53,   52,   51,   50,   45,   44,   43,  248,
-        3,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-      248,  248,  248,  248
+       10,   11,   12,   13,   14,   15,   15,   16,   15,   15,
+       15,   15,   17,   15,   18,   19,   20,   21,   22,   15,
+       23,   15,   15,   25,   39,   39,   54,   26,   27,   29,
+       29,   30,   34,   34,   35,   31,   32,   27,   47,   36,
+       27,   27,   27,  262,   27,   27,   24,   24,   24,   25,
+       38,   39,   39,   40,   41,   45,   39,   42,   39,   52,
+       46,   39,   39,   43,   24,   24,   24,   25,   38,   48,
+       39,   40,   41,   44,   83,   49,   50,   53,   39,   39,
+       51,   56,   39,   25,   39,   58,   73,   26,   27,   59,
+
+       24,   63,   74,   39,   52,   64,   65,   29,   29,   30,
+       60,   68,   39,   31,   32,   39,   66,   60,   68,   34,
+       34,   35,   96,   66,   27,   39,   36,   75,   27,   27,
+       24,   24,   24,   25,   39,   39,   77,   26,   41,   69,
+       69,   69,   70,   69,   39,   39,   69,   71,   39,   80,
+       81,   76,   79,   39,   39,   78,   82,   39,   39,   39,
+       39,   95,   39,   39,   89,   85,   24,   63,   84,   39,
+       39,   64,   65,   94,   87,   86,   88,   60,   68,   85,
+       60,   68,   39,   66,   60,   91,   66,   39,   39,   98,
+       92,   99,   39,   39,   39,  103,   97,   39,   39,  104,
+
+      100,   39,   39,  106,  101,   39,  107,  108,  109,   39,
+       39,  102,   39,  110,   39,  111,  105,   39,   60,   91,
+       39,  118,   39,  112,   92,  121,  119,   39,   39,   39,
+      113,  114,  114,   69,  115,  114,  124,  139,  114,  117,
+       39,  261,  123,  120,  126,  126,   69,  127,  126,  141,
+       39,  126,  129,   85,  106,  134,   39,  130,  130,   69,
+      131,  130,   39,   39,  130,  133,  109,  140,   39,  135,
+      135,   69,  136,  135,   39,   39,  135,  138,   60,  144,
+      142,   60,  146,  149,  145,   39,   61,  147,  148,   39,
+      156,   61,   39,  155,  157,  218,   39,   39,  179,   39,
+
+      150,  151,  151,   69,  152,  151,   60,  160,  151,  154,
+       60,  162,  161,   39,  158,  175,  163,   60,  165,   60,
+      167,   60,  171,  166,   39,  168,  228,  172,   60,  173,
+       60,  144,  169,   39,  174,   39,  145,  181,  180,   60,
+      183,   60,  185,  176,  258,  184,   39,  186,  187,   39,
+      188,  188,   69,  189,  188,  197,   39,  188,  191,  192,
+      192,   69,  193,  192,   61,  204,  192,  195,   60,  160,
+       39,  196,   60,  165,  161,   60,  171,  221,  166,   39,
+      198,  172,  199,   39,  205,   39,   60,  183,   60,  209,
+       60,  211,  184,   39,  210,   93,  212,   60,  214,   60,
+
+      216,   72,  223,  215,  228,  217,   61,   39,   60,  209,
+      233,  243,  229,  230,  210,  243,  226,   60,  214,  228,
+      244,  228,  241,  215,  236,  236,   69,  237,  236,  245,
+      228,  236,  239,   60,  216,   60,  247,   60,  249,  217,
+       39,  248,  252,  250,  251,  253,   60,  247,  254,   39,
+      255,  228,  248,  259,  228,  220,  207,  243,  203,  240,
+      235,  232,  225,  178,  220,  207,  203,  256,   24,   24,
+       24,   24,   28,   28,   28,   28,   33,   33,   33,   33,
+       37,   37,   37,   37,   39,   39,   39,   39,   60,   60,
+       60,   62,   62,   62,   62,   66,  201,   66,   66,   67,
+
+       67,   67,   67,   38,   38,   38,   38,   72,   72,  178,
+       72,   90,   90,   90,   90,   92,  125,   92,   92,  116,
+      116,  116,  116,  128,  128,  128,  128,  132,  132,  132,
+      132,  137,  137,  137,  137,  143,  143,  143,  143,  145,
+      122,  145,  145,  153,  153,  153,  153,  159,  159,  159,
+      159,  161,   93,  161,  161,  164,  164,  164,  164,  166,
+       61,  166,  166,  170,  170,  170,  170,  172,   39,  172,
+      172,  177,  177,  177,  177,  147,   61,  147,  147,  182,
+      182,  182,  182,  184,   57,  184,  184,  190,  190,  190,
+      190,  194,  194,  194,  194,  163,   55,  163,  163,  168,
+
+       39,  168,  168,  174,  262,  174,  174,  200,  200,  200,
+      200,  202,  202,  202,  202,  186,  262,  186,  186,  206,
+      206,  206,  206,  208,  208,  208,  208,  210,  262,  210,
+      210,  213,  213,  213,  213,  215,  262,  215,  215,  219,
+      219,  219,  219,  222,  222,  222,  222,  224,  224,  224,
+      224,  227,  227,  227,  227,  231,  231,  231,  231,  212,
+      262,  212,  212,  217,  262,  217,  217,  234,  234,  234,
+      234,  238,  238,  238,  238,  223,  262,  223,  223,  242,
+      242,  242,  242,  246,  246,  246,  246,  248,  262,  248,
+      248,  250,  262,  250,  250,  257,  257,  262,  257,  260,
+
+      260,  260,  260,    3,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262
     } ;
 
-static yyconst flex_int16_t yy_chk[625] =
+static yyconst flex_int16_t yy_chk[738] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    4,   55,  245,   55,    4,    4,    5,
-        5,    5,    6,    6,    6,    5,    5,    7,  244,    6,
-        8,    7,    7,  242,    8,    8,    9,    9,    9,    9,
-        9,   15,   14,    9,    9,   15,   22,    9,   14,  242,
-       22,  101,  101,    9,   10,   10,   10,   10,   10,   23,
-      189,   10,   10,   23,   23,   27,   27,  120,  220,  189,
-       27,   27,   28,   28,   28,   30,   30,  220,   28,   28,
-
-      152,   30,   32,   32,   33,   33,   33,  152,   32,   36,
-      120,   33,  232,   36,   36,   37,   37,   37,   37,  192,
-      192,  235,   37,   37,   39,   39,   39,   39,   39,   60,
-       60,   39,   39,  225,   60,   60,   62,   62,   65,   65,
-       67,   67,   62,  197,   65,  235,   67,   84,   84,   87,
-       87,  197,  197,   84,  222,   87,   92,   92,   92,   92,
-       92,  243,  218,   92,   92,  100,  100,  100,  100,  100,
-      216,  214,  100,  100,  102,  102,  102,  102,  102,  243,
-      211,  102,  102,  105,  105,  105,  105,  105,  110,  110,
-      105,  105,  112,  112,  110,  198,  195,  234,  112,  116,
-
-      116,  116,  116,  116,  121,  121,  116,  116,  123,  123,
-      121,  125,  125,  221,  123,  127,  127,  125,  130,  130,
-      234,  127,  132,  132,  130,  138,  138,  221,  132,  145,
-      145,  138,  147,  147,  193,  145,  191,  190,  147,  150,
-      150,  150,  150,  150,  180,  174,  150,  150,  151,  151,
-      151,  151,  151,  153,  153,  151,  151,  158,  158,  153,
-      164,  164,  173,  158,  175,  175,  164,  181,  181,  241,
-      175,  183,  183,  181,  185,  185,  171,  183,  187,  187,
-      185,  200,  200,  170,  187,  205,  205,  200,  210,  241,
-      169,  205,  210,  213,  213,  213,  213,  213,  224,  224,
-
-      213,  213,  227,  227,  224,  229,  229,  163,  227,  236,
-      236,  229,  149,  144,  137,  236,  249,  249,  249,  249,
-      250,  250,  250,  250,  251,  251,  251,  251,  252,  252,
-      252,  252,  253,  253,  253,  253,  254,  254,  254,  255,
-      255,  255,  255,  256,  136,  256,  256,  257,  257,  257,
-      257,  258,  258,  258,  258,  259,  259,  135,  259,  260,
-      260,  260,  260,  261,  134,  261,  261,  262,  262,  262,
-      262,  263,  263,  263,  263,  264,  264,  264,  264,  265,
-      265,  265,  265,  266,  266,  266,  266,  267,  129,  267,
-      267,  268,  268,  268,  268,  269,  269,  269,  269,  270,
-
-      119,  270,  270,  271,  271,  271,  271,  272,  118,  272,
-      272,  273,  273,  273,  273,  274,  117,  274,  274,  275,
-      275,  275,  275,  276,  115,  276,  276,  277,  277,  277,
-      277,  278,  114,  278,  278,  279,  279,  279,  279,  280,
-      280,  280,  280,  281,  109,  281,  281,  282,  108,  282,
-      282,  283,  107,  283,  283,  284,  284,  284,  284,  285,
-      285,  285,  285,  286,  106,  286,  286,  287,  287,  287,
-      287,  288,  288,  288,  288,  289,  104,  289,  289,  290,
-      290,  290,  290,  291,  103,  291,  291,  292,  292,  292,
-      292,  293,  293,  293,  293,  294,  294,  294,  294,  295,
-
-      295,  295,  295,  296,  296,  296,  296,  297,   99,  297,
-      297,  298,   98,  298,  298,  299,  299,  299,  299,  300,
-      300,  300,  300,  301,   97,  301,  301,  302,  302,  302,
-      302,  303,  303,  303,  303,  304,   96,  304,  304,  305,
-       95,  305,  305,   94,   93,   91,   86,   85,   83,   82,
-       81,   80,   79,   78,   77,   76,   75,   74,   73,   72,
-       71,   70,   58,   57,   56,   54,   53,   52,   51,   50,
-       49,   48,   47,   46,   45,   44,   43,   42,   41,   25,
-       21,   20,   19,   18,   17,   16,   13,   12,   11,    3,
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-      248,  248,  248,  248,  248,  248,  248,  248,  248,  248,
-      248,  248,  248,  248
+        1,    1,    1,    4,   19,   13,   19,    4,    4,    5,
+        5,    5,    6,    6,    6,    5,    5,    7,   13,    6,
+        8,    7,    7,  260,    8,    8,    9,    9,    9,    9,
+        9,   53,   11,    9,    9,   11,   12,    9,   17,   17,
+       12,   14,   16,    9,   10,   10,   10,   10,   10,   14,
+       18,   10,   10,   10,   53,   14,   16,   18,   43,   21,
+       16,   21,   23,   24,   42,   23,   42,   24,   24,   23,
+
+       28,   28,   43,   47,   47,   28,   28,   29,   29,   29,
+       31,   31,   75,   29,   29,   46,   31,   33,   33,   34,
+       34,   34,   75,   33,   37,   44,   34,   44,   37,   37,
+       38,   38,   38,   38,   45,   49,   46,   38,   38,   40,
+       40,   40,   40,   40,   48,   50,   40,   40,   51,   50,
+       51,   45,   49,   52,   54,   48,   52,   55,   56,   57,
+       58,   74,   59,   74,   58,   59,   62,   62,   54,   73,
+       77,   62,   62,   73,   57,   56,   57,   64,   64,   55,
+       67,   67,   76,   64,   69,   69,   67,   78,   79,   77,
+       69,   78,   80,   81,   84,   82,   76,   82,   86,   83,
+
+       79,   83,   89,   85,   80,   85,   86,   87,   87,   88,
+       87,   81,   94,   87,   97,   88,   84,   96,   90,   90,
+       98,   96,  101,   89,   90,   99,   97,   99,  102,  110,
+       94,   95,   95,   95,   95,   95,  102,  110,   95,   95,
+      107,  258,  101,   98,  104,  104,  104,  104,  104,  112,
+      112,  104,  104,  105,  105,  107,  105,  106,  106,  106,
+      106,  106,  113,  111,  106,  106,  108,  111,  108,  109,
+      109,  109,  109,  109,  122,  118,  109,  109,  114,  114,
+      113,  116,  116,  119,  114,  120,  196,  116,  118,  119,
+      123,  125,  123,  122,  124,  196,  124,  139,  142,  142,
+
+      120,  121,  121,  121,  121,  121,  126,  126,  121,  121,
+      128,  128,  126,  134,  125,  139,  128,  130,  130,  132,
+      132,  135,  135,  130,  140,  132,  255,  135,  137,  137,
+      143,  143,  134,  150,  137,  148,  143,  150,  148,  151,
+      151,  153,  153,  140,  255,  151,  180,  153,  155,  155,
+      156,  156,  156,  156,  156,  169,  169,  156,  156,  157,
+      157,  157,  157,  157,  158,  180,  157,  157,  159,  159,
+      175,  158,  164,  164,  159,  170,  170,  198,  164,  198,
+      175,  170,  176,  176,  181,  181,  182,  182,  188,  188,
+      190,  190,  182,  204,  188,  257,  190,  192,  192,  194,
+
+      194,  199,  199,  192,  205,  194,  218,  226,  208,  208,
+      218,  229,  205,  205,  208,  230,  204,  213,  213,  244,
+      229,  245,  226,  213,  221,  221,  221,  221,  221,  230,
+      252,  221,  221,  233,  233,  236,  236,  238,  238,  233,
+      241,  236,  244,  238,  241,  245,  246,  246,  251,  251,
+      252,  253,  246,  256,  242,  234,  231,  227,  224,  222,
+      219,  206,  202,  200,  197,  187,  179,  253,  263,  263,
+      263,  263,  264,  264,  264,  264,  265,  265,  265,  265,
+      266,  266,  266,  266,  267,  267,  267,  267,  268,  268,
+      268,  269,  269,  269,  269,  270,  177,  270,  270,  271,
+
+      271,  271,  271,  272,  272,  272,  272,  273,  273,  141,
+      273,  274,  274,  274,  274,  275,  103,  275,  275,  276,
+      276,  276,  276,  277,  277,  277,  277,  278,  278,  278,
+      278,  279,  279,  279,  279,  280,  280,  280,  280,  281,
+      100,  281,  281,  282,  282,  282,  282,  283,  283,  283,
+      283,  284,   72,  284,  284,  285,  285,  285,  285,  286,
+       60,  286,  286,  287,  287,  287,  287,  288,   39,  288,
+      288,  289,  289,  289,  289,  290,   26,  290,  290,  291,
+      291,  291,  291,  292,   22,  292,  292,  293,  293,  293,
+      293,  294,  294,  294,  294,  295,   20,  295,  295,  296,
+
+       15,  296,  296,  297,    3,  297,  297,  298,  298,  298,
+      298,  299,  299,  299,  299,  300,    0,  300,  300,  301,
+      301,  301,  301,  302,  302,  302,  302,  303,    0,  303,
+      303,  304,  304,  304,  304,  305,    0,  305,  305,  306,
+      306,  306,  306,  307,  307,  307,  307,  308,  308,  308,
+      308,  309,  309,  309,  309,  310,  310,  310,  310,  311,
+        0,  311,  311,  312,    0,  312,  312,  313,  313,  313,
+      313,  314,  314,  314,  314,  315,    0,  315,  315,  316,
+      316,  316,  316,  317,  317,  317,  317,  318,    0,  318,
+      318,  319,    0,  319,  319,  320,  320,    0,  320,  321,
+
+      321,  321,  321,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262,  262,  262,  262,
+      262,  262,  262,  262,  262,  262,  262
     } ;
 
 #define YY_TRAILING_MASK 0x2000
@@ -839,9 +872,17 @@ static void setformat(DiskParseContext *dpc, const char *str) {
     else xlu__disk_err(dpc,str,"unknown value for format");
 }
  
+/* Sets ->backend based on the string value.  This ought to be an enum. */
+static void setbackendtype(DiskParseContext *dpc, const char *str) {
+    if (     !strcmp(str,"phy"))   DSET(dpc,backend,BACKEND,str,PHY);
+    else if (!strcmp(str,"tap"))   DSET(dpc,backend,BACKEND,str,TAP);
+    else if (!strcmp(str,"qdisk")) DSET(dpc,backend,BACKEND,str,QDISK);
+    else xlu__disk_err(dpc,str,"unknown value for backendtype");
+}
+ 
 #define DEPRECATE(usewhatinstead) /* not currently reported */
 
-#line 845 "libxlu_disk_l.c"
+#line 886 "libxlu_disk_l.c"
 
 #define INITIAL 0
 
@@ -1076,12 +1117,12 @@ YY_DECL
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 116 "libxlu_disk_l.l"
+#line 124 "libxlu_disk_l.l"
 
 
  /*----- the scanner rules which do the parsing -----*/
 
-#line 1085 "libxlu_disk_l.c"
+#line 1126 "libxlu_disk_l.c"
 
 	if ( !yyg->yy_init )
 		{
@@ -1139,14 +1180,14 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 249 )
+				if ( yy_current_state >= 263 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			*yyg->yy_state_ptr++ = yy_current_state;
 			++yy_cp;
 			}
-		while ( yy_current_state != 248 );
+		while ( yy_current_state != 262 );
 
 yy_find_action:
 		yy_current_state = *--yyg->yy_state_ptr;
@@ -1196,148 +1237,154 @@ do_action:	/* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 120 "libxlu_disk_l.l"
+#line 128 "libxlu_disk_l.l"
 { /* ignore whitespace before parameters */ }
 	YY_BREAK
 /* ordinary parameters setting enums or strings */
 case 2:
 /* rule 2 can match eol */
 YY_RULE_SETUP
-#line 124 "libxlu_disk_l.l"
+#line 132 "libxlu_disk_l.l"
 { STRIP(','); setformat(DPC, FROMEQUALS); }
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 126 "libxlu_disk_l.l"
+#line 134 "libxlu_disk_l.l"
 { DPC->disk->is_cdrom = 1; }
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 127 "libxlu_disk_l.l"
+#line 135 "libxlu_disk_l.l"
 { DPC->disk->is_cdrom = 1; }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 128 "libxlu_disk_l.l"
+#line 136 "libxlu_disk_l.l"
 { DPC->disk->is_cdrom = 0; }
 	YY_BREAK
 case 6:
 /* rule 6 can match eol */
 YY_RULE_SETUP
-#line 129 "libxlu_disk_l.l"
+#line 137 "libxlu_disk_l.l"
 { xlu__disk_err(DPC,yytext,"unknown value for type"); }
 	YY_BREAK
 case 7:
 /* rule 7 can match eol */
 YY_RULE_SETUP
-#line 131 "libxlu_disk_l.l"
+#line 139 "libxlu_disk_l.l"
 { STRIP(','); setaccess(DPC,yytext); }
 	YY_BREAK
 case 8:
 /* rule 8 can match eol */
 YY_RULE_SETUP
-#line 133 "libxlu_disk_l.l"
-{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
+#line 140 "libxlu_disk_l.l"
+{ STRIP(','); setbackendtype(DPC,yytext); }
 	YY_BREAK
 case 9:
 /* rule 9 can match eol */
 YY_RULE_SETUP
-#line 134 "libxlu_disk_l.l"
+#line 142 "libxlu_disk_l.l"
+{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
+	YY_BREAK
+case 10:
+/* rule 10 can match eol */
+YY_RULE_SETUP
+#line 143 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
 	YY_BREAK
 /* the target magic parameter, eats the rest of the string */
-case 10:
+case 11:
 YY_RULE_SETUP
-#line 138 "libxlu_disk_l.l"
+#line 147 "libxlu_disk_l.l"
 { STRIP(','); SAVESTRING("target", pdev_path, FROMEQUALS); }
 	YY_BREAK
 /* unknown parameters */
-case 11:
-/* rule 11 can match eol */
+case 12:
+/* rule 12 can match eol */
 YY_RULE_SETUP
-#line 142 "libxlu_disk_l.l"
+#line 151 "libxlu_disk_l.l"
 { xlu__disk_err(DPC,yytext,"unknown parameter"); }
 	YY_BREAK
 /* deprecated prefixes */
 /* the "/.*" in these patterns ensures that they count as if they
    * matched the whole string, so these patterns take precedence */
-case 12:
+case 13:
 YY_RULE_SETUP
-#line 149 "libxlu_disk_l.l"
+#line 158 "libxlu_disk_l.l"
 {
                     STRIP(':');
                     DPC->had_depr_prefix=1; DEPRECATE("use `[format=]...,'");
                     setformat(DPC, yytext);
                  }
 	YY_BREAK
-case 13:
+case 14:
 YY_RULE_SETUP
-#line 155 "libxlu_disk_l.l"
+#line 164 "libxlu_disk_l.l"
 {
 		    STRIP(':');
                     DPC->had_depr_prefix=1; DEPRECATE("use `script=...'");
 		    SAVESTRING("script", script, yytext);
 		}
 	YY_BREAK
-case 14:
+case 15:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 8;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 161 "libxlu_disk_l.l"
+#line 170 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 15:
+case 16:
 YY_RULE_SETUP
-#line 162 "libxlu_disk_l.l"
+#line 171 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 16:
+case 17:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 163 "libxlu_disk_l.l"
+#line 172 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 17:
+case 18:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 6;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 164 "libxlu_disk_l.l"
+#line 173 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 18:
+case 19:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 5;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 165 "libxlu_disk_l.l"
+#line 174 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 19:
+case 20:
 *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 yyg->yy_c_buf_p = yy_cp = yy_bp + 4;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 166 "libxlu_disk_l.l"
+#line 175 "libxlu_disk_l.l"
 { DPC->had_depr_prefix=1; DEPRECATE(0); }
 	YY_BREAK
-case 20:
-/* rule 20 can match eol */
+case 21:
+/* rule 21 can match eol */
 YY_RULE_SETUP
-#line 168 "libxlu_disk_l.l"
+#line 177 "libxlu_disk_l.l"
 {
 		  xlu__disk_err(DPC,yytext,"unknown deprecated disk prefix");
 		  return 0;
 		}
 	YY_BREAK
 /* positional parameters */
-case 21:
-/* rule 21 can match eol */
+case 22:
+/* rule 22 can match eol */
 YY_RULE_SETUP
-#line 175 "libxlu_disk_l.l"
+#line 184 "libxlu_disk_l.l"
 {
     char *colon;
     STRIP(',');
@@ -1372,18 +1419,18 @@ YY_RULE_SETUP
     }
 }
 	YY_BREAK
-case 22:
-/* rule 22 can match eol */
+case 23:
+/* rule 23 can match eol */
 YY_RULE_SETUP
-#line 209 "libxlu_disk_l.l"
+#line 218 "libxlu_disk_l.l"
 { xlu__disk_err(DPC,yytext,"bad disk syntax"); return 0; }
 	YY_BREAK
-case 23:
+case 24:
 YY_RULE_SETUP
-#line 210 "libxlu_disk_l.l"
+#line 219 "libxlu_disk_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 1387 "libxlu_disk_l.c"
+#line 1434 "libxlu_disk_l.c"
 			case YY_STATE_EOF(INITIAL):
 				yyterminate();
 
@@ -1646,7 +1693,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 249 )
+			if ( yy_current_state >= 263 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1670,11 +1717,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 249 )
+		if ( yy_current_state >= 263 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 248);
+	yy_is_jam = (yy_current_state == 262);
 	if ( ! yy_is_jam )
 		*yyg->yy_state_ptr++ = yy_current_state;
 
@@ -2474,4 +2521,4 @@ void xlu__disk_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 210 "libxlu_disk_l.l"
+#line 219 "libxlu_disk_l.l"
diff --git a/tools/libxl/libxlu_disk_l.h b/tools/libxl/libxlu_disk_l.h
index bc3d9ff..45529ce 100644
--- a/tools/libxl/libxlu_disk_l.h
+++ b/tools/libxl/libxlu_disk_l.h
@@ -339,7 +339,7 @@ extern int xlu__disk_yylex (yyscan_t yyscanner);
 #undef YY_DECL
 #endif
 
-#line 210 "libxlu_disk_l.l"
+#line 219 "libxlu_disk_l.l"
 
 #line 345 "libxlu_disk_l.h"
 #undef xlu__disk_yyIN_HEADER
diff --git a/tools/libxl/libxlu_disk_l.l b/tools/libxl/libxlu_disk_l.l
index 8e511ea..2738377 100644
--- a/tools/libxl/libxlu_disk_l.l
+++ b/tools/libxl/libxlu_disk_l.l
@@ -100,6 +100,14 @@ static void setformat(DiskParseContext *dpc, const char *str) {
     else xlu__disk_err(dpc,str,"unknown value for format");
 }
  
+/* Sets ->backend based on the string value.  This ought to be an enum. */
+static void setbackendtype(DiskParseContext *dpc, const char *str) {
+    if (     !strcmp(str,"phy"))   DSET(dpc,backend,BACKEND,str,PHY);
+    else if (!strcmp(str,"tap"))   DSET(dpc,backend,BACKEND,str,TAP);
+    else if (!strcmp(str,"qdisk")) DSET(dpc,backend,BACKEND,str,QDISK);
+    else xlu__disk_err(dpc,str,"unknown value for backendtype");
+}
+ 
 #define DEPRECATE(usewhatinstead) /* not currently reported */
 
 %}
@@ -131,6 +139,7 @@ devtype=disk,?	{ DPC->disk->is_cdrom = 0; }
 devtype=[^,]*,?	{ xlu__disk_err(DPC,yytext,"unknown value for type"); }
 
 access=[^,]*,?	{ STRIP(','); setaccess(DPC, FROMEQUALS); }
+backendtype=[^,]*? { STRIP(','); setbackendtype(DPC,yytext); }
 
 vdev=[^,]*,?	{ STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
 script=[^,]*,?	{ STRIP(','); SAVESTRING("script", script, FROMEQUALS); }
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 14/14] xl: xl block-attach -N (dry run) option
  2011-05-12 14:36                         ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Jackson
@ 2011-05-12 14:36                           ` Ian Jackson
  2011-05-13 12:56                             ` Ian Campbell
  2011-05-13 12:53                           ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Campbell
  1 sibling, 1 reply; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Ian Jackson

This is mainly for debugging purposes at the moment.  Eventually I
hope all commands will gain this so that -N will be a global option.

In the meantime this new option is not documented and should be
regarded as unstable.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 tools/libxl/xl_cmdimpl.c |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index ccffd26..a8b3f9f 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3930,13 +3930,25 @@ int main_networkdetach(int argc, char **argv)
 
 int main_blockattach(int argc, char **argv)
 {
-    int opt;
+    int opt, dry_run = 0;
     uint32_t fe_domid, be_domid = 0;
     libxl_device_disk disk = { 0 };
     XLU_Config *config = 0;
 
-    if ((opt = def_getopt(argc, argv, "", "block-attach", 2)) != -1)
-        return opt;
+    while ((opt = getopt(argc, argv, "Nh")) != -1) {
+        switch (opt) {
+        case 'N':
+            /* fixme this should become a global option eventually */
+            dry_run = 1;
+            break;
+        case 'h':
+            help("block-attach");
+            return 0;
+        default:
+            fprintf(stderr, "option `%c' not supported.\n", optopt);
+            break;
+        }
+    }
     if ((argc-optind < 2)) {
         help("block-attach");
         return 2;
@@ -3953,6 +3965,22 @@ int main_blockattach(int argc, char **argv)
 
     disk.backend_domid = be_domid;
 
+    if (dry_run) {
+        /* fixme: this should be generated from the idl */
+        /* fixme: enums (backend, format) should be converted to strings */
+        printf("disk.backend_domid = %"PRIx32"\n", disk.backend_domid);
+        printf("disk.pdev_path =     %s\n",        disk.pdev_path);
+        printf("disk.vdev =          %s\n",        disk.vdev);
+        printf("disk.backend =       %d\n",        disk.backend);
+        printf("disk.format =        %d\n",        disk.format);
+        printf("disk.script =        %s\n",        disk.script);
+        printf("disk.removable =     %d\n",        disk.removable);
+        printf("disk.readwrite =     %d\n",        disk.readwrite);
+        printf("disk.is_cdrom =      %d\n",        disk.is_cdrom);
+        if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
+        return 0;
+    }
+
     if (libxl_device_disk_add(ctx, fe_domid, &disk)) {
         fprintf(stderr, "libxl_device_disk_add failed.\n");
     }
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk
  2011-05-12 14:36                       ` [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk Ian Jackson
  2011-05-12 14:36                         ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Jackson
@ 2011-05-12 14:42                         ` Ian Jackson
  2011-05-13 12:50                         ` Ian Campbell
  2 siblings, 0 replies; 36+ messages in thread
From: Ian Jackson @ 2011-05-12 14:42 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

Ian Jackson writes ("[PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk"):
> From: Ian Jackson <ijackson@chiark.greenend.org.uk>
> 
> Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>

FAOD, these aren't the right email address.  It seems I didn't
correctly override the default git settings on my laptop.  The right
address is my Citrix one, above.

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 00/14] libxl: disk configuration handling
  2011-05-12 14:36 [PATCH/RFC 00/14] libxl: disk configuration handling Ian Jackson
  2011-05-12 14:36 ` [PATCH 01/14] libxl: add missing copyright notices to some files Ian Jackson
@ 2011-05-13 10:33 ` Ian Campbell
  2011-06-02 16:57   ` Ian Jackson
  1 sibling, 1 reply; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 10:33 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> This is the latest version of my disk config parsing patch series.
> 
> 00-04  Hopefully uncontroversial cleanups and minor features.

For these:
Acked-by: Ian Campbell <ian.campbell@citrix.com>

Although I'm not sure about the benefit of #4, it is consistent with
e.g. free() accepting NULL so why not.

> 05-07  Preparatory work.
> 08-10  The new parser and its documentation.
> 11-12  Replace old parsers with calls to the new one.
> 13-14  Two features, one of them essential.
> 
> The use of the pcre library is gone; everything is done with flex now.
> The result is reasonably clean.
> 
> You can see how it improves the approach needed for addition of new
> features to the disk config syntax by looking at patch 13, which is
> precisely such a new feature.  In patch 13 everything but the change
> to libxlu_disk_l.l is autogenerated, so it is that subset that is the
> relevant change.
> 
> I'd like to apply as many of these as I can get acks for :-).
> 
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts
  2011-05-12 14:36         ` [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts Ian Jackson
  2011-05-12 14:36           ` [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable" Ian Jackson
@ 2011-05-13 10:35           ` Ian Campbell
  2011-06-02 16:48             ` Ian Jackson
  1 sibling, 1 reply; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 10:35 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> This is not currently implemented.  Applications setting it to
> anything but NULL will cause an error.  Code to set it from xl
> configuration files will appear later in this series.
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

Is there (going to be) a spec of what such scripts must do, are and are
not allowed to do etc? (apologies if this comes later in the series)

> ---
>  tools/libxl/libxl.c   |    7 +++++++
>  tools/libxl/libxl.idl |    1 +
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index d4a47f2..ac7b68a 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -968,6 +968,13 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
>          goto out_free;
>      }
>  
> +    if (disk->script) {
> +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "External block scripts"
> +                   " not yet supported, sorry");
> +        rc = ERROR_INVAL;
> +        goto out_free;
> +    }
> +
>      devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
>      if (devid==-1) {
>          LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Invalid or unsupported"
> diff --git a/tools/libxl/libxl.idl b/tools/libxl/libxl.idl
> index a5be66f..546cd3c 100644
> --- a/tools/libxl/libxl.idl
> +++ b/tools/libxl/libxl.idl
> @@ -261,6 +261,7 @@ libxl_device_disk = Struct("device_disk", [
>      ("vdev", string),
>      ("backend", libxl_disk_backend),
>      ("format", libxl_disk_format),
> +    ("script", string),
>      ("unpluggable", integer),
>      ("readwrite", integer),
>      ("is_cdrom", integer),

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable"
  2011-05-12 14:36           ` [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable" Ian Jackson
  2011-05-12 14:36             ` [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Ian Jackson
@ 2011-05-13 10:36             ` Ian Campbell
  1 sibling, 0 replies; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 10:36 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> This property corresponds to what is called "removable" in xenstore,
> and is the conventional meaning of "removable": ie, the _media_ can be
> removed even as the _device_ remains present.
> 
> "unpluggable" is a misleading name for this.
> 
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 28e810c..97a1241 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -385,7 +385,7 @@ static void printf_info(int domid,
>          printf("\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path);
>          printf("\t\t\t(phystype %d)\n", d_config->disks[i].backend);
>          printf("\t\t\t(virtpath %s)\n", d_config->disks[i].vdev);
> -        printf("\t\t\t(unpluggable %d)\n", d_config->disks[i].unpluggable);
> +        printf("\t\t\t(unpluggable %d)\n", d_config->disks[i].removable);
>          printf("\t\t\t(readwrite %d)\n", d_config->disks[i].readwrite);
>          printf("\t\t\t(is_cdrom %d)\n", d_config->disks[i].is_cdrom);
>          printf("\t\t)\n");

Does anybody actually use this thing? I find it hard to believe that it
is actually close enough to whatever it is suppose to mimic to be
useful...

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work
  2011-05-12 14:36             ` [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Ian Jackson
  2011-05-12 14:36               ` [PATCH 08/14] libxl: disks: new xlu_disk_parse function Ian Jackson
@ 2011-05-13 10:38               ` Ian Campbell
  2011-06-02 16:48                 ` Ian Jackson
  1 sibling, 1 reply; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 10:38 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> libxl callers should not be required to specify the backend if they
> don't want to.  So LIBXL_DISK_BACKEND_UNKNOWN should instruct libxl to
> choose the backend for itself.

I guess the selection of LIBXL_DISK_BACKEND_TAP was chosen to give the
greatest coverage as a stop gap measure until more smarts arrive? (It'll
fall back to QDISK as necessary too, which is nice). 

> 
> More thorough fixes for the disk handling will follow.
> 
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

> ---
>  tools/libxl/libxl.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index fe012cb..73fc3e9 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -989,6 +989,21 @@ int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *dis
>      device.domid = domid;
>      device.kind = DEVICE_VBD;
>  
> +
> +    /*
> +     * Fixing the incoming backend type to try to decide on which
> +     * backend to use.  Unfortunately at the moment this code is
> +     * utterly broken, but it more or less works.
> +     */
> +
> +    /*
> +     * Backend type UNKNOWN should mean "caller does not want to specify",
> +     * not "break pointlessely".  (Callers should not be required to
> +     * specify the backend if they don't want to.)
> +     */
> +    if (disk->backend == LIBXL_DISK_BACKEND_UNKNOWN)
> +        disk->backend = LIBXL_DISK_BACKEND_TAP;
> +
>      /* If blktap is not available then fallback to qdisk */
>      if (disk->backend == LIBXL_DISK_BACKEND_TAP && !libxl__blktap_enabled(&gc))
>          disk->backend = LIBXL_DISK_BACKEND_QDISK;

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 08/14] libxl: disks: new xlu_disk_parse function
  2011-05-12 14:36               ` [PATCH 08/14] libxl: disks: new xlu_disk_parse function Ian Jackson
  2011-05-12 14:36                 ` [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output Ian Jackson
@ 2011-05-13 10:48                 ` Ian Campbell
  2011-06-02 16:50                   ` Ian Jackson
  1 sibling, 1 reply; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 10:48 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, Ian Jackson

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> [...]
> +void xlu__disk_err(DiskParseContext *dpc, const char *erroneous,
> +                   const char *message) {
> +    fprintf(dpc->cfg->report,
> +           "%s: config parsing error in disk specification: %s"
> +            "%s%s%s"
> +            " in `%s'\n",
> +           dpc->cfg->filename, message,
> +            erroneous?": near `":"", erroneous?erroneous:"", erroneous?"'":"",
> +            dpc->spec);

Something seems to be up with the leading whitespace here.

[...]
> +   * Normally one would pass nspecs==1 and only specs[0].  But it is
> +   * permitted to pass more strings in which case each is parsed as a
> +   * string containing a collection of parameters (but they all refer
> +   * to of the configuration for a single disk).

           ^^ what is that doing there?

I don't really speak enough flex to have a proper opinion but it looks
plausible enough to me so:

Acked-by: Ian Campbell <ian.campbell@citrix.com>

This is the third time this week I've wondered if a patch ought to come
along with a library of test inputs and expected outputs. I'll be
proposing we switch to the waterfall model before you know it...

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output
  2011-05-12 14:36                 ` [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output Ian Jackson
  2011-05-12 14:36                   ` [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax Ian Jackson
@ 2011-05-13 10:49                   ` Ian Campbell
  1 sibling, 0 replies; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 10:49 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> Commit the flex output into revision control, for the benefit of those
> without flex or with only very old flex.  This change is split into a
> separate patch for ease of review.  Generated with flex 2.5.35-10 on
> Debian squeeze i386, by running "make" in the libxl directory.  No
> manual changes in this commit.
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>
(without reading it, on the basis that its all autogenerated)

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax
  2011-05-12 14:36                   ` [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax Ian Jackson
  2011-05-12 14:36                     ` [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse Ian Jackson
@ 2011-05-13 12:45                     ` Ian Campbell
  2011-05-18 10:31                       ` Ian Jackson
  1 sibling, 1 reply; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 12:45 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 4270 bytes --]

Since this is a bit of a total rewrite I've attached the patched up
version of the file too for other people's convenience since the diff
itself is almost unusable, hence I have snipped most of the - lines in
the diff before commenting on the + bits.

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> ---
>  docs/misc/xl-disk-configuration.txt |  221 +++++++++++++++++++---------------
>  1 files changed, 123 insertions(+), 98 deletions(-)
> 
> diff --git a/docs/misc/xl-disk-configuration.txt b/docs/misc/xl-disk-configuration.txt
> index 58332a9..90ba54e 100644
> --- a/docs/misc/xl-disk-configuration.txt
> +++ b/docs/misc/xl-disk-configuration.txt
> @@ -1,57 +1,99 @@
> +                     ---------------------
> +                     XL DISK CONFIGURATION
> +                     ---------------------
> 
> +This document specifies the xl config file format disk configuration
> +option.  It the following form:

            In ?

[...]
> +    disk = [ '<diskspec>', '<diskspec>', ... ]
[...]
> +where each diskspec is in this form:
> +
> +   [<key>=<value>|flag]*,
> +     [<target>, [<format>, [<vdev>, [<access>]]]],
> +     [<key>=<value>]*,
> +     [target=<target>]

The actual meaning of this is pretty opaque. The paragraphs following
"More formally" does a pretty good job of describing it but I still have
a few questions/misunderstandings.

It's not obvious that the "[<target>, [<format>, [<vdev>,
[<access>]]]]," bit specifies the "positional parameters" (I'm assuming
they do) nor is it mentioned in the text whether or not the positional
parameters must be contiguous if used.

Are you using "*" to mean "0 or 1 of the preceding element" as opposed
to "0 or more of the preceding element", I initially read it as the
second which confused me because it suggests that a valid syntax could
be
        [<key>=<value>|flag][<key>=<value>|flag][<key>=<value>|flag],
whereas I expected it would need to be
        [<key>=<value>|flag],[<key>=<value>|flag],[<key>=<value>|flag],
is the placement of either the "," or the "*" wrong and/or did you mean
"?" rather than "*"?

> +=====================
> +POSITIONAL PARAMETERS
> +=====================
> +
> +target
> +------
> +
> +Description:           Block device or image file path.  For a
> +                       physical block device a /dev will be prepended
>                         when not specified and when the path doesn't
> +                       start with a '/'.

Won't we prepend a /dev/ for any path, regardless of whether it is a
physical block device or an image file? Granted it's not likely to be
all that useful in the second case but we can't really distinguish the
two until too late.

[...]

> +Deprecated values are acceptable and are intended work compatibly with
> +xend and xl from xen 4.1.  In future they may print a warning.
> +Support for deprecated parameters and syntaxes are likely to be
> +dropped in future versions of xl.
> 
> +There is also support for a deprecated old syntax for <diskspec>:
> 
> +  [<format>:][<target>],<vdev>[:<devtype>],<access>   (deprecated)
> 
> +This syntax also supports deprecated prefixes, described below.  These
> +are found prepended to the format parameter - eg "tap:aio:qcow:".

Are valid <format>s a fixed list of existing formats which will not be
extended as list of supported formats grows in the future, IOW new
formats will only be available via the format positional paramter?
 
> 
> +<block-dev-type>:
> +-----------------

That tag doesn't appear anywhere in the syntax description, so it's not
clear where it is allowable. I'd assume it was <devtype> above if I
didn't know any better...

> +Description:           Specifies the block device type.
> +Supported values:      phy,file, tap, tap2
                              ^ whitespace
> 
> +<access-type>:
> +--------------

Spelled <access> above?

> +Description:           Backend implementation option to choose from
> +                       while accessing block device.
> +                       Example: tap:aio:vhd:/path/to/file
> +Supported values:      'aio', 'tapdisk', 'ioemu'
> --
> 1.7.2.5
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel


[-- Attachment #2: xl-disk-configuration.txt --]
[-- Type: text/plain, Size: 5669 bytes --]

                     ---------------------
                     XL DISK CONFIGURATION
                     ---------------------

This document specifies the xl config file format disk configuration
option.  It the following form:

    disk = [ '<diskspec>', '<diskspec>', ... ]

where each diskspec is in this form:

   [<key>=<value>|flag]*,
     [<target>, [<format>, [<vdev>, [<access>]]]],
     [<key>=<value>]*,
     [target=<target>]


For example, these strings are equivalent:

  /dev/vg/guest-volume,,hda
  /dev/vg/guest-volume,raw,hda,rw
  format=raw, vdev=xvda, access=rw, target=/dev/vg/guest-volume
  raw:/dev/vg/guest-volume,hda,w   (deprecated, see below)

As are these:

  /root/image.iso,,hdc,cdrom
  /root/image.iso,,hdc,,cdrom
  /root/image.iso,raw,hdc,devtype=cdrom
  format=raw, vdev=hdc, access=ro, devtype=cdrom, target=/root/image.iso
  raw:/root/image.iso,hdc:cdrom,ro   (deprecated, see below)

These might be specified in the domain config file like this:

  disk = [ '/dev/vg/guest-volume,,hda', '/root/image.iso,,hdc,cdrom' ]


More formally, the string is a series of comma-separated keyword/value
pairs, flags and positional parameters.  Parameters which are not bare
keywords and which do not contain "=" symbols are assigned to the
so-far-unspecified positional parameters, in the order below.  The
positional parameters may also be specified explicitly by name.

Each parameter may be specified at most once, either as a positional
parameter or a named parameter.  Default values apply if the parameter
is not specified, or if it is specified with an empty value (whether
positionally or explicitly).

Whitespace may appear before each parameter and will be ignored.


=====================
POSITIONAL PARAMETERS
=====================

target
------

Description:           Block device or image file path.  For a
                       physical block device a /dev will be prepended
                       when not specified and when the path doesn't
                       start with a '/'.
Supported values:      N/A
Deprecated values:     N/A
Default value:         None.  While a path is provided in most cases
                       there is an exception: for a cdrom device, lack
                       of this attribute would imply an empty cdrom
                       drive.

Special syntax:

   When this parameter is specified by name, ie with the "target="
   syntax in the configuration file, it consumes the whole rest of the
   <diskspec>.  Therefore in that case it must come last.  This is
   permissible even if an empty value for the target was already
   specifed as a positional parameter.  This is the only way to
   specify a target string containing metacharacters such as commas
   and (in some cases) colons, which would otherwise be
   misinterpreted.

   Future parameter and flag names will start with an ascii letter and
   contain only ascii alphanumerics, hyphens and underscores, and will
   not be legal as vdevs.  Targets which might match that syntax
   should not be specified as positional parameters.


format
------

Description:           Specifies the format of image file.
Supported values:      raw, qcow, qcow2, vhd
Deprecated values:     None
Default value:         raw


vdev
----

Description:           Virtual device as seen by the guest (also
                       referred to as guest drive designation in some
                       specifications).  See docs/misc/vbd-interface.txt.
Supported values:      hd[x], xvd[x], sd[x] etc.  Please refer to the
                       above specification for further details.
Deprecated values:     None
Default Value:         None, this parameter is mandatory.


access
-------

Description:           Specified access control information.  Whether
                       or not the block device is provided to the
                       guest in read-only or read-write mode depends
                       on this attribute.
Supported values:      ro, r   (specifies read-only)
                       rw, w   (specifies read/write)
Deprecated values:     None
Default value:         rw
                       unless devtype=cdrom, in which case r



==========================
OTHER PARAMETERS AND FLAGS
==========================


devtype=<devtype>
-----------------

Description:           Qualifies virtual device type.
Supported values:      cdrom
Deprecated values:     None
Mandatory:             No


cdrom
-----

Convenience alias for "devtype=cdrom".


script=<script>
---------------

Specifies that <target> is not a normal host path, but rather
information to be interpreted by /etc/xen/scripts/block-<script>.



==================================
DEPRECATED PARAMETERS AND PREFIXES
==================================

Deprecated values are acceptable and are intended work compatibly with
xend and xl from xen 4.1.  In future they may print a warning.
Support for deprecated parameters and syntaxes are likely to be
dropped in future versions of xl.

There is also support for a deprecated old syntax for <diskspec>:

  [<format>:][<target>],<vdev>[:<devtype>],<access>   (deprecated)

This syntax also supports deprecated prefixes, described below.  These
are found prepended to the format parameter - eg "tap:aio:qcow:".

<block-dev-type>:
-----------------

Description:           Specifies the block device type.
Supported values:      phy,file, tap, tap2

<access-type>:
--------------

Description:           Backend implementation option to choose from
                       while accessing block device.
                       Example: tap:aio:vhd:/path/to/file
Supported values:      'aio', 'tapdisk', 'ioemu'

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse
  2011-05-12 14:36                     ` [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse Ian Jackson
  2011-05-12 14:36                       ` [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk Ian Jackson
@ 2011-05-13 12:49                       ` Ian Campbell
  1 sibling, 0 replies; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 12:49 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, Ian Jackson

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> +static void parse_disk_config(XLU_Config **config, const char *spec,
> +                              libxl_device_disk *disk)
> +{
> +    parse_disk_config_multistring(config, 1,&spec, disk);
                                               ^ whitespace

Otherwise,
Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk
  2011-05-12 14:36                       ` [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk Ian Jackson
  2011-05-12 14:36                         ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Jackson
  2011-05-12 14:42                         ` [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk Ian Jackson
@ 2011-05-13 12:50                         ` Ian Campbell
  2 siblings, 0 replies; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 12:50 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, Ian Jackson

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> From: Ian Jackson <ijackson@chiark.greenend.org.uk>
> 
> Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk"
  2011-05-12 14:36                         ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Jackson
  2011-05-12 14:36                           ` [PATCH 14/14] xl: xl block-attach -N (dry run) option Ian Jackson
@ 2011-05-13 12:53                           ` Ian Campbell
  2011-06-02 16:57                             ` Ian Jackson
  1 sibling, 1 reply; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 12:53 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> [...]
> diff --git a/tools/libxl/libxlu_disk_l.l b/tools/libxl/libxlu_disk_l.l
> index 8e511ea..2738377 100644
> --- a/tools/libxl/libxlu_disk_l.l
> +++ b/tools/libxl/libxlu_disk_l.l
> @@ -100,6 +100,14 @@ static void setformat(DiskParseContext *dpc, const char *str) {
>      else xlu__disk_err(dpc,str,"unknown value for format");
>  }
> 
> +/* Sets ->backend based on the string value.  This ought to be an enum. */

Is this an old comment? Backend is a libxl_disk_backend, which _is_ an
enum.

> +static void setbackendtype(DiskParseContext *dpc, const char *str) {
> +    if (     !strcmp(str,"phy"))   DSET(dpc,backend,BACKEND,str,PHY);
> +    else if (!strcmp(str,"tap"))   DSET(dpc,backend,BACKEND,str,TAP);
> +    else if (!strcmp(str,"qdisk")) DSET(dpc,backend,BACKEND,str,QDISK);
> +    else xlu__disk_err(dpc,str,"unknown value for backendtype");
> +}
> +
>  #define DEPRECATE(usewhatinstead) /* not currently reported */
> 
>  %}

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 14/14] xl: xl block-attach -N (dry run) option
  2011-05-12 14:36                           ` [PATCH 14/14] xl: xl block-attach -N (dry run) option Ian Jackson
@ 2011-05-13 12:56                             ` Ian Campbell
  0 siblings, 0 replies; 36+ messages in thread
From: Ian Campbell @ 2011-05-13 12:56 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> This is mainly for debugging purposes at the moment.  Eventually I
> hope all commands will gain this so that -N will be a global option.

A few existing commands take a -n with the same meaning (create,
cpucpoolcreate). A bunch of others use -n for something else.

I'm unsure what to suggest we do about that. Using -N, with -n as an
alias where it already exists, seems sensible enough I suppose.

> In the meantime this new option is not documented and should be
> regarded as unstable.
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

> ---
>  tools/libxl/xl_cmdimpl.c |   34 +++++++++++++++++++++++++++++++---
>  1 files changed, 31 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index ccffd26..a8b3f9f 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -3930,13 +3930,25 @@ int main_networkdetach(int argc, char **argv)
>  
>  int main_blockattach(int argc, char **argv)
>  {
> -    int opt;
> +    int opt, dry_run = 0;
>      uint32_t fe_domid, be_domid = 0;
>      libxl_device_disk disk = { 0 };
>      XLU_Config *config = 0;
>  
> -    if ((opt = def_getopt(argc, argv, "", "block-attach", 2)) != -1)
> -        return opt;
> +    while ((opt = getopt(argc, argv, "Nh")) != -1) {

You've undone part of 23299:39f2942fe56b here.

> +        switch (opt) {
> +        case 'N':
> +            /* fixme this should become a global option eventually */
> +            dry_run = 1;
> +            break;
> +        case 'h':
> +            help("block-attach");
> +            return 0;
> +        default:
> +            fprintf(stderr, "option `%c' not supported.\n", optopt);
> +            break;
> +        }
> +    }
>      if ((argc-optind < 2)) {
>          help("block-attach");
>          return 2;
> @@ -3953,6 +3965,22 @@ int main_blockattach(int argc, char **argv)
>  
>      disk.backend_domid = be_domid;
>  
> +    if (dry_run) {
> +        /* fixme: this should be generated from the idl */
> +        /* fixme: enums (backend, format) should be converted to strings */

Yes, that'd be good.

> +        printf("disk.backend_domid = %"PRIx32"\n", disk.backend_domid);
> +        printf("disk.pdev_path =     %s\n",        disk.pdev_path);
> +        printf("disk.vdev =          %s\n",        disk.vdev);
> +        printf("disk.backend =       %d\n",        disk.backend);
> +        printf("disk.format =        %d\n",        disk.format);
> +        printf("disk.script =        %s\n",        disk.script);
> +        printf("disk.removable =     %d\n",        disk.removable);
> +        printf("disk.readwrite =     %d\n",        disk.readwrite);
> +        printf("disk.is_cdrom =      %d\n",        disk.is_cdrom);
> +        if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
> +        return 0;
> +    }
> +
>      if (libxl_device_disk_add(ctx, fe_domid, &disk)) {
>          fprintf(stderr, "libxl_device_disk_add failed.\n");
>      }

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax
  2011-05-13 12:45                     ` [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax Ian Campbell
@ 2011-05-18 10:31                       ` Ian Jackson
  2011-05-20  9:27                         ` Ian Campbell
  0 siblings, 1 reply; 36+ messages in thread
From: Ian Jackson @ 2011-05-18 10:31 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("Re: [Xen-devel] [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax"):
> Since this is a bit of a total rewrite I've attached the patched up
> version of the file too for other people's convenience since the diff
> itself is almost unusable, hence I have snipped most of the - lines in
> the diff before commenting on the + bits.

Right.

> > +where each diskspec is in this form:
> > +
> > +   [<key>=<value>|flag]*,
> > +     [<target>, [<format>, [<vdev>, [<access>]]]],
> > +     [<key>=<value>]*,
> > +     [target=<target>]
> 
> The actual meaning of this is pretty opaque. The paragraphs following
> "More formally" does a pretty good job of describing it but I still have
> a few questions/misunderstandings.

Do you think I should get rid of this template ?

> It's not obvious that the "[<target>, [<format>, [<vdev>,
> [<access>]]]]," bit specifies the "positional parameters" (I'm assuming
> they do) nor is it mentioned in the text whether or not the positional
> parameters must be contiguous if used.
> 
> Are you using "*" to mean "0 or 1 of the preceding element" as opposed
> to "0 or more of the preceding element", I initially read it as the
> second which confused me because it suggests that a valid syntax could
> be
>         [<key>=<value>|flag][<key>=<value>|flag][<key>=<value>|flag],
> whereas I expected it would need to be
>         [<key>=<value>|flag],[<key>=<value>|flag],[<key>=<value>|flag],
> is the placement of either the "," or the "*" wrong and/or did you mean
> "?" rather than "*"?

No, it's just that the placement of the "," is wrong.

> > +Description:           Block device or image file path.  For a
> > +                       physical block device a /dev will be prepended
> >                         when not specified and when the path doesn't
> > +                       start with a '/'.
> 
> Won't we prepend a /dev/ for any path, regardless of whether it is a
> physical block device or an image file? Granted it's not likely to be
> all that useful in the second case but we can't really distinguish the
> two until too late.

Yes, this is a good point.

> > +Deprecated values are acceptable and are intended work compatibly with
> > +xend and xl from xen 4.1.  In future they may print a warning.
> > +Support for deprecated parameters and syntaxes are likely to be
> > +dropped in future versions of xl.
> > 
> > +There is also support for a deprecated old syntax for <diskspec>:
> > 
> > +  [<format>:][<target>],<vdev>[:<devtype>],<access>   (deprecated)
> > 
> > +This syntax also supports deprecated prefixes, described below.  These
> > +are found prepended to the format parameter - eg "tap:aio:qcow:".
> 
> Are valid <format>s a fixed list of existing formats which will not be
> extended as list of supported formats grows in the future, IOW new
> formats will only be available via the format positional paramter?

That is correct.

> > +<block-dev-type>:
> > +-----------------
> 
> That tag doesn't appear anywhere in the syntax description, so it's not
> clear where it is allowable. I'd assume it was <devtype> above if I
> didn't know any better...
> 
> > +Description:           Specifies the block device type.
> > +Supported values:      phy,file, tap, tap2
>                               ^ whitespace

I think this is a leftover which should be deleted.

> > +<access-type>:
> > +--------------
> 
> Spelled <access> above?

No.  It should be backend-type.

I will send out a fixed version.

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax
  2011-05-18 10:31                       ` Ian Jackson
@ 2011-05-20  9:27                         ` Ian Campbell
  2011-05-20 10:21                           ` Ian Jackson
  0 siblings, 1 reply; 36+ messages in thread
From: Ian Campbell @ 2011-05-20  9:27 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Wed, 2011-05-18 at 11:31 +0100, Ian Jackson wrote:
> 
> > > +where each diskspec is in this form:
> > > +
> > > +   [<key>=<value>|flag]*,
> > > +     [<target>, [<format>, [<vdev>, [<access>]]]],
> > > +     [<key>=<value>]*,
> > > +     [target=<target>]
> > 
> > The actual meaning of this is pretty opaque. The paragraphs following
> > "More formally" does a pretty good job of describing it but I still have
> > a few questions/misunderstandings.
> 
> Do you think I should get rid of this template ? 

I think it would be ok if you correct the * placements etc. Having some
sort of (semi-)formal syntax declaration in addition to the wordy
description is useful IMHO.

Would the syntax be clearer as a BNF style thing rather than a regexp-y
thing? e.g. this would allow "[<target>, [<format>, [<vdev>,
[<access>]]]]," to be declared as "POSITIONAL_PARAMETERS := ..." making
the syntax a little more self-documenting and "KEY := ..." could be
defined with reference to the relevant following sections etc.

Should the second "<key>=<value>" usage also have a "|flag"?

I presume "key" can also == "target" and can be the non-ultimate key so
long as the value does not contain any problematic characters. In this
case the explicit target= needs to be marked as optional.

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax
  2011-05-20  9:27                         ` Ian Campbell
@ 2011-05-20 10:21                           ` Ian Jackson
  2011-05-20 10:26                             ` Ian Campbell
  0 siblings, 1 reply; 36+ messages in thread
From: Ian Jackson @ 2011-05-20 10:21 UTC (permalink / raw)
  To: xen-devel

Ian Campbell writes ("Re: [Xen-devel] [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax"):
> I think it would be ok if you correct the * placements etc. Having some
> sort of (semi-)formal syntax declaration in addition to the wordy
> description is useful IMHO.
> 
> Would the syntax be clearer as a BNF style thing rather than a regexp-y
> thing? e.g. this would allow "[<target>, [<format>, [<vdev>,
> [<access>]]]]," to be declared as "POSITIONAL_PARAMETERS := ..." making
> the syntax a little more self-documenting and "KEY := ..." could be
> defined with reference to the relevant following sections etc.

The trouble with bnf is that it all comes out of order -
self-assembly, so to speak.

> Should the second "<key>=<value>" usage also have a "|flag"?

Yes.

> I presume "key" can also == "target" and can be the non-ultimate key so
> long as the value does not contain any problematic characters. In this
> case the explicit target= needs to be marked as optional.

No, general "key" may not be "target".  "target=" always eats the rest
of the string.

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax
  2011-05-20 10:21                           ` Ian Jackson
@ 2011-05-20 10:26                             ` Ian Campbell
  0 siblings, 0 replies; 36+ messages in thread
From: Ian Campbell @ 2011-05-20 10:26 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Fri, 2011-05-20 at 11:21 +0100, Ian Jackson wrote:
> Ian Campbell writes ("Re: [Xen-devel] [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax"):
> > I think it would be ok if you correct the * placements etc. Having some
> > sort of (semi-)formal syntax declaration in addition to the wordy
> > description is useful IMHO.
> > 
> > Would the syntax be clearer as a BNF style thing rather than a regexp-y
> > thing? e.g. this would allow "[<target>, [<format>, [<vdev>,
> > [<access>]]]]," to be declared as "POSITIONAL_PARAMETERS := ..." making
> > the syntax a little more self-documenting and "KEY := ..." could be
> > defined with reference to the relevant following sections etc.
> 
> The trouble with bnf is that it all comes out of order -
> self-assembly, so to speak.
> 
> > Should the second "<key>=<value>" usage also have a "|flag"?
> 
> Yes.
> 
> > I presume "key" can also == "target" and can be the non-ultimate key so
> > long as the value does not contain any problematic characters. In this
> > case the explicit target= needs to be marked as optional.
> 
> No, general "key" may not be "target".  "target=" always eats the rest
> of the string.

Oh, yes, that's pretty obvious now I think about it...

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts
  2011-05-13 10:35           ` [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts Ian Campbell
@ 2011-06-02 16:48             ` Ian Jackson
  0 siblings, 0 replies; 36+ messages in thread
From: Ian Jackson @ 2011-06-02 16:48 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel, Ian Jackson

Ian Campbell writes ("Re: [Xen-devel] [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts"):
> On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> > This is not currently implemented.  Applications setting it to
> > anything but NULL will cause an error.  Code to set it from xl
> > configuration files will appear later in this series.
> > 
> > Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Is there (going to be) a spec of what such scripts must do, are and are
> not allowed to do etc? (apologies if this comes later in the series)

Yes, there is, but it doesn't currently exist.  xend supports these so
some reverse-engineering is needed.

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work
  2011-05-13 10:38               ` [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Ian Campbell
@ 2011-06-02 16:48                 ` Ian Jackson
  0 siblings, 0 replies; 36+ messages in thread
From: Ian Jackson @ 2011-06-02 16:48 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("Re: [Xen-devel] [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work"):
> On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> > libxl callers should not be required to specify the backend if they
> > don't want to.  So LIBXL_DISK_BACKEND_UNKNOWN should instruct libxl to
> > choose the backend for itself.
> 
> I guess the selection of LIBXL_DISK_BACKEND_TAP was chosen to give the
> greatest coverage as a stop gap measure until more smarts arrive? (It'll
> fall back to QDISK as necessary too, which is nice). 

Indeed.  This is wrong, at the moment.  Also the patch was missing the
block attach case.  So I will resend it.

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 08/14] libxl: disks: new xlu_disk_parse function
  2011-05-13 10:48                 ` [PATCH 08/14] libxl: disks: new xlu_disk_parse function Ian Campbell
@ 2011-06-02 16:50                   ` Ian Jackson
  0 siblings, 0 replies; 36+ messages in thread
From: Ian Jackson @ 2011-06-02 16:50 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("Re: [Xen-devel] [PATCH 08/14] libxl: disks: new xlu_disk_parse function"):
> On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> > [...]
...
> Something seems to be up with the leading whitespace here.

Fixed.

> > +   * string containing a collection of parameters (but they all refer
> > +   * to of the configuration for a single disk).
>            ^^ what is that doing there?

Fixed.

....
> This is the third time this week I've wondered if a patch ought to come
> along with a library of test inputs and expected outputs. I'll be
> proposing we switch to the waterfall model before you know it...

My series repost will include one, since it seemed useful.

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 00/14] libxl: disk configuration handling
  2011-05-13 10:33 ` [PATCH/RFC 00/14] libxl: disk configuration handling Ian Campbell
@ 2011-06-02 16:57   ` Ian Jackson
  0 siblings, 0 replies; 36+ messages in thread
From: Ian Jackson @ 2011-06-02 16:57 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("Re: [Xen-devel] [PATCH/RFC 00/14] libxl: disk configuration handling"):
> On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> > This is the latest version of my disk config parsing patch series.
> > 00-04  Hopefully uncontroversial cleanups and minor features.
> 
> For these:
> Acked-by: Ian Campbell <ian.campbell@citrix.com>

Thanks.  I have done some more testing on these and addressed your
comments

I will apply 1-6 which you acked.

> Although I'm not sure about the benefit of #4, it is consistent with
> e.g. free() accepting NULL so why not.

It helped me with a temporary debugging patch.  In this case
consistency and temporary convenience pointed the same way :-).

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk"
  2011-05-13 12:53                           ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Campbell
@ 2011-06-02 16:57                             ` Ian Jackson
  0 siblings, 0 replies; 36+ messages in thread
From: Ian Jackson @ 2011-06-02 16:57 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("Re: [Xen-devel] [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk""):
> On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> > +/* Sets ->backend based on the string value.  This ought to be an enum. */
> 
> Is this an old comment? Backend is a libxl_disk_backend, which _is_ an
> enum.

What I mean, now, is that the IDL should provide a table of these
strings, and there should be a standard conversion function, rather
than this open-coded list of strcmps.  I will update the comments.

Ian.

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2011-06-02 16:57 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-12 14:36 [PATCH/RFC 00/14] libxl: disk configuration handling Ian Jackson
2011-05-12 14:36 ` [PATCH 01/14] libxl: add missing copyright notices to some files Ian Jackson
2011-05-12 14:36   ` [PATCH 02/14] libxl: add missing copyright notices to autogenerated files Ian Jackson
2011-05-12 14:36     ` [PATCH 03/14] libxl: provide TOSTRING in libxl_internal.h and libxlu_internal.h Ian Jackson
2011-05-12 14:36       ` [PATCH 04/14] libxl: make libxl_ctx_free tolerate NULL ctx argument Ian Jackson
2011-05-12 14:36         ` [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts Ian Jackson
2011-05-12 14:36           ` [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable" Ian Jackson
2011-05-12 14:36             ` [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Ian Jackson
2011-05-12 14:36               ` [PATCH 08/14] libxl: disks: new xlu_disk_parse function Ian Jackson
2011-05-12 14:36                 ` [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output Ian Jackson
2011-05-12 14:36                   ` [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax Ian Jackson
2011-05-12 14:36                     ` [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse Ian Jackson
2011-05-12 14:36                       ` [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk Ian Jackson
2011-05-12 14:36                         ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Jackson
2011-05-12 14:36                           ` [PATCH 14/14] xl: xl block-attach -N (dry run) option Ian Jackson
2011-05-13 12:56                             ` Ian Campbell
2011-05-13 12:53                           ` [PATCH 13/14] libxl: disks: allow specification of "backendtype=phy|tap|qdisk" Ian Campbell
2011-06-02 16:57                             ` Ian Jackson
2011-05-12 14:42                         ` [PATCH 12/14] xl: disks: replace block-attach disk config parser with call to xlu_parse_disk Ian Jackson
2011-05-13 12:50                         ` Ian Campbell
2011-05-13 12:49                       ` [PATCH 11/14] xl: disks: replace config file disk spec parser with call to xlu_disk_parse Ian Campbell
2011-05-13 12:45                     ` [PATCH 10/14] docs: update xl-disk-configuration.txt to describe new syntax Ian Campbell
2011-05-18 10:31                       ` Ian Jackson
2011-05-20  9:27                         ` Ian Campbell
2011-05-20 10:21                           ` Ian Jackson
2011-05-20 10:26                             ` Ian Campbell
2011-05-13 10:49                   ` [PATCH 09/14] libxl: disks: commit libxlu_disk_l.[ch] flex output Ian Campbell
2011-05-13 10:48                 ` [PATCH 08/14] libxl: disks: new xlu_disk_parse function Ian Campbell
2011-06-02 16:50                   ` Ian Jackson
2011-05-13 10:38               ` [PATCH 07/14] libxl: disks: Make LIBXL_DISK_BACKEND_UNKNOWN work Ian Campbell
2011-06-02 16:48                 ` Ian Jackson
2011-05-13 10:36             ` [PATCH 06/14] libxl: disks: rename disk param "unpluggable" to "removable" Ian Campbell
2011-05-13 10:35           ` [PATCH 05/14] libxl: disks: expose new "script" parameter for external block scripts Ian Campbell
2011-06-02 16:48             ` Ian Jackson
2011-05-13 10:33 ` [PATCH/RFC 00/14] libxl: disk configuration handling Ian Campbell
2011-06-02 16:57   ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.