From 194401c2586eec62124bc331975593be840f3045 Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Sat, 29 May 2004 01:07:56 +0000 Subject: [lcd4linux @ 2004-05-29 01:07:56 by reinelt] bug in plugin_diskstats fixed --- lcd4linux.conf.sample | 32 ++++++++++++++++---------------- plugin_diskstats.c | 14 +++++++++----- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/lcd4linux.conf.sample b/lcd4linux.conf.sample index 7b5ecb2..a65cb26 100644 --- a/lcd4linux.conf.sample +++ b/lcd4linux.conf.sample @@ -46,7 +46,7 @@ Display CF633 { Display Curses { Driver 'Curses' - Size '20x4' + Size '20x6' } @@ -149,7 +149,7 @@ Plugin Pop3 { Widget OS { class 'Text' expression '*** '.uname('sysname').' '.uname('release').' ***' - width 16 + width 20 align 'M' speed 100 update tick @@ -220,10 +220,10 @@ Widget Disk { class 'Text' # disk.[rw]blk return blocks, we assume a blocksize of 512 # to get the number in kB/s we would do blk*512/1024, which is blk/2 - expression (proc_stat::disk('.*', 'rblk', 500)+proc_stat::disk('.*', 'wblk', 500))/2 + #expression (proc_stat::disk('.*', 'rblk', 500)+proc_stat::disk('.*', 'wblk', 500))/2 # with kernel 2.6, disk_io disappeared from /proc/stat but moved to /proc/diskstat # therefore you have to use another function called 'diskstats': - # expression (diskstats('.*', '.*_sectors', 500) + expression diskstats('.*', '.*_sectors', 500) prefix 'disk' postfix ' ' width 10 @@ -234,11 +234,11 @@ Widget Disk { Widget DiskBar { class 'Bar' - expression proc_stat::disk('.*', 'rblk', 500) - expression2 proc_stat::disk('.*', 'wblk', 500) + #expression proc_stat::disk('.*', 'rblk', 500) + #expression2 proc_stat::disk('.*', 'wblk', 500) # for kernel 2.6: - # expression diskstats('.*', 'read_sectors', 500) - # expression2 diskstats('.*', 'write_sectors', 500) + expression diskstats('.*', 'read_sectors', 500) + expression2 diskstats('.*', 'write_sectors', 500) length 14 direction 'E' update tack @@ -431,14 +431,14 @@ Layout Default { Col1 'Load' Col11 'LoadBar' } -# Row5 { -# Col1 'Disk' -# Col11 'DiskBar' -# } -# Row6 { -# Col1 'Eth0' -# Col11 'Eth0Bar' -# } + Row5 { + Col1 'Disk' + Col11 'DiskBar' + } + Row6 { + Col1 'Eth0' + Col11 'Eth0Bar' + } } Layout L24x8 { diff --git a/plugin_diskstats.c b/plugin_diskstats.c index a48f00f..2e5b5fe 100644 --- a/plugin_diskstats.c +++ b/plugin_diskstats.c @@ -1,4 +1,4 @@ -/* $Id: plugin_diskstats.c,v 1.1 2004/05/29 00:27:23 reinelt Exp $ +/* $Id: plugin_diskstats.c,v 1.2 2004/05/29 01:07:56 reinelt Exp $ * * plugin for /proc/diskstats parsing * @@ -23,6 +23,9 @@ * * * $Log: plugin_diskstats.c,v $ + * Revision 1.2 2004/05/29 01:07:56 reinelt + * bug in plugin_diskstats fixed + * * Revision 1.1 2004/05/29 00:27:23 reinelt * * added plugin_diskstats.c @@ -101,7 +104,7 @@ static int parse_diskstats (void) while (beg != NULL) { while (*beg == ' ') beg++; if ((end = strchr(beg, ' '))) *end = '\0'; - switch (i++) { + switch (i) { case 0: major = beg; break; @@ -110,12 +113,13 @@ static int parse_diskstats (void) break; case 2: name = beg; - hash_set2 ("major", name, major); - hash_set2 ("minor", name, minor); + hash_set2 (name, "major", major); + hash_set2 (name, "minor", minor); break; default: - hash_set2 (key[i-3], name, beg); + hash_set2 (name, key[i-3], beg); } + i++; beg = end ? end+1 : NULL; } } -- cgit v1.2.3