--------------------- PatchSet 403 Date: 2002/12/15 08:23:07 Author: rbcollins Branch: unify-io Tag: (none) Log: make reconfiguring a method Members: src/SwapDir.h:1.1.2.38->1.1.2.39 src/cache_cf.cc:1.4.12.7->1.4.12.8 src/structs.h:1.9.10.7->1.9.10.8 src/typedefs.h:1.6.10.8->1.6.10.9 src/fs/aufs/store_asyncufs.h:1.2.12.41->1.2.12.42 src/fs/aufs/store_dir_aufs.cc:1.2.12.35->1.2.12.36 src/fs/coss/store_coss.h:1.3.10.37->1.3.10.38 src/fs/coss/store_dir_coss.cc:1.4.10.44->1.4.10.45 src/fs/diskd/store_dir_diskd.cc:1.2.16.43->1.2.16.44 src/fs/diskd/store_diskd.h:1.1.20.43->1.1.20.44 src/fs/null/store_null.cc:1.1.20.15->1.1.20.16 src/fs/ufs/store_dir_ufs.cc:1.1.20.38->1.1.20.39 src/fs/ufs/store_ufs.h:1.1.20.30->1.1.20.31 Index: squid3/src/SwapDir.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SwapDir.h,v retrieving revision 1.1.2.38 retrieving revision 1.1.2.39 diff -u -r1.1.2.38 -r1.1.2.39 --- squid3/src/SwapDir.h 15 Dec 2002 06:42:34 -0000 1.1.2.38 +++ squid3/src/SwapDir.h 15 Dec 2002 08:23:07 -0000 1.1.2.39 @@ -1,6 +1,6 @@ /* - * $Id: SwapDir.h,v 1.1.2.38 2002/12/15 06:42:34 rbcollins Exp $ + * $Id: SwapDir.h,v 1.1.2.39 2002/12/15 08:23:07 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -38,7 +38,6 @@ /* 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); @@ -49,6 +48,7 @@ fs.blksize = 1024; } virtual ~SwapDir(); + virtual void reconfigure(int, char *) = 0; const char *type; int cur_size; int low_size; Index: squid3/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v retrieving revision 1.4.12.7 retrieving revision 1.4.12.8 diff -u -r1.4.12.7 -r1.4.12.8 --- squid3/src/cache_cf.cc 15 Dec 2002 02:34:36 -0000 1.4.12.7 +++ squid3/src/cache_cf.cc 15 Dec 2002 08:23:07 -0000 1.4.12.8 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.4.12.7 2002/12/15 02:34:36 rbcollins Exp $ + * $Id: cache_cf.cc,v 1.4.12.8 2002/12/15 08:23:07 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1285,7 +1285,7 @@ fatalf("Unknown cache_dir type '%s'\n", type_str); } sd = swap->swapDirs[i]; - storefs_list[fs].reconfigurefunc(sd, i, path_str); + sd->reconfigure (i, path_str); update_maxobjsize(); return; } Index: squid3/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/structs.h,v retrieving revision 1.9.10.7 retrieving revision 1.9.10.8 diff -u -r1.9.10.7 -r1.9.10.8 --- squid3/src/structs.h 15 Dec 2002 02:34:36 -0000 1.9.10.7 +++ squid3/src/structs.h 15 Dec 2002 08:23:07 -0000 1.9.10.8 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.9.10.7 2002/12/15 02:34:36 rbcollins Exp $ + * $Id: structs.h,v 1.9.10.8 2002/12/15 08:23:07 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1914,7 +1914,6 @@ struct _storefs_entry { const char *typestr; - 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.8 retrieving revision 1.6.10.9 diff -u -r1.6.10.8 -r1.6.10.9 --- squid3/src/typedefs.h 15 Dec 2002 02:34:36 -0000 1.6.10.8 +++ squid3/src/typedefs.h 15 Dec 2002 08:23:07 -0000 1.6.10.9 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.6.10.8 2002/12/15 02:34:36 rbcollins Exp $ + * $Id: typedefs.h,v 1.6.10.9 2002/12/15 08:23:07 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -246,7 +246,6 @@ typedef void HLPCMDOPTS(int *argc, char **argv); typedef void IDNSCB(void *, rfc1035_rr *, int); -typedef void STFSRECONFIGURE(SwapDir *, int, char *); typedef void STFSSHUTDOWN(void); typedef SwapDir *STFSNEW(void); 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.41 retrieving revision 1.2.12.42 diff -u -r1.2.12.41 -r1.2.12.42 --- squid3/src/fs/aufs/store_asyncufs.h 15 Dec 2002 02:34:36 -0000 1.2.12.41 +++ squid3/src/fs/aufs/store_asyncufs.h 15 Dec 2002 08:23:07 -0000 1.2.12.42 @@ -160,6 +160,7 @@ virtual int callback(); virtual void sync(); virtual void parse (int index, char *path); + virtual void reconfigure(int, char *); }; #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.35 retrieving revision 1.2.12.36 diff -u -r1.2.12.35 -r1.2.12.36 --- squid3/src/fs/aufs/store_dir_aufs.cc 15 Dec 2002 07:27:02 -0000 1.2.12.35 +++ squid3/src/fs/aufs/store_dir_aufs.cc 15 Dec 2002 08:23:07 -0000 1.2.12.36 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_aufs.cc,v 1.2.12.35 2002/12/15 07:27:02 rbcollins Exp $ + * $Id: store_dir_aufs.cc,v 1.2.12.36 2002/12/15 08:23:07 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -106,13 +106,11 @@ * * This routine is called when the given swapdir needs reconfiguring */ -static void -storeAufsDirReconfigure(SwapDir * sd, int index, char *path) +void +AUFSSwapDir::reconfigure(int index, char *path) { int i; int size; - int l1; - int l2; i = GetInteger(); size = i << 10; /* Mbytes to kbytes */ @@ -128,15 +126,15 @@ fatal("storeAufsDirReconfigure: invalid level 2 directories value"); /* just reconfigure it */ - if (size == sd->max_size) + if (size == max_size) debug(3, 1) ("Cache dir '%s' size remains unchanged at %d KB\n", path, size); else debug(3, 1) ("Cache dir '%s' size changed to %d KB\n", path, size); - sd->max_size = size; + max_size = size; - parse_cachedir_options(sd, options, 0); + parse_cachedir_options(this, options, 0); return; } @@ -206,7 +204,6 @@ storeFsSetup_aufs(storefs_entry_t * storefs) { assert(!asyncufs_initialised); - 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.37 retrieving revision 1.3.10.38 diff -u -r1.3.10.37 -r1.3.10.38 --- squid3/src/fs/coss/store_coss.h 15 Dec 2002 06:36:37 -0000 1.3.10.37 +++ squid3/src/fs/coss/store_coss.h 15 Dec 2002 08:23:07 -0000 1.3.10.38 @@ -101,6 +101,7 @@ virtual void writeCleanDone(); virtual void logEntry(const StoreEntry & e, int op) const; virtual void parse (int index, char *path); + virtual void reconfigure (int, char *); //private: int fd; int swaplog_fd; 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.44 retrieving revision 1.4.10.45 diff -u -r1.4.10.44 -r1.4.10.45 --- squid3/src/fs/coss/store_dir_coss.cc 15 Dec 2002 06:36:37 -0000 1.4.10.44 +++ squid3/src/fs/coss/store_dir_coss.cc 15 Dec 2002 08:23:07 -0000 1.4.10.45 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.4.10.44 2002/12/15 06:36:37 rbcollins Exp $ + * $Id: store_dir_coss.cc,v 1.4.10.45 2002/12/15 08:23:07 rbcollins Exp $ * * DEBUG: section 47 Store COSS Directory Routines * AUTHOR: Eric Stern @@ -75,7 +75,6 @@ static void storeCossDirRebuild(CossSwapDir * sd); static void storeCossDirCloseTmpSwapLog(CossSwapDir * sd); static FILE *storeCossDirOpenTmpSwapLog(CossSwapDir *, int *, int *); -static STFSRECONFIGURE storeCossDirReconfigure; /* The "only" externally visible function */ STSETUP storeFsSetup_coss; @@ -727,8 +726,8 @@ } -static void -storeCossDirReconfigure(SwapDir * sd, int index, char *path) +void +CossSwapDir::reconfigure(int index, char *path) { unsigned int i; unsigned int size; @@ -738,15 +737,15 @@ if (size <= 0) fatal("storeCossDirParse: invalid size value"); - if (size == (size_t)sd->max_size) + if (size == (size_t)max_size) debug(3, 1) ("Cache COSS dir '%s' size remains unchanged at %d KB\n", path, size); else { debug(3, 1) ("Cache COSS dir '%s' size changed to %d KB\n", path, size); - sd->max_size = size; + max_size = size; } - parse_cachedir_options(sd, NULL, 1); + parse_cachedir_options(this, NULL, 1); /* 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"); } @@ -829,7 +828,6 @@ { assert(!coss_initialised); - storefs->reconfigurefunc = storeCossDirReconfigure; storefs->donefunc = storeCossDirDone; storefs->newfunc = storeCossNew; coss_index_pool = memPoolCreate("COSS index data", sizeof(CossIndexNode)); 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.43 retrieving revision 1.2.16.44 diff -u -r1.2.16.43 -r1.2.16.44 --- squid3/src/fs/diskd/store_dir_diskd.cc 15 Dec 2002 07:27:02 -0000 1.2.16.43 +++ squid3/src/fs/diskd/store_dir_diskd.cc 15 Dec 2002 08:23:07 -0000 1.2.16.44 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_diskd.cc,v 1.2.16.43 2002/12/15 07:27:02 rbcollins Exp $ + * $Id: store_dir_diskd.cc,v 1.2.16.44 2002/12/15 08:23:07 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -317,13 +317,11 @@ * * This routine is called when the given swapdir needs reconfiguring */ -static void -storeDiskdDirReconfigure(SwapDir * sd, int index, char *path) +void +DiskdSwapDir::reconfigure(int index, char *path) { int i; int size; - int l1; - int l2; i = GetInteger(); size = i << 10; /* Mbytes to kbytes */ @@ -339,14 +337,14 @@ fatal("storeDiskdDirReconfigure: invalid level 2 directories value"); /* just reconfigure it */ - if (size == sd->max_size) + if (size == max_size) debug(3, 1) ("Cache dir '%s' size remains unchanged at %d KB\n", path, size); else debug(3, 1) ("Cache dir '%s' size changed to %d KB\n", path, size); - sd->max_size = size; - parse_cachedir_options(sd, options, 1); + max_size = size; + parse_cachedir_options(this, options, 1); } void @@ -412,7 +410,6 @@ storeFsSetup_diskd(storefs_entry_t * storefs) { assert(!diskd_initialised); - storefs->reconfigurefunc = storeDiskdDirReconfigure; storefs->donefunc = storeDiskdDirDone; storefs->newfunc = storeDiskdNew; memset(&diskd_stats, '\0', sizeof(diskd_stats)); 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.43 retrieving revision 1.1.20.44 diff -u -r1.1.20.43 -r1.1.20.44 --- squid3/src/fs/diskd/store_diskd.h 15 Dec 2002 02:34:36 -0000 1.1.20.43 +++ squid3/src/fs/diskd/store_diskd.h 15 Dec 2002 08:23:07 -0000 1.1.20.44 @@ -140,6 +140,7 @@ virtual int callback(); virtual void sync(); virtual void parse (int index, char *path); + virtual void reconfigure (int, char *); }; #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.15 retrieving revision 1.1.20.16 diff -u -r1.1.20.15 -r1.1.20.16 --- squid3/src/fs/null/store_null.cc 15 Dec 2002 02:34:36 -0000 1.1.20.15 +++ squid3/src/fs/null/store_null.cc 15 Dec 2002 08:23:07 -0000 1.1.20.16 @@ -1,6 +1,6 @@ /* - * $Id: store_null.cc,v 1.1.20.15 2002/12/15 02:34:36 rbcollins Exp $ + * $Id: store_null.cc,v 1.1.20.16 2002/12/15 08:23:07 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -50,17 +50,17 @@ virtual StoreIOState::Pointer createStoreIO(StoreEntry &, STFNCB *, STIOCB *, void *); virtual StoreIOState::Pointer openStoreIO(StoreEntry &, STFNCB *, STIOCB *, void *); virtual void parse(int, char*); + virtual void reconfigure (int, char *); }; static int null_initialised = 0; -static STFSRECONFIGURE storeNullDirReconfigure; static EVH storeNullDirRebuildComplete; /* The only externally visible interface */ STSETUP storeFsSetup_null; -static void -storeNullDirReconfigure(SwapDir * sd, int index, char *path) +void +NullSwapDir::reconfigure(int index, char *path) { (void) 0; } @@ -129,7 +129,6 @@ storeFsSetup_null(storefs_entry_t * storefs) { assert(!null_initialised); - storefs->reconfigurefunc = storeNullDirReconfigure; storefs->donefunc = storeNullDirDone; storefs->newfunc = storeNullNew; null_initialised = 1; 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.38 retrieving revision 1.1.20.39 diff -u -r1.1.20.38 -r1.1.20.39 --- squid3/src/fs/ufs/store_dir_ufs.cc 15 Dec 2002 07:27:02 -0000 1.1.20.38 +++ squid3/src/fs/ufs/store_dir_ufs.cc 15 Dec 2002 08:23:07 -0000 1.1.20.39 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.1.20.38 2002/12/15 07:27:02 rbcollins Exp $ + * $Id: store_dir_ufs.cc,v 1.1.20.39 2002/12/15 08:23:07 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -88,8 +88,8 @@ * * This routine is called when the given swapdir needs reconfiguring */ -static void -storeUfsDirReconfigure(SwapDir * sd, int index, char *path) +void +UfsSwapDir::reconfigure(int index, char *path) { int i; int size; @@ -110,15 +110,15 @@ fatal("storeUfsDirReconfigure: invalid level 2 directories value"); /* just reconfigure it */ - if (size == sd->max_size) + if (size == max_size) debug(3, 1) ("Cache dir '%s' size remains unchanged at %d KB\n", path, size); else debug(3, 1) ("Cache dir '%s' size changed to %d KB\n", path, size); - sd->max_size = size; + max_size = size; - parse_cachedir_options(sd, options, 1); + parse_cachedir_options(this, options, 1); } void @@ -226,7 +226,6 @@ storeFsSetup_ufs(storefs_entry_t * storefs) { assert(!ufs_initialised); - storefs->reconfigurefunc = storeUfsDirReconfigure; storefs->donefunc = storeUfsDirDone; storefs->newfunc = storeUfsNew; ufs_initialised = 1; 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.30 retrieving revision 1.1.20.31 diff -u -r1.1.20.30 -r1.1.20.31 --- squid3/src/fs/ufs/store_ufs.h 15 Dec 2002 02:34:37 -0000 1.1.20.30 +++ squid3/src/fs/ufs/store_ufs.h 15 Dec 2002 08:23:07 -0000 1.1.20.31 @@ -62,6 +62,7 @@ virtual void unlink(StoreEntry &); virtual int canStore(StoreEntry const&)const; virtual void parse (int index, char *path); + virtual void reconfigure (int, char *); }; #include "IOStrategy.h"