qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] Allow custom file sizes for backed files


From: alex
Subject: [Qemu-devel] [PATCH] Allow custom file sizes for backed files
Date: Mon, 11 May 2009 17:33:32 +0200

From: Alexander Graf <address@hidden>

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 <address@hidden>
---
 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 via email to

[Prev in Thread] Current Thread [Next in Thread]