qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 1/5] raw-posix: always prefer specific devices to hd


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 1/5] raw-posix: always prefer specific devices to hdev
Date: Wed, 8 Feb 2012 18:37:32 +0100

There is no need to try matching device names; using ioctls is more
effective.  So, always return a low priority from the generic
hdev_probe_device and let the ioctl tests override it.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 block/raw-posix.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 2ee5d69..2a5b6fa 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -712,13 +712,9 @@ static int hdev_probe_device(const char *filename)
 {
     struct stat st;
 
-    /* allow a dedicated CD-ROM driver to match with a higher priority */
-    if (strstart(filename, "/dev/cdrom", NULL))
-        return 50;
-
     if (stat(filename, &st) >= 0 &&
             (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) {
-        return 100;
+        return 50;
     }
 
     return 0;
@@ -947,9 +943,6 @@ static int floppy_probe_device(const char *filename)
     struct floppy_struct fdparam;
     struct stat st;
 
-    if (strstart(filename, "/dev/fd", NULL))
-        prio = 50;
-
     fd = open(filename, O_RDONLY | O_NONBLOCK);
     if (fd < 0) {
         goto out;
@@ -959,7 +952,8 @@ static int floppy_probe_device(const char *filename)
         goto outc;
     }
 
-    /* Attempt to detect via a floppy specific ioctl */
+    /* Attempt to detect via a floppy specific ioctl.  If it fails,
+     * hdev will be just as good.  */
     ret = ioctl(fd, FDGETPRM, &fdparam);
     if (ret >= 0)
         prio = 100;
-- 
1.7.7.6





reply via email to

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