diff options
author | Max Reitz <mreitz@redhat.com> | 2014-03-05 22:41:39 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-03-06 16:18:11 +0100 |
commit | 7dc74db88b1eb3cff12174d0448ecfb6cd0e2469 (patch) | |
tree | 3acd0451be36b358635c444164cfd5ccae0a8c6d /block | |
parent | 464d9f641d5a2382bd43d10ae41355edf69338b1 (diff) | |
download | qemu-7dc74db88b1eb3cff12174d0448ecfb6cd0e2469.zip qemu-7dc74db88b1eb3cff12174d0448ecfb6cd0e2469.tar.gz qemu-7dc74db88b1eb3cff12174d0448ecfb6cd0e2469.tar.bz2 |
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 <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/raw-win32.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/block/raw-win32.c b/block/raw-win32.c index ae1c8e6..0755434 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, |