--- squid-2.5.STABLE10/src/Makefile.am.statvfs	2005-04-23 03:32:27.000000000 +0200
+++ squid-2.5.STABLE10/src/Makefile.am	2005-07-06 16:15:04.000000000 +0200
@@ -190,6 +190,7 @@
 	store_client.c \
 	store_digest.c \
 	store_dir.c \
+	store_dir_stat.c \
 	store_key_md5.c \
 	store_log.c \
 	store_rebuild.c \
--- squid-2.5.STABLE10/src/tools.c.statvfs	2005-04-22 22:45:12.000000000 +0200
+++ squid-2.5.STABLE10/src/tools.c	2005-07-06 16:15:04.000000000 +0200
@@ -738,6 +738,12 @@
     return b ? (100.0 * a / b) : 0.0;
 }
 
+unsigned long long
+llpercent(unsigned long long a, unsigned long long b)
+{
+    return b ? ((unsigned long long) (100.0 * a / b + 0.5)) : 0;
+}
+
 void
 squid_signal(int sig, SIGHDLR * func, int flags)
 {
--- squid-2.5.STABLE10/src/store_dir.c.statvfs	2005-03-26 03:50:54.000000000 +0100
+++ squid-2.5.STABLE10/src/store_dir.c	2005-07-06 16:15:04.000000000 +0200
@@ -486,60 +486,3 @@
     ndir++;
 }
 
-int
-storeDirGetBlkSize(const char *path, int *blksize)
-{
-#if HAVE_STATVFS
-    struct statvfs sfs;
-    if (statvfs(path, &sfs)) {
-	debug(50, 1) ("%s: %s\n", path, xstrerror());
-	*blksize = 2048;
-	return 1;
-    }
-    *blksize = (int) sfs.f_frsize;
-#else
-    struct statfs sfs;
-    if (statfs(path, &sfs)) {
-	debug(50, 1) ("%s: %s\n", path, xstrerror());
-	*blksize = 2048;
-	return 1;
-    }
-    *blksize = (int) sfs.f_bsize;
-#endif
-    /*
-     * Sanity check; make sure we have a meaningful value.
-     */
-    if (*blksize < 512)
-	*blksize = 2048;
-    return 0;
-}
-
-#define fsbtoblk(num, fsbs, bs) \
-    (((fsbs) != 0 && (fsbs) < (bs)) ? \
-            (num) / ((bs) / (fsbs)) : (num) * ((fsbs) / (bs)))
-int
-storeDirGetUFSStats(const char *path, int *totl_kb, int *free_kb, int *totl_in, int *free_in)
-{
-#if HAVE_STATVFS
-    struct statvfs sfs;
-    if (statvfs(path, &sfs)) {
-	debug(50, 1) ("%s: %s\n", path, xstrerror());
-	return 1;
-    }
-    *totl_kb = (int) fsbtoblk(sfs.f_blocks, sfs.f_frsize, 1024);
-    *free_kb = (int) fsbtoblk(sfs.f_bfree, sfs.f_frsize, 1024);
-    *totl_in = (int) sfs.f_files;
-    *free_in = (int) sfs.f_ffree;
-#else
-    struct statfs sfs;
-    if (statfs(path, &sfs)) {
-	debug(50, 1) ("%s: %s\n", path, xstrerror());
-	return 1;
-    }
-    *totl_kb = (int) fsbtoblk(sfs.f_blocks, sfs.f_bsize, 1024);
-    *free_kb = (int) fsbtoblk(sfs.f_bfree, sfs.f_bsize, 1024);
-    *totl_in = (int) sfs.f_files;
-    *free_in = (int) sfs.f_ffree;
-#endif
-    return 0;
-}
--- squid-2.5.STABLE10/src/Makefile.in.statvfs	2005-07-06 16:15:04.000000000 +0200
+++ squid-2.5.STABLE10/src/Makefile.in	2005-07-06 16:15:04.000000000 +0200
@@ -286,6 +286,7 @@
 	store_client.c \
 	store_digest.c \
 	store_dir.c \
+	store_dir_stat.c \
 	store_key_md5.c \
 	store_log.c \
 	store_rebuild.c \
@@ -505,7 +506,7 @@
 	ssl.$(OBJEXT) $(am__objects_8) stat.$(OBJEXT) \
 	StatHist.$(OBJEXT) String.$(OBJEXT) stmem.$(OBJEXT) \
 	store.$(OBJEXT) store_io.$(OBJEXT) store_client.$(OBJEXT) \
-	store_digest.$(OBJEXT) store_dir.$(OBJEXT) \
+	store_digest.$(OBJEXT) store_dir.$(OBJEXT) store_dir_stat.$(OBJEXT) \
 	store_key_md5.$(OBJEXT) store_log.$(OBJEXT) \
 	store_rebuild.$(OBJEXT) store_swapin.$(OBJEXT) \
 	store_swapmeta.$(OBJEXT) store_swapout.$(OBJEXT) \
@@ -576,7 +577,7 @@
 @AMDEP_TRUE@	$(DEPDIR)/ssl_support.Po $(DEPDIR)/stat.Po \
 @AMDEP_TRUE@	$(DEPDIR)/stmem.Po $(DEPDIR)/store.Po \
 @AMDEP_TRUE@	$(DEPDIR)/store_client.Po $(DEPDIR)/store_digest.Po \
-@AMDEP_TRUE@	$(DEPDIR)/store_dir.Po $(DEPDIR)/store_io.Po \
+@AMDEP_TRUE@	$(DEPDIR)/store_dir.Po $(DEPDIR)/store_dir_stat.Po $(DEPDIR)/store_io.Po \
 @AMDEP_TRUE@	$(DEPDIR)/store_key_md5.Po $(DEPDIR)/store_log.Po \
 @AMDEP_TRUE@	$(DEPDIR)/store_modules.Po \
 @AMDEP_TRUE@	$(DEPDIR)/store_rebuild.Po \
@@ -807,6 +808,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/store_client.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/store_digest.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/store_dir.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/store_dir_stat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/store_io.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/store_key_md5.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/store_log.Po@am__quote@
--- /dev/null	2005-07-06 10:26:47.607584424 +0200
+++ squid-2.5.STABLE10/src/store_dir_stat.h	2005-07-06 16:15:04.000000000 +0200
@@ -0,0 +1,57 @@
+
+/*
+ * $Id: store_dir_stat.h,v 1.420.2.34 2005/04/19 22:19:27 hno Exp $
+ *
+ *
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#ifndef SQUID_STORE_DIR_STAT_H
+#define SQUID_STORE_DIR_STAT_H
+
+#include "squid.h"
+
+#ifdef HAVE_STATVFS
+#define _FILE_OFFSET_BITS 64
+#define _LARGEFILE64_SOURCE 1
+#include <sys/statvfs.h>
+#endif
+/* Windows uses sys/vfs.h */
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+
+int storeDirGetBlkSize(const char *path, int *blksize);
+
+#ifdef HAVE_STATVFS
+extern int storeDirGetUFSStats(const char *, fsblkcnt_t *, fsblkcnt_t *, fsfilcnt_t *, fsfilcnt_t *);
+#else
+extern int storeDirGetUFSStats(const char *path, int *totl_kb, int *free_kb, int *totl_in, int *free_in);
+#endif
+
+#endif /* SQUID_STORE_DIR_STAT_H */
--- /dev/null	2005-07-06 10:26:47.607584424 +0200
+++ squid-2.5.STABLE10/src/store_dir_stat.c	2005-07-06 16:15:04.000000000 +0200
@@ -0,0 +1,101 @@
+
+/*
+ * $Id: store_dir_stat.c,v 1.135.2.3 2005/03/26 02:50:54 hno Exp $
+ *
+ * DEBUG: section 47    Store Directory Routines
+ * AUTHOR: Duane Wessels
+ *
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *  
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "squid.h"
+#include "store_dir_stat.h"
+
+int
+storeDirGetBlkSize(const char *path, int *blksize)
+{
+#if HAVE_STATVFS
+    struct statvfs sfs;
+    if (statvfs(path, &sfs)) {
+	debug(50, 1) ("%s: %s\n", path, xstrerror());
+	*blksize = 2048;
+	return 1;
+    }
+    *blksize = (int) sfs.f_frsize;
+#else
+    struct statfs sfs;
+    if (statfs(path, &sfs)) {
+	debug(50, 1) ("%s: %s\n", path, xstrerror());
+	*blksize = 2048;
+	return 1;
+    }
+    *blksize = (int) sfs.f_bsize;
+#endif
+    /*
+     * Sanity check; make sure we have a meaningful value.
+     */
+    if (*blksize < 512)
+	*blksize = 2048;
+    return 0;
+}
+
+#define fsbtoblk(num, fsbs, bs) \
+    (((fsbs) != 0 && (fsbs) < (bs)) ? \
+            (num) / ((bs) / (fsbs)) : (num) * ((fsbs) / (bs)))
+
+#if HAVE_STATVFS
+int
+storeDirGetUFSStats(const char *path, fsblkcnt_t *totl_kb, fsblkcnt_t *free_kb, fsfilcnt_t *totl_in, fsfilcnt_t *free_in)
+#else
+int
+storeDirGetUFSStats(const char *path, int *totl_kb, int *free_kb, int *totl_in, int *free_in)
+#endif
+{
+#if HAVE_STATVFS
+    struct statvfs sfs;
+    if (statvfs(path, &sfs)) {
+	debug(50, 1) ("%s: %s\n", path, xstrerror());
+	return 1;
+    }
+    *totl_kb = fsbtoblk(sfs.f_blocks, sfs.f_frsize, 1024);
+    *free_kb = fsbtoblk(sfs.f_bfree, sfs.f_frsize, 1024);
+    *totl_in = sfs.f_files;
+    *free_in = sfs.f_ffree;
+#else
+    struct statfs sfs;
+    if (statfs(path, &sfs)) {
+	debug(50, 1) ("%s: %s\n", path, xstrerror());
+	return 1;
+    }
+    *totl_kb = fsbtoblk(sfs.f_blocks, sfs.f_bsize, 1024);
+    *free_kb = fsbtoblk(sfs.f_bfree, sfs.f_bsize, 1024);
+    *totl_in = sfs.f_files;
+    *free_in = sfs.f_ffree;
+#endif
+    return 0;
+}
--- squid-2.5.STABLE10/src/fs/diskd/store_dir_diskd.c.statvfs	2005-05-01 12:48:07.000000000 +0200
+++ squid-2.5.STABLE10/src/fs/diskd/store_dir_diskd.c	2005-07-06 16:21:13.000000000 +0200
@@ -40,6 +40,7 @@
 #include <sys/shm.h>
 
 #include "store_diskd.h"
+#include "store_dir_stat.h"
 
 #define DefaultLevelOneDirs     16
 #define DefaultLevelTwoDirs     256
@@ -1959,10 +1960,17 @@
 storeDiskdDirStats(SwapDir * SD, StoreEntry * sentry)
 {
     diskdinfo_t *diskdinfo = SD->fsdata;
+#ifdef HAVE_STATVFS
+    fsblkcnt_t totl_kb = 0;
+    fsblkcnt_t free_kb = 0;
+    fsfilcnt_t totl_in = 0;
+    fsfilcnt_t free_in = 0;
+#else
     int totl_kb = 0;
     int free_kb = 0;
     int totl_in = 0;
     int free_in = 0;
+#endif
     int x;
     storeAppendPrintf(sentry, "First level subdirectories: %d\n", diskdinfo->l1);
     storeAppendPrintf(sentry, "Second level subdirectories: %d\n", diskdinfo->l2);
@@ -1975,6 +1983,16 @@
 	percent(diskdinfo->map->n_files_in_map, diskdinfo->map->max_n_files));
     x = storeDirGetUFSStats(SD->path, &totl_kb, &free_kb, &totl_in, &free_in);
     if (0 == x) {
+#ifdef HAVE_STATVFS
+       storeAppendPrintf(sentry, "Filesystem Space in use: %llu/%llu KB (%llu%%)\n",
+           (unsigned long long)(totl_kb - free_kb),
+           (unsigned long long)totl_kb,
+           llpercent(totl_kb - free_kb, totl_kb));
+       storeAppendPrintf(sentry, "Filesystem Inodes in use: %llu/%llu (%llu%%)\n",
+           (unsigned long long)(totl_in - free_in),
+           (unsigned long long)totl_in,
+           llpercent(totl_in - free_in, totl_in));
+#else
 	storeAppendPrintf(sentry, "Filesystem Space in use: %d/%d KB (%d%%)\n",
 	    totl_kb - free_kb,
 	    totl_kb,
@@ -1983,6 +2001,7 @@
 	    totl_in - free_in,
 	    totl_in,
 	    percent(totl_in - free_in, totl_in));
+#endif
     }
     storeAppendPrintf(sentry, "Flags:");
     if (SD->flags.selected)
--- squid-2.5.STABLE10/src/fs/ufs/store_dir_ufs.c.statvfs	2005-03-27 00:27:11.000000000 +0100
+++ squid-2.5.STABLE10/src/fs/ufs/store_dir_ufs.c	2005-07-06 16:15:04.000000000 +0200
@@ -36,6 +36,7 @@
 #include "squid.h"
 
 #include "store_ufs.h"
+#include "store_dir_stat.h"
 
 #define DefaultLevelOneDirs     16
 #define DefaultLevelTwoDirs     256
@@ -1701,10 +1702,17 @@
 storeUfsDirStats(SwapDir * SD, StoreEntry * sentry)
 {
     ufsinfo_t *ufsinfo = SD->fsdata;
+#ifdef HAVE_STATVFS
+    fsblkcnt_t totl_kb = 0;
+    fsblkcnt_t free_kb = 0;
+    fsfilcnt_t totl_in = 0;
+    fsfilcnt_t free_in = 0;
+#else
     int totl_kb = 0;
     int free_kb = 0;
     int totl_in = 0;
     int free_in = 0;
+#endif
     int x;
     storeAppendPrintf(sentry, "First level subdirectories: %d\n", ufsinfo->l1);
     storeAppendPrintf(sentry, "Second level subdirectories: %d\n", ufsinfo->l2);
@@ -1717,6 +1725,16 @@
 	percent(ufsinfo->map->n_files_in_map, ufsinfo->map->max_n_files));
     x = storeDirGetUFSStats(SD->path, &totl_kb, &free_kb, &totl_in, &free_in);
     if (0 == x) {
+#ifdef HAVE_STATVFS
+       storeAppendPrintf(sentry, "Filesystem Space in use: %llu/%llu KB (%llu%%)\n",
+           (unsigned long long)(totl_kb - free_kb),
+           (unsigned long long)totl_kb,
+           llpercent(totl_kb - free_kb, totl_kb));
+       storeAppendPrintf(sentry, "Filesystem Inodes in use: %llu/%llu (%llu%%)\n",
+           (unsigned long long)(totl_in - free_in),
+           (unsigned long long)totl_in,
+           llpercent(totl_in - free_in, totl_in));
+#else
 	storeAppendPrintf(sentry, "Filesystem Space in use: %d/%d KB (%d%%)\n",
 	    totl_kb - free_kb,
 	    totl_kb,
@@ -1725,6 +1743,7 @@
 	    totl_in - free_in,
 	    totl_in,
 	    percent(totl_in - free_in, totl_in));
+#endif
     }
     storeAppendPrintf(sentry, "Flags:");
     if (SD->flags.selected)
--- squid-2.5.STABLE10/src/fs/aufs/store_dir_aufs.c.statvfs	2005-03-27 00:27:10.000000000 +0100
+++ squid-2.5.STABLE10/src/fs/aufs/store_dir_aufs.c	2005-07-06 16:15:04.000000000 +0200
@@ -36,6 +36,7 @@
 #include "squid.h"
 
 #include "store_asyncufs.h"
+#include "store_dir_stat.h"
 
 #define DefaultLevelOneDirs     16
 #define DefaultLevelTwoDirs     256
@@ -1692,10 +1693,17 @@
 storeAufsDirStats(SwapDir * SD, StoreEntry * sentry)
 {
     squidaioinfo_t *aioinfo = SD->fsdata;
+#ifdef HAVE_STATVFS
+    fsblkcnt_t totl_kb;
+    fsblkcnt_t free_kb;
+    fsfilcnt_t totl_in;
+    fsfilcnt_t free_in;
+#else
     int totl_kb = 0;
     int free_kb = 0;
     int totl_in = 0;
     int free_in = 0;
+#endif
     int x;
     storeAppendPrintf(sentry, "First level subdirectories: %d\n", aioinfo->l1);
     storeAppendPrintf(sentry, "Second level subdirectories: %d\n", aioinfo->l2);
@@ -1708,6 +1716,16 @@
 	percent(aioinfo->map->n_files_in_map, aioinfo->map->max_n_files));
     x = storeDirGetUFSStats(SD->path, &totl_kb, &free_kb, &totl_in, &free_in);
     if (0 == x) {
+#ifdef HAVE_STATVFS
+       storeAppendPrintf(sentry, "Filesystem Space in use: %llu/%llu KB (%llu%%)\n",
+           (unsigned long long)(totl_kb - free_kb),
+           (unsigned long long)totl_kb,
+           llpercent(totl_kb - free_kb, totl_kb));
+       storeAppendPrintf(sentry, "Filesystem Inodes in use: %llu/%llu (%llu%%)\n",
+           (unsigned long long)(totl_in - free_in),
+           (unsigned long long)totl_in,
+           llpercent(totl_in - free_in, totl_in));
+#else
 	storeAppendPrintf(sentry, "Filesystem Space in use: %d/%d KB (%d%%)\n",
 	    totl_kb - free_kb,
 	    totl_kb,
@@ -1716,6 +1734,7 @@
 	    totl_in - free_in,
 	    totl_in,
 	    percent(totl_in - free_in, totl_in));
+#endif
     }
     storeAppendPrintf(sentry, "Flags:");
     if (SD->flags.selected)
--- squid-2.5.STABLE10/src/protos.h.statvfs	2005-04-20 00:19:27.000000000 +0200
+++ squid-2.5.STABLE10/src/protos.h	2005-07-06 16:15:04.000000000 +0200
@@ -1005,8 +1005,6 @@
 extern void storeDirCallback(void);
 extern void storeDirLRUDelete(StoreEntry *);
 extern void storeDirLRUAdd(StoreEntry *);
-extern int storeDirGetBlkSize(const char *path, int *blksize);
-extern int storeDirGetUFSStats(const char *, int *, int *, int *, int *);
 
 /*
  * store_swapmeta.c
@@ -1074,6 +1072,7 @@
 extern time_t getCurrentTime(void);
 extern int percent(int, int);
 extern double dpercent(double, double);
+extern unsigned long long llpercent(unsigned long long, unsigned long long);
 extern void squid_signal(int sig, SIGHDLR *, int flags);
 extern pid_t readPidFile(void);
 extern struct in_addr inaddrFromHostent(const struct hostent *hp);

