+++ /dev/null
-From 0cf02f586f50e0bc1b25f0ecf76207b2510d77df 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 32/48] 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, 14 insertions(+), 1 deletion(-)
-
-diff --git a/vma.c b/vma.c
-index c7c0538..4903568 100644
---- a/vma.c
-+++ b/vma.c
-@@ -294,7 +294,20 @@ static int extract_content(int argc, char **argv)
- }
-
- BlockDriverState *bs = bdrv_new();
-- if (errp || bdrv_open(&bs, devfn, NULL, NULL, flags, &errp)) {
-+
-+ 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,
- error_get_pretty(errp));
- }
---
-2.1.4
-