From patchwork Fri Aug 7 17:33:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bique Alexandre X-Patchwork-Id: 30949 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 316B2B7093 for ; Sat, 8 Aug 2009 03:41:54 +1000 (EST) Received: from localhost ([127.0.0.1]:50119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZTRu-0005t8-P4 for incoming@patchwork.ozlabs.org; Fri, 07 Aug 2009 13:41:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MZTLl-000429-Ry for qemu-devel@nongnu.org; Fri, 07 Aug 2009 13:35:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MZTLe-0003zI-5u for qemu-devel@nongnu.org; Fri, 07 Aug 2009 13:35:26 -0400 Received: from [199.232.76.173] (port=39299 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZTLe-0003zF-3Z for qemu-devel@nongnu.org; Fri, 07 Aug 2009 13:35:22 -0400 Received: from smtp.ctxuk.citrix.com ([62.200.22.115]:11273 helo=SMTP.EU.CITRIX.COM) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MZTLd-0002Cr-I3 for qemu-devel@nongnu.org; Fri, 07 Aug 2009 13:35:21 -0400 X-IronPort-AV: E=Sophos;i="4.43,343,1246838400"; d="scan'208";a="6538155" Received: from lonpmailmx01.citrite.net ([10.30.224.162]) by LONPIPO01.EU.CITRIX.COM with ESMTP; 07 Aug 2009 17:35:21 +0000 Received: from localhost.localdomain (10.80.2.58) by smtprelay.citirx.com (10.30.224.162) with Microsoft SMTP Server id 8.1.358.0; Fri, 7 Aug 2009 18:35:20 +0100 From: Alexandre Bique To: qemu-devel@nongnu.org Date: Fri, 7 Aug 2009 18:33:08 +0100 Message-ID: <1249666392-31905-4-git-send-email-alexandre.bique@citrix.com> X-Mailer: git-send-email 1.6.4 In-Reply-To: <1249666392-31905-3-git-send-email-alexandre.bique@citrix.com> References: <1249666392-31905-1-git-send-email-alexandre.bique@citrix.com> <1249666392-31905-2-git-send-email-alexandre.bique@citrix.com> <1249666392-31905-3-git-send-email-alexandre.bique@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Alexandre Bique Subject: [Qemu-devel] [PATCH 3/7] atapi: guessing if the cdrom device is a scsi device. 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 ATAPI pass through code is enabled when the block device is a scsi device. So we have to guess if the block device is a scsi device in cdrom_open(). Signed-off-by: Alexandre Bique --- block/raw-posix.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index bdee07f..ebb13d4 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1305,6 +1305,14 @@ static int cdrom_open(BlockDriverState *bs, const char *filename, int flags) s->type = FTYPE_CD; /* open will not fail even if no CD is inserted, so add O_NONBLOCK */ +#if defined(__linux__) && defined(CONFIG_AIO) + if (strstart(filename, "/dev/sg", NULL) || + strstart(filename, "/dev/cd", NULL) || + strstart(filename, "/dev/dvd", NULL) || + strstart(filename, "/dev/sr", NULL)) { + bs->sg = 1; + } +#endif return raw_open_common(bs, filename, flags, O_NONBLOCK); }