From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLJZj-0004Z2-Cs for qemu-devel@nongnu.org; Wed, 05 Mar 2014 16:42:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLJZd-0002cR-FF for qemu-devel@nongnu.org; Wed, 05 Mar 2014 16:42:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52910) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLJZd-0002cK-6y for qemu-devel@nongnu.org; Wed, 05 Mar 2014 16:41:57 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s25Lfuej016657 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 5 Mar 2014 16:41:56 -0500 From: Max Reitz Date: Wed, 5 Mar 2014 22:41:39 +0100 Message-Id: <1394055700-5988-5-git-send-email-mreitz@redhat.com> In-Reply-To: <1394055700-5988-1-git-send-email-mreitz@redhat.com> References: <1394055700-5988-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH 4/5] block/raw-win32: Implement bdrv_parse_filename() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz The "file" protocol driver should strip the "file:" prefix from filenames if present. Signed-off-by: Max Reitz --- 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