[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 03/38] block: Fix the use of protocols in backing fi
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 03/38] block: Fix the use of protocols in backing files |
Date: |
Fri, 17 Dec 2010 18:44:18 +0100 |
From: Stefan Hajnoczi <address@hidden>
Backing filenames may contain a protocol. The code currently doesn't
consider this case and produces filenames that embed "<protocol>:".
Don't combine filenames if the backing filename contains a protocol.
Based on an earlier patch by Anthony Liguori <address@hidden>.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 65fce80..b4aaf41 100644
--- a/block.c
+++ b/block.c
@@ -611,10 +611,18 @@ int bdrv_open(BlockDriverState *bs, const char *filename,
int flags,
BlockDriver *back_drv = NULL;
bs->backing_hd = bdrv_new("");
- path_combine(backing_filename, sizeof(backing_filename),
- filename, bs->backing_file);
- if (bs->backing_format[0] != '\0')
+
+ if (path_has_protocol(bs->backing_file)) {
+ pstrcpy(backing_filename, sizeof(backing_filename),
+ bs->backing_file);
+ } else {
+ path_combine(backing_filename, sizeof(backing_filename),
+ filename, bs->backing_file);
+ }
+
+ if (bs->backing_format[0] != '\0') {
back_drv = bdrv_find_format(bs->backing_format);
+ }
/* backing files always opened read-only */
back_flags =
--
1.7.2.3
- [Qemu-devel] [PULL 00/38] Block patches, Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 04/38] Introduce strtosz_suffix(), Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 03/38] block: Fix the use of protocols in backing files,
Kevin Wolf <=
- [Qemu-devel] [PATCH 06/38] ide: split ide command interpretation off, Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 02/38] block: Introduce path_has_protocol() function, Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 10/38] ide: add ncq identify data for ahci sata drives, Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 11/38] pci: add storage class for sata, Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 09/38] ide: move transfer_start after variable modification, Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 05/38] qemu-img.c: Clean up handling of image size in img_create(), Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 01/38] blockdev: check dinfo ptr before using, Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 07/38] ide: fix whitespace gap in ide_exec_cmd, Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 14/38] config: move ide core and pci to pci.mak, Kevin Wolf, 2010/12/17
- [Qemu-devel] [PATCH 21/38] Prevent creating an image with the same filename as backing file, Kevin Wolf, 2010/12/17