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

Bug#604737: sysfsutils: I have implemented this - I have a patch



Source: sysfsutils
Version: 2.1.0+repack-4
Followup-For: Bug #604737

Dear Maintainer,

I was looking for a way to set i/o scheduler. sysfsutils works fine when you can explicitly specify every path, but wildcards (or other basic shell expansion) would make things more flexible. E.g. One can deploy a standard config even when machines will not always have the same disks. E.g. for VMs we might want:
class/block/vd[a-z]/queue/scheduler = deadline

I achieved this with a relatively simple modification of the load_conffile function in debian/sysfsutils.init (which gets deployed to /etc/init.d/sysfsutils). I'm presuming reportbug will ask if I have a patch to attach shortly?


-- System Information:
Debian Release: 8.8
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
--- debian/sysfsutils.init	2013-05-02 17:10:06.000000000 +0100
+++ /home/alex/sysfsutils.init	2017-06-29 12:10:50.596302572 +0100
@@ -42,15 +42,17 @@
 		else
 		    log_failure_msg "unknown attribute $f2"
 		fi
-	    elif [ "$f1" -a -n "$f2" -a -z "$f3" ]; then
-		if [ -f "/sys/$f1" ]; then
-		    # Some fields need a terminating newline, others
-		    # need the terminating newline to be absent :-(
-		     echo -n "$f2" > "/sys/$f1" 2>/dev/null ||
-			echo "$f2" > "/sys/$f1"
-		else
-		    log_failure_msg "unknown attribute $f1"
-		fi
+	    elif [ -n "$f2" -a -z "$f3" ]; then
+		for path in /sys/$f1; do
+		    if [ -f "$path" ]; then
+		        # Some fields need a terminating newline, others
+		        # need the terminating newline to be absent :-(
+		         echo -n "$f2" > "$path" 2>/dev/null ||
+			     echo "$f2" > "$path"
+		    else
+		        log_failure_msg "unknown attribute $f1"
+		    fi
+		done
 	    else
 		log_failure_msg "syntax error in $CONFFILE: '$f1' '$f2' '$f3'"
 		log_end_msg 1

Reply to: