From patchwork Wed Jun 23 10:25:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 56669 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8DF21B707D for ; Wed, 23 Jun 2010 20:27:17 +1000 (EST) Received: from localhost ([127.0.0.1]:44305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORNAo-00034l-7a for incoming@patchwork.ozlabs.org; Wed, 23 Jun 2010 06:27:14 -0400 Received: from [140.186.70.92] (port=54867 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORN94-00032l-N1 for qemu-devel@nongnu.org; Wed, 23 Jun 2010 06:25:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORN93-0002eC-7B for qemu-devel@nongnu.org; Wed, 23 Jun 2010 06:25:26 -0400 Received: from verein.lst.de ([213.95.11.210]:40906) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORN92-0002dD-VH for qemu-devel@nongnu.org; Wed, 23 Jun 2010 06:25:25 -0400 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id o5NAPHWY011314 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Wed, 23 Jun 2010 12:25:17 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-7.2) id o5NAPHnL011313 for qemu-devel@nongnu.org; Wed, 23 Jun 2010 12:25:17 +0200 Date: Wed, 23 Jun 2010 12:25:17 +0200 From: Christoph Hellwig To: qemu-devel@nongnu.org Message-ID: <20100623102517.GA11292@lst.de> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Scanned-By: MIMEDefang 2.39 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH] block: allow filenames with colons again for host devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Before the raw/file split we used to allow filenames with colons for host device only. While this was more by accident than by design people rely on it, so we need to bring it back. So move the host device probing to be before the protocol detection again. Signed-off-by: Christoph Hellwig Index: qemu/block.c =================================================================== --- qemu.orig/block.c 2010-06-23 12:16:52.599254111 +0200 +++ qemu/block.c 2010-06-23 12:20:31.423254251 +0200 @@ -288,23 +288,30 @@ BlockDriver *bdrv_find_protocol(const ch char protocol[128]; int len; const char *p; - int is_drive; /* TODO Drivers without bdrv_file_open must be specified explicitly */ + /* + * XXX(hch): we really should not let host device detection + * override an explicit protocol specification, but moving this + * later breaks access to device names with colons in them. + * Thanks to the brain-dead persistent naming schemes on udev- + * based Linux systems those actually are quite common. + */ + drv1 = find_hdev_driver(filename); + if (drv1) { + return drv1; + } + #ifdef _WIN32 - is_drive = is_windows_drive(filename) || - is_windows_drive_prefix(filename); -#else - is_drive = 0; + if (is_windows_drive(filename) || + is_windows_drive_prefix(filename)) + return bdrv_find_format("file"); #endif + p = strchr(filename, ':'); - if (!p || is_drive) { - drv1 = find_hdev_driver(filename); - if (!drv1) { - drv1 = bdrv_find_format("file"); - } - return drv1; + if (!p) { + return bdrv_find_format("file"); } len = p - filename; if (len > sizeof(protocol) - 1)