From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Jackson <ijackson@chiark.greenend.org.uk>
Subject: [PATCH] xl: replace block-attach disk config parser with call to xlu_parse_disk
Date: Thu, 24 Mar 2011 17:49:49 +0000 [thread overview]
Message-ID: <1300988989-18305-4-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1300988989-18305-3-git-send-email-ian.jackson@eu.citrix.com>
From: Ian Jackson <ijackson@chiark.greenend.org.uk>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
tools/libxl/xl_cmdimpl.c | 37 ++-----------------------------------
1 files changed, 2 insertions(+), 35 deletions(-)
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 416de46..b1bc724 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4281,9 +4281,9 @@ 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;
while ((opt = getopt(argc, argv, "h")) != -1) {
switch (opt) {
@@ -4300,40 +4300,7 @@ int main_blockattach(int argc, char **argv)
return 0;
}
- tok = strtok(argv[optind+1], ":");
- if (!strcmp(tok, "phy")) {
- disk.backend = DISK_BACKEND_PHY;
- } else if (!strcmp(tok, "file")) {
- disk.backend = DISK_BACKEND_TAP;
- } else if (!strcmp(tok, "tap")) {
- tok = strtok(NULL, ":");
- if (!strcmp(tok, "aio")) {
- disk.backend = DISK_BACKEND_TAP;
- } else if (!strcmp(tok, "vhd")) {
- disk.format = DISK_FORMAT_VHD;
- disk.backend = DISK_BACKEND_TAP;
- } else if (!strcmp(tok, "qcow")) {
- disk.format = DISK_FORMAT_QCOW;
- disk.backend = DISK_BACKEND_QDISK;
- } else if (!strcmp(tok, "qcow2")) {
- disk.format = DISK_FORMAT_QCOW2;
- disk.backend = 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.unpluggable = 1;
- disk.readwrite = ((argc-optind <= 3) || (argv[optind+3][0] == 'w'));
+ parse_disk_config(&config, &disk, argv[optind+1]);
if (domain_qualifier_to_domid(argv[optind], &fe_domid, 0) < 0) {
fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);
--
1.5.6.5
next prev parent reply other threads:[~2011-03-24 17:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-24 17:49 [PATCH] libxl: move TOSTRING to libxl_internal.h Ian Jackson
2011-03-24 17:49 ` [PATCH] libxl: new xlu_disk_parse function Ian Jackson
2011-03-24 17:49 ` [PATCH] xl: replace config file disk spec parser with call to xlu_disk_parse Ian Jackson
2011-03-24 17:49 ` Ian Jackson [this message]
2011-03-28 17:31 ` [PATCH] libxl: new xlu_disk_parse function Gianni Tedesco
2011-03-28 18:13 ` Stefano Stabellini
2011-03-29 9:10 ` Ian Campbell
2011-03-31 17:33 ` Ian Jackson
2011-04-01 15:28 ` Stefano Stabellini
2011-03-31 17:30 ` Ian Jackson
2011-04-02 8:51 ` Ian Campbell
2011-04-04 11:29 ` Stefano Stabellini
2011-04-14 7:20 ` Gianni Tedesco
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=1300988989-18305-4-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=ijackson@chiark.greenend.org.uk \
--cc=xen-devel@lists.xensource.com \
/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).