File support-more-devices.patch of Package pm-profiler

Allow more than 26 disk devices. Do not needlessly use "cd" to determine device name.


--- pm-profiler-0.1_20111222/tools/get-current-settings.orig	2020-11-01 14:25:54.198712884 +0100
+++ pm-profiler-0.1_20111222/tools/get-current-settings	2020-11-01 22:59:24.838968958 +0100
@@ -126,13 +126,11 @@ function get_dirty_writeback_centisecs {
 function get_read_ahead_kb {
     Option="READ_AHEAD_KB"
     Value=`cat /sys/block/sda/queue/read_ahead_kb`
-    cd /dev
-    for I in sd?; do
-        if [[ `cat /sys/block/$I/queue/read_ahead_kb` != $Value ]]; then
+    for I in /sys/block/sd*/queue/read_ahead_kb; do
+        if [[ `cat $I` != $Value ]]; then
             echo "Warning: different values: "$Option >&2
         fi
     done
-    cd - > /dev/null
     echo $Option"="$Value
 }
 
openSUSE Build Service is sponsored by