qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/5] block/raw-posix: Implement bdrv_parse_filen


From: Benoît Canet
Subject: Re: [Qemu-devel] [PATCH 2/5] block/raw-posix: Implement bdrv_parse_filename()
Date: Thu, 6 Mar 2014 14:03:30 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

The Wednesday 05 Mar 2014 à 22:41:37 (+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-posix.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index 161ea14..892145c 100644
> --- a/block/raw-posix.c
> +++ b/block/raw-posix.c
> @@ -336,6 +336,17 @@ error:
>  }
>  #endif
>  
> +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),
> @@ -1412,6 +1423,7 @@ static BlockDriver bdrv_file = {
>      .instance_size = sizeof(BDRVRawState),
>      .bdrv_needs_filename = true,
>      .bdrv_probe = NULL, /* no probe for protocols */
> +    .bdrv_parse_filename = raw_parse_filename,
>      .bdrv_file_open = raw_open,
>      .bdrv_reopen_prepare = raw_reopen_prepare,
>      .bdrv_reopen_commit = raw_reopen_commit,
> -- 
> 1.9.0
> 
> 
Reviewed-by: Benoit Canet <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]