mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 03:59:52 +00:00
raw-posix: improve detection of scsi-generic devices
Allow symbolic links which point to /dev/sgX devices. Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
ebef0bbb1a
commit
05acda4d16
@ -48,6 +48,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/param.h>
|
||||||
#include <linux/cdrom.h>
|
#include <linux/cdrom.h>
|
||||||
#include <linux/fd.h>
|
#include <linux/fd.h>
|
||||||
#endif
|
#endif
|
||||||
@ -868,8 +869,13 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
|
|||||||
|
|
||||||
s->type = FTYPE_FILE;
|
s->type = FTYPE_FILE;
|
||||||
#if defined(__linux__)
|
#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
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user