diff -dru xfce4-diskperf-plugin-1.0/panel-plugin/devperf.c xfce4-diskperf-plugin-1.0.linux-2.6/panel-plugin/devperf.c --- xfce4-diskperf-plugin-1.0/panel-plugin/devperf.c Sat Oct 4 08:05:36 2003 +++ xfce4-diskperf-plugin-1.0.linux-2.6/panel-plugin/devperf.c Tue Oct 14 22:44:21 2003 @@ -47,22 +47,21 @@ #include +#ifndef LINUX26 #define STATISTICS_FILE "/proc/partitions" - +#else +#define STATISTICS_FILE "/proc/diskstats" +#endif int DevCheckStatAvailability () { FILE *pF; - char acLine[256]; - int status; pF = fopen (STATISTICS_FILE, "r"); if (!pF) return (-errno); - status = (((fgets (acLine, sizeof (acLine), pF)) - && (strstr (acLine, "rsect"))) ? 0 : NO_EXTENDED_STATS); fclose (pF); - return (status); + return 0; } /* DevCheckStatAvailability() */ @@ -79,12 +78,25 @@ pF = fopen (STATISTICS_FILE, "r"); if (!pF) return (-1); +#ifndef LINUX26 while ((c = fgetc (pF)) && (c != '\n')); /* Skip the header line */ while ((n = fscanf (pF, "%u %u %*u %*s %*u %*u %u %u %*u %*u %u %u %*u %u %*u", &major, &minor, &rsect, &ruse, &wsect, &wuse, - &use)) == 7) + &use)) == 7) { +#else + for (;;) { + n = fscanf (pF, + "%u %u %*s %*u %*u %u %u", + &major, &minor, &rsect, &ruse); + if (n != 4) break; + if (fgetc(pF) == '\n') {printf("bla\n");continue;} + n = fscanf (pF, + "%*u %*u %u %u %*u %u %*u", + &wsect, &wuse, &use); + if (n != 3) break; +#endif if ((major == iMajorNo) && (minor == iMinorNo)) { fclose (pF); gettimeofday (&oTimeStamp, 0); @@ -95,6 +107,7 @@ p_poPerf->wbytes = SECTOR_SIZE * wsect; return (0); } + } fclose (pF); return (-1); } /* DevGetPerfData() */