--------------------- PatchSet 381 Date: 2002/12/14 11:41:08 Author: rbcollins Branch: unify-io Tag: (none) Log: write.done->method Members: src/SwapDir.cc:1.1.2.22->1.1.2.23 src/SwapDir.h:1.1.2.30->1.1.2.31 src/store_dir.cc:1.4.10.13->1.4.10.14 src/ufscommon.cc:1.4.10.32->1.4.10.33 src/ufscommon.h:1.1.20.54->1.1.20.55 src/fs/aufs/store_dir_aufs.cc:1.2.12.30->1.2.12.31 src/fs/coss/store_coss.h:1.3.10.26->1.3.10.27 src/fs/coss/store_dir_coss.cc:1.4.10.27->1.4.10.28 src/fs/diskd/store_dir_diskd.cc:1.2.16.38->1.2.16.39 src/fs/null/store_null.cc:1.1.20.13->1.1.20.14 src/fs/ufs/store_dir_ufs.cc:1.1.20.33->1.1.20.34 Index: squid3/src/SwapDir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.cc,v retrieving revision 1.1.2.22 retrieving revision 1.1.2.23 diff -u -r1.1.2.22 -r1.1.2.23 --- squid3/src/SwapDir.cc 14 Dec 2002 11:23:48 -0000 1.1.2.22 +++ squid3/src/SwapDir.cc 14 Dec 2002 11:41:08 -0000 1.1.2.23 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.cc,v 1.1.2.22 2002/12/14 11:23:48 rbcollins Exp $ + * $Id: SwapDir.cc,v 1.1.2.23 2002/12/14 11:41:08 rbcollins Exp $ * * DEBUG: section ?? Swap Dir base object * AUTHOR: Robert Collins @@ -117,4 +117,7 @@ } void +SwapDir::writeCleanDone(){} + +void SwapDir::logEntry(const StoreEntry & e, int op) const{} Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.30 retrieving revision 1.1.2.31 diff -u -r1.1.2.30 -r1.1.2.31 --- squid3/src/SwapDir.h 14 Dec 2002 11:23:48 -0000 1.1.2.30 +++ squid3/src/SwapDir.h 14 Dec 2002 11:41:08 -0000 1.1.2.31 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.30 2002/12/14 11:23:48 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.31 2002/12/14 11:41:08 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -37,7 +37,6 @@ #include "StoreIOState.h" typedef const StoreEntry *STLOGCLEANNEXTENTRY(SwapDir *); typedef void STLOGCLEANWRITE(SwapDir *, const StoreEntry *); -typedef void STLOGCLEANDONE(SwapDir *); struct SwapDir { public: @@ -81,15 +80,20 @@ virtual void closeLog(); virtual void logEntry(const StoreEntry & e, int op) const; struct { + class CleanLog { + public: + const StoreEntry *nextEntry(); + void write(StoreEntry const &); + }; struct { STLOGCLEANNEXTENTRY *nextentry; STLOGCLEANWRITE *write; - STLOGCLEANDONE *done; void *state; } clean; int writes_since_clean; } log; virtual int writeCleanStart(); + virtual void writeCleanDone(); struct { int blksize; } fs; Index: squid3/src/store_dir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_dir.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/store_dir.cc 14 Dec 2002 11:23:48 -0000 1.4.10.13 +++ squid3/src/store_dir.cc 14 Dec 2002 11:41:08 -0000 1.4.10.14 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.cc,v 1.4.10.13 2002/12/14 11:23:48 rbcollins Exp $ + * $Id: store_dir.cc,v 1.4.10.14 2002/12/14 11:41:08 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -247,7 +247,7 @@ void storeDirSwapLog(const StoreEntry * e, int op) { - SwapDir *sd; + assert (e); assert(!EBIT_TEST(e->flags, KEY_PRIVATE)); assert(e->swap_filen >= 0); /* @@ -261,8 +261,7 @@ e->getMD5Text(), e->swap_dirn, e->swap_filen); - sd = INDEXSD(e->swap_dirn); - sd->logEntry(*e, op); + INDEXSD(e->swap_dirn)->logEntry(*e, op); } void @@ -412,10 +411,8 @@ } } /* Flush */ - for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) { - sd = INDEXSD(dirn); - sd->log.clean.done(sd); - } + for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) + INDEXSD(dirn)->writeCleanDone(); if (reopen) storeDirOpenSwapLogs(); getCurrentTime(); Index: squid3/src/ufscommon.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.cc,v retrieving revision 1.4.10.32 retrieving revision 1.4.10.33 diff -u -r1.4.10.32 -r1.4.10.33 --- squid3/src/ufscommon.cc 14 Dec 2002 11:23:48 -0000 1.4.10.32 +++ squid3/src/ufscommon.cc 14 Dec 2002 11:41:08 -0000 1.4.10.33 @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.4.10.32 2002/12/14 11:23:48 rbcollins Exp $ + * $Id: ufscommon.cc,v 1.4.10.33 2002/12/14 11:41:08 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -1000,10 +1000,10 @@ } void -commonUfsDirWriteCleanDone(SwapDir * sd) +UFSSwapDir::writeCleanDone() { int fd; - struct _clean_state *state = (struct _clean_state *)sd->log.clean.state; + struct _clean_state *state = (struct _clean_state *)log.clean.state; if (NULL == state) return; if (state->fd < 0) @@ -1016,14 +1016,14 @@ "not replaced.\n"); file_close(state->fd); state->fd = -1; - unlink(state->newLog); + ::unlink(state->newLog); } safe_free(state->outbuf); /* * You can't rename open files on Microsoft "operating systems" * so we have to close before renaming. */ - sd->closeLog(); + closeLog(); /* save the fd value for a later test */ fd = state->fd; /* rename */ @@ -1052,8 +1052,8 @@ file_close(state->fd); state->fd = -1; safe_free(state); - sd->log.clean.state = NULL; - sd->log.clean.write = NULL; + log.clean.state = NULL; + log.clean.write = NULL; } void Index: squid3/src/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.h,v retrieving revision 1.1.20.54 retrieving revision 1.1.20.55 diff -u -r1.1.20.54 -r1.1.20.55 --- squid3/src/ufscommon.h 14 Dec 2002 11:23:48 -0000 1.1.20.54 +++ squid3/src/ufscommon.h 14 Dec 2002 11:41:08 -0000 1.1.20.55 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.1.20.54 2002/12/14 11:23:48 rbcollins Exp $ + * $Id: ufscommon.h,v 1.1.20.55 2002/12/14 11:41:08 rbcollins Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -55,9 +55,7 @@ }; /* Common UFS routines */ -void commonUfsDirSwapLog(const SwapDir * sd, const StoreEntry * e, int op); FREE storeSwapLogDataFree; -void commonUfsDirWriteCleanDone(SwapDir * sd); const StoreEntry *commonUfsDirCleanLogNextEntry(SwapDir * sd); void commonUfsDirUnlinkFile(SwapDir * SD, sfileno f); void commonUfsDirMaintain(SwapDir * SD); @@ -93,6 +91,7 @@ virtual void openLog(); virtual void closeLog(); virtual int writeCleanStart(); + virtual void writeCleanDone(); virtual void logEntry(const StoreEntry & e, int op) const; void unlinkFile(sfileno f); 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.30 retrieving revision 1.2.12.31 diff -u -r1.2.12.30 -r1.2.12.31 --- squid3/src/fs/aufs/store_dir_aufs.cc 14 Dec 2002 11:23:48 -0000 1.2.12.30 +++ squid3/src/fs/aufs/store_dir_aufs.cc 14 Dec 2002 11:41:09 -0000 1.2.12.31 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.30 2002/12/14 11:23:48 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.31 2002/12/14 11:41:09 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -189,7 +189,6 @@ aioinfo->suggest = 0; aioinfo->io.storeDirUnlinkFile = storeAufsDirIOUnlinkFile; sd->log.clean.nextentry = commonUfsDirCleanLogNextEntry; - sd->log.clean.done = commonUfsDirWriteCleanDone; parse_cachedir_options(sd, options, 0); 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.26 retrieving revision 1.3.10.27 diff -u -r1.3.10.26 -r1.3.10.27 --- squid3/src/fs/coss/store_coss.h 14 Dec 2002 11:23:48 -0000 1.3.10.26 +++ squid3/src/fs/coss/store_coss.h 14 Dec 2002 11:41:09 -0000 1.3.10.27 @@ -113,6 +113,7 @@ virtual void openLog(); virtual void closeLog(); virtual int writeCleanStart(); + virtual void writeCleanDone(); virtual void logEntry(const StoreEntry & e, int op) const; }; 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.27 retrieving revision 1.4.10.28 diff -u -r1.4.10.27 -r1.4.10.28 --- squid3/src/fs/coss/store_dir_coss.cc 14 Dec 2002 11:23:48 -0000 1.4.10.27 +++ squid3/src/fs/coss/store_dir_coss.cc 14 Dec 2002 11:41:09 -0000 1.4.10.28 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.27 2002/12/14 11:23:48 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.28 2002/12/14 11:41:09 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -77,7 +77,6 @@ static FILE *storeCossDirOpenTmpSwapLog(SwapDir *, int *, int *); static STLOGCLEANNEXTENTRY storeCossDirCleanLogNextEntry; static STLOGCLEANWRITE storeCossDirWriteCleanEntry; -static STLOGCLEANDONE storeCossDirWriteCleanDone; static STFSPARSE storeCossDirParse; static STFSRECONFIGURE storeCossDirReconfigure; @@ -555,11 +554,11 @@ } } -static void -storeCossDirWriteCleanDone(SwapDir * sd) +void +CossSwapDir::writeCleanDone() { int fd; - struct _clean_state *state = (struct _clean_state *)sd->log.clean.state; + struct _clean_state *state = (struct _clean_state *)log.clean.state; if (NULL == state) return; if (state->fd < 0) @@ -571,14 +570,14 @@ "not replaced.\n"); file_close(state->fd); state->fd = -1; - unlink(state->newLog); + ::unlink(state->newLog); } safe_free(state->outbuf); /* * You can't rename open files on Microsoft "operating systems" * so we have to close before renaming. */ - sd->closeLog(); + closeLog(); /* save the fd value for a later test */ fd = state->fd; /* rename */ @@ -607,8 +606,8 @@ file_close(state->fd); state->fd = -1; safe_free(state); - sd->log.clean.state = NULL; - sd->log.clean.write = NULL; + log.clean.state = NULL; + log.clean.write = NULL; } static void @@ -751,7 +750,6 @@ sd->log.clean.write = storeCossDirWriteCleanEntry; sd->log.clean.nextentry = storeCossDirCleanLogNextEntry; - sd->log.clean.done = storeCossDirWriteCleanDone; cs->current_offset = 0; cs->fd = -1; 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.38 retrieving revision 1.2.16.39 diff -u -r1.2.16.38 -r1.2.16.39 --- squid3/src/fs/diskd/store_dir_diskd.cc 14 Dec 2002 11:23:48 -0000 1.2.16.38 +++ squid3/src/fs/diskd/store_dir_diskd.cc 14 Dec 2002 11:41:09 -0000 1.2.16.39 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.38 2002/12/14 11:23:48 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.39 2002/12/14 11:41:09 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -394,7 +394,6 @@ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeDiskdDirIOUnlinkFile; sd->log.clean.nextentry = commonUfsDirCleanLogNextEntry; - sd->log.clean.done = commonUfsDirWriteCleanDone; parse_cachedir_options(sd, options, 0); 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.13 retrieving revision 1.1.20.14 diff -u -r1.1.20.13 -r1.1.20.14 --- squid3/src/fs/null/store_null.cc 14 Dec 2002 04:39:40 -0000 1.1.20.13 +++ squid3/src/fs/null/store_null.cc 14 Dec 2002 11:41:09 -0000 1.1.20.14 @@ -1,6 +1,6 @@ /* - * $Id: store_null.cc,v 1.1.20.13 2002/12/14 04:39:40 rbcollins Exp $ + * $Id: store_null.cc,v 1.1.20.14 2002/12/14 11:41:09 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -53,7 +53,6 @@ static int null_initialised = 0; static STFSRECONFIGURE storeNullDirReconfigure; -static STLOGCLEANDONE storeNullDirWriteCleanDone; static EVH storeNullDirRebuildComplete; /* The only externally visible interface */ @@ -116,17 +115,10 @@ } static void -storeNullDirWriteCleanDone(SwapDir * unused) -{ - (void) 0; -} - -static void storeNullDirParse(SwapDir * sd, int index, char *path) { sd->index = index; sd->path = xstrdup(path); - sd->log.clean.done = storeNullDirWriteCleanDone; parse_cachedir_options(sd, NULL, 0); } 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.33 retrieving revision 1.1.20.34 diff -u -r1.1.20.33 -r1.1.20.34 --- squid3/src/fs/ufs/store_dir_ufs.cc 14 Dec 2002 11:23:48 -0000 1.1.20.33 +++ squid3/src/fs/ufs/store_dir_ufs.cc 14 Dec 2002 11:41:09 -0000 1.1.20.34 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.33 2002/12/14 11:23:48 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.34 2002/12/14 11:41:09 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -170,7 +170,6 @@ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeUfsDirIOUnlinkFile; sd->log.clean.nextentry = commonUfsDirCleanLogNextEntry; - sd->log.clean.done = commonUfsDirWriteCleanDone; parse_cachedir_options(sd, options, 1);