X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdisk.c;h=465b005707dd73d64b95678ef5ee096c64cc71e9;hb=03af72c5ef8b98ddfcab87ea44b764f5b0e165aa;hp=a798a8943ce4e5886e475ae148bbae2415f7818d;hpb=063a5e75b36173e89ffa18d32d47509f6ef968ec;p=collectd.git diff --git a/src/disk.c b/src/disk.c index a798a894..465b0057 100644 --- a/src/disk.c +++ b/src/disk.c @@ -128,7 +128,7 @@ static int numdisk = 0; /* #endif HAVE_LIBKSTAT */ #elif defined(HAVE_LIBSTATGRAB) -/* #endif HAVE_LIBKSTATGRAB */ +/* #endif HAVE_LIBSTATGRAB */ #elif HAVE_PERFSTAT static perfstat_disk_t * stat_disk; @@ -954,12 +954,11 @@ static int disk_read (void) # error "kstat_io_t does not have the required members" # endif static kstat_io_t kio; - int i; if (kc == NULL) return (-1); - for (i = 0; i < numdisk; i++) + for (int i = 0; i < numdisk; i++) { if (kstat_read (kc, ksp[i], &kio) == -1) continue; @@ -997,13 +996,12 @@ static int disk_read (void) # else int disks; #endif - int counter; char name[DATA_MAX_NAME_LEN]; if ((ds = sg_get_disk_io_stats(&disks)) == NULL) return (0); - for (counter=0; counter < disks; counter++) { + for (int counter = 0; counter < disks; counter++) { strncpy(name, ds->disk_name, sizeof(name)); name[sizeof(name)-1] = '\0'; /* strncpy doesn't terminate longer strings */ @@ -1026,7 +1024,6 @@ static int disk_read (void) derive_t write_ops; perfstat_id_t firstpath; int rnumdisk; - int i; if ((numdisk = perfstat_disk(NULL, NULL, sizeof(perfstat_disk_t), 0)) < 0) { @@ -1052,7 +1049,7 @@ static int disk_read (void) return (-1); } - for (i = 0; i < rnumdisk; i++) + for (int i = 0; i < rnumdisk; i++) { if (ignorelist_match (ignorelist, stat_disk[i].name) != 0) continue;