From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WM4Mz-0006ae-Ay for qemu-devel@nongnu.org; Fri, 07 Mar 2014 18:40:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WM4Mu-0007as-BE for qemu-devel@nongnu.org; Fri, 07 Mar 2014 18:40:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:11536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WM4Mu-0007ao-3W for qemu-devel@nongnu.org; Fri, 07 Mar 2014 18:39:56 -0500 From: Max Reitz Date: Sat, 8 Mar 2014 00:39:42 +0100 Message-Id: <1394235585-10500-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1394235585-10500-1-git-send-email-mreitz@redhat.com> References: <1394235585-10500-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v2 2/5] block/raw-posix: bdrv_parse_filename() for floppy List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , =?UTF-8?q?Beno=C3=AEt=20Canet?= , Stefan Hajnoczi , Max Reitz The "host_floppy" protocol driver should strip the "host_floppy:" prefix from filenames if present. Signed-off-by: Max Reitz Reviewed-by: Benoit Canet --- block/raw-posix.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/block/raw-posix.c b/block/raw-posix.c index ab32ff9..4b8c183 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1844,6 +1844,15 @@ static BlockDriver bdrv_host_device = { }; #ifdef __linux__ +static void floppy_parse_filename(const char *filename, QDict *options, + Error **errp) +{ + /* The prefix is optional, just as for "file". */ + strstart(filename, "host_floppy:", &filename); + + qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename))); +} + static int floppy_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { @@ -1949,6 +1958,7 @@ static BlockDriver bdrv_host_floppy = { .instance_size = sizeof(BDRVRawState), .bdrv_needs_filename = true, .bdrv_probe_device = floppy_probe_device, + .bdrv_parse_filename = floppy_parse_filename, .bdrv_file_open = floppy_open, .bdrv_close = raw_close, .bdrv_reopen_prepare = raw_reopen_prepare, -- 1.9.0