[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/5] block/raw-win32: Implement bdrv_parse_filen
From: |
Benoît Canet |
Subject: |
Re: [Qemu-devel] [PATCH 4/5] block/raw-win32: Implement bdrv_parse_filename() |
Date: |
Thu, 6 Mar 2014 14:05:38 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
The Wednesday 05 Mar 2014 à 22:41:39 (+0100), Max Reitz wrote :
> The "file" protocol driver should strip the "file:" prefix from
> filenames if present.
>
> Signed-off-by: Max Reitz <address@hidden>
> ---
> block/raw-win32.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> 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,
> --
> 1.9.0
>
>
Reviewed-by: Benoit Canet <address@hidden>
- [Qemu-devel] [PATCH 0/5] block/raw: Strip "file:" prefix from filenames, Max Reitz, 2014/03/05
- [Qemu-devel] [PATCH 1/5] block: Keep "filename" option after parsing, Max Reitz, 2014/03/05
- [Qemu-devel] [PATCH 2/5] block/raw-posix: Implement bdrv_parse_filename(), Max Reitz, 2014/03/05
- [Qemu-devel] [PATCH 3/5] block/raw-posix: Strip "file:" prefix on creation, Max Reitz, 2014/03/05
- [Qemu-devel] [PATCH 4/5] block/raw-win32: Implement bdrv_parse_filename(), Max Reitz, 2014/03/05
- Re: [Qemu-devel] [PATCH 4/5] block/raw-win32: Implement bdrv_parse_filename(),
Benoît Canet <=
- [Qemu-devel] [PATCH 5/5] block/raw-win32: Strip "file:" prefix on creation, Max Reitz, 2014/03/05
- Re: [Qemu-devel] [PATCH 0/5] block/raw: Strip "file:" prefix from filenames, Eric Blake, 2014/03/05
- Re: [Qemu-devel] [PATCH 0/5] block/raw: Strip "file:" prefix from filenames, Kevin Wolf, 2014/03/06