qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Benoît Canet" <benoit.canet@irqsave.net>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH 5/5] block/raw-win32: bdrv_parse_filename() for hdev
Date: Thu,  6 Mar 2014 23:27:41 +0100	[thread overview]
Message-ID: <1394144861-2403-2-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1394144861-2403-1-git-send-email-mreitz@redhat.com>

The "host_device" protocol driver should strip the "host_device:" prefix
from filenames if present.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 block/raw-win32.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/block/raw-win32.c b/block/raw-win32.c
index 9954748..48cb2c2 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -593,6 +593,15 @@ static int hdev_probe_device(const char *filename)
     return 0;
 }
 
+static void hdev_parse_filename(const char *filename, QDict *options,
+                                Error **errp)
+{
+    /* The prefix is optional, just as for "file". */
+    strstart(filename, "host_device:", &filename);
+
+    qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename)));
+}
+
 static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
                      Error **errp)
 {
@@ -663,6 +672,7 @@ static BlockDriver bdrv_host_device = {
     .protocol_name	= "host_device",
     .instance_size	= sizeof(BDRVRawState),
     .bdrv_needs_filename = true,
+    .bdrv_parse_filename = hdev_parse_filename,
     .bdrv_probe_device	= hdev_probe_device,
     .bdrv_file_open	= hdev_open,
     .bdrv_close		= raw_close,
-- 
1.9.0

  reply	other threads:[~2014-03-06 22:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 22:25 [Qemu-devel] [PATCH 0/5] block: Strip protocol prefixes from filenames Max Reitz
2014-03-06 22:25 ` [Qemu-devel] [PATCH 1/5] block/raw-posix: bdrv_parse_filename() for hdev Max Reitz
2014-03-06 22:38   ` Benoît Canet
2014-03-06 22:25 ` [Qemu-devel] [PATCH 2/5] block/raw-posix: bdrv_parse_filename() for floppy Max Reitz
2014-03-06 22:38   ` Benoît Canet
2014-03-06 22:25 ` [Qemu-devel] [PATCH 3/5] block/raw-posix: bdrv_parse_filename() for cdrom Max Reitz
2014-03-06 22:37   ` Benoît Canet
2014-03-06 22:39     ` Max Reitz
2014-03-06 22:25 ` [Qemu-devel] [PATCH 4/5] block/raw-posix: Strip protocol prefix on creation Max Reitz
2014-03-06 22:45   ` Benoît Canet
2014-03-06 23:58   ` Eric Blake
2014-03-06 22:27 ` Max Reitz
2014-03-06 22:27   ` Max Reitz [this message]
2014-03-06 22:47     ` [Qemu-devel] [PATCH 5/5] block/raw-win32: bdrv_parse_filename() for hdev Benoît Canet
2014-03-06 22:37   ` [Qemu-devel] [PATCH 4/5] block/raw-posix: Strip protocol prefix on creation Max Reitz

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=1394144861-2403-2-git-send-email-mreitz@redhat.com \
    --to=mreitz@redhat.com \
    --cc=benoit.canet@irqsave.net \
    --cc=kwolf@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).