qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 22/25] raw-posix: improve detection of scsi-generic


From: Kevin Wolf
Subject: [Qemu-devel] [PATCH 22/25] raw-posix: improve detection of scsi-generic devices
Date: Wed, 8 Sep 2010 15:29:39 +0200

From: Bernhard Kohl <address@hidden>

Allow symbolic links which point to /dev/sgX devices.

Signed-off-by: Bernhard Kohl <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
 block/raw-posix.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 0fce449..813372a 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -48,6 +48,7 @@
 #endif
 #ifdef __linux__
 #include <sys/ioctl.h>
+#include <sys/param.h>
 #include <linux/cdrom.h>
 #include <linux/fd.h>
 #endif
@@ -868,8 +869,13 @@ static int hdev_open(BlockDriverState *bs, const char 
*filename, int flags)
 
     s->type = FTYPE_FILE;
 #if defined(__linux__)
-    if (strstart(filename, "/dev/sg", NULL)) {
-        bs->sg = 1;
+    {
+        char resolved_path[ MAXPATHLEN ], *temp;
+
+        temp = realpath(filename, resolved_path);
+        if (temp && strstart(temp, "/dev/sg", NULL)) {
+            bs->sg = 1;
+        }
     }
 #endif
 
-- 
1.7.2.2




reply via email to

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