WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] xl: fix block-attach command parsing

To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] xl: fix block-attach command parsing
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Thu, 20 May 2010 14:39:46 -0700
Cc: Vincent Hanquez <Vincent.Hanquez@xxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Thu, 20 May 2010 14:40:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc12 Lightning/1.0b2pre Thunderbird/3.0.4
Fix two command-line parsing problems:
 - the argc check is wrong: it must be provided with the frontend device
 - the ro/rw mode is optional, so default to rw if it is absent

Also, update the usage message accordingly.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>

diff -r 0f0a25c4c991 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu May 20 09:18:33 2010 -0700
+++ b/tools/libxl/xl_cmdimpl.c  Thu May 20 14:37:24 2010 -0700
@@ -3444,7 +3444,7 @@
     uint32_t fe_domid, be_domid = 0;
     libxl_device_disk disk = { 0 };
 
-    if ((argc < 3) || (argc > 6)) {
+    if ((argc < 4) || (argc > 6)) {
         help("block-attach");
         exit(0);
     }
@@ -3489,7 +3489,7 @@
     }
     disk.virtpath = argv[3];
     disk.unpluggable = 1;
-    disk.readwrite = (argv[4][0] == 'w') ? 1 : 0;
+    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]);
diff -r 0f0a25c4c991 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c Thu May 20 09:18:33 2010 -0700
+++ b/tools/libxl/xl_cmdtable.c Thu May 20 14:37:24 2010 -0700
@@ -216,7 +216,7 @@
     { "block-attach",
       &main_blockattach,
       "Create a new virtual block device",
-      "<Domain> <BackDev> <FrontDev> <Mode> [BackDomain]",
+      "<Domain> <BackDev> <FrontDev> [<Mode>] [BackDomain]",
     },
     { "block-list",
       &main_blocklist,



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] xl: fix block-attach command parsing, Jeremy Fitzhardinge <=