[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xl: block-attach command line parsing



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1275891182 -3600
# Node ID aaef5d82344df4d94e46f73a4f2284ceb081e99e
# Parent  62447b8e0f2653aef259530c72504b1773135e66
xl: block-attach command line parsing

Command line arguments start at argv[2].

Signed-off-by: Eric Chanudet <eric.chanudet@xxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff -r 62447b8e0f26 -r aaef5d82344d tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon Jun 07 07:12:20 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Mon Jun 07 07:13:02 2010 +0100
@@ -3637,7 +3637,7 @@ int main_blockattach(int argc, char **ar
     uint32_t fe_domid, be_domid = 0;
     libxl_device_disk disk = { 0 };
 
-    if ((argc < 4) || (argc > 6)) {
+    if ((argc < 5) || (argc > 7)) {
         help("block-attach");
         exit(0);
     }
@@ -3652,7 +3652,7 @@ int main_blockattach(int argc, char **ar
         }
     }
 
-    tok = strtok(argv[2], ":");
+    tok = strtok(argv[3], ":");
     if (!strcmp(tok, "phy")) {
         disk.phystype = PHYSTYPE_PHY;
     } else if (!strcmp(tok, "file")) {
@@ -3680,17 +3680,17 @@ int main_blockattach(int argc, char **ar
         fprintf(stderr, "Error: missing path to disk image.\n");
         exit(1);
     }
-    disk.virtpath = argv[3];
+    disk.virtpath = argv[4];
     disk.unpluggable = 1;
-    disk.readwrite = (argc <= 4 || argv[4][0] == 'w') ? 1 : 0;
-
-    if (domain_qualifier_to_domid(argv[1], &fe_domid, 0) < 0) {
-        fprintf(stderr, "%s is an invalid domain identifier\n", argv[1]);
+    disk.readwrite = ((argc <= 4) || (argv[5][0] == 'w'));
+
+    if (domain_qualifier_to_domid(argv[2], &fe_domid, 0) < 0) {
+        fprintf(stderr, "%s is an invalid domain identifier\n", argv[2]);
         exit(1);
     }
-    if (argc == 6) {
-        if (domain_qualifier_to_domid(argv[5], &be_domid, 0) < 0) {
-            fprintf(stderr, "%s is an invalid domain identifier\n", argv[5]);
+    if (argc == 7) {
+        if (domain_qualifier_to_domid(argv[6], &be_domid, 0) < 0) {
+            fprintf(stderr, "%s is an invalid domain identifier\n", argv[6]);
             exit(1);
         }
     }

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.