From: Max Reitz Date: Wed, 5 Mar 2014 21:41:39 +0000 (+0100) Subject: block/raw-win32: Implement bdrv_parse_filename() X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~386^2~42^2~119^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7dc74db88b1eb3cff12174d0448ecfb6cd0e2469;p=sdk%2Femulator%2Fqemu.git block/raw-win32: Implement bdrv_parse_filename() The "file" protocol driver should strip the "file:" prefix from filenames if present. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoit Canet Signed-off-by: Kevin Wolf --- diff --git a/block/raw-win32.c b/block/raw-win32.c index ae1c8e6cca..0755434732 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -251,6 +251,17 @@ static void raw_parse_flags(int flags, int *access_flags, DWORD *overlapped) } } +static void raw_parse_filename(const char *filename, QDict *options, + Error **errp) +{ + /* The filename does not have to be prefixed by the protocol name, since + * "file" is the default protocol; therefore, the return value of this + * function call can be ignored. */ + strstart(filename, "file:", &filename); + + qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename))); +} + static QemuOptsList raw_runtime_opts = { .name = "raw", .head = QTAILQ_HEAD_INITIALIZER(raw_runtime_opts.head), @@ -504,6 +515,7 @@ static BlockDriver bdrv_file = { .protocol_name = "file", .instance_size = sizeof(BDRVRawState), .bdrv_needs_filename = true, + .bdrv_parse_filename = raw_parse_filename, .bdrv_file_open = raw_open, .bdrv_close = raw_close, .bdrv_create = raw_create,