From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59208 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OtL2S-0002q0-B5 for qemu-devel@nongnu.org; Wed, 08 Sep 2010 09:50:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OtKis-0005do-8E for qemu-devel@nongnu.org; Wed, 08 Sep 2010 09:30:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39639) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OtKis-0005dS-29 for qemu-devel@nongnu.org; Wed, 08 Sep 2010 09:29:58 -0400 From: Kevin Wolf Date: Wed, 8 Sep 2010 15:29:39 +0200 Message-Id: <1283952582-17498-23-git-send-email-kwolf@redhat.com> In-Reply-To: <1283952582-17498-1-git-send-email-kwolf@redhat.com> References: <1283952582-17498-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 22/25] raw-posix: improve detection of scsi-generic devices List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Bernhard Kohl Allow symbolic links which point to /dev/sgX devices. Signed-off-by: Bernhard Kohl Signed-off-by: Kevin Wolf --- 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 +#include #include #include #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