All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@suse.de>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: [PATCH] qemu-xen: Fix extendable images
Date: Tue, 01 Jul 2008 13:51:09 +0200	[thread overview]
Message-ID: <486A1A2D.7000203@suse.de> (raw)

[-- 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

             reply	other threads:[~2008-07-01 11:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 11:51 Kevin Wolf [this message]
2008-07-02 17:36 ` [PATCH] qemu-xen: Fix extendable images Ian Jackson

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=486A1A2D.7000203@suse.de \
    --to=kwolf@suse.de \
    --cc=Ian.Jackson@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.