Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MbHTo-0001vA-A3 for qemu-devel@nongnu.org; Wed, 12 Aug 2009 13:19:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbHTj-0001qP-4s for qemu-devel@nongnu.org; Wed, 12 Aug 2009 13:19:15 -0400 Received: from [199.232.76.173] (port=58032 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbHTi-0001qJ-Tz for qemu-devel@nongnu.org; Wed, 12 Aug 2009 13:19:10 -0400 Received: from smtp.ctxuk.citrix.com ([62.200.22.115]:14529 helo=SMTP.EU.CITRIX.COM) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MbHTi-0004gL-H2 for qemu-devel@nongnu.org; Wed, 12 Aug 2009 13:19:10 -0400 Received: from iwj by mariner.uk.xensource.com with local (Exim 4.63) (envelope-from ) id 1MbHTh-0007lD-6Z for qemu-devel@nongnu.org; Wed, 12 Aug 2009 18:19:09 +0100 In-Reply-To: <<19074.63829.151234.423348@mariner.uk.xensource.com>> References: <<19074.63829.151234.423348@mariner.uk.xensource.com>> From: Ian Jackson Date: Tue, 11 Aug 2009 16:36:21 +0100 Message-ID: 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 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.4.4.4