diff --git a/sysdeps/common/ChangeLog b/sysdeps/common/ChangeLog index f1e6a31c..c191e99f 100644 --- a/sysdeps/common/ChangeLog +++ b/sysdeps/common/ChangeLog @@ -1,3 +1,9 @@ +2004-09-21 Benoît Dejean + + * fsusage.c: (_glibtop_get_fsusage_read_write), + (glibtop_get_fsusage_s): + * mountlist.c: (glibtop_get_mountlist_s): Back to previous version. + 2004-09-19 Benoît Dejean * fsusage.c: (_glibtop_get_fsusage_read_write) : Added new flag. diff --git a/sysdeps/common/fsusage.c b/sysdeps/common/fsusage.c index 0da0cf52..abcd2bdf 100644 --- a/sysdeps/common/fsusage.c +++ b/sysdeps/common/fsusage.c @@ -108,9 +108,6 @@ static const unsigned long _glibtop_sysdeps_fsusage = + (1L << GLIBTOP_FSUSAGE_BAVAIL) + (1L << GLIBTOP_FSUSAGE_FILES) + (1L << GLIBTOP_FSUSAGE_FFREE) + (1L << GLIBTOP_FSUSAGE_BLOCK_SIZE); -static const unsigned long _glibtop_sysdeps_fsusage_read_write = -(1L << GLIBTOP_FSUSAGE_READ) + (1L << GLIBTOP_FSUSAGE_WRITE); - /* * _glibtop_get_fsusage_read_write @@ -121,29 +118,29 @@ static const unsigned long _glibtop_sysdeps_fsusage_read_write = * function full of #something where everything is mixed. * These functions are private. * - * gboolean _glibtop__get_fsusage_read_write(glibtop*server, - * glibtop_fsusage *buf, - * const char *path); + * void _glibtop__get_fsusage_read_write(glibtop*server, + * glibtop_fsusage *buf, + * const char *path); * * TODO: split this file properly, is possible */ #ifdef linux -gboolean _glibtop_linux_get_fsusage_read_write(glibtop *server, - glibtop_fsusage *buf, - const char *path); +void _glibtop_linux_get_fsusage_read_write(glibtop *server, + glibtop_fsusage *buf, + const char *path); #define _glibtop_get_fsusage_read_write(S, B, P) \ _glibtop_linux_get_fsusage_read_write(S, B, P) #else /* default fallback */ #warning glibtop_get_fsusage .read .write are not implemented. -static inline gboolean +static inline void _glibtop_get_fsusage_read_write(glibtop *server, glibtop_fsusage *buf, const char *path) { - return FALSE; + /* NOOP */ } #endif @@ -278,8 +275,8 @@ glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf, buf->flags = _glibtop_sysdeps_fsusage; - if(_glibtop_get_fsusage_read_write(server, buf, path)) - buf->flags |= _glibtop_sysdeps_fsusage_read_write; + /* setting additional flags is delegated */ + _glibtop_get_fsusage_read_write(server, buf, path); } #if defined _AIX && defined _I386 diff --git a/sysdeps/common/mountlist.c b/sysdeps/common/mountlist.c index 0d1e44a7..41d79be9 100644 --- a/sysdeps/common/mountlist.c +++ b/sysdeps/common/mountlist.c @@ -593,5 +593,9 @@ glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs) buf->number = mount_array->len; buf->total = buf->number * buf->size; + buf->flags = (1 << GLIBTOP_MOUNTLIST_SIZE) + | (1 << GLIBTOP_MOUNTLIST_SIZE) + | (1 << GLIBTOP_MOUNTLIST_TOTAL); + return (glibtop_mountentry*) g_array_free(mount_array, FALSE); } diff --git a/sysdeps/linux/ChangeLog b/sysdeps/linux/ChangeLog index 9911b1a2..5b1b83ef 100644 --- a/sysdeps/linux/ChangeLog +++ b/sysdeps/linux/ChangeLog @@ -1,3 +1,9 @@ +2004-09-21 Benoît Dejean + + * fsusage.c: (linux_2_6_0), (linux_2_4_0), + (_glibtop_linux_get_fsusage_read_write): Back to previous version. + Now set .flags correctly. + 2004-09-19 Benoît Dejean * fsusage.c: (linux_2_6_0), (linux_2_4_0), diff --git a/sysdeps/linux/fsusage.c b/sysdeps/linux/fsusage.c index 33430a63..47f81b5e 100644 --- a/sysdeps/linux/fsusage.c +++ b/sysdeps/linux/fsusage.c @@ -11,7 +11,7 @@ #include #include -gboolean _glibtop_linux_get_fsusage_read_write(glibtop *server, +void _glibtop_linux_get_fsusage_read_write(glibtop *server, glibtop_fsusage *buf, const char *path); @@ -20,12 +20,11 @@ gboolean _glibtop_linux_get_fsusage_read_write(glibtop *server, * linux/Documentation/iostats.txt */ -static gboolean linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path) +static void linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *path) { FILE *mtab = setmntent("/etc/mtab", "r"); struct mntent *emnt; - gboolean ret = FALSE; while((emnt = getmntent(mtab)) != NULL) { @@ -76,35 +75,31 @@ static gboolean linux_2_6_0(glibtop *server, glibtop_fsusage *buf, const char *p p = skip_token(p); buf->write = strtoull(p, &p, 0); - ret = TRUE; + buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE); + break; } } endmntent(mtab); - - return ret; } -static gboolean linux_2_4_0(glibtop *server, glibtop_fsusage *buf, const char *path) +static void linux_2_4_0(glibtop *server, glibtop_fsusage *buf, const char *path) { - return FALSE; } -gboolean _glibtop_linux_get_fsusage_read_write(glibtop *server, - glibtop_fsusage *buf, - const char *path) +void _glibtop_linux_get_fsusage_read_write(glibtop *server, + glibtop_fsusage *buf, + const char *path) { if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0)) { - return linux_2_6_0(server, buf, path); + linux_2_6_0(server, buf, path); } else if(server->os_version_code >= LINUX_VERSION_CODE(2, 4, 0)) { - return linux_2_4_0(server, buf, path); + linux_2_4_0(server, buf, path); } - - return FALSE; }