make conky fs stuff report same as df for ext3 volumes
authorDavid Carter <boojit@pundo.com>
Thu, 1 Dec 2005 06:32:14 +0000 (06:32 +0000)
committerDavid Carter <boojit@pundo.com>
Thu, 1 Dec 2005 06:32:14 +0000 (06:32 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@436 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
configure.in
src/conky.c
src/conky.h
src/fs.c

index 0df262d..bc6581b 100644 (file)
--- 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.
index 51e401c..b4606a4 100644 (file)
@@ -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
 
index d97cd72..da3462a 100644 (file)
@@ -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) {
index a5e1492..5c98c1d 100644 (file)
@@ -90,6 +90,7 @@ struct fs_stat {
        char *path;
        long long size;
        long long avail;
+       long long free;
 };
 
 /*struct cpu_stat {
index 4eaee9a..eae1431 100644 (file)
--- 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));
        }
 }