From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Alexandre Bique Date: Fri, 7 Aug 2009 18:33:08 +0100 Message-ID: <1249666392-31905-4-git-send-email-alexandre.bique@citrix.com> 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 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 3/7] atapi: guessing if the cdrom device is a scsi device. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexandre Bique 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); } -- 1.6.4