All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Xen-devel <xen-devel@lists.xensource.com>
Cc: Vincent Hanquez <Vincent.Hanquez@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: [PATCH] xl: fix block-attach command parsing
Date: Thu, 20 May 2010 14:39:46 -0700	[thread overview]
Message-ID: <4BF5AC22.2040409@goop.org> (raw)

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@citrix.com>

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,

                 reply	other threads:[~2010-05-20 21:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4BF5AC22.2040409@goop.org \
    --to=jeremy@goop.org \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=Vincent.Hanquez@eu.citrix.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.