Hi all.

This is a small cleanup patch discussed recently in another thread.
Note it depends on rock-reconfigure-t3.patch.


Before the change, SwapDir::reconfigure() took index and path
arguments.  But none of them was actually used: neither index nor path
can be changed during reconfigure.  And both index and path are
available as SwapDir members.  So there is no reason to have these
arguments.


Regards,
  Dmitry
Remove SwapDir::reconfigure() arguments since they are not used.

Before the change, SwapDir::reconfigure() took index and path
arguments.  But none of them was actually used: neither index nor path
can be changed during reconfigure.  And both index and path are
available as SwapDir members.  So there is no reason to have these
arguments.

=== modified file 'src/SwapDir.h'
--- src/SwapDir.h	2011-09-20 16:17:56 +0000
+++ src/SwapDir.h	2011-09-20 16:18:13 +0000
@@ -108,41 +108,41 @@ SQUIDCEXTERN STDIRSELECT *storeDirSelect
 SQUIDCEXTERN int storeVerifySwapDirs(void);
 SQUIDCEXTERN void storeDirCloseSwapLogs(void);
 SQUIDCEXTERN void storeDirCloseTmpSwapLog(int dirn);
 SQUIDCEXTERN void storeDirDiskFull(sdirno);
 SQUIDCEXTERN void storeDirOpenSwapLogs(void);
 SQUIDCEXTERN void storeDirSwapLog(const StoreEntry *, int op);
 SQUIDCEXTERN void storeDirLRUDelete(StoreEntry *);
 SQUIDCEXTERN void storeDirLRUAdd(StoreEntry *);
 SQUIDCEXTERN int storeDirGetBlkSize(const char *path, int *blksize);
 SQUIDCEXTERN int storeDirGetUFSStats(const char *, int *, int *, int *, int *);
 
 /// manages a single cache_dir
 class SwapDir : public Store
 {
 
 public:
     typedef RefCount<SwapDir> Pointer;
 
     SwapDir(char const *aType);
     virtual ~SwapDir();
-    virtual void reconfigure(int, char *) = 0;
+    virtual void reconfigure() = 0;
     char const *type() const;
 
     virtual bool needsDiskStrand() const; ///< needs a dedicated kid process
     virtual bool active() const; ///< may be used in this strand
     /// whether stat should be reported by this SwapDir
     virtual bool doReportStat() const { return active(); }
 
     /* official Store interface functions */
     virtual void diskFull();
 
     virtual StoreEntry * get(const cache_key *);
 
     virtual void get(String const, STOREGETCLIENT, void * cbdata);
 
     virtual uint64_t maxSize() const { return max_size;}
 
     virtual uint64_t minSize() const;
 
     virtual int64_t maxObjectSize() const { return max_objsize; }
 

=== modified file 'src/cache_cf.cc'
--- src/cache_cf.cc	2011-09-20 15:56:52 +0000
+++ src/cache_cf.cc	2011-09-20 16:20:46 +0000
@@ -1942,41 +1942,41 @@ parse_cachedir(SquidConfig::_cacheSwap *
 
     for (i = 0; i < swap->n_configured; i++) {
         assert (swap->swapDirs[i].getRaw());
 
         if ((strcasecmp(path_str, dynamic_cast<SwapDir *>(swap->swapDirs[i].getRaw())->path)) == 0) {
             /* this is specific to on-fs Stores. The right
              * way to handle this is probably to have a mapping
              * from paths to stores, and have on-fs stores
              * register with that, and lookip in that in their
              * own setup logic. RBC 20041225. TODO.
              */
 
             sd = dynamic_cast<SwapDir *>(swap->swapDirs[i].getRaw());
 
             if (strcmp(sd->type(), StoreFileSystem::FileSystems().items[fs]->type()) != 0) {
                 debugs(3, 0, "ERROR: Can't change type of existing cache_dir " <<
                        sd->type() << " " << sd->path << " to " << type_str << ". Restart required");
                 return;
             }
 
-            sd->reconfigure (i, path_str);
+            sd->reconfigure();
 
             update_maxobjsize();
 
             return;
         }
     }
 
     /* new cache_dir */
     if (swap->n_configured > 63) {
         /* 7 bits, signed */
         debugs(3, DBG_CRITICAL, "WARNING: There is a fixed maximum of 63 cache_dir entries Squid can handle.");
         debugs(3, DBG_CRITICAL, "WARNING: '" << path_str << "' is one to many.");
         self_destruct();
         return;
     }
 
     allocate_new_swapdir(swap);
 
     swap->swapDirs[swap->n_configured] = StoreFileSystem::FileSystems().items[fs]->createSwapDir();
 

=== modified file 'src/fs/coss/CossSwapDir.h'
--- src/fs/coss/CossSwapDir.h	2011-04-28 12:23:55 +0000
+++ src/fs/coss/CossSwapDir.h	2011-09-20 16:19:02 +0000
@@ -31,41 +31,41 @@ class CossSwapDir : public SwapDir, publ
 public:
     CossSwapDir();
     virtual void init();
     virtual void create();
     virtual void dump(StoreEntry &)const;
     ~CossSwapDir();
     virtual StoreSearch *search(String const url, HttpRequest *);
     virtual void unlink (StoreEntry &);
     virtual void statfs (StoreEntry &)const;
     virtual bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const;
     virtual int callback();
     virtual void sync();
     virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
     virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
     virtual void openLog();
     virtual void closeLog();
     virtual int writeCleanStart();
     virtual void writeCleanDone();
     virtual void logEntry(const StoreEntry & e, int op) const;
     virtual void parse (int index, char *path);
-    virtual void reconfigure (int, char *);
+    virtual void reconfigure();
     virtual void swappedOut(const StoreEntry &e);
     virtual uint64_t currentSize() const { return cur_size; }
     virtual uint64_t currentCount() const { return n_disk_objects; }
     /* internals */
     virtual off_t storeCossFilenoToDiskOffset(sfileno);
     virtual sfileno storeCossDiskOffsetToFileno(off_t);
     virtual CossMemBuf *storeCossFilenoToMembuf(sfileno f);
     /* IORequestor routines */
     virtual void ioCompletedNotification();
     virtual void closeCompleted();
     virtual void readCompleted(const char *buf, int len, int errflag, RefCount<ReadRequest>);
     virtual void writeCompleted(int errflag, size_t len, RefCount<WriteRequest>);
     //private:
     int swaplog_fd;
     int count;
     dlink_list membufs;
 
     CossMemBuf *current_membuf;
     off_t current_offset;	/* in Blocks */
     int numcollisions;

=== modified file 'src/fs/coss/store_dir_coss.cc'
--- src/fs/coss/store_dir_coss.cc	2011-09-11 21:44:54 +0000
+++ src/fs/coss/store_dir_coss.cc	2011-09-20 16:19:23 +0000
@@ -1019,41 +1019,41 @@ CossSwapDir::parse(int anIndex, char *aP
     if (max_objsize == -1)
         fatal("COSS requires max-size to be set to something other than -1!\n");
 
     if (max_objsize > COSS_MEMBUF_SZ)
         fatalf("COSS max-size option must be less than COSS_MEMBUF_SZ (%d)\n",
                COSS_MEMBUF_SZ);
 
     // check that we won't overflow sfileno later.
     const uint64_t max_offset = (uint64_t)SwapFilenMax << blksz_bits;
 
     if (maxSize() > max_offset) {
         debugs(47, 0, "COSS block-size = " << (1<<blksz_bits) << " bytes");
         debugs(47,0, "COSS largest file offset = " << (max_offset >> 10) << " KB");
         debugs(47, 0, "COSS cache_dir size = " << (maxSize() >> 10) << " KB");
         fatal("COSS cache_dir size exceeds largest offset\n");
     }
 }
 
 
 void
-CossSwapDir::reconfigure(int index, char *path)
+CossSwapDir::reconfigure()
 {
     const int i = GetInteger();
     if (i <= 0)
         fatal("storeCossDirParse: invalid size value");
 
     const uint64_t size = static_cast<uint64_t>(i) << 20; // MBytes to Bytes
 
     if (size == maxSize())
         debugs(3, 1, "Cache COSS dir '" << path << "' size remains unchanged at " << i << " MB");
     else {
         debugs(3, 1, "Cache COSS dir '" << path << "' size changed to " << i << " MB");
         max_size = size;
     }
 
     /* Enforce maxobjsize being set to something */
     if (max_objsize == -1)
         fatal("COSS requires max-size to be set to something other than -1!\n");
 }
 
 void

=== modified file 'src/fs/rock/RockSwapDir.cc'
--- src/fs/rock/RockSwapDir.cc	2011-09-20 16:17:56 +0000
+++ src/fs/rock/RockSwapDir.cc	2011-09-20 16:18:22 +0000
@@ -248,41 +248,41 @@ Rock::SwapDir::parse(int anIndex, char *
     index = anIndex;
 
     path = xstrdup(aPath);
 
     // cache store is located at path/db
     String fname(path);
     fname.append("/rock");
     filePath = xstrdup(fname.termedBuf());
 
     parseSize(false);
     parseOptions(0);
 
     // Current openForWriting() code overwrites the old slot if needed
     // and possible, so proactively removing old slots is probably useless.
     assert(!repl); // repl = createRemovalPolicy(Config.replPolicy);
 
     validateOptions();
 }
 
 void
-Rock::SwapDir::reconfigure(int, char *aPath)
+Rock::SwapDir::reconfigure()
 {
     parseSize(true);
     parseOptions(1);
     // TODO: can we reconfigure the replacement policy (repl)?
     validateOptions();
 }
 
 /// parse maximum db disk size
 void
 Rock::SwapDir::parseSize(const bool reconfiguring)
 {
     const int i = GetInteger();
     if (i < 0)
         fatal("negative Rock cache_dir size value");
     const uint64_t new_max_size =
         static_cast<uint64_t>(i) << 20; // MBytes to Bytes
     if (!reconfiguring)
         max_size = new_max_size;
     else if (new_max_size != max_size) {
         debugs(3, DBG_IMPORTANT, "WARNING: cache_dir '" << path << "' size "

=== modified file 'src/fs/rock/RockSwapDir.h'
--- src/fs/rock/RockSwapDir.h	2011-09-20 16:17:56 +0000
+++ src/fs/rock/RockSwapDir.h	2011-09-20 16:18:16 +0000
@@ -7,41 +7,41 @@
 #include "fs/rock/RockDbCell.h"
 #include "ipc/StoreMap.h"
 
 class DiskIOStrategy;
 class ReadRequest;
 class WriteRequest;
 
 namespace Rock
 {
 
 class Rebuild;
 
 /// \ingroup Rock
 class SwapDir: public ::SwapDir, public IORequestor
 {
 public:
     SwapDir();
     virtual ~SwapDir();
 
     /* public ::SwapDir API */
-    virtual void reconfigure(int, char *);
+    virtual void reconfigure();
     virtual StoreSearch *search(String const url, HttpRequest *);
     virtual StoreEntry *get(const cache_key *key);
     virtual void get(String const, STOREGETCLIENT, void * cbdata);
     virtual void disconnect(StoreEntry &e);
     virtual uint64_t currentSize() const;
     virtual uint64_t currentCount() const;
     virtual bool doReportStat() const;
     virtual void swappedOut(const StoreEntry &e);
 
     int64_t entryLimitHigh() const { return SwapFilenMax; } ///< Core limit
     int64_t entryLimitAllowed() const;
 
     typedef Ipc::StoreMapWithExtras<DbCellHeader> DirMap;
 
 protected:
     /* protected ::SwapDir API */
     virtual bool needsDiskStrand() const;
     virtual void create();
     virtual void init();
     virtual ConfigOption *getOptionTree() const;

=== modified file 'src/fs/ufs/store_dir_ufs.cc'
--- src/fs/ufs/store_dir_ufs.cc	2011-08-10 15:54:51 +0000
+++ src/fs/ufs/store_dir_ufs.cc	2011-09-20 16:19:56 +0000
@@ -93,41 +93,41 @@ UFSSwapDir::parseSizeL1L2()
     max_size = size;
 
     l1 = GetInteger();
 
     if (l1 <= 0)
         fatal("UFSSwapDir::parseSizeL1L2: invalid level 1 directories value");
 
     l2 = GetInteger();
 
     if (l2 <= 0)
         fatal("UFSSwapDir::parseSizeL1L2: invalid level 2 directories value");
 }
 
 /*
  * storeUfsDirReconfigure
  *
  * This routine is called when the given swapdir needs reconfiguring
  */
 
 void
-UFSSwapDir::reconfigure(int aIndex, char *aPath)
+UFSSwapDir::reconfigure()
 {
     parseSizeL1L2();
     parseOptions(1);
 }
 
 /*
  * storeUfsDirParse
  *
  * Called when a *new* fs is being setup.
  */
 void
 UFSSwapDir::parse (int anIndex, char *aPath)
 {
     index = anIndex;
     path = xstrdup(aPath);
 
     parseSizeL1L2();
 
     /* Initialise replacement policy stuff */
     repl = createRemovalPolicy(Config.replPolicy);

=== modified file 'src/fs/ufs/ufscommon.h'
--- src/fs/ufs/ufscommon.h	2011-05-12 03:58:16 +0000
+++ src/fs/ufs/ufscommon.h	2011-09-20 16:20:09 +0000
@@ -56,41 +56,41 @@ public:
     virtual void init();
     virtual void create();
     virtual void dump(StoreEntry &) const;
     ~UFSSwapDir();
     virtual StoreSearch *search(String const url, HttpRequest *);
     virtual bool doubleCheck(StoreEntry &);
     virtual void unlink(StoreEntry &);
     virtual void statfs(StoreEntry &)const;
     virtual void maintain();
     virtual bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const;
     virtual void reference(StoreEntry &);
     virtual bool dereference(StoreEntry &);
     virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
     virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
     virtual void openLog();
     virtual void closeLog();
     virtual int writeCleanStart();
     virtual void writeCleanDone();
     virtual void logEntry(const StoreEntry & e, int op) const;
     virtual void parse(int index, char *path);
-    virtual void reconfigure(int, char *);
+    virtual void reconfigure();
     virtual int callback();
     virtual void sync();
     virtual void swappedOut(const StoreEntry &e);
     virtual uint64_t currentSize() const { return cur_size; }
     virtual uint64_t currentCount() const { return n_disk_objects; }
 
     void unlinkFile(sfileno f);
     // move down when unlink is a virtual method
     //protected:
     UFSStrategy *IO;
     char *fullPath(sfileno, char *) const;
     /* temp */
     void closeTmpSwapLog();
     FILE *openTmpSwapLog(int *clean_flag, int *zero_flag);
     char *swapSubDir(int subdirn) const;
     int mapBitTest(sfileno filn);
     void mapBitReset(sfileno filn);
     void mapBitSet(sfileno filn);
     StoreEntry *addDiskRestore(const cache_key * key,
                                sfileno file_number,

=== modified file 'src/tests/TestSwapDir.cc'
--- src/tests/TestSwapDir.cc	2011-06-21 23:44:03 +0000
+++ src/tests/TestSwapDir.cc	2011-09-20 16:22:34 +0000
@@ -11,41 +11,41 @@ TestSwapDir::maxSize() const
 
 uint64_t
 TestSwapDir::currentSize() const
 {
     return 2;
 }
 
 uint64_t
 TestSwapDir::currentCount() const
 {
     return 2;
 }
 
 void
 TestSwapDir::stat(StoreEntry &) const
 {
     const_cast<TestSwapDir *>(this)->statsCalled = true;
 }
 
 void
-TestSwapDir::reconfigure(int, char*)
+TestSwapDir::reconfigure()
 {}
 
 void
 TestSwapDir::init()
 {}
 
 bool
 TestSwapDir::canStore(const StoreEntry &, int64_t, int &load) const
 {
     load = 0;
     return true;
 }
 
 StoreIOState::Pointer
 TestSwapDir::createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *)
 {
     return NULL;
 }
 
 StoreIOState::Pointer

=== modified file 'src/tests/TestSwapDir.h'
--- src/tests/TestSwapDir.h	2011-06-21 23:44:03 +0000
+++ src/tests/TestSwapDir.h	2011-09-20 16:22:27 +0000
@@ -1,32 +1,32 @@
 #ifndef TEST_TESTSWAPDIR
 #define TEST_TESTSWAPDIR
 
 #include "squid.h"
 #include "SwapDir.h"
 
 class TestSwapDir : public SwapDir
 {
 
 public:
     TestSwapDir() : SwapDir("test"), statsCalled (false) {}
 
     bool statsCalled;
 
     virtual uint64_t maxSize() const;
     virtual uint64_t currentSize() const;
     virtual uint64_t currentCount() const;
     virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */
     virtual void swappedOut(const StoreEntry &e) {}
 
-    virtual void reconfigure(int, char*);
+    virtual void reconfigure();
     virtual void init();
     virtual bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const;
     virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
     virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
     virtual void parse(int, char*);
     virtual StoreSearch *search(String, HttpRequest *);
 };
 
 typedef RefCount<TestSwapDir> TestSwapDirPointer;
 
 #endif  /* TEST_TESTSWAPDIR */

Reply via email to