summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2014-03-08 00:39:45 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-03-13 14:42:25 +0100
commit57ed25b1b08a43f29326df064d43b6420a23b5ba (patch)
tree0b687b870317f3e77a50434764aa6c5ac1e6a8b8 /block
parentcc28c6aa46334be01f3e65a74601ae38f94bd602 (diff)
downloadqemu-57ed25b1b08a43f29326df064d43b6420a23b5ba.tar.gz
block/raw-win32: bdrv_parse_filename() for hdev
The "host_device" protocol driver should strip the "host_device:" prefix from filenames if present. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/raw-win32.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/block/raw-win32.c b/block/raw-win32.c
index 99547488e4..48cb2c2258 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -593,6 +593,15 @@ static int hdev_probe_device(const char *filename)
return 0;
}
+static void hdev_parse_filename(const char *filename, QDict *options,
+ Error **errp)
+{
+ /* The prefix is optional, just as for "file". */
+ strstart(filename, "host_device:", &filename);
+
+ qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
+}
+
static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
@@ -663,6 +672,7 @@ static BlockDriver bdrv_host_device = {
.protocol_name = "host_device",
.instance_size = sizeof(BDRVRawState),
.bdrv_needs_filename = true,
+ .bdrv_parse_filename = hdev_parse_filename,
.bdrv_probe_device = hdev_probe_device,
.bdrv_file_open = hdev_open,
.bdrv_close = raw_close,