All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-xen: Fix extendable images
@ 2008-07-01 11:51 Kevin Wolf
  2008-07-02 17:36 ` Ian Jackson
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2008-07-01 11:51 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

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

[-- Attachment #2: fix-extendable-images.patch --]
[-- Type: text/x-patch, Size: 2341 bytes --]

>From 2e45a5eb3a46e26f582f1cc0805a650b58c04109 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@suse.de>
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@suse.de>
---
 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


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-02 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-01 11:51 [PATCH] qemu-xen: Fix extendable images Kevin Wolf
2008-07-02 17:36 ` Ian Jackson

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.