Commit 57ed25b1 authored by Max Reitz's avatar Max Reitz Committed by Stefan Hajnoczi
Browse files

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: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarBenoit Canet <benoit@irqsave.net>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent cc28c6aa
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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,