--------------------- PatchSet 354 Date: 2002/12/13 21:09:17 Author: rbcollins Branch: unify-io Tag: (none) Log: make statfs a method Members: src/SwapDir.cc:1.1.2.9->1.1.2.10 src/SwapDir.h:1.1.2.14->1.1.2.15 src/store_dir.cc:1.4.10.4->1.4.10.5 src/ufscommon.cc:1.4.10.15->1.4.10.16 src/ufscommon.h:1.1.20.38->1.1.20.39 src/fs/aufs/store_dir_aufs.cc:1.2.12.16->1.2.12.17 src/fs/coss/store_coss.h:1.3.10.15->1.3.10.16 src/fs/coss/store_dir_coss.cc:1.4.10.13->1.4.10.14 src/fs/diskd/store_dir_diskd.cc:1.2.16.23->1.2.16.24 src/fs/diskd/store_diskd.h:1.1.20.37->1.1.20.38 src/fs/null/store_null.cc:1.1.20.7->1.1.20.8 src/fs/ufs/store_dir_ufs.cc:1.1.20.17->1.1.20.18 Index: squid3/src/SwapDir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -u -r1.1.2.9 -r1.1.2.10 --- squid3/src/SwapDir.cc 13 Dec 2002 12:17:20 -0000 1.1.2.9 +++ squid3/src/SwapDir.cc 13 Dec 2002 21:09:17 -0000 1.1.2.10 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.cc,v 1.1.2.9 2002/12/13 12:17:20 rbcollins Exp $ + * $Id: SwapDir.cc,v 1.1.2.10 2002/12/13 21:09:17 rbcollins Exp $ * * DEBUG: section ?? Swap Dir base object * AUTHOR: Robert Collins @@ -65,3 +65,6 @@ void SwapDir::unlink(StoreEntry &){} + +void +SwapDir::statfs(StoreEntry &)const {} Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -u -r1.1.2.14 -r1.1.2.15 --- squid3/src/SwapDir.h 13 Dec 2002 20:43:39 -0000 1.1.2.14 +++ squid3/src/SwapDir.h 13 Dec 2002 21:09:17 -0000 1.1.2.15 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.14 2002/12/13 20:43:39 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.15 2002/12/13 21:09:17 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -34,7 +34,6 @@ #ifndef SQUID_SWAPDIR_H #define SQUID_SWAPDIR_H -typedef void STSTATFS(SwapDir *, StoreEntry *); typedef void STMAINTAINFS(SwapDir *); typedef int STCHECKOBJ(SwapDir *, const StoreEntry *); typedef void STREFOBJ(SwapDir *, StoreEntry *); @@ -76,7 +75,7 @@ virtual void newFileSystem(); /* Create a new fs */ virtual void dump(StoreEntry &)const; /* Dump fs config snippet */ virtual bool doubleCheck(StoreEntry &); /* Double check the obj integrity */ - STSTATFS *statfs; /* Dump fs statistics */ + virtual void statfs(StoreEntry &) const; /* Dump fs statistics */ STMAINTAINFS *maintainfs; /* Replacement maintainence */ STCHECKOBJ *checkobj; /* Check if the fs will store an object */ /* These two are notifications */ Index: squid3/src/store_dir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_dir.cc,v retrieving revision 1.4.10.4 retrieving revision 1.4.10.5 diff -u -r1.4.10.4 -r1.4.10.5 --- squid3/src/store_dir.cc 13 Dec 2002 09:32:58 -0000 1.4.10.4 +++ squid3/src/store_dir.cc 13 Dec 2002 21:09:18 -0000 1.4.10.5 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.cc,v 1.4.10.4 2002/12/13 09:32:58 rbcollins Exp $ + * $Id: store_dir.cc,v 1.4.10.5 2002/12/13 21:09:18 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -283,6 +283,7 @@ { int i; SwapDir *SD; + assert (sentry); storeAppendPrintf(sentry, "Store Directory Statistics:\n"); storeAppendPrintf(sentry, "Store Entries : %lu\n", @@ -304,7 +305,7 @@ storeSwapDir(i)); storeAppendPrintf(sentry, "FS Block Size %d Bytes\n", SD->fs.blksize); - SD->statfs(SD, sentry); + SD->statfs(*sentry); if (SD->repl) { storeAppendPrintf(sentry, "Removal policy: %s\n", SD->repl->_type); if (SD->repl->Stats) Index: squid3/src/ufscommon.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.cc,v retrieving revision 1.4.10.15 retrieving revision 1.4.10.16 diff -u -r1.4.10.15 -r1.4.10.16 --- squid3/src/ufscommon.cc 13 Dec 2002 11:57:47 -0000 1.4.10.15 +++ squid3/src/ufscommon.cc 13 Dec 2002 21:09:19 -0000 1.4.10.16 @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.4.10.15 2002/12/13 11:57:47 rbcollins Exp $ + * $Id: ufscommon.cc,v 1.4.10.16 2002/12/13 21:09:19 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -1437,40 +1437,40 @@ /* ========== LOCAL FUNCTIONS ABOVE, GLOBAL FUNCTIONS BELOW ========== */ void -commonUfsDirStats(SwapDir * SD, StoreEntry * sentry) +UFSSwapDir::statfs(StoreEntry & sentry) const { - squidufsinfo_t *ioinfo = (squidufsinfo_t *)SD->fsdata; + squidufsinfo_t *ioinfo = (squidufsinfo_t *)fsdata; int totl_kb = 0; int free_kb = 0; int totl_in = 0; int free_in = 0; int x; - storeAppendPrintf(sentry, "First level subdirectories: %d\n", ioinfo->l1); - storeAppendPrintf(sentry, "Second level subdirectories: %d\n", ioinfo->l2); - storeAppendPrintf(sentry, "Maximum Size: %d KB\n", SD->max_size); - storeAppendPrintf(sentry, "Current Size: %d KB\n", SD->cur_size); - storeAppendPrintf(sentry, "Percent Used: %0.2f%%\n", - 100.0 * SD->cur_size / SD->max_size); - storeAppendPrintf(sentry, "Filemap bits in use: %d of %d (%d%%)\n", + storeAppendPrintf(&sentry, "First level subdirectories: %d\n", ioinfo->l1); + storeAppendPrintf(&sentry, "Second level subdirectories: %d\n", ioinfo->l2); + storeAppendPrintf(&sentry, "Maximum Size: %d KB\n", max_size); + storeAppendPrintf(&sentry, "Current Size: %d KB\n", cur_size); + storeAppendPrintf(&sentry, "Percent Used: %0.2f%%\n", + 100.0 * cur_size / max_size); + storeAppendPrintf(&sentry, "Filemap bits in use: %d of %d (%d%%)\n", ioinfo->map->n_files_in_map, ioinfo->map->max_n_files, percent(ioinfo->map->n_files_in_map, ioinfo->map->max_n_files)); - x = storeDirGetUFSStats(SD->path, &totl_kb, &free_kb, &totl_in, &free_in); + x = storeDirGetUFSStats(path, &totl_kb, &free_kb, &totl_in, &free_in); if (0 == x) { - storeAppendPrintf(sentry, "Filesystem Space in use: %d/%d KB (%d%%)\n", + storeAppendPrintf(&sentry, "Filesystem Space in use: %d/%d KB (%d%%)\n", totl_kb - free_kb, totl_kb, percent(totl_kb - free_kb, totl_kb)); - storeAppendPrintf(sentry, "Filesystem Inodes in use: %d/%d (%d%%)\n", + storeAppendPrintf(&sentry, "Filesystem Inodes in use: %d/%d (%d%%)\n", totl_in - free_in, totl_in, percent(totl_in - free_in, totl_in)); } - storeAppendPrintf(sentry, "Flags:"); - if (SD->flags.selected) - storeAppendPrintf(sentry, " SELECTED"); - if (SD->flags.read_only) - storeAppendPrintf(sentry, " READ-ONLY"); - storeAppendPrintf(sentry, "\n"); + storeAppendPrintf(&sentry, "Flags:"); + if (flags.selected) + storeAppendPrintf(&sentry, " SELECTED"); + if (flags.read_only) + storeAppendPrintf(&sentry, " READ-ONLY"); + storeAppendPrintf(&sentry, "\n"); } #if 0 Index: squid3/src/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.h,v retrieving revision 1.1.20.38 retrieving revision 1.1.20.39 diff -u -r1.1.20.38 -r1.1.20.39 --- squid3/src/ufscommon.h 13 Dec 2002 20:43:43 -0000 1.1.20.38 +++ squid3/src/ufscommon.h 13 Dec 2002 21:09:22 -0000 1.1.20.39 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.1.20.38 2002/12/13 20:43:43 rbcollins Exp $ + * $Id: ufscommon.h,v 1.1.20.39 2002/12/13 21:09:22 rbcollins Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -85,7 +85,7 @@ ~UFSSwapDir(); virtual bool doubleCheck(StoreEntry &); virtual void unlink(StoreEntry &) = 0; - + virtual void statfs(StoreEntry &)const; void unlinkFile(sfileno f); // move down when unlink is a virtual method Index: squid3/src/fs/aufs/store_dir_aufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_dir_aufs.cc,v retrieving revision 1.2.12.16 retrieving revision 1.2.12.17 diff -u -r1.2.12.16 -r1.2.12.17 --- squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 20:43:46 -0000 1.2.12.16 +++ squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 21:09:23 -0000 1.2.12.17 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.16 2002/12/13 20:43:46 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.17 2002/12/13 21:09:23 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -189,7 +189,6 @@ aioinfo->map = NULL; /* Debugging purposes */ aioinfo->suggest = 0; aioinfo->io.storeDirUnlinkFile = storeAufsDirIOUnlinkFile; - sd->statfs = commonUfsDirStats; sd->maintainfs = commonUfsDirMaintain; sd->checkobj = storeAufsDirCheckObj; sd->refobj = commonUfsDirRefObj; Index: squid3/src/fs/coss/store_coss.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/coss/store_coss.h,v retrieving revision 1.3.10.15 retrieving revision 1.3.10.16 diff -u -r1.3.10.15 -r1.3.10.16 --- squid3/src/fs/coss/store_coss.h 13 Dec 2002 20:43:50 -0000 1.3.10.15 +++ squid3/src/fs/coss/store_coss.h 13 Dec 2002 21:09:25 -0000 1.3.10.16 @@ -111,6 +111,7 @@ virtual void dump(StoreEntry &)const; ~CossSwapDir(); virtual void unlink (StoreEntry &); + virtual void statfs (StoreEntry &)const; }; extern off_t storeCossAllocate(SwapDir * SD, const StoreEntry * e, int which); Index: squid3/src/fs/coss/store_dir_coss.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/coss/store_dir_coss.cc,v retrieving revision 1.4.10.13 retrieving revision 1.4.10.14 diff -u -r1.4.10.13 -r1.4.10.14 --- squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 20:43:52 -0000 1.4.10.13 +++ squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 21:09:26 -0000 1.4.10.14 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.13 2002/12/13 20:43:52 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.14 2002/12/13 21:09:26 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -709,30 +709,30 @@ /* ========== LOCAL FUNCTIONS ABOVE, GLOBAL FUNCTIONS BELOW ========== */ -static void -storeCossDirStats(SwapDir * SD, StoreEntry * sentry) +void +CossSwapDir::statfs(StoreEntry & sentry) const { - CossInfo *cs = (CossInfo *) SD->fsdata; + CossInfo *cs = (CossInfo *) fsdata; - storeAppendPrintf(sentry, "\n"); - storeAppendPrintf(sentry, "Maximum Size: %d KB\n", SD->max_size); - storeAppendPrintf(sentry, "Current Size: %d KB\n", SD->cur_size); - storeAppendPrintf(sentry, "Percent Used: %0.2f%%\n", - 100.0 * SD->cur_size / SD->max_size); - storeAppendPrintf(sentry, "Number of object collisions: %d\n", (int) cs->numcollisions); + storeAppendPrintf(&sentry, "\n"); + storeAppendPrintf(&sentry, "Maximum Size: %d KB\n", max_size); + storeAppendPrintf(&sentry, "Current Size: %d KB\n", cur_size); + storeAppendPrintf(&sentry, "Percent Used: %0.2f%%\n", + 100.0 * cur_size / max_size); + storeAppendPrintf(&sentry, "Number of object collisions: %d\n", (int) cs->numcollisions); #if 0 /* is this applicable? I Hope not .. */ storeAppendPrintf(sentry, "Filemap bits in use: %d of %d (%d%%)\n", SD->map->n_files_in_map, SD->map->max_n_files, percent(SD->map->n_files_in_map, SD->map->max_n_files)); #endif - storeAppendPrintf(sentry, "Pending operations: %d out of %d\n", cs->aq.aq_numpending, MAX_ASYNCOP); - storeAppendPrintf(sentry, "Flags:"); - if (SD->flags.selected) - storeAppendPrintf(sentry, " SELECTED"); - if (SD->flags.read_only) - storeAppendPrintf(sentry, " READ-ONLY"); - storeAppendPrintf(sentry, "\n"); + storeAppendPrintf(&sentry, "Pending operations: %d out of %d\n", cs->aq.aq_numpending, MAX_ASYNCOP); + storeAppendPrintf(&sentry, "Flags:"); + if (flags.selected) + storeAppendPrintf(&sentry, " SELECTED"); + if (flags.read_only) + storeAppendPrintf(&sentry, " READ-ONLY"); + storeAppendPrintf(&sentry, "\n"); } static void @@ -759,7 +759,6 @@ cs->fd = -1; cs->swaplog_fd = -1; - sd->statfs = storeCossDirStats; sd->maintainfs = NULL; sd->checkobj = storeCossDirCheckObj; sd->refobj = NULL; /* LRU is done in storeCossRead */ Index: squid3/src/fs/diskd/store_dir_diskd.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/diskd/Attic/store_dir_diskd.cc,v retrieving revision 1.2.16.23 retrieving revision 1.2.16.24 diff -u -r1.2.16.23 -r1.2.16.24 --- squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 20:43:57 -0000 1.2.16.23 +++ squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 21:09:26 -0000 1.2.16.24 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.23 2002/12/13 20:43:57 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.24 2002/12/13 21:09:26 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -51,7 +51,6 @@ static int diskd_initialised = 0; static STCHECKOBJ storeDiskdDirCheckObj; -static void storeDiskdDirStats(SwapDir *, StoreEntry *); static void storeDiskdStats(StoreEntry * sentry); static void storeDiskdDirSync(SwapDir *); static void storeDiskdDirIOUnlinkFile(char *path); @@ -238,11 +237,11 @@ /* ========== LOCAL FUNCTIONS ABOVE, GLOBAL FUNCTIONS BELOW ========== */ void -storeDiskdDirStats(SwapDir * SD, StoreEntry * sentry) +DiskdSwapDir::statfs(StoreEntry & sentry)const { - commonUfsDirStats (SD, sentry); - DiskdIO *IO = dynamic_cast(SD->IO); - storeAppendPrintf(sentry, "Pending operations: %d\n", IO->away); + UFSSwapDir::statfs (sentry); + DiskdIO *IO = dynamic_cast(IO); + storeAppendPrintf(&sentry, "Pending operations: %d\n", IO->away); } static void @@ -396,7 +395,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeDiskdDirIOUnlinkFile; - sd->statfs = storeDiskdDirStats; sd->maintainfs = commonUfsDirMaintain; sd->checkobj = storeDiskdDirCheckObj; sd->refobj = commonUfsDirRefObj; Index: squid3/src/fs/diskd/store_diskd.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/diskd/Attic/store_diskd.h,v retrieving revision 1.1.20.37 retrieving revision 1.1.20.38 diff -u -r1.1.20.37 -r1.1.20.38 --- squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 20:43:58 -0000 1.1.20.37 +++ squid3/src/fs/diskd/store_diskd.h 13 Dec 2002 21:09:27 -0000 1.1.20.38 @@ -139,9 +139,11 @@ class DiskdSwapDir : public UFSSwapDir { +public: virtual void init(); virtual void dump(StoreEntry &)const; virtual void unlink(StoreEntry &); + virtual void statfs (StoreEntry &) const; }; #define SHMBUF_BLKSZ SM_PAGE_SIZE Index: squid3/src/fs/null/store_null.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/null/store_null.cc,v retrieving revision 1.1.20.7 retrieving revision 1.1.20.8 diff -u -r1.1.20.7 -r1.1.20.8 --- squid3/src/fs/null/store_null.cc 13 Dec 2002 10:45:15 -0000 1.1.20.7 +++ squid3/src/fs/null/store_null.cc 13 Dec 2002 21:09:27 -0000 1.1.20.8 @@ -1,6 +1,6 @@ /* - * $Id: store_null.cc,v 1.1.20.7 2002/12/13 10:45:15 rbcollins Exp $ + * $Id: store_null.cc,v 1.1.20.8 2002/12/13 21:09:27 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -58,7 +58,6 @@ }; static int null_initialised = 0; -static void storeNullDirStats(SwapDir * SD, StoreEntry * sentry); static STCHECKOBJ storeNullDirCheckObj; static STFSRECONFIGURE storeNullDirReconfigure; static STLOGCLEANSTART storeNullDirWriteCleanStart; @@ -107,12 +106,6 @@ return result; } -static void -storeNullDirStats(SwapDir * SD, StoreEntry * sentry) -{ - (void) 0; -} - void NullSwapDir::init() { @@ -153,7 +146,6 @@ { sd->index = index; sd->path = xstrdup(path); - sd->statfs = storeNullDirStats; sd->checkobj = storeNullDirCheckObj; sd->log.clean.start = storeNullDirWriteCleanStart; sd->log.clean.done = storeNullDirWriteCleanDone; Index: squid3/src/fs/ufs/store_dir_ufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/store_dir_ufs.cc,v retrieving revision 1.1.20.17 retrieving revision 1.1.20.18 diff -u -r1.1.20.17 -r1.1.20.18 --- squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 20:44:02 -0000 1.1.20.17 +++ squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 21:09:28 -0000 1.1.20.18 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.17 2002/12/13 20:44:02 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.18 2002/12/13 21:09:28 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -170,7 +170,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeUfsDirIOUnlinkFile; - sd->statfs = commonUfsDirStats; sd->maintainfs = commonUfsDirMaintain; sd->checkobj = storeUfsDirCheckObj; sd->refobj = commonUfsDirRefObj;