From a788e2b6e259689ca29dada1570c671a70db71a4 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 1 Jul 2009 15:17:38 -0700 Subject: [PATCH] (SIGAR-148) use sigar_statvfs on AIX --- src/os/aix/aix_sigar.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/os/aix/aix_sigar.c b/src/os/aix/aix_sigar.c index ae89fa58..8bb19228 100644 --- a/src/os/aix/aix_sigar.c +++ b/src/os/aix/aix_sigar.c @@ -1262,10 +1262,6 @@ int sigar_disk_usage_get(sigar_t *sigar, const char *name, return SIGAR_OK; } -/* XXX this is exactly the same as linux and hpux, solaris is darn close */ - -#define SIGAR_FS_BLOCKS_TO_BYTES(val, bsize) ((val * bsize) >> 1) - int sigar_file_system_usage_get(sigar_t *sigar, const char *dirname, sigar_file_system_usage_t *fsusage) @@ -1273,23 +1269,13 @@ int sigar_file_system_usage_get(sigar_t *sigar, sigar_cache_entry_t *ent; struct stat sb; int status; - struct statfs buf; - sigar_uint64_t val, bsize; - if (statfs((char *)dirname, &buf) != 0) { - return errno; + status = sigar_statvfs(sigar, dirname, fsusage); + + if (status != SIGAR_OK) { + return status; } - bsize = buf.f_bsize / 512; - val = buf.f_blocks; - fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(val, bsize); - val = buf.f_bfree; - fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(val, bsize); - val = buf.f_bavail; - fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(val, bsize); - fsusage->used = fsusage->total - fsusage->free; - fsusage->files = buf.f_files; - fsusage->free_files = buf.f_ffree; fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage); SIGAR_DISK_STATS_INIT(&fsusage->disk);