--------------------- PatchSet 389 Date: 2002/12/14 22:04:13 Author: rbcollins Branch: unify-io Tag: (none) Log: removed unused field and simplify swapdir structure Members: src/SwapDir.h:1.1.2.35->1.1.2.36 src/store_dir.cc:1.4.10.17->1.4.10.18 src/ufscommon.cc:1.4.10.38->1.4.10.39 src/fs/coss/store_dir_coss.cc:1.4.10.33->1.4.10.34 Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.35 retrieving revision 1.1.2.36 diff -u -r1.1.2.35 -r1.1.2.36 --- squid3/src/SwapDir.h 14 Dec 2002 21:46:49 -0000 1.1.2.35 +++ squid3/src/SwapDir.h 14 Dec 2002 22:04:13 -0000 1.1.2.36 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.35 2002/12/14 21:46:49 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.36 2002/12/14 22:04:13 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -83,12 +83,7 @@ virtual const StoreEntry *nextEntry() = 0; virtual void write(StoreEntry const &) = 0; }; - struct { - struct { - CleanLog *state; - } clean; - int writes_since_clean; - } log; + CleanLog *cleanLog; virtual int writeCleanStart(); virtual void writeCleanDone(); struct { Index: squid3/src/store_dir.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_dir.cc,v retrieving revision 1.4.10.17 retrieving revision 1.4.10.18 diff -u -r1.4.10.17 -r1.4.10.18 --- squid3/src/store_dir.cc 14 Dec 2002 21:46:49 -0000 1.4.10.17 +++ squid3/src/store_dir.cc 14 Dec 2002 22:04:13 -0000 1.4.10.18 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.cc,v 1.4.10.17 2002/12/14 21:46:49 rbcollins Exp $ + * $Id: store_dir.cc,v 1.4.10.18 2002/12/14 22:04:13 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -362,7 +362,6 @@ * the run. Thanks goes to Eric Stern, since this solution * came out of his COSS code. */ -#define CLEAN_BUF_SZ 16384 int storeDirWriteCleanLogs(int reopen) { @@ -395,15 +394,15 @@ notdone = 0; for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) { sd = INDEXSD(dirn); - if (NULL == sd->log.clean.state) + if (NULL == sd->cleanLog) continue; - e = sd->log.clean.state->nextEntry(); + e = sd->cleanLog->nextEntry(); if (!e) continue; notdone = 1; if (!sd->canLog(*e)) continue; - sd->log.clean.state->write(*e); + sd->cleanLog->write(*e); if ((++n & 0xFFFF) == 0) { getCurrentTime(); debug(20, 1) (" %7d entries written so far.\n", n); @@ -422,7 +421,6 @@ dt, (double) n / (dt > 0.0 ? dt : 1.0)); return n; } -#undef CLEAN_BUF_SZ /* * sync all avaliable fs'es .. Index: squid3/src/ufscommon.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.cc,v retrieving revision 1.4.10.38 retrieving revision 1.4.10.39 diff -u -r1.4.10.38 -r1.4.10.39 --- squid3/src/ufscommon.cc 14 Dec 2002 21:46:49 -0000 1.4.10.38 +++ squid3/src/ufscommon.cc 14 Dec 2002 22:04:13 -0000 1.4.10.39 @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.4.10.38 2002/12/14 21:46:49 rbcollins Exp $ + * $Id: ufscommon.cc,v 1.4.10.39 2002/12/14 22:04:13 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -930,7 +930,7 @@ #if HAVE_FCHMOD struct stat sb; #endif - log.clean.state = NULL; + cleanLog = NULL; state->newLog = xstrdup(logFile(".clean")); state->fd = file_open(state->newLog, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY); if (state->fd < 0) { @@ -950,7 +950,7 @@ if (stat(state->cur, &sb) == 0) fchmod(state->fd, sb.st_mode); #endif - log.clean.state = state; + cleanLog = state; return 0; } @@ -998,7 +998,7 @@ state->fd = -1; unlink(state->newLog); delete state; - sd->log.clean.state = NULL; + sd->cleanLog = NULL; return; } state->outbuf_offset = 0; @@ -1008,7 +1008,7 @@ void UFSSwapDir::writeCleanDone() { - UFSCleanLog *state = (UFSCleanLog *)log.clean.state; + UFSCleanLog *state = (UFSCleanLog *)cleanLog; int fd; if (NULL == state) return; @@ -1058,7 +1058,7 @@ file_close(state->fd); state->fd = -1; delete state; - log.clean.state = NULL; + cleanLog = NULL; } void 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.33 retrieving revision 1.4.10.34 diff -u -r1.4.10.33 -r1.4.10.34 --- squid3/src/fs/coss/store_dir_coss.cc 14 Dec 2002 21:46:49 -0000 1.4.10.33 +++ squid3/src/fs/coss/store_dir_coss.cc 14 Dec 2002 22:04:14 -0000 1.4.10.34 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.33 2002/12/14 21:46:49 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.34 2002/12/14 22:04:14 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -484,7 +484,7 @@ #endif state->newLog = xstrdup(storeCossDirSwapLogFile(this, ".clean")); state->fd = file_open(state->newLog, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY); - log.clean.state = NULL; + cleanLog = NULL; if (state->fd < 0) { xfree(state->newLog); delete state; @@ -502,7 +502,7 @@ if (stat(state->cur, &sb) == 0) fchmod(state->fd, sb.st_mode); #endif - log.clean.state = state; + cleanLog = state; return 0; } @@ -550,7 +550,7 @@ state->fd = -1; unlink(state->newLog); delete state; - sd->log.clean.state = NULL; + sd->cleanLog = NULL; return; } state->outbuf_offset = 0; @@ -561,7 +561,7 @@ CossSwapDir::writeCleanDone() { int fd; - CossCleanLog *state = (CossCleanLog *)log.clean.state; + CossCleanLog *state = (CossCleanLog *)cleanLog; if (NULL == state) return; if (state->fd < 0) @@ -609,7 +609,7 @@ file_close(state->fd); state->fd = -1; delete state; - log.clean.state = NULL; + cleanLog = NULL; } static void