]> git.proxmox.com Git - pve-qemu-kvm.git/commitdiff
vma: better driver guessing for bdrv_open
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 24 Feb 2016 12:56:16 +0000 (13:56 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 24 Feb 2016 15:26:58 +0000 (16:26 +0100)
debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch b/debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch
new file mode 100644 (file)
index 0000000..50b1d44
--- /dev/null
@@ -0,0 +1,42 @@
+From 97fe08940a43098fb033950ea8c46716a7476439 Mon Sep 17 00:00:00 2001
+From: Wolfgang Bumiller <w.bumiller@proxmox.com>
+Date: Tue, 23 Feb 2016 15:48:41 +0100
+Subject: [PATCH] vma: better driver guessing for bdrv_open
+
+Only use 'raw' when the file actually ends with .raw and
+no protocol has been specified. With protocol pass the
+BDRV_O_PROTOCOL flag to tell bdrv_fill_options() to take it
+into account.
+---
+ vma.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/vma.c b/vma.c
+index cc48013..1c4103f 100644
+--- a/vma.c
++++ b/vma.c
+@@ -301,10 +301,17 @@ static int extract_content(int argc, char **argv)
+             BlockDriverState *bs = bdrv_new();
+-          const char *tmp = g_strrstr(devfn, ".");
+-          const char *format = (tmp == NULL) ? "raw" : ++tmp;
+-          QDict *options = qdict_new();
+-          qdict_put(options, "driver", qstring_from_str(format));
++          size_t devlen = strlen(devfn);
++          bool protocol = path_has_protocol(devfn);
++          QDict *options = NULL;
++          if (devlen > 4 && strcmp(devfn+devlen-4, ".raw") == 0 && !protocol) {
++              /* explicit raw format */
++              options = qdict_new();
++              qdict_put(options, "driver", qstring_from_str("raw"));
++          } else if (protocol) {
++              /* tell bdrv_open to honor the protocol */
++              flags |= BDRV_O_PROTOCOL;
++          }
+           if (errp || bdrv_open(&bs, devfn, NULL, options, flags, &errp)) {
+                 g_error("can't open file %s - %s", devfn,
+-- 
+2.1.4
+
index 8a61d6bcac49c4e6f59de39e1d2cd0c985daf12d..379f0d1efa60cb5fcefdc570b36066cc73a35306 100644 (file)
@@ -40,6 +40,7 @@ pve/0039-qapi-qmp_mashal_-renames-for-get_link_status.patch
 pve/0040-vnc-make-x509-imply-tls-again.patch
 pve/0041-PVE-VNC-authentication.patch
 pve/0042-vma-writer-don-t-bail-out-on-zero-length-files.patch
+pve/0043-vma-better-driver-guessing-for-bdrv_open.patch
 extra/CVE-2015-8558-ehci_make_idt_processing_more_robust.patch
 extra/CVE-2015-8613-scsi-initialize-info-object.patch
 extra/CVE-2015-8701-net-rocker-off-by-one.patch