qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Benoît Canet" <benoit.canet@irqsave.net>
To: Max Reitz <mreitz@redhat.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Benoît Canet" <benoit.canet@irqsave.net>,
	qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/5] block/raw-posix: bdrv_parse_filename() for cdrom
Date: Sun, 9 Mar 2014 13:13:21 +0100	[thread overview]
Message-ID: <20140309121321.GA3307@irqsave.net> (raw)
In-Reply-To: <1394235585-10500-4-git-send-email-mreitz@redhat.com>

The Saturday 08 Mar 2014 à 00:39:43 (+0100), Max Reitz wrote :
> The "host_cdrom" protocol drivers should strip the "host_cdrom:" prefix
> from filenames if present.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  block/raw-posix.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index 4b8c183..697cd2e 100644
> --- a/block/raw-posix.c
> +++ b/block/raw-posix.c
> @@ -1983,7 +1983,20 @@ static BlockDriver bdrv_host_floppy = {
>      .bdrv_media_changed = floppy_media_changed,
>      .bdrv_eject         = floppy_eject,
>  };
> +#endif
>  
> +#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
> +static void cdrom_parse_filename(const char *filename, QDict *options,
> +                                 Error **errp)
> +{
> +    /* The prefix is optional, just as for "file". */
> +    strstart(filename, "host_cdrom:", &filename);
> +
> +    qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
> +}
> +#endif
> +
> +#ifdef __linux__
>  static int cdrom_open(BlockDriverState *bs, QDict *options, int flags,
>                        Error **errp)
>  {
> @@ -2070,6 +2083,7 @@ static BlockDriver bdrv_host_cdrom = {
>      .instance_size      = sizeof(BDRVRawState),
>      .bdrv_needs_filename = true,
>      .bdrv_probe_device	= cdrom_probe_device,
> +    .bdrv_parse_filename = cdrom_parse_filename,
>      .bdrv_file_open     = cdrom_open,
>      .bdrv_close         = raw_close,
>      .bdrv_reopen_prepare = raw_reopen_prepare,
> @@ -2200,6 +2214,7 @@ static BlockDriver bdrv_host_cdrom = {
>      .instance_size      = sizeof(BDRVRawState),
>      .bdrv_needs_filename = true,
>      .bdrv_probe_device	= cdrom_probe_device,
> +    .bdrv_parse_filename = cdrom_parse_filename,
>      .bdrv_file_open     = cdrom_open,
>      .bdrv_close         = raw_close,
>      .bdrv_reopen_prepare = raw_reopen_prepare,
> -- 
> 1.9.0
> 
Reviewed-by: Benoit Canet <benoit@irqsave.net>

  reply	other threads:[~2014-03-09 12:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 23:39 [Qemu-devel] [PATCH v2 0/5] block: Strip protocol prefixes from filenames Max Reitz
2014-03-07 23:39 ` [Qemu-devel] [PATCH v2 1/5] block/raw-posix: bdrv_parse_filename() for hdev Max Reitz
2014-03-07 23:39 ` [Qemu-devel] [PATCH v2 2/5] block/raw-posix: bdrv_parse_filename() for floppy Max Reitz
2014-03-07 23:39 ` [Qemu-devel] [PATCH v2 3/5] block/raw-posix: bdrv_parse_filename() for cdrom Max Reitz
2014-03-09 12:13   ` Benoît Canet [this message]
2014-03-07 23:39 ` [Qemu-devel] [PATCH v2 4/5] block/raw-posix: Strip protocol prefix on creation Max Reitz
2014-03-07 23:39 ` [Qemu-devel] [PATCH v2 5/5] block/raw-win32: bdrv_parse_filename() for hdev Max Reitz
2014-03-12 10:03 ` [Qemu-devel] [PATCH v2 0/5] block: Strip protocol prefixes from filenames Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140309121321.GA3307@irqsave.net \
    --to=benoit.canet@irqsave.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).