From 1f16e29c844652e12d0b039b5fcc4aa66bb54958 Mon Sep 17 00:00:00 2001 From: David Carter Date: Thu, 1 Dec 2005 06:32:14 +0000 Subject: [PATCH] make conky fs stuff report same as df for ext3 volumes git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@436 7f574dfc-610e-0410-a909-a81674777703 --- ChangeLog | 2 ++ configure.in | 4 ++-- src/conky.c | 2 +- src/conky.h | 1 + src/fs.c | 4 +++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0df262d6..bc6581b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ 2003-11-30 * Fixed sf.net bugs 1369607, 1367735 and gentoo bug 113921, all variations of the same array out of bounds issue. + * "Fixed" code in fs.c and conky.c to make fs stats match those displayed by df + (affects reporting against ext3 filesystems only) 2005-11-27 * new code in linux.c and top.c to calculate CPU % correctly on 2.6 kernels. diff --git a/configure.in b/configure.in index 51e401c5..b4606a48 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ -AC_INIT([Conky],[1.3.5dev],[brenden1@users.sourceforge.net]) +AC_INIT([Conky],[1.3.5dev2],[brenden1@users.sourceforge.net]) -AM_INIT_AUTOMAKE(conky, 1.3.5dev) +AM_INIT_AUTOMAKE(conky, 1.3.5dev2) AM_CONFIG_HEADER(src/config.h) AC_PROG_LIBTOOL diff --git a/src/conky.c b/src/conky.c index d97cd72e..da3462a2 100644 --- a/src/conky.c +++ b/src/conky.c @@ -2501,7 +2501,7 @@ static void generate_text() OBJ(fs_used) { if (obj->data.fs != NULL) human_readable(obj->data.fs->size - - obj->data.fs->avail, + (obj->data.fs->free ? obj->data.fs->free :obj->data.fs->avail), p, 255); } OBJ(fs_bar_free) { diff --git a/src/conky.h b/src/conky.h index a5e14925..5c98c1dc 100644 --- a/src/conky.h +++ b/src/conky.h @@ -90,6 +90,7 @@ struct fs_stat { char *path; long long size; long long avail; + long long free; }; /*struct cpu_stat { diff --git a/src/fs.c b/src/fs.c index 4eaee9a4..eae1431e 100644 --- a/src/fs.c +++ b/src/fs.c @@ -81,10 +81,12 @@ void update_fs_stat(struct fs_stat* fs) if(statfs(fs->path, &s) == 0) { fs->size = (long long) s.f_blocks * s.f_bsize; /* bfree (root) or bavail (non-roots) ? */ - fs->avail = (long long) s.f_bavail * s.f_bsize; + fs->avail = (long long) s.f_bavail* s.f_bsize; + fs->free = (long long) s.f_bfree * s.f_bsize;; } else { fs->size = 0; fs->avail = 0; + fs->free = 0; ERR("statfs '%s': %s", fs->path, strerror(errno)); } }