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] qemu-xen: Fix extendable images

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] qemu-xen: Fix extendable images
From: Kevin Wolf <kwolf@xxxxxxx>
Date: Tue, 01 Jul 2008 13:51:09 +0200
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 01 Jul 2008 04:54:10 -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: Thunderbird 2.0.0.12 (X11/20071114)
Hi Ian,

I'm not completely sure about this one. The question is what you really
wanted to achieve with that BLOCK_DRIVER_FLAG_EXTENDABLE thing. I
suspect that you just put it into the wrong struct accidentally
(bdrv_host_device instead of bdrv_raw), but I might be wrong. Changing
it allows me to use qcow2 images through tap:ioemu again - in fact, I
think it fixes extendable images in general, i.e. also for HVM.

Please check if the attached patch makes sense and apply if appropriate.

Kevin
>From 2e45a5eb3a46e26f582f1cc0805a650b58c04109 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@xxxxxxx>
Date: Tue, 1 Jul 2008 14:19:30 +0200
Subject: [PATCH] qemu-xen: Fix extendable images

bdrv_file_open should specify raw image format instead of guessing. This fixes 
a segfault when bdrv_open2 wants to access drv->flags. bdrv_file_open is used 
at least by qcow2.

Additionally, move the extensible flag from bdrv_host_device to bdrv_raw. qcow2 
wants to open the image file as an extensible file.

Signed-off-by: Kevin Wolf <kwolf@xxxxxxx>
---
 block-raw-posix.c |    4 ++--
 block-raw-win32.c |    4 ++--
 block.c           |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/block-raw-posix.c b/block-raw-posix.c
index 44d8497..b1740d2 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -582,6 +582,8 @@ BlockDriver bdrv_raw = {
     .bdrv_pwrite = raw_pwrite,
     .bdrv_truncate = raw_truncate,
     .bdrv_getlength = raw_getlength,
+
+    .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE
 };
 
 /***********************************************/
@@ -942,6 +944,4 @@ BlockDriver bdrv_host_device = {
     .bdrv_set_locked = raw_set_locked,
     /* generic scsi device */
     .bdrv_ioctl = raw_ioctl,
-
-    .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE
 };
diff --git a/block-raw-win32.c b/block-raw-win32.c
index 428ff68..c94ad0e 100644
--- a/block-raw-win32.c
+++ b/block-raw-win32.c
@@ -399,6 +399,8 @@ BlockDriver bdrv_raw = {
     .bdrv_pwrite = raw_pwrite,
     .bdrv_truncate = raw_truncate,
     .bdrv_getlength = raw_getlength,
+
+    .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE
 };
 
 /***********************************************/
@@ -549,6 +551,4 @@ BlockDriver bdrv_host_device = {
     .bdrv_pread = raw_pread,
     .bdrv_pwrite = raw_pwrite,
     .bdrv_getlength = raw_getlength,
-
-    .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE;
 };
diff --git a/block.c b/block.c
index fd1fd35..b83e633 100644
--- a/block.c
+++ b/block.c
@@ -356,7 +356,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char 
*filename, int flags)
     bs = bdrv_new("");
     if (!bs)
         return -ENOMEM;
-    ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, NULL);
+    ret = bdrv_open2(bs, filename, flags | BDRV_O_FILE, &bdrv_raw);
     if (ret < 0) {
         bdrv_delete(bs);
         return ret;
-- 
1.5.4.5

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>