From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, armbru@redhat.com
Subject: [Qemu-devel] [PATCH 1/5] raw-posix: always prefer specific devices to hdev
Date: Wed, 8 Feb 2012 18:37:32 +0100 [thread overview]
Message-ID: <1328722656-22856-2-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1328722656-22856-1-git-send-email-pbonzini@redhat.com>
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 <pbonzini@redhat.com>
---
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
next prev parent reply other threads:[~2012-02-08 17:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 17:37 [Qemu-devel] [PATCH 0/5] Fix CD-ROM door with SCSI passthrough Paolo Bonzini
2012-02-08 17:37 ` Paolo Bonzini [this message]
2012-02-10 12:49 ` [Qemu-devel] [PATCH 1/5] raw-posix: always prefer specific devices to hdev Markus Armbruster
2012-02-08 17:37 ` [Qemu-devel] [PATCH 2/5] raw-posix: put Linux fd fields into a union Paolo Bonzini
2012-02-08 17:37 ` [Qemu-devel] [PATCH 3/5] raw-posix: keep complete control of door locking if possible Paolo Bonzini
2012-02-10 12:49 ` Markus Armbruster
2012-02-10 14:00 ` Paolo Bonzini
2012-02-10 14:56 ` Markus Armbruster
2012-02-10 15:19 ` Paolo Bonzini
2012-02-08 17:37 ` [Qemu-devel] [PATCH 4/5] configure: probe for dbus Paolo Bonzini
2012-02-08 17:37 ` [Qemu-devel] [PATCH 5/5] raw-posix: unmount CD-ROM filesystem via udisks Paolo Bonzini
2012-02-10 12:51 ` Markus Armbruster
2012-02-10 14:20 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1328722656-22856-2-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).