From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNgxs-0002RW-Tz for qemu-devel@nongnu.org; Wed, 12 Mar 2014 07:04:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WNgxn-0007L0-QF for qemu-devel@nongnu.org; Wed, 12 Mar 2014 07:04:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WNgxn-0007KU-I7 for qemu-devel@nongnu.org; Wed, 12 Mar 2014 07:04:43 -0400 From: Stefan Hajnoczi Date: Wed, 12 Mar 2014 11:29:32 +0100 Message-Id: <1394620172-25071-25-git-send-email-stefanha@redhat.com> In-Reply-To: <1394620172-25071-1-git-send-email-stefanha@redhat.com> References: <1394620172-25071-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 24/24] block/raw-win32: bdrv_parse_filename() for hdev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Anthony Liguori From: Max Reitz The "host_device" protocol driver should strip the "host_device:" prefix from filenames if present. Signed-off-by: Max Reitz Reviewed-by: Benoit Canet Signed-off-by: Stefan Hajnoczi --- 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.8.5.3