Back to previous version.

* fsusage.c: (_glibtop_get_fsusage_read_write),
	(glibtop_get_fsusage_s):
	* mountlist.c: (glibtop_get_mountlist_s): Back to previous version.

	* fsusage.c: (linux_2_6_0), (linux_2_4_0),
	(_glibtop_linux_get_fsusage_read_write): Back to previous version.
	Now set .flags correctly.
This commit is contained in:
Benoît Dejean
2004-09-20 23:43:24 +00:00
parent a6311d88c3
commit 0b0b1ab43c
5 changed files with 36 additions and 28 deletions

View File

@@ -1,3 +1,9 @@
2004-09-21 Benoît Dejean <tazforever@dlfp.org>
* 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 <tazforever@dlfp.org> 2004-09-19 Benoît Dejean <tazforever@dlfp.org>
* fsusage.c: (_glibtop_get_fsusage_read_write) : Added new flag. * fsusage.c: (_glibtop_get_fsusage_read_write) : Added new flag.

View File

@@ -108,9 +108,6 @@ static const unsigned long _glibtop_sysdeps_fsusage =
+ (1L << GLIBTOP_FSUSAGE_BAVAIL) + (1L << GLIBTOP_FSUSAGE_FILES) + (1L << GLIBTOP_FSUSAGE_BAVAIL) + (1L << GLIBTOP_FSUSAGE_FILES)
+ (1L << GLIBTOP_FSUSAGE_FFREE) + (1L << GLIBTOP_FSUSAGE_BLOCK_SIZE); + (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 * _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. * function full of #something where everything is mixed.
* These functions are private. * These functions are private.
* *
* gboolean _glibtop_<arch>_get_fsusage_read_write(glibtop*server, * void _glibtop_<arch>_get_fsusage_read_write(glibtop*server,
* glibtop_fsusage *buf, * glibtop_fsusage *buf,
* const char *path); * const char *path);
* *
* TODO: split this file properly, is possible * TODO: split this file properly, is possible
*/ */
#ifdef linux #ifdef linux
gboolean _glibtop_linux_get_fsusage_read_write(glibtop *server, void _glibtop_linux_get_fsusage_read_write(glibtop *server,
glibtop_fsusage *buf, glibtop_fsusage *buf,
const char *path); const char *path);
#define _glibtop_get_fsusage_read_write(S, B, P) \ #define _glibtop_get_fsusage_read_write(S, B, P) \
_glibtop_linux_get_fsusage_read_write(S, B, P) _glibtop_linux_get_fsusage_read_write(S, B, P)
#else /* default fallback */ #else /* default fallback */
#warning glibtop_get_fsusage .read .write are not implemented. #warning glibtop_get_fsusage .read .write are not implemented.
static inline gboolean static inline void
_glibtop_get_fsusage_read_write(glibtop *server, _glibtop_get_fsusage_read_write(glibtop *server,
glibtop_fsusage *buf, glibtop_fsusage *buf,
const char *path) const char *path)
{ {
return FALSE; /* NOOP */
} }
#endif #endif
@@ -278,8 +275,8 @@ glibtop_get_fsusage_s (glibtop *server, glibtop_fsusage *buf,
buf->flags = _glibtop_sysdeps_fsusage; buf->flags = _glibtop_sysdeps_fsusage;
if(_glibtop_get_fsusage_read_write(server, buf, path)) /* setting additional flags is delegated */
buf->flags |= _glibtop_sysdeps_fsusage_read_write; _glibtop_get_fsusage_read_write(server, buf, path);
} }
#if defined _AIX && defined _I386 #if defined _AIX && defined _I386

View File

@@ -593,5 +593,9 @@ glibtop_get_mountlist_s (glibtop *server, glibtop_mountlist *buf, int all_fs)
buf->number = mount_array->len; buf->number = mount_array->len;
buf->total = buf->number * buf->size; 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); return (glibtop_mountentry*) g_array_free(mount_array, FALSE);
} }

View File

@@ -1,3 +1,9 @@
2004-09-21 Benoît Dejean <tazforever@dlfp.org>
* 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 <tazforever@dlfp.org> 2004-09-19 Benoît Dejean <tazforever@dlfp.org>
* fsusage.c: (linux_2_6_0), (linux_2_4_0), * fsusage.c: (linux_2_6_0), (linux_2_4_0),

View File

@@ -11,7 +11,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
gboolean _glibtop_linux_get_fsusage_read_write(glibtop *server, void _glibtop_linux_get_fsusage_read_write(glibtop *server,
glibtop_fsusage *buf, glibtop_fsusage *buf,
const char *path); const char *path);
@@ -20,12 +20,11 @@ gboolean _glibtop_linux_get_fsusage_read_write(glibtop *server,
* linux/Documentation/iostats.txt * 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"); FILE *mtab = setmntent("/etc/mtab", "r");
struct mntent *emnt; struct mntent *emnt;
gboolean ret = FALSE;
while((emnt = getmntent(mtab)) != NULL) 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); p = skip_token(p);
buf->write = strtoull(p, &p, 0); buf->write = strtoull(p, &p, 0);
ret = TRUE; buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
break; break;
} }
} }
endmntent(mtab); 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, void _glibtop_linux_get_fsusage_read_write(glibtop *server,
glibtop_fsusage *buf, glibtop_fsusage *buf,
const char *path) const char *path)
{ {
if(server->os_version_code >= LINUX_VERSION_CODE(2, 6, 0)) 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)) 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;
} }