From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 3/3] xl: support xend empty cdrom device syntax
Date: Wed, 25 Jul 2012 17:08:06 +0100 [thread overview]
Message-ID: <1343232486-2943-4-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1343232486-2943-1-git-send-email-ian.jackson@eu.citrix.com>
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@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
-
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
next prev parent reply other threads:[~2012-07-25 16:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 16:08 [PATCH v2 0/3] xl: empty disk devices Ian Jackson
2012-07-25 16:08 ` [PATCH 1/3] xl: support empty CDROM devices Ian Jackson
2012-07-25 16:08 ` [PATCH 2/3] xl: disk parsing preparation for empty cdrom devices Ian Jackson
2012-07-25 16:08 ` Ian Jackson [this message]
2012-07-26 9:35 ` [PATCH v2 0/3] xl: empty disk devices Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343232486-2943-4-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=ian.campbell@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).