qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] raw-posix: improve detection of scsi-generic devices
@ 2010-09-06 15:06 Bernhard Kohl
  2010-09-06 15:39 ` Alexander Graf
  0 siblings, 1 reply; 6+ messages in thread
From: Bernhard Kohl @ 2010-09-06 15:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Bernhard Kohl, Bernhard Kohl

From: Bernhard Kohl <bernhard.kohl@gmx.net>

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

Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
---
 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 72fb8ce..4544a57 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-07  9:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-06 15:06 [Qemu-devel] [PATCH] raw-posix: improve detection of scsi-generic devices Bernhard Kohl
2010-09-06 15:39 ` Alexander Graf
2010-09-07  2:04   ` Christoph Hellwig
2010-09-07  9:40     ` Bernhard Kohl
2010-09-07  9:44       ` Alexander Graf
2010-09-07  9:47     ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).