[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/3] xl: support xend empty cdrom device syntax
xend accepts `,hdc:cdrom,r' as an empty CDROM drive. However this is not consistent with the existing xl syntax in docs/misc/xl-disk-configuration.txt which requires `,,hdc:cdrom,r' (the additional positional paramter is the format). We fix this by spotting the case specially: when the target is empty and the format contains a colon, reinterpret the format as <vdev>:<devtype>. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> - Changes in v2: * Rebased on top of `xl: support empty CDROM devices' * Fix commit message. --- docs/misc/xl-disk-configuration.txt | 11 +++++++++++ tools/libxl/check-xl-disk-parse | 1 + tools/libxl/libxlu_disk_l.c | 16 ++++++++++------ tools/libxl/libxlu_disk_l.h | 2 +- tools/libxl/libxlu_disk_l.l | 6 +++++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/docs/misc/xl-disk-configuration.txt b/docs/misc/xl-disk-configuration.txt index 740b8f6..5da5e11 100644 --- a/docs/misc/xl-disk-configuration.txt +++ b/docs/misc/xl-disk-configuration.txt @@ -221,3 +221,14 @@ to specify several of these, for example: "tap:aio:/some/path..." All of these prefixes are now stripped and ignored. + + +Missing format and empty target +------------------------------- + +The following syntax is also supported: + + ,<vdev>:<devtype>,<access> (deprecated) + +This is soley for compatibility with xend's syntax for empty cdroms, +which is (for example) ",hdc:cdrom,r". diff --git a/tools/libxl/check-xl-disk-parse b/tools/libxl/check-xl-disk-parse index 7a33780..ffe3613 100755 --- a/tools/libxl/check-xl-disk-parse +++ b/tools/libxl/check-xl-disk-parse @@ -123,6 +123,7 @@ disk: { EOF one 0 devtype=cdrom,,,hdc one 0 ,,hdc:cdrom,r +one 0 ,hdc:cdrom,r one 0 vdev=hdc,access=r,devtype=cdrom,target= one 0 ,empty,hdc:cdrom,r diff --git a/tools/libxl/libxlu_disk_l.c b/tools/libxl/libxlu_disk_l.c index b4ad651..f690385 100644 --- a/tools/libxl/libxlu_disk_l.c +++ b/tools/libxl/libxlu_disk_l.c @@ -1404,7 +1404,11 @@ YY_RULE_SETUP SAVESTRING("target", pdev_path, yytext); } else if (!DPC->had_depr_prefix && DPC->disk->format == LIBXL_DISK_FORMAT_UNKNOWN) { - setformat(DPC,yytext); + if (!*DPC->disk->pdev_path && vdev_and_devtype(DPC,yytext)) { + DPC->disk->format = LIBXL_DISK_FORMAT_EMPTY; + } else { + setformat(DPC,yytext); + } } else if (!DPC->disk->vdev) { if (!vdev_and_devtype(DPC,yytext)) SAVESTRING("vdev", vdev, yytext); @@ -1419,7 +1423,7 @@ YY_RULE_SETUP YY_BREAK case 23: YY_RULE_SETUP -#line 233 "libxlu_disk_l.l" +#line 237 "libxlu_disk_l.l" { BEGIN(LEXERR); yymore(); @@ -1427,17 +1431,17 @@ YY_RULE_SETUP YY_BREAK case 24: YY_RULE_SETUP -#line 237 "libxlu_disk_l.l" +#line 241 "libxlu_disk_l.l" { xlu__disk_err(DPC,yytext,"bad disk syntax"); return 0; } YY_BREAK case 25: YY_RULE_SETUP -#line 240 "libxlu_disk_l.l" +#line 244 "libxlu_disk_l.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1441 "libxlu_disk_l.c" +#line 1445 "libxlu_disk_l.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(LEXERR): yyterminate(); @@ -2529,4 +2533,4 @@ void xlu__disk_yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 240 "libxlu_disk_l.l" +#line 244 "libxlu_disk_l.l" diff --git a/tools/libxl/libxlu_disk_l.h b/tools/libxl/libxlu_disk_l.h index 4d0328e..26c9a86 100644 --- a/tools/libxl/libxlu_disk_l.h +++ b/tools/libxl/libxlu_disk_l.h @@ -340,7 +340,7 @@ extern int xlu__disk_yylex (yyscan_t yyscanner); #undef YY_DECL #endif -#line 240 "libxlu_disk_l.l" +#line 244 "libxlu_disk_l.l" #line 346 "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 7e0a635..f4e6b1a 100644 --- a/tools/libxl/libxlu_disk_l.l +++ b/tools/libxl/libxlu_disk_l.l @@ -217,7 +217,11 @@ phy:/.* { DPC->had_depr_prefix=1; DEPRECATE(0); } SAVESTRING("target", pdev_path, yytext); } else if (!DPC->had_depr_prefix && DPC->disk->format == LIBXL_DISK_FORMAT_UNKNOWN) { - setformat(DPC,yytext); + if (!*DPC->disk->pdev_path && vdev_and_devtype(DPC,yytext)) { + DPC->disk->format = LIBXL_DISK_FORMAT_EMPTY; + } else { + setformat(DPC,yytext); + } } else if (!DPC->disk->vdev) { if (!vdev_and_devtype(DPC,yytext)) SAVESTRING("vdev", vdev, yytext); -- 1.7.2.5 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |