--------------------- PatchSet 346 Date: 2002/12/13 11:17:46 Author: rbcollins Branch: unify-io Tag: (none) Log: make freefs a method (destructor in this case) Members: src/SwapDir.cc:1.1.2.6->1.1.2.7 src/SwapDir.h:1.1.2.10->1.1.2.11 src/cache_cf.cc:1.4.12.5->1.4.12.6 src/ufscommon.cc:1.4.10.10->1.4.10.11 src/ufscommon.h:1.1.20.33->1.1.20.34 src/fs/aufs/store_dir_aufs.cc:1.2.12.12->1.2.12.13 src/fs/coss/store_coss.h:1.3.10.12->1.3.10.13 src/fs/coss/store_dir_coss.cc:1.4.10.9->1.4.10.10 src/fs/diskd/store_dir_diskd.cc:1.2.16.19->1.2.16.20 src/fs/ufs/store_dir_ufs.cc:1.1.20.11->1.1.20.12 Index: squid3/src/SwapDir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -r1.1.2.6 -r1.1.2.7 --- squid3/src/SwapDir.cc 13 Dec 2002 10:45:14 -0000 1.1.2.6 +++ squid3/src/SwapDir.cc 13 Dec 2002 11:17:46 -0000 1.1.2.7 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.cc,v 1.1.2.6 2002/12/13 10:45:14 rbcollins Exp $ + * $Id: SwapDir.cc,v 1.1.2.7 2002/12/13 11:17:46 rbcollins Exp $ * * DEBUG: section ?? Swap Dir base object * AUTHOR: Robert Collins @@ -48,6 +48,7 @@ SwapDir::~SwapDir() { IO->deleteSelf(); + xfree(path); } void Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- squid3/src/SwapDir.h 13 Dec 2002 10:45:14 -0000 1.1.2.10 +++ squid3/src/SwapDir.h 13 Dec 2002 11:17:46 -0000 1.1.2.11 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.10 2002/12/13 10:45:14 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.11 2002/12/13 11:17:46 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 STFREE(SwapDir *); typedef int STDBLCHECK(SwapDir *, StoreEntry *); typedef void STSTATFS(SwapDir *, StoreEntry *); typedef void STMAINTAINFS(SwapDir *); @@ -78,7 +77,6 @@ virtual void init() = 0; /* Initialise the fs */ virtual void newFileSystem(); /* Create a new fs */ virtual void dump(StoreEntry &)const; /* Dump fs config snippet */ - STFREE *freefs; /* Free the fs data */ STDBLCHECK *dblcheck; /* Double check the obj integrity */ STSTATFS *statfs; /* Dump fs statistics */ STMAINTAINFS *maintainfs; /* Replacement maintainence */ Index: squid3/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v retrieving revision 1.4.12.5 retrieving revision 1.4.12.6 diff -u -r1.4.12.5 -r1.4.12.6 --- squid3/src/cache_cf.cc 13 Dec 2002 10:45:14 -0000 1.4.12.5 +++ squid3/src/cache_cf.cc 13 Dec 2002 11:17:46 -0000 1.4.12.6 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.4.12.5 2002/12/13 10:45:14 rbcollins Exp $ + * $Id: cache_cf.cc,v 1.4.12.6 2002/12/13 11:17:46 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1395,15 +1395,13 @@ static void free_cachedir(_SquidConfig::_cacheSwap * swap) { - SwapDir *s; int i; /* DON'T FREE THESE FOR RECONFIGURE */ if (reconfiguring) return; for (i = 0; i < swap->n_configured; i++) { - s = swap->swapDirs[i]; - s->freefs(s); - xfree(s->path); + SwapDir * s = swap->swapDirs[i]; + swap->swapDirs[i] = NULL; delete s; } safe_free(swap->swapDirs); Index: squid3/src/ufscommon.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.cc,v retrieving revision 1.4.10.10 retrieving revision 1.4.10.11 diff -u -r1.4.10.10 -r1.4.10.11 --- squid3/src/ufscommon.cc 13 Dec 2002 10:45:15 -0000 1.4.10.10 +++ squid3/src/ufscommon.cc 13 Dec 2002 11:17:46 -0000 1.4.10.11 @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.4.10.10 2002/12/13 10:45:15 rbcollins Exp $ + * $Id: ufscommon.cc,v 1.4.10.11 2002/12/13 11:17:46 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -89,7 +89,6 @@ static FILE *commonUfsDirOpenTmpSwapLog(SwapDir *, int *, int *); #if 0 static STLOGOPEN commonUfsDirOpenSwapLog; -static STFREE commonUfsDirFree; static STLOGCLEANSTART commonUfsDirWriteCleanStart; static STLOGCLEANNEXTENTRY commonUfsDirCleanLogNextEntry; #endif @@ -1533,10 +1532,9 @@ /* * Only "free" the filesystem specific stuff here */ -void -commonUfsDirFree(SwapDir * s) +UFSSwapDir::~UFSSwapDir() { - squidufsinfo_t *ioinfo = (squidufsinfo_t *) s->fsdata; + squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; if (ioinfo->swaplog_fd > -1) { file_close(ioinfo->swaplog_fd); ioinfo->swaplog_fd = -1; @@ -1544,7 +1542,7 @@ filemapFreeMemory(ioinfo->map); xfree(ioinfo); /* This memory leaks. XXX: FIXME - fsdata needs to go away */ - s->fsdata = NULL; /* Will aid debugging... */ + fsdata = NULL; /* Will aid debugging... */ } Index: squid3/src/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.h,v retrieving revision 1.1.20.33 retrieving revision 1.1.20.34 diff -u -r1.1.20.33 -r1.1.20.34 --- squid3/src/ufscommon.h 13 Dec 2002 10:45:15 -0000 1.1.20.33 +++ squid3/src/ufscommon.h 13 Dec 2002 11:17:46 -0000 1.1.20.34 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.1.20.33 2002/12/13 10:45:15 rbcollins Exp $ + * $Id: ufscommon.h,v 1.1.20.34 2002/12/13 11:17:46 rbcollins Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -83,6 +83,7 @@ virtual void init(); virtual void newFileSystem(); virtual void dump(StoreEntry &) const; + ~UFSSwapDir(); private: static EVH CleanEvent; void initBitmap(); 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.12 retrieving revision 1.2.12.13 diff -u -r1.2.12.12 -r1.2.12.13 --- squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 10:45:15 -0000 1.2.12.12 +++ squid3/src/fs/aufs/store_dir_aufs.cc 13 Dec 2002 11:17:46 -0000 1.2.12.13 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.12 2002/12/13 10:45:15 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.13 2002/12/13 11:17:46 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->freefs = commonUfsDirFree; sd->dblcheck = commonUfsCleanupDoubleCheck; sd->statfs = commonUfsDirStats; sd->maintainfs = commonUfsDirMaintain; 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.12 retrieving revision 1.3.10.13 diff -u -r1.3.10.12 -r1.3.10.13 --- squid3/src/fs/coss/store_coss.h 13 Dec 2002 10:45:15 -0000 1.3.10.12 +++ squid3/src/fs/coss/store_coss.h 13 Dec 2002 11:17:46 -0000 1.3.10.13 @@ -107,6 +107,7 @@ virtual void init(); virtual void newFileSystem(); virtual void dump(StoreEntry &)const; + ~CossSwapDir(); }; 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.9 retrieving revision 1.4.10.10 diff -u -r1.4.10.9 -r1.4.10.10 --- squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 10:45:15 -0000 1.4.10.9 +++ squid3/src/fs/coss/store_dir_coss.cc 13 Dec 2002 11:17:46 -0000 1.4.10.10 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.9 2002/12/13 10:45:15 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.10 2002/12/13 11:17:46 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -83,7 +83,6 @@ static STLOGCLOSE storeCossDirCloseSwapLog; static STLOGWRITE storeCossDirSwapLog; static STCHECKOBJ storeCossDirCheckObj; -static STFREE storeCossDirShutdown; static STFSPARSE storeCossDirParse; static STFSRECONFIGURE storeCossDirReconfigure; static STCALLBACK storeCossDirCallback; @@ -656,12 +655,11 @@ } /* we are shutting down, flush all membufs to disk */ -static void -storeCossDirShutdown(SwapDir * SD) +CossSwapDir::~CossSwapDir() { - CossInfo *cs = (CossInfo *) SD->fsdata; + CossInfo *cs = (CossInfo *) fsdata; - storeCossSync(SD); /* This'll call a_file_syncqueue() */ + storeCossSync(this); /* This'll call a_file_syncqueue() */ a_file_closequeue(&cs->aq); file_close(cs->fd); cs->fd = -1; @@ -761,7 +759,6 @@ cs->fd = -1; cs->swaplog_fd = -1; - sd->freefs = storeCossDirShutdown; sd->dblcheck = NULL; sd->statfs = storeCossDirStats; sd->maintainfs = NULL; 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.19 retrieving revision 1.2.16.20 diff -u -r1.2.16.19 -r1.2.16.20 --- squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 10:45:15 -0000 1.2.16.19 +++ squid3/src/fs/diskd/store_dir_diskd.cc 13 Dec 2002 11:17:46 -0000 1.2.16.20 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.19 2002/12/13 10:45:15 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.20 2002/12/13 11:17:46 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -396,7 +396,6 @@ ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeDiskdDirIOUnlinkFile; - sd->freefs = commonUfsDirFree; sd->dblcheck = commonUfsCleanupDoubleCheck; sd->statfs = storeDiskdDirStats; sd->maintainfs = commonUfsDirMaintain; 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.11 retrieving revision 1.1.20.12 diff -u -r1.1.20.11 -r1.1.20.12 --- squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 10:45:15 -0000 1.1.20.11 +++ squid3/src/fs/ufs/store_dir_ufs.cc 13 Dec 2002 11:17:46 -0000 1.1.20.12 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.11 2002/12/13 10:45:15 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.12 2002/12/13 11:17:46 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->freefs = commonUfsDirFree; sd->dblcheck = commonUfsCleanupDoubleCheck; sd->statfs = commonUfsDirStats; sd->maintainfs = commonUfsDirMaintain;