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:
@@ -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>
|
||||
|
||||
* fsusage.c: (_glibtop_get_fsusage_read_write) : Added new flag.
|
||||
|
@@ -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_<arch>_get_fsusage_read_write(glibtop*server,
|
||||
* glibtop_fsusage *buf,
|
||||
* const char *path);
|
||||
* void _glibtop_<arch>_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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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>
|
||||
|
||||
* fsusage.c: (linux_2_6_0), (linux_2_4_0),
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#include <string.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,
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user