Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 295

kvm-83-270.el5_11.src.rpm

From 7461a0177fad50e9f2ef2806fcbfade3a9d8b5b8 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Fri, 3 Sep 2010 11:48:50 -0300
Subject: [PATCH 2/4] block-raw-posix: Factor out cdrom_probe_device

RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <1283514532-8401-2-git-send-email-kwolf@redhat.com>
Patchwork-id: 11753
O-Subject: [RHEL-5.6 KVM PATCH 1/3] block-raw-posix: Factor out
	cdrom_probe_device
Bugzilla: 609472
RH-Acked-by: Christoph Hellwig <chellwig@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>

Bugzilla: 609472
Upstream status: n/a

This doesn't really correspond to any specific upstream commit, but it makes
the code touched by the following patches similar enough to upstream that the
patches apply with no or only little modifications.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu/block-raw-posix.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu/block-raw-posix.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/qemu/block-raw-posix.c b/qemu/block-raw-posix.c
index a4f31c4..d8c883d 100644
--- a/qemu/block-raw-posix.c
+++ b/qemu/block-raw-posix.c
@@ -894,6 +894,15 @@ kern_return_t GetBSDPath( io_iterator_t mediaIterator, char *bsdPath, CFIndex ma
 
 #endif
 
+#if defined(__linux__)
+static int cdrom_probe_device(const char *filename)
+{
+    if (strstart(filename, "/dev/cd", NULL))
+        return 100;
+    return 0;
+}
+#endif
+
 static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
 {
     BDRVRawState *s = bs->opaque;
@@ -943,7 +952,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
 
     s->type = FTYPE_FILE;
 #if defined(__linux__)
-    if (strstart(filename, "/dev/cd", NULL) ||
+    if (cdrom_probe_device(filename) ||
         bs->type == BDRV_TYPE_CDROM) {
         /* open will not fail even if no CD is inserted */
         open_flags |= O_NONBLOCK;
-- 
1.6.5.5