--------------------- PatchSet 390 Date: 2002/12/15 02:34:36 Author: rbcollins Branch: unify-io Tag: (none) Log: start removing fsdata fields Members: src/SwapDir.h:1.1.2.36->1.1.2.37 src/cache_cf.cc:1.4.12.6->1.4.12.7 src/structs.h:1.9.10.6->1.9.10.7 src/typedefs.h:1.6.10.7->1.6.10.8 src/ufscommon.cc:1.4.10.39->1.4.10.40 src/ufscommon.h:1.1.20.56->1.1.20.57 src/fs/aufs/store_asyncufs.h:1.2.12.40->1.2.12.41 src/fs/aufs/store_dir_aufs.cc:1.2.12.32->1.2.12.33 src/fs/coss/store_coss.h:1.3.10.27->1.3.10.28 src/fs/coss/store_dir_coss.cc:1.4.10.34->1.4.10.35 src/fs/diskd/store_dir_diskd.cc:1.2.16.40->1.2.16.41 src/fs/diskd/store_diskd.h:1.1.20.42->1.1.20.43 src/fs/null/store_null.cc:1.1.20.14->1.1.20.15 src/fs/ufs/store_dir_ufs.cc:1.1.20.35->1.1.20.36 src/fs/ufs/store_ufs.h:1.1.20.29->1.1.20.30 Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.36 retrieving revision 1.1.2.37 diff -u -r1.1.2.36 -r1.1.2.37 --- squid3/src/SwapDir.h 14 Dec 2002 22:04:13 -0000 1.1.2.36 +++ squid3/src/SwapDir.h 15 Dec 2002 02:34:36 -0000 1.1.2.37 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.36 2002/12/14 22:04:13 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.37 2002/12/15 02:34:36 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -36,6 +36,12 @@ #include "StoreIOState.h" +/* Store dir configuration routines */ +/* SwapDir *sd, char *path ( + char *opt later when the strtok mess is gone) */ +typedef void STFSRECONFIGURE(SwapDir *, int, char *); +typedef void STFSSTARTUP(void); +typedef void STFSSHUTDOWN(void); +typedef SwapDir *STFSNEW(void); struct SwapDir { public: static SwapDir *Factory (_storefs_entry const &fs); @@ -86,6 +92,7 @@ CleanLog *cleanLog; virtual int writeCleanStart(); virtual void writeCleanDone(); + virtual void parse(int index, char *path) = 0; struct { int blksize; } fs; Index: squid3/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v retrieving revision 1.4.12.6 retrieving revision 1.4.12.7 diff -u -r1.4.12.6 -r1.4.12.7 --- squid3/src/cache_cf.cc 13 Dec 2002 11:17:46 -0000 1.4.12.6 +++ squid3/src/cache_cf.cc 15 Dec 2002 02:34:36 -0000 1.4.12.7 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.4.12.6 2002/12/13 11:17:46 rbcollins Exp $ + * $Id: cache_cf.cc,v 1.4.12.7 2002/12/15 02:34:36 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1302,8 +1302,8 @@ swap->swapDirs[swap->n_configured] = SwapDir::Factory(storefs_list[fs]); sd = swap->swapDirs[swap->n_configured]; /* parse the FS parameters and options */ - storefs_list[fs].parsefunc(sd, swap->n_configured, path_str); - swap->n_configured++; + sd->parse(swap->n_configured, path_str); + ++swap->n_configured; /* Update the max object size */ update_maxobjsize(); } Index: squid3/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/structs.h,v retrieving revision 1.9.10.6 retrieving revision 1.9.10.7 diff -u -r1.9.10.6 -r1.9.10.7 --- squid3/src/structs.h 13 Dec 2002 10:45:15 -0000 1.9.10.6 +++ squid3/src/structs.h 15 Dec 2002 02:34:36 -0000 1.9.10.7 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.9.10.6 2002/12/13 10:45:15 rbcollins Exp $ + * $Id: structs.h,v 1.9.10.7 2002/12/15 02:34:36 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1914,7 +1914,6 @@ struct _storefs_entry { const char *typestr; - STFSPARSE *parsefunc; STFSRECONFIGURE *reconfigurefunc; STFSSHUTDOWN *donefunc; STFSNEW *newfunc; Index: squid3/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/typedefs.h,v retrieving revision 1.6.10.7 retrieving revision 1.6.10.8 diff -u -r1.6.10.7 -r1.6.10.8 --- squid3/src/typedefs.h 14 Dec 2002 02:56:03 -0000 1.6.10.7 +++ squid3/src/typedefs.h 15 Dec 2002 02:34:36 -0000 1.6.10.8 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.6.10.7 2002/12/14 02:56:03 rbcollins Exp $ + * $Id: typedefs.h,v 1.6.10.8 2002/12/15 02:34:36 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -246,11 +246,7 @@ typedef void HLPCMDOPTS(int *argc, char **argv); typedef void IDNSCB(void *, rfc1035_rr *, int); -/* Store dir configuration routines */ -/* SwapDir *sd, char *path ( + char *opt later when the strtok mess is gone) */ -typedef void STFSPARSE(SwapDir *, int, char *); typedef void STFSRECONFIGURE(SwapDir *, int, char *); -typedef void STFSSTARTUP(void); typedef void STFSSHUTDOWN(void); typedef SwapDir *STFSNEW(void); Index: squid3/src/ufscommon.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.cc,v retrieving revision 1.4.10.39 retrieving revision 1.4.10.40 diff -u -r1.4.10.39 -r1.4.10.40 --- squid3/src/ufscommon.cc 14 Dec 2002 22:04:13 -0000 1.4.10.39 +++ squid3/src/ufscommon.cc 15 Dec 2002 02:34:36 -0000 1.4.10.40 @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.4.10.39 2002/12/14 22:04:13 rbcollins Exp $ + * $Id: ufscommon.cc,v 1.4.10.40 2002/12/15 02:34:36 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -118,24 +118,18 @@ int UFSSwapDir::mapBitTest(sfileno filn) { - squidufsinfo_t *ioinfo; - ioinfo = (squidufsinfo_t *) fsdata; - return file_map_bit_test(ioinfo->map, filn); + return file_map_bit_test(map, filn); } void UFSSwapDir::mapBitSet(sfileno filn) { - squidufsinfo_t *ioinfo; - ioinfo = (squidufsinfo_t *) fsdata; - file_map_bit_set(ioinfo->map, filn); + file_map_bit_set(map, filn); } void UFSSwapDir::mapBitReset(sfileno filn) { - squidufsinfo_t *ioinfo; - ioinfo = (squidufsinfo_t *) fsdata; /* * We have to test the bit before calling file_map_bit_reset. * file_map_bit_reset doesn't do bounds checking. It assumes @@ -143,8 +137,8 @@ * the map is dynamic in size. Also clearing an already clear * bit puts the map counter of-of-whack. */ - if (file_map_bit_test(ioinfo->map, filn)) - file_map_bit_reset(ioinfo->map, filn); + if (file_map_bit_test(map, filn)) + file_map_bit_reset(map, filn); } int @@ -152,8 +146,8 @@ { squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; int fn; - fn = file_map_allocate(ioinfo->map, ioinfo->suggest); - file_map_bit_set(ioinfo->map, fn); + fn = file_map_allocate(map, ioinfo->suggest); + file_map_bit_set(map, fn); ioinfo->suggest = fn + 1; return fn; } @@ -167,12 +161,10 @@ void UFSSwapDir::initBitmap() { - squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; - - if (ioinfo->map == NULL) { + if (map == NULL) { /* First time */ - ioinfo->map = file_map_create(); - } else if (ioinfo->map->max_n_files) { + map = file_map_create(); + } else if (map->max_n_files) { /* it grew, need to expand */ /* XXX We don't need it anymore .. */ } @@ -306,17 +298,14 @@ void UFSSwapDir::openLog() { - squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; char *logPath; - int fd; logPath = logFile(); - fd = file_open(logPath, O_WRONLY | O_CREAT | O_BINARY); - if (fd < 0) { + swaplog_fd = file_open(logPath, O_WRONLY | O_CREAT | O_BINARY); + if (swaplog_fd < 0) { debug(50, 1) ("%s: %s\n", logPath, xstrerror()); fatal("commonUfsDirOpenSwapLog: Failed to open swap log."); } - debug(50, 3) ("Cache Dir #%d log opened on FD %d\n", index, fd); - ioinfo->swaplog_fd = fd; + debug(50, 3) ("Cache Dir #%d log opened on FD %d\n", index, swaplog_fd); if (0 == n_dirs) assert(NULL == dir_index); ++n_dirs; @@ -326,13 +315,12 @@ void UFSSwapDir::closeLog() { - squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; - if (ioinfo->swaplog_fd < 0) /* not open */ + if (swaplog_fd < 0) /* not open */ return; - file_close(ioinfo->swaplog_fd); + file_close(swaplog_fd); debug(47, 3) ("Cache Dir #%d log closed on FD %d\n", - index, ioinfo->swaplog_fd); - ioinfo->swaplog_fd = -1; + index, swaplog_fd); + swaplog_fd = -1; n_dirs--; assert(n_dirs >= 0); if (0 == n_dirs) @@ -821,11 +809,10 @@ void UFSSwapDir::closeTmpSwapLog() { - squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; char *swaplog_path = xstrdup(logFile(NULL)); char *new_path = xstrdup(logFile(".new")); int fd; - file_close(ioinfo->swaplog_fd); + file_close(swaplog_fd); #if defined (_SQUID_OS2_) || defined (_SQUID_CYGWIN_) || defined(_SQUID_MSWIN_) if (unlink(swaplog_path) < 0) { debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror()); @@ -842,14 +829,13 @@ } safe_free(swaplog_path); safe_free(new_path); - ioinfo->swaplog_fd = fd; + swaplog_fd = fd; debug(47, 3) ("Cache Dir #%d log opened on FD %d\n", index, fd); } FILE * UFSSwapDir::openTmpSwapLog(int *clean_flag, int *zero_flag) { - squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; char *swaplog_path = xstrdup(logFile(NULL)); char *clean_path = xstrdup(logFile(".last-clean")); char *new_path = xstrdup(logFile(".new")); @@ -866,15 +852,15 @@ } *zero_flag = log_sb.st_size == 0 ? 1 : 0; /* close the existing write-only FD */ - if (ioinfo->swaplog_fd >= 0) - file_close(ioinfo->swaplog_fd); + if (swaplog_fd >= 0) + file_close(swaplog_fd); /* open a write-only FD for the new log */ fd = file_open(new_path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY); if (fd < 0) { debug(50, 1) ("%s: %s\n", new_path, xstrerror()); fatal("storeDirOpenTmpSwapLog: Failed to open swap log."); } - ioinfo->swaplog_fd = fd; + swaplog_fd = fd; /* open a read-only stream of the old log */ fp = fopen(swaplog_path, "rb"); if (fp == NULL) { @@ -1070,7 +1056,6 @@ void UFSSwapDir::logEntry(const StoreEntry & e, int op) const { - squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; storeSwapLogData *s = (storeSwapLogData *)memAllocate(MEM_SWAP_LOG_DATA); s->op = (char) op; s->swap_filen = e.swap_filen; @@ -1082,7 +1067,7 @@ s->refcount = e.refcount; s->flags = e.flags; xmemcpy(s->key, e.key, MD5_DIGEST_CHARS); - file_write(ioinfo->swaplog_fd, + file_write(swaplog_fd, -1, s, sizeof(storeSwapLogData), @@ -1258,7 +1243,6 @@ int UFSSwapDir::validFileno(sfileno filn, int flag) const { - squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; if (filn < 0) return 0; /* @@ -1266,7 +1250,7 @@ * be considered invalid. */ if (flag) - if (filn > ioinfo->map->max_n_files) + if (filn > map->max_n_files) return 0; return 1; } Index: squid3/src/ufscommon.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ufscommon.h,v retrieving revision 1.1.20.56 retrieving revision 1.1.20.57 diff -u -r1.1.20.56 -r1.1.20.57 --- squid3/src/ufscommon.h 14 Dec 2002 21:32:10 -0000 1.1.20.56 +++ squid3/src/ufscommon.h 15 Dec 2002 02:34:36 -0000 1.1.20.57 @@ -1,6 +1,6 @@ /* - * $Id: ufscommon.h,v 1.1.20.56 2002/12/14 21:32:10 rbcollins Exp $ + * $Id: ufscommon.h,v 1.1.20.57 2002/12/15 02:34:36 rbcollins Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -46,10 +46,9 @@ typedef struct _squidufsinfo_t squidufsinfo_t; struct _squidufsinfo_t { - int swaplog_fd; int l1; int l2; - fileMap *map; +// fileMap *map; int suggest; iospecific_t io; }; @@ -117,7 +116,10 @@ int clean); int validFileno(sfileno filn, int flag) const; int mapBitAllocate(); +protected: + fileMap *map; private: + int swaplog_fd; static EVH CleanEvent; void initBitmap(); bool verifyCacheDirs(); @@ -126,6 +128,7 @@ void createSwapSubDirs(); void dumpEntry(StoreEntry &) const; char *logFile(char const *ext = NULL)const; + }; #include "RefCount.h" Index: squid3/src/fs/aufs/store_asyncufs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_asyncufs.h,v retrieving revision 1.2.12.40 retrieving revision 1.2.12.41 diff -u -r1.2.12.40 -r1.2.12.41 --- squid3/src/fs/aufs/store_asyncufs.h 13 Dec 2002 23:23:31 -0000 1.2.12.40 +++ squid3/src/fs/aufs/store_asyncufs.h 15 Dec 2002 02:34:36 -0000 1.2.12.41 @@ -159,6 +159,7 @@ virtual int canStore(StoreEntry const &)const; virtual int callback(); virtual void sync(); + virtual void parse (int index, char *path); }; #include "IOStrategy.h" 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.32 retrieving revision 1.2.12.33 diff -u -r1.2.12.32 -r1.2.12.33 --- squid3/src/fs/aufs/store_dir_aufs.cc 14 Dec 2002 21:32:10 -0000 1.2.12.32 +++ squid3/src/fs/aufs/store_dir_aufs.cc 15 Dec 2002 02:34:36 -0000 1.2.12.33 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.32 2002/12/14 21:32:10 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.33 2002/12/15 02:34:36 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -152,8 +152,8 @@ * storeAufsDirParse * * Called when a *new* fs is being setup. */ -static void -storeAufsDirParse(SwapDir * sd, int index, char *path) +void +AUFSSwapDir::parse(int anIndex, char *aPath) { int i; int size; @@ -178,21 +178,20 @@ if (aioinfo == NULL) fatal("storeAufsDirParse: couldn't xmalloc() squidufsinfo_t!\n"); - sd->index = index; - sd->path = xstrdup(path); - sd->max_size = size; - sd->fsdata = aioinfo; + index = anIndex; + path = xstrdup(aPath); + max_size = size; + fsdata = aioinfo; aioinfo->l1 = l1; aioinfo->l2 = l2; - aioinfo->swaplog_fd = -1; - aioinfo->map = NULL; /* Debugging purposes */ + map = NULL; /* Debugging purposes */ aioinfo->suggest = 0; aioinfo->io.storeDirUnlinkFile = storeAufsDirIOUnlinkFile; - parse_cachedir_options(sd, options, 0); + parse_cachedir_options(this, options, 0); /* Initialise replacement policy stuff */ - sd->repl = createRemovalPolicy(Config.replPolicy); + repl = createRemovalPolicy(Config.replPolicy); } /* @@ -219,7 +218,6 @@ storeFsSetup_aufs(storefs_entry_t * storefs) { assert(!asyncufs_initialised); - storefs->parsefunc = storeAufsDirParse; storefs->reconfigurefunc = storeAufsDirReconfigure; storefs->donefunc = storeAufsDirDone; storefs->newfunc = storeAufsNew; 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.27 retrieving revision 1.3.10.28 diff -u -r1.3.10.27 -r1.3.10.28 --- squid3/src/fs/coss/store_coss.h 14 Dec 2002 11:41:09 -0000 1.3.10.27 +++ squid3/src/fs/coss/store_coss.h 15 Dec 2002 02:34:36 -0000 1.3.10.28 @@ -115,6 +115,7 @@ virtual int writeCleanStart(); virtual void writeCleanDone(); virtual void logEntry(const StoreEntry & e, int op) const; + virtual void parse (int index, char *path); }; 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.34 retrieving revision 1.4.10.35 diff -u -r1.4.10.34 -r1.4.10.35 --- squid3/src/fs/coss/store_dir_coss.cc 14 Dec 2002 22:04:14 -0000 1.4.10.34 +++ squid3/src/fs/coss/store_dir_coss.cc 15 Dec 2002 02:34:36 -0000 1.4.10.35 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.34 2002/12/14 22:04:14 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.35 2002/12/15 02:34:36 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -75,7 +75,6 @@ static void storeCossDirRebuild(SwapDir * sd); static void storeCossDirCloseTmpSwapLog(SwapDir * sd); static FILE *storeCossDirOpenTmpSwapLog(SwapDir *, int *, int *); -static STFSPARSE storeCossDirParse; static STFSRECONFIGURE storeCossDirReconfigure; /* The "only" externally visible function */ @@ -726,8 +725,8 @@ storeAppendPrintf(&sentry, "\n"); } -static void -storeCossDirParse(SwapDir * sd, int index, char *path) +void +CossSwapDir::parse(int anIndex, char *aPath) { unsigned int i; unsigned int size; @@ -742,10 +741,10 @@ if (cs == NULL) fatal("storeCossDirParse: couldn't xmalloc() CossInfo!\n"); - sd->index = index; - sd->path = xstrdup(path); - sd->max_size = size; - sd->fsdata = cs; + index = anIndex; + path = xstrdup(aPath); + max_size = size; + fsdata = cs; cs->fd = -1; cs->swaplog_fd = -1; @@ -759,9 +758,9 @@ cs->index.head = NULL; cs->index.tail = NULL; - parse_cachedir_options(sd, NULL, 0); + parse_cachedir_options(this, NULL, 0); /* Enforce maxobjsize being set to something */ - if (sd->max_objsize == -1) + if (max_objsize == -1) fatal("COSS requires max-size to be set to something other than -1!\n"); } @@ -860,7 +859,6 @@ { assert(!coss_initialised); - storefs->parsefunc = storeCossDirParse; storefs->reconfigurefunc = storeCossDirReconfigure; storefs->donefunc = storeCossDirDone; storefs->newfunc = storeCossNew; 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.40 retrieving revision 1.2.16.41 diff -u -r1.2.16.40 -r1.2.16.41 --- squid3/src/fs/diskd/store_dir_diskd.cc 14 Dec 2002 21:32:10 -0000 1.2.16.40 +++ squid3/src/fs/diskd/store_dir_diskd.cc 15 Dec 2002 02:34:36 -0000 1.2.16.41 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.40 2002/12/14 21:32:10 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.41 2002/12/15 02:34:36 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -361,8 +361,8 @@ * * Called when a *new* fs is being setup. */ -static void -storeDiskdDirParse(SwapDir * sd, int index, char *path) +void +DiskdSwapDir::parse(int anIndex, char *aPath) { int i; int size; @@ -383,21 +383,19 @@ if (l2 <= 0) fatal("storeDiskdDirParse: invalid level 2 directories value"); - sd->fsdata = ufsinfo = (squidufsinfo_t *)xcalloc(1, sizeof(*ufsinfo)); - sd->index = index; - sd->path = xstrdup(path); - sd->max_size = size; + fsdata = ufsinfo = (squidufsinfo_t *)xcalloc(1, sizeof(*ufsinfo)); + index = anIndex; + path = xstrdup(aPath); + max_size = size; ufsinfo->l1 = l1; ufsinfo->l2 = l2; - ufsinfo->swaplog_fd = -1; - ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeDiskdDirIOUnlinkFile; - parse_cachedir_options(sd, options, 0); + parse_cachedir_options(this, options, 0); /* Initialise replacement policy stuff */ - sd->repl = createRemovalPolicy(Config.replPolicy); + repl = createRemovalPolicy(Config.replPolicy); } /* @@ -421,7 +419,6 @@ storeFsSetup_diskd(storefs_entry_t * storefs) { assert(!diskd_initialised); - storefs->parsefunc = storeDiskdDirParse; storefs->reconfigurefunc = storeDiskdDirReconfigure; storefs->donefunc = storeDiskdDirDone; storefs->newfunc = storeDiskdNew; 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.42 retrieving revision 1.1.20.43 diff -u -r1.1.20.42 -r1.1.20.43 --- squid3/src/fs/diskd/store_diskd.h 14 Dec 2002 00:54:29 -0000 1.1.20.42 +++ squid3/src/fs/diskd/store_diskd.h 15 Dec 2002 02:34:36 -0000 1.1.20.43 @@ -139,6 +139,7 @@ virtual int canStore(StoreEntry const &) const; virtual int callback(); virtual void sync(); + virtual void parse (int index, char *path); }; #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.14 retrieving revision 1.1.20.15 diff -u -r1.1.20.14 -r1.1.20.15 --- squid3/src/fs/null/store_null.cc 14 Dec 2002 11:41:09 -0000 1.1.20.14 +++ squid3/src/fs/null/store_null.cc 15 Dec 2002 02:34:36 -0000 1.1.20.15 @@ -1,6 +1,6 @@ /* - * $Id: store_null.cc,v 1.1.20.14 2002/12/14 11:41:09 rbcollins Exp $ + * $Id: store_null.cc,v 1.1.20.15 2002/12/15 02:34:36 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -49,6 +49,7 @@ virtual int canStore(StoreEntry const &)const; virtual StoreIOState::Pointer createStoreIO(StoreEntry &, STFNCB *, STIOCB *, void *); virtual StoreIOState::Pointer openStoreIO(StoreEntry &, STFNCB *, STIOCB *, void *); + virtual void parse(int, char*); }; static int null_initialised = 0; @@ -114,12 +115,12 @@ return -1; } -static void -storeNullDirParse(SwapDir * sd, int index, char *path) +void +NullSwapDir::parse(int anIndex, char *aPath) { - sd->index = index; - sd->path = xstrdup(path); - parse_cachedir_options(sd, NULL, 0); + index = anIndex; + path = xstrdup(aPath); + parse_cachedir_options(this, NULL, 0); } /* Setup and register the store module */ @@ -128,7 +129,6 @@ storeFsSetup_null(storefs_entry_t * storefs) { assert(!null_initialised); - storefs->parsefunc = storeNullDirParse; storefs->reconfigurefunc = storeNullDirReconfigure; storefs->donefunc = storeNullDirDone; storefs->newfunc = storeNullNew; 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.35 retrieving revision 1.1.20.36 diff -u -r1.1.20.35 -r1.1.20.36 --- squid3/src/fs/ufs/store_dir_ufs.cc 14 Dec 2002 21:32:11 -0000 1.1.20.35 +++ squid3/src/fs/ufs/store_dir_ufs.cc 15 Dec 2002 02:34:36 -0000 1.1.20.36 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.35 2002/12/14 21:32:11 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.36 2002/12/15 02:34:36 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -133,8 +133,8 @@ * * Called when a *new* fs is being setup. */ -static void -storeUfsDirParse(SwapDir * sd, int index, char *path) +void +UfsSwapDir::parse(int anIndex, char *aPath) { int i; int size; @@ -159,21 +159,19 @@ if (ufsinfo == NULL) fatal("storeUfsDirParse: couldn't xmalloc() squidufsinfo_t!\n"); - sd->index = index; - sd->path = xstrdup(path); - sd->max_size = size; - sd->fsdata = ufsinfo; + index = anIndex; + path = xstrdup(aPath); + max_size = size; + fsdata = ufsinfo; ufsinfo->l1 = l1; ufsinfo->l2 = l2; - ufsinfo->swaplog_fd = -1; - ufsinfo->map = NULL; /* Debugging purposes */ ufsinfo->suggest = 0; ufsinfo->io.storeDirUnlinkFile = storeUfsDirIOUnlinkFile; - parse_cachedir_options(sd, options, 1); + parse_cachedir_options(this, options, 1); /* Initialise replacement policy stuff */ - sd->repl = createRemovalPolicy(Config.replPolicy); + repl = createRemovalPolicy(Config.replPolicy); } /* @@ -207,16 +205,16 @@ createSwapSubDirs(); } -UFSSwapDir::UFSSwapDir() : IO(NULL) {} +UFSSwapDir::UFSSwapDir() : IO(NULL), map(NULL), swaplog_fd (-1) {} UFSSwapDir::~UFSSwapDir() { squidufsinfo_t *ioinfo = (squidufsinfo_t *) fsdata; - if (ioinfo->swaplog_fd > -1) { - file_close(ioinfo->swaplog_fd); - ioinfo->swaplog_fd = -1; + if (swaplog_fd > -1) { + file_close(swaplog_fd); + swaplog_fd = -1; } - filemapFreeMemory(ioinfo->map); + filemapFreeMemory(map); xfree(ioinfo); /* This memory leaks. XXX: FIXME - fsdata needs to go away */ fsdata = NULL; /* Will aid debugging... */ @@ -243,7 +241,6 @@ storeFsSetup_ufs(storefs_entry_t * storefs) { assert(!ufs_initialised); - storefs->parsefunc = storeUfsDirParse; storefs->reconfigurefunc = storeUfsDirReconfigure; storefs->donefunc = storeUfsDirDone; storefs->newfunc = storeUfsNew; @@ -299,8 +296,8 @@ 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)); + map->n_files_in_map, map->max_n_files, + percent(map->n_files_in_map, map->max_n_files)); 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", Index: squid3/src/fs/ufs/store_ufs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/ufs/Attic/store_ufs.h,v retrieving revision 1.1.20.29 retrieving revision 1.1.20.30 diff -u -r1.1.20.29 -r1.1.20.30 --- squid3/src/fs/ufs/store_ufs.h 13 Dec 2002 22:03:38 -0000 1.1.20.29 +++ squid3/src/fs/ufs/store_ufs.h 15 Dec 2002 02:34:37 -0000 1.1.20.30 @@ -61,6 +61,7 @@ virtual void dump(StoreEntry &)const; virtual void unlink(StoreEntry &); virtual int canStore(StoreEntry const&)const; + virtual void parse (int index, char *path); }; #include "IOStrategy.h"