1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

diskio: convert print functions to match common signature

This commit is contained in:
Phil Sutter 2009-11-08 13:54:42 +01:00
parent b9f1dc7283
commit 80114f3b1e
3 changed files with 47 additions and 10 deletions

View File

@ -1103,23 +1103,23 @@ void generate_text_internal(char *p, int p_max_size,
} }
#endif /* X11 */ #endif /* X11 */
OBJ(diskio) { OBJ(diskio) {
print_diskio(obj, 0, p, p_max_size); print_diskio(obj, p, p_max_size);
} }
OBJ(diskio_write) { OBJ(diskio_write) {
print_diskio(obj, 1, p, p_max_size); print_diskio_write(obj, p, p_max_size);
} }
OBJ(diskio_read) { OBJ(diskio_read) {
print_diskio(obj, -1, p, p_max_size); print_diskio_read(obj, p, p_max_size);
} }
#ifdef X11 #ifdef X11
OBJ(diskiograph) { OBJ(diskiograph) {
print_diskiograph(obj, 0, p); print_diskiograph(obj, p, p_max_size);
} }
OBJ(diskiograph_read) { OBJ(diskiograph_read) {
print_diskiograph(obj, -1, p); print_diskiograph(obj, p, p_max_size);
} }
OBJ(diskiograph_write) { OBJ(diskiograph_write) {
print_diskiograph(obj, 1, p); print_diskiograph(obj, p, p_max_size);
} }
#endif /* X11 */ #endif /* X11 */
OBJ(downspeed) { OBJ(downspeed) {

View File

@ -119,7 +119,7 @@ void parse_diskio_arg(struct text_object *obj, const char *arg)
* 0: read + write * 0: read + write
* 1: write * 1: write
*/ */
void print_diskio(struct text_object *obj, int dir, char *p, int p_max_size) static void print_diskio_dir(struct text_object *obj, int dir, char *p, int p_max_size)
{ {
struct diskio_stat *diskio = obj->data.opaque; struct diskio_stat *diskio = obj->data.opaque;
double val; double val;
@ -139,6 +139,21 @@ void print_diskio(struct text_object *obj, int dir, char *p, int p_max_size)
human_readable((val / update_interval) * 1024LL, p, p_max_size); human_readable((val / update_interval) * 1024LL, p, p_max_size);
} }
void print_diskio(struct text_object *obj, char *p, int p_max_size)
{
print_diskio_dir(obj, 0, p, p_max_size);
}
void print_diskio_read(struct text_object *obj, char *p, int p_max_size)
{
print_diskio_dir(obj, -1, p, p_max_size);
}
void print_diskio_write(struct text_object *obj, char *p, int p_max_size)
{
print_diskio_dir(obj, 1, p, p_max_size);
}
#ifdef X11 #ifdef X11
void parse_diskiograph_arg(struct text_object *obj, const char *arg) void parse_diskiograph_arg(struct text_object *obj, const char *arg)
{ {
@ -150,7 +165,7 @@ void parse_diskiograph_arg(struct text_object *obj, const char *arg)
free(buf); free(buf);
} }
void print_diskiograph(struct text_object *obj, int dir, char *p) static void print_diskiograph_dir(struct text_object *obj, int dir, char *p, int p_max_size)
{ {
struct diskio_stat *diskio = obj->data.opaque; struct diskio_stat *diskio = obj->data.opaque;
double val; double val;
@ -158,6 +173,9 @@ void print_diskiograph(struct text_object *obj, int dir, char *p)
if (!diskio) if (!diskio)
return; return;
if (!p_max_size)
return;
if (dir < 0) if (dir < 0)
val = diskio->current_read; val = diskio->current_read;
else if (dir == 0) else if (dir == 0)
@ -167,6 +185,21 @@ void print_diskiograph(struct text_object *obj, int dir, char *p)
new_graph(obj, p, val); new_graph(obj, p, val);
} }
void print_diskiograph(struct text_object *obj, char *p, int p_max_size)
{
print_diskiograph_dir(obj, 0, p, p_max_size);
}
void print_diskiograph_read(struct text_object *obj, char *p, int p_max_size)
{
print_diskiograph_dir(obj, -1, p, p_max_size);
}
void print_diskiograph_write(struct text_object *obj, char *p, int p_max_size)
{
print_diskiograph_dir(obj, 1, p, p_max_size);
}
#endif /* X11 */ #endif /* X11 */
void update_diskio_values(struct diskio_stat *ds, void update_diskio_values(struct diskio_stat *ds,

View File

@ -52,10 +52,14 @@ void clear_diskio_stats(void);
void update_diskio_values(struct diskio_stat *, unsigned int, unsigned int); void update_diskio_values(struct diskio_stat *, unsigned int, unsigned int);
void parse_diskio_arg(struct text_object *, const char *); void parse_diskio_arg(struct text_object *, const char *);
void print_diskio(struct text_object *, int, char *, int); void print_diskio(struct text_object *, char *, int);
void print_diskio_read(struct text_object *, char *, int);
void print_diskio_write(struct text_object *, char *, int);
#ifdef X11 #ifdef X11
void parse_diskiograph_arg(struct text_object *, const char *); void parse_diskiograph_arg(struct text_object *, const char *);
void print_diskiograph(struct text_object *, int, char *); void print_diskiograph(struct text_object *, char *, int);
void print_diskiograph_read(struct text_object *, char *, int);
void print_diskiograph_write(struct text_object *, char *, int);
#endif /* X11 */ #endif /* X11 */
#endif /* DISKIO_H_ */ #endif /* DISKIO_H_ */