[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/5] block/raw-win32: bdrv_parse_filename() for hdev
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH 5/5] block/raw-win32: bdrv_parse_filename() for hdev |
Date: |
Thu, 6 Mar 2014 23:27:41 +0100 |
The "host_device" protocol driver should strip the "host_device:" prefix
from filenames if present.
Signed-off-by: Max Reitz <address@hidden>
---
block/raw-win32.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/block/raw-win32.c b/block/raw-win32.c
index 9954748..48cb2c2 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,
--
1.9.0
- [Qemu-devel] [PATCH 0/5] block: Strip protocol prefixes from filenames, Max Reitz, 2014/03/06
- [Qemu-devel] [PATCH 1/5] block/raw-posix: bdrv_parse_filename() for hdev, Max Reitz, 2014/03/06
- [Qemu-devel] [PATCH 2/5] block/raw-posix: bdrv_parse_filename() for floppy, Max Reitz, 2014/03/06
- [Qemu-devel] [PATCH 3/5] block/raw-posix: bdrv_parse_filename() for cdrom, Max Reitz, 2014/03/06
- [Qemu-devel] [PATCH 4/5] block/raw-posix: Strip protocol prefix on creation, Max Reitz, 2014/03/06
- [Qemu-devel] [PATCH 4/5] block/raw-posix: Strip protocol prefix on creation, Max Reitz, 2014/03/06