qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/7] atapi: guessing if the cdrom device is a scsi d


From: Alexandre Bique
Subject: [Qemu-devel] [PATCH 3/7] atapi: guessing if the cdrom device is a scsi device.
Date: Fri, 7 Aug 2009 18:33:08 +0100

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 <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]