diff --git a/src/conky.c b/src/conky.c index fd8a0c27..e9570b87 100644 --- a/src/conky.c +++ b/src/conky.c @@ -4668,7 +4668,7 @@ static void generate_text_internal(char *p, int p_max_size, (obj->data.diskio->current / update_interval) * 1024LL, p, p_max_size, "diskio"); } else { - human_readable(diskio_value * 1024LL, p, p_max_size, + human_readable(info.diskio_value * 1024LL, p, p_max_size, "diskio"); } } @@ -4677,7 +4677,7 @@ static void generate_text_internal(char *p, int p_max_size, human_readable((obj->data.diskio->current_write / update_interval) * 1024LL, p, p_max_size, "diskio_write"); } else { - human_readable(diskio_write_value * 1024LL, p, p_max_size, + human_readable(info.diskio_write_value * 1024LL, p, p_max_size, "diskio_write"); } } @@ -4686,7 +4686,7 @@ static void generate_text_internal(char *p, int p_max_size, human_readable((obj->data.diskio->current_read / update_interval) * 1024LL, p, p_max_size, "diskio_read"); } else { - human_readable(diskio_read_value * 1024LL, p, p_max_size, + human_readable(info.diskio_read_value * 1024LL, p, p_max_size, "diskio_read"); } } @@ -4695,7 +4695,7 @@ static void generate_text_internal(char *p, int p_max_size, new_graph(p, obj->a, obj->b, obj->c, obj->d, obj->data.diskio->current, obj->e, 1); } else { - new_graph(p, obj->a, obj->b, obj->c, obj->d, diskio_value, + new_graph(p, obj->a, obj->b, obj->c, obj->d, info.diskio_value, obj->e, 1); } } @@ -4705,7 +4705,7 @@ static void generate_text_internal(char *p, int p_max_size, obj->data.diskio->current_read, obj->e, 1); } else { new_graph(p, obj->a, obj->b, obj->c, obj->d, - diskio_read_value, obj->e, 1); + info.diskio_read_value, obj->e, 1); } } OBJ(diskiograph_write) { @@ -4714,7 +4714,7 @@ static void generate_text_internal(char *p, int p_max_size, obj->data.diskio->current_write, obj->e, 1); } else { new_graph(p, obj->a, obj->b, obj->c, obj->d, - diskio_write_value, obj->e, 1); + info.diskio_write_value, obj->e, 1); } } OBJ(downspeed) { @@ -6324,9 +6324,9 @@ static void generate_text(void) update_stuff(); /* fix diskio rates to b/s (use update_interval */ - diskio_read_value = diskio_read_value / update_interval; - diskio_write_value = diskio_write_value / update_interval; - diskio_value = diskio_value / update_interval; + info.diskio_read_value /= update_interval; + info.diskio_write_value /= update_interval; + info.diskio_value /= update_interval; /* add things to the buffer */ diff --git a/src/conky.h b/src/conky.h index 1662075a..7e0e958d 100644 --- a/src/conky.h +++ b/src/conky.h @@ -129,10 +129,6 @@ struct dns_data { char **ns_list; }; -unsigned int diskio_value; -unsigned int diskio_read_value; -unsigned int diskio_write_value; - struct fs_stat { char path[DEFAULT_TEXT_BUFFER_SIZE]; char type[DEFAULT_TEXT_BUFFER_SIZE]; @@ -330,6 +326,10 @@ struct information { double music_player_interval; short kflags; /* kernel settings, see enum KFLAG */ + + unsigned int diskio_value; + unsigned int diskio_read_value; + unsigned int diskio_write_value; }; enum { diff --git a/src/diskio.c b/src/diskio.c index e8fa96b0..4d3a2182 100644 --- a/src/diskio.c +++ b/src/diskio.c @@ -145,7 +145,7 @@ void update_diskio(void) int tot, tot_read, tot_write; if (!(fp = open_file("/proc/diskstats", &rep))) { - diskio_value = 0; + info.diskio_value = 0; return; } @@ -222,9 +222,9 @@ void update_diskio(void) last_read = current_read; last_write = current_write; - diskio_value = tot; - diskio_read_value = tot_read; - diskio_write_value = tot_write; + info.diskio_value = tot; + info.diskio_read_value = tot_read; + info.diskio_write_value = tot_write; fclose(fp); } diff --git a/src/freebsd.c b/src/freebsd.c index cb66fbc6..bcebc319 100644 --- a/src/freebsd.c +++ b/src/freebsd.c @@ -705,9 +705,9 @@ void update_diskio() * That's why it is better to return 0 first time; */ if (diskio_setup == 0) { diskio_setup = 1; - diskio_value = 0; + info.diskio_value = 0; } else { - diskio_value = (unsigned int) ((diskio_current - diskio_prev) / 1024); + info.diskio_value = (unsigned int) ((diskio_current - diskio_prev) / 1024); } diskio_prev = diskio_current;