qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: alex@csgraf.de
To: qemu-devel@nongnu.org
Cc: Alexander Graf <alex@csgraf.de>
Subject: [Qemu-devel] [PATCH] Allow custom file sizes for backed files
Date: Mon, 11 May 2009 17:33:32 +0200	[thread overview]
Message-ID: <1242056012-20382-1-git-send-email-alex@csgraf.de> (raw)

From: Alexander Graf <alex@csgraf.de>

Currently when creating an image with a backing file enabled, the size
of the file is the same as the size of the backing file.

I don't see any reason why it has to be that way. Qcow2 even contains
code to handle the case where the backing file doesn't contain the data
we want to read from it, so we're fine here.

This patch allows to specify a size option even when using a backing
file. I tested that it works with a raw backed qcow2 file.

Signed-off-by: Alexander Graf <alex@csgraf.de>
---
 qemu-img.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index 29149a2..01fa059 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -271,9 +271,10 @@ static int img_create(int argc, char **argv)
         bdrv_get_geometry(bs, &size);
         size *= 512;
         bdrv_delete(bs);
-    } else {
-        if (optind >= argc)
-            help();
+    } else if (optind >= argc) {
+        help();
+    }
+    if (optind < argc) {
         p = argv[optind];
         sizef = strtod(p, (char **)&p);
         if (*p == 'M') {
-- 
1.6.0.2

                 reply	other threads:[~2009-05-11 15:33 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=1242056012-20382-1-git-send-email-alex@csgraf.de \
    --to=alex@csgraf.de \
    --cc=qemu-devel@nongnu.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).