]> xenbits.xensource.com Git - qemu-xen-4.0-testing.git/commitdiff
qemu-xen: Fix extendable images iwj.block-rw-rangecheck
authorIan Jackson <iwj@mariner.uk.xensource.com>
Wed, 2 Jul 2008 17:38:07 +0000 (18:38 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 2 Jul 2008 17:38:07 +0000 (18:38 +0100)
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
block-raw-win32.c
block.c

index 050683624ae1a0285f8f6b8b92e94d16c5115a3b..c3252c9e9d0a664aefbf86d9ed4b83726b23250d 100644 (file)
@@ -565,6 +565,8 @@ BlockDriver bdrv_raw = {
     .bdrv_pwrite = raw_pwrite,
     .bdrv_truncate = raw_truncate,
     .bdrv_getlength = raw_getlength,
+
+    .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE
 };
 
 /***********************************************/
@@ -923,6 +925,4 @@ BlockDriver bdrv_host_device = {
     .bdrv_set_locked = raw_set_locked,
     /* generic scsi device */
     .bdrv_ioctl = raw_ioctl,
-
-    .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE
 };
index 77d1936b863b5e98e7648e162baa58cc310bb04d..c755d35d789d08228cea1f72930ff160962ebb4c 100644 (file)
@@ -395,6 +395,8 @@ BlockDriver bdrv_raw = {
     .bdrv_pwrite = raw_pwrite,
     .bdrv_truncate = raw_truncate,
     .bdrv_getlength = raw_getlength,
+
+    .bdrv_flags = BLOCK_DRIVER_FLAG_EXTENDABLE
 };
 
 /***********************************************/
@@ -545,6 +547,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 8932ff845517e64cdcc5aff44ff73ce387f0fcfc..efed58f58cc7121883d652a99d2eb881a5729c7a 100644 (file)
--- a/block.c
+++ b/block.c
@@ -332,7 +332,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;