--- /dev/null
+--- ./snmpdiskio 2008-10-05 16:00:39.870799390 +0300
++++ 0.9.6/snmpdiskio 2008-10-05 16:01:46.636993902 +0300
+@@ -1,7 +1,21 @@
+-#!/bin/sh
+-# $Id$
++#!/bin/bash
++# $Id$
++# snmpdiskio v0.9.6 (c) 2008 Dieter Verlaeckt <dieter.verlaeckt@gmail.com>
++# snmpdiskio v0.9.5 (c) 2007 Pablo Destefanis <pdestefanis@gmail.com>
+ # snmpdiskio v0.9.4 (c) 2006 Mikael Fridh <mikael@meanstreak.se>
+
++# Fields in /proc/partitions (kernel 2.4)
++# major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
++
++# Fields in /proc/diskstats (kernel 2.6) for disks (i.e. hda)
++# major minor name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
++
++# Fields in /proc/diskstats (kernel 2.6) for partitions (i.e. hda1)
++# major minor name rio rsect wio wsect
++
++# InBlocks = sectors written to disk
++# OutBlocks = sectors read from disk
++
+ # Set default procfile for kernel 2.4
+ PROCFILE="/proc/partitions"
+ MODE="linux24"
+@@ -32,19 +46,27 @@
+ fi
+ }
+
+-hdInBlocks()
++hdInBlocks()
+ {
+- awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $10 ~ /[0-9]+/ { printf "%.0f\n", $10 * 512 }
+- $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $10 !~ /[0-9]+/ { printf "%.0f\n", $5 * 512 } ' $PROCFILE
++ if [ "$MODE" = "linux26" ]; then
++ awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 7 { printf "%.0f\n", $7 * 512 }
++ $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 14 { printf "%.0f\n", $10 * 512 } ' $PROCFILE
++ else
++ awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 15 { printf "%.0f\n", $11 * 512 } ' $PROCFILE
++ fi
+ }
+
+-hdOutBlocks()
++hdOutBlocks()
+ {
+- awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 ~ /[0-9]+/ { printf "%.0f\n", $8 * 512 }
+- $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 !~ /[0-9]+/ { printf "%.0f\n", $7 * 512 } ' $PROCFILE
++ if [ "$MODE" = "linux26" ]; then
++ awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 7 { printf "%.0f\n", $5 * 512 }
++ $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 14 { printf "%.0f\n", $6 * 512 } ' $PROCFILE
++ else
++ awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 15 { printf "%.0f\n", $7 * 512 } ' $PROCFILE
++ fi
+ }
+
+-usage()
++usage()
+ {
+ cat <<-EOUSAGE
+ Usage: $0 <hdNum|hdIndex|hdDescr|hdInBlocks|hdOutBlocks>