From patchwork Fri May 7 15:14:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 51929 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 0C9DCB7D19 for ; Sat, 8 May 2010 01:27:24 +1000 (EST) Received: from localhost ([127.0.0.1]:36743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAPSS-0006NP-Jv for incoming@patchwork.ozlabs.org; Fri, 07 May 2010 11:27:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OAPGu-0007Qw-3s for qemu-devel@nongnu.org; Fri, 07 May 2010 11:15:24 -0400 Received: from [140.186.70.92] (port=54799 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAPGr-0007PG-U9 for qemu-devel@nongnu.org; Fri, 07 May 2010 11:15:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAPGq-00070K-8R for qemu-devel@nongnu.org; Fri, 07 May 2010 11:15:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40912) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAPGq-000706-0i for qemu-devel@nongnu.org; Fri, 07 May 2010 11:15:20 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o47FFHTG007351 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 May 2010 11:15:17 -0400 Received: from localhost.localdomain (vpn2-10-135.ams2.redhat.com [10.36.10.135]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o47FETE3002113; Fri, 7 May 2010 11:15:11 -0400 From: Kevin Wolf To: aliguori@linux.vnet.ibm.com Date: Fri, 7 May 2010 17:14:05 +0200 Message-Id: <1273245247-24827-10-git-send-email-kwolf@redhat.com> In-Reply-To: <1273245247-24827-1-git-send-email-kwolf@redhat.com> References: <1273245247-24827-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 09/11] block: Fix protocol detection for Windows 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 We can't assume the file protocol for Windows devices, they need the same detection as other files for which an explicit protocol is not specified. Signed-off-by: Kevin Wolf --- block.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index 6345599..977d01f 100644 --- a/block.c +++ b/block.c @@ -287,16 +287,18 @@ static BlockDriver *find_protocol(const char *filename) char protocol[128]; int len; const char *p; + int is_drive; /* TODO Drivers without bdrv_file_open must be specified explicitly */ #ifdef _WIN32 - if (is_windows_drive(filename) || - is_windows_drive_prefix(filename)) - return bdrv_find_format("file"); + is_drive = is_windows_drive(filename) || + is_windows_drive_prefix(filename); +#else + is_drive = 0; #endif p = strchr(filename, ':'); - if (!p) { + if (!p || is_drive) { drv1 = find_hdev_driver(filename); if (!drv1) { drv1 = bdrv_find_format("file");