Blame 0021-99base-init-only-poll-cdroms-if-the-kernel-does-supp.patch

Harald Hoyer 55891e
From ab55a117e20d0af861e78e1e0b492775f306280d Mon Sep 17 00:00:00 2001
Harald Hoyer 55891e
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 55891e
Date: Mon, 29 Aug 2011 19:12:12 +0200
Harald Hoyer 55891e
Subject: [PATCH] 99base/init: only poll cdroms, if the kernel does support
Harald Hoyer 55891e
 autopolling
Harald Hoyer 55891e
Harald Hoyer 55891e
---
Harald Hoyer 55891e
 modules.d/99base/init |   34 +++++++++++++++-------------------
Harald Hoyer 55891e
 1 files changed, 15 insertions(+), 19 deletions(-)
Harald Hoyer 55891e
Harald Hoyer 55891e
diff --git a/modules.d/99base/init b/modules.d/99base/init
Harald Hoyer 55891e
index 90128c7..0328903 100755
Harald Hoyer 55891e
--- a/modules.d/99base/init
Harald Hoyer 55891e
+++ b/modules.d/99base/init
Harald Hoyer 55891e
@@ -205,7 +205,8 @@ getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-tr
Harald Hoyer 55891e
 source_hook pre-trigger
Harald Hoyer 55891e
 
Harald Hoyer 55891e
 # then the rest
Harald Hoyer 55891e
-udevadm trigger --action=add $udevtriggeropts  >/dev/null 2>&1
Harald Hoyer 55891e
+udevadm trigger --type=subsystems --action=add >/dev/null 2>&1
Harald Hoyer 55891e
+udevadm trigger --type=devices --action=add >/dev/null 2>&1
Harald Hoyer 55891e
 
Harald Hoyer 55891e
 getarg 'rd.break=initqueue' 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
Harald Hoyer 55891e
 
Harald Hoyer 55891e
@@ -246,25 +247,20 @@ while :; do
Harald Hoyer 55891e
     # no more udev jobs and queues empty.
Harald Hoyer 55891e
     sleep 0.5
Harald Hoyer 55891e
 
Harald Hoyer 55891e
-    # dirty hack for some cdrom drives,
Harald Hoyer 55891e
-    # which report no medium for quiet
Harald Hoyer 55891e
-    # some time.
Harald Hoyer 55891e
-    for cdrom in /sys/block/sr*; do
Harald Hoyer 55891e
-        [ -e "$cdrom" ] || continue
Harald Hoyer 55891e
-        # skip, if cdrom medium was already found
Harald Hoyer 55891e
-        strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \
Harald Hoyer 55891e
-            ID_CDROM_MEDIA && continue
Harald Hoyer 55891e
-
Harald Hoyer 55891e
-        if [ -e "$cdrom"/events_poll_msecs -a ! -e "/tmp/.poll_${cdrom##*/}" ]; then
Harald Hoyer 55891e
-            msecs=$(while read a; do echo $a;done < "$cdrom"/events_poll_msecs)
Harald Hoyer 55891e
-            if [ "$msecs" = "-1" ]; then
Harald Hoyer 55891e
-                echo 250 > "$cdrom"/events_poll_msecs
Harald Hoyer 55891e
-                > "/tmp/.poll_${cdrom##*/}"
Harald Hoyer 55891e
-            fi
Harald Hoyer 55891e
-        else
Harald Hoyer 55891e
+    if [ ! -e /sys/module/block/parameters/uevent ]; then
Harald Hoyer 55891e
+        # if the kernel does not support autopolling
Harald Hoyer 55891e
+        # then we have to do a
Harald Hoyer 55891e
+        # dirty hack for some cdrom drives,
Harald Hoyer 55891e
+        # which report no medium for quiet
Harald Hoyer 55891e
+        # some time.
Harald Hoyer 55891e
+        for cdrom in /sys/block/sr*; do
Harald Hoyer 55891e
+            [ -e "$cdrom" ] || continue
Harald Hoyer 55891e
+            # skip, if cdrom medium was already found
Harald Hoyer 55891e
+            strstr "$(udevadm info --query=env --path=${cdrom##/sys})" \
Harald Hoyer 55891e
+                ID_CDROM_MEDIA && continue
Harald Hoyer 55891e
             echo change > "$cdrom/uevent"
Harald Hoyer 55891e
-        fi
Harald Hoyer 55891e
-    done
Harald Hoyer 55891e
+        done
Harald Hoyer 55891e
+    fi
Harald Hoyer 55891e
 
Harald Hoyer 55891e
     if [ $main_loop -gt $(($RDRETRY/2)) ]; then
Harald Hoyer 55891e
 	for job in $hookdir/initqueue/timeout/*.sh; do