]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Removed unused StoreIOState::STFNCB callbacks (#1283)
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 20 Feb 2023 03:07:45 +0000 (03:07 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 20 Feb 2023 03:07:54 +0000 (03:07 +0000)
Unused since before 2016 commit abf396e that discovered the problem.

18 files changed:
src/StoreIOState.cc
src/StoreIOState.h
src/fs/rock/RockHeaderUpdater.cc
src/fs/rock/RockIoState.cc
src/fs/rock/RockIoState.h
src/fs/rock/RockSwapDir.cc
src/fs/rock/RockSwapDir.h
src/fs/ufs/UFSStoreState.cc
src/fs/ufs/UFSStrategy.cc
src/fs/ufs/UFSStrategy.h
src/fs/ufs/UFSSwapDir.cc
src/fs/ufs/UFSSwapDir.h
src/store/Disk.h
src/store_io.cc
src/store_swapin.cc
src/store_swapout.cc
src/tests/TestSwapDir.cc
src/tests/TestSwapDir.h

index 6fd9b2a8358b959d0a29f447bfca5cb76c84bd02..38873cd7ec217dd2c8ff4525a773e734adfd29f1 100644 (file)
@@ -27,13 +27,12 @@ StoreIOState::operator delete (void *)
     assert(0);
 }
 
-StoreIOState::StoreIOState(StoreIOState::STFNCB *cbFile, StoreIOState::STIOCB *cbIo, void *data) :
+StoreIOState::StoreIOState(StoreIOState::STIOCB *cbIo, void *data) :
     swap_dirn(-1),
     swap_filen(-1),
     e(nullptr),
     mode(O_BINARY),
     offset_(0),
-    file_callback(cbFile),
     callback(cbIo),
     callback_data(cbdataReference(data))
 {
index 3eedc0abadc972513e4eb82402876187dcf72022..a3d56d050a60ccba7b7e0e2c60395b8520f1a2ec 100644 (file)
@@ -28,18 +28,6 @@ public:
      */
     typedef void STRCB(void *their_data, const char *buf, ssize_t len, StoreIOState::Pointer self);
 
-    /*
-     * STFNCB is the "store file number callback."  It is called
-     * when an underlying storage module has allocated the swap
-     * file number and also indicates that the swap file has been
-     * opened for reading or writing.  STFNCB functions are passed
-     * to storeCreate() and storeOpen().  Examples of STFNCB callbacks
-     * are:
-     * storeSwapInFileNotify
-     * storeSwapOutFileNotify
-     */
-    typedef void STFNCB(void *their_data, int errflag, StoreIOState::Pointer self);
-
     /*
      * STIOCB is the "store close callback" for store files.  It
      * is called when the store file is closed.  STIOCB functions
@@ -54,7 +42,7 @@ public:
     void *operator new (size_t amount);
     void operator delete (void *address);
 
-    StoreIOState(StoreIOState::STFNCB *cbFile, StoreIOState::STIOCB *cbIo, void *data);
+    StoreIOState(StoreIOState::STIOCB *, void *cbData);
     ~StoreIOState() override;
 
     off_t offset() const {return offset_;}
@@ -85,7 +73,6 @@ public:
     StoreEntry *e;      /* Need this so the FS layers can play god */
     mode_t mode;
     off_t offset_; ///< number of bytes written or read for this entry so far
-    STFNCB *file_callback;  // XXX: Unused. TODO: Remove.
     STIOCB *callback;
     void *callback_data;
 
@@ -99,8 +86,8 @@ public:
     } flags;
 };
 
-StoreIOState::Pointer storeCreate(StoreEntry *, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
-StoreIOState::Pointer storeOpen(StoreEntry *, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
+StoreIOState::Pointer storeCreate(StoreEntry *, StoreIOState::STIOCB *, void *);
+StoreIOState::Pointer storeOpen(StoreEntry *, StoreIOState::STIOCB *, void *);
 void storeClose(StoreIOState::Pointer, int how);
 void storeRead(StoreIOState::Pointer, char *, size_t, off_t, StoreIOState::STRCB *, void *);
 void storeIOWrite(StoreIOState::Pointer, char const *, size_t, off_t, FREE *);
index d0c8e99bbbb4243c5524a3b379c1c747f6a75be3..b659f13f56b130232afc6020ad533929dd607294 100644 (file)
@@ -73,7 +73,6 @@ Rock::HeaderUpdater::startReading()
 {
     reader = store->openStoreIO(
                  *update.entry,
-                 nullptr, // unused; see StoreIOState::file_callback
                  &NoteDoneReading,
                  this);
     readMore("need swap entry metadata");
@@ -168,7 +167,6 @@ Rock::HeaderUpdater::startWriting()
 {
     writer = store->createUpdateIO(
                  update,
-                 nullptr, // unused; see StoreIOState::file_callback
                  &NoteDoneWriting,
                  this);
     Must(writer);
index 11d1198715df3cb75ddc06d04aa30b42cfa4e36e..d86d6c21bceceb657e29c84d366959b443a96683 100644 (file)
 
 Rock::IoState::IoState(Rock::SwapDir::Pointer &aDir,
                        StoreEntry *anEntry,
-                       StoreIOState::STFNCB *cbFile,
                        StoreIOState::STIOCB *cbIo,
                        void *data) :
-    StoreIOState(cbFile, cbIo, data),
+    StoreIOState(cbIo, data),
     readableAnchor_(nullptr),
     writeableAnchor_(nullptr),
     splicingPoint(-1),
index 70fe5c1812446a9c6d10cf96577f535f5188fbc5..dd83edc9ca93be78eb25fa82d926fb5924f91fd4 100644 (file)
@@ -29,7 +29,7 @@ class IoState: public ::StoreIOState
 public:
     typedef RefCount<IoState> Pointer;
 
-    IoState(Rock::SwapDir::Pointer &aDir, StoreEntry *e, StoreIOState::STFNCB *cbFile, StoreIOState::STIOCB *cbIo, void *data);
+    IoState(Rock::SwapDir::Pointer &, StoreEntry *, StoreIOState::STIOCB *, void *cbData);
     ~IoState() override;
 
     void file(const RefCount<DiskFile> &aFile);
index 0950a8a7de37659a34db2f1495325661a9818b94..758b49ddf43f29c463802805467e4334d957d1bc 100644 (file)
@@ -609,7 +609,7 @@ Rock::SwapDir::canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load)
 }
 
 StoreIOState::Pointer
-Rock::SwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB *cbFile, StoreIOState::STIOCB *cbIo, void *data)
+Rock::SwapDir::createStoreIO(StoreEntry &e, StoreIOState::STIOCB * const cbIo, void * const cbData)
 {
     if (!theFile || theFile->error()) {
         debugs(47,4, theFile);
@@ -631,7 +631,7 @@ Rock::SwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB *cbFile, StoreI
     // If that does not happen, the entry will not decrement the read level!
 
     Rock::SwapDir::Pointer self(this);
-    IoState *sio = new IoState(self, &e, cbFile, cbIo, data);
+    IoState *sio = new IoState(self, &e, cbIo, cbData);
 
     sio->swap_dirn = index;
     sio->swap_filen = filen;
@@ -649,7 +649,7 @@ Rock::SwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB *cbFile, StoreI
 }
 
 StoreIOState::Pointer
-Rock::SwapDir::createUpdateIO(const Ipc::StoreMapUpdate &update, StoreIOState::STFNCB *cbFile, StoreIOState::STIOCB *cbIo, void *data)
+Rock::SwapDir::createUpdateIO(const Ipc::StoreMapUpdate &update, StoreIOState::STIOCB *cbIo, void *data)
 {
     if (!theFile || theFile->error()) {
         debugs(47,4, theFile);
@@ -660,7 +660,7 @@ Rock::SwapDir::createUpdateIO(const Ipc::StoreMapUpdate &update, StoreIOState::S
     Must(update.fresh.fileNo >= 0);
 
     Rock::SwapDir::Pointer self(this);
-    IoState *sio = new IoState(self, update.entry, cbFile, cbIo, data);
+    IoState *sio = new IoState(self, update.entry, cbIo, data);
 
     sio->swap_dirn = index;
     sio->swap_filen = update.fresh.fileNo;
@@ -752,7 +752,7 @@ Rock::SwapDir::noteFreeMapSlice(const Ipc::StoreMapSliceId sliceId)
 
 // tries to open an old entry with swap_filen for reading
 StoreIOState::Pointer
-Rock::SwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB *cbFile, StoreIOState::STIOCB *cbIo, void *data)
+Rock::SwapDir::openStoreIO(StoreEntry &e, StoreIOState::STIOCB * const cbIo, void * const cbData)
 {
     if (!theFile || theFile->error()) {
         debugs(47,4, theFile);
@@ -780,7 +780,7 @@ Rock::SwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB *cbFile, StoreIOS
         return nullptr; // we were writing after all
 
     Rock::SwapDir::Pointer self(this);
-    IoState *sio = new IoState(self, &e, cbFile, cbIo, data);
+    IoState *sio = new IoState(self, &e, cbIo, cbData);
 
     sio->swap_dirn = index;
     sio->swap_filen = e.swap_filen;
index a07555a28373f4af32eec84a4902d32bd066de8f..786e803df8ac66b6b2fed1591685a42c6ca32995 100644 (file)
@@ -93,8 +93,8 @@ protected:
     ConfigOption *getOptionTree() const override;
     bool allowOptionReconfigure(const char *const option) const override;
     bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const override;
-    StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) override;
-    StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) override;
+    StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) override;
+    StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) override;
     void maintain() override;
     void diskFull() override;
     void reference(StoreEntry &e) override;
@@ -125,7 +125,7 @@ protected:
     int64_t diskOffsetLimit() const;
 
     void updateHeadersOrThrow(Ipc::StoreMapUpdate &update);
-    StoreIOState::Pointer createUpdateIO(const Ipc::StoreMapUpdate &update, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *);
+    StoreIOState::Pointer createUpdateIO(const Ipc::StoreMapUpdate &, StoreIOState::STIOCB *, void *);
 
     void anchorEntry(StoreEntry &e, const sfileno filen, const Ipc::StoreMapAnchor &anchor);
 
index f5852595f8f4cbebb75c48f0b5c46ba023a15fb8..01f3eac8654d2ef34e6f5d0db6282dc08286e5d4 100644 (file)
@@ -326,7 +326,7 @@ Fs::Ufs::UFSStoreState::doCloseCallback(int errflag)
 /* ============= THE REAL UFS CODE ================ */
 
 Fs::Ufs::UFSStoreState::UFSStoreState(SwapDir * SD, StoreEntry * anEntry, STIOCB * cbIo, void *data) :
-    StoreIOState(nullptr, cbIo, data),
+    StoreIOState(cbIo, data),
     opening(false),
     creating(false),
     closing(false),
index 348b78aa2ac50745374516a7da437509cf7a3c57..5e1a30a5864b00279cd863534132b3ba11d8be52 100644 (file)
@@ -54,7 +54,7 @@ Fs::Ufs::UFSStrategy::unlinkFile(char const *path)
 }
 
 StoreIOState::Pointer
-Fs::Ufs::UFSStrategy::open(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB *,
+Fs::Ufs::UFSStrategy::open(SwapDir * const SD, StoreEntry * const e,
                            StoreIOState::STIOCB * aCallback, void *callback_data)
 {
     assert (((UFSSwapDir *)SD)->IO == this);
@@ -90,7 +90,7 @@ Fs::Ufs::UFSStrategy::open(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB *,
 }
 
 StoreIOState::Pointer
-Fs::Ufs::UFSStrategy::create(SwapDir * SD, StoreEntry * e, StoreIOState::STFNCB *,
+Fs::Ufs::UFSStrategy::create(SwapDir * const SD, StoreEntry * const e,
                              StoreIOState::STIOCB * aCallback, void *callback_data)
 {
     assert (((UFSSwapDir *)SD)->IO == this);
index f9cc8e2a3b75b5d9d715f835335545ae0e65084a..a84ee8e1e4b913a19a0b0bb965922d6073b9e31d 100644 (file)
@@ -33,10 +33,8 @@ public:
     StoreIOState::Pointer createState(SwapDir *SD, StoreEntry *e, StoreIOState::STIOCB * callback, void *callback_data) const;
     /* UFS specific */
     virtual RefCount<DiskFile> newFile (char const *path);
-    StoreIOState::Pointer open(SwapDir *, StoreEntry *, StoreIOState::STFNCB *,
-                               StoreIOState::STIOCB *, void *);
-    StoreIOState::Pointer create(SwapDir *, StoreEntry *, StoreIOState::STFNCB *,
-                                 StoreIOState::STIOCB *, void *);
+    StoreIOState::Pointer open(SwapDir *, StoreEntry *, StoreIOState::STIOCB *, void *);
+    StoreIOState::Pointer create(SwapDir *, StoreEntry *, StoreIOState::STIOCB *, void *);
 
     virtual void unlinkFile (char const *);
     virtual void sync();
index 25b0e7f8e0453a4daed43c5f3c5ff8f2ee2def18..0cdcef8de7b652ffcddeeb0deb426a80b94e1e8a 100644 (file)
@@ -543,15 +543,15 @@ Fs::Ufs::UFSSwapDir::dereference(StoreEntry & e)
 }
 
 StoreIOState::Pointer
-Fs::Ufs::UFSSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * aCallback, void *callback_data)
+Fs::Ufs::UFSSwapDir::createStoreIO(StoreEntry &e, StoreIOState::STIOCB * const aCallback, void * const callback_data)
 {
-    return IO->create (this, &e, file_callback, aCallback, callback_data);
+    return IO->create(this, &e, aCallback, callback_data);
 }
 
 StoreIOState::Pointer
-Fs::Ufs::UFSSwapDir::openStoreIO(StoreEntry &e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * aCallback, void *callback_data)
+Fs::Ufs::UFSSwapDir::openStoreIO(StoreEntry &e, StoreIOState::STIOCB * const aCallback, void * const callback_data)
 {
-    return IO->open (this, &e, file_callback, aCallback, callback_data);
+    return IO->open(this, &e, aCallback, callback_data);
 }
 
 int
index 6fcc9de9dd517ce51ec3b871ca647971bed634df..0e23b66f09c0eb7de9d4056fff677446cccff16f 100644 (file)
@@ -56,8 +56,8 @@ public:
     bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const override;
     void reference(StoreEntry &) override;
     bool dereference(StoreEntry &) override;
-    StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) override;
-    StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) override;
+    StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) override;
+    StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) override;
     void openLog() override;
     void closeLog() override;
     int writeCleanStart() override;
index 1674f583101a597e8c2001af5fcdbf02b481314b..45c629cba6f18f6ae432f6653c26e36c322ca0db 100644 (file)
@@ -119,8 +119,8 @@ public:
     /// check whether we can store the entry; if we can, report current load
     virtual bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const = 0;
 
-    virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) = 0;
-    virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) = 0;
+    virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) = 0;
+    virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) = 0;
 
     bool canLog(StoreEntry const &e)const;
     virtual void openLog();
index c52352e3d24ca4d4a24fa88d5d2eb447c75f9563..178488abcda5f92cf81bada2d85480bafe7e30a8 100644 (file)
@@ -22,7 +22,7 @@ StoreIoStats store_io_stats;
  * to select different polices depending on object size or type.
  */
 StoreIOState::Pointer
-storeCreate(StoreEntry * e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * close_callback, void *callback_data)
+storeCreate(StoreEntry * e, StoreIOState::STIOCB * close_callback, void *callback_data)
 {
     assert (e);
 
@@ -41,7 +41,7 @@ storeCreate(StoreEntry * e, StoreIOState::STFNCB * file_callback, StoreIOState::
     }
 
     /* Now that we have a fs to use, call its storeCreate function */
-    StoreIOState::Pointer sio = sd->createStoreIO(*e, file_callback, close_callback, callback_data);
+    StoreIOState::Pointer sio = sd->createStoreIO(*e, close_callback, callback_data);
 
     if (sio == nullptr)
         ++store_io_stats.create.create_fail;
@@ -55,10 +55,10 @@ storeCreate(StoreEntry * e, StoreIOState::STFNCB * file_callback, StoreIOState::
  * storeOpen() is purely for reading ..
  */
 StoreIOState::Pointer
-storeOpen(StoreEntry * e, StoreIOState::STFNCB * file_callback, StoreIOState::STIOCB * callback,
+storeOpen(StoreEntry * e, StoreIOState::STIOCB * callback,
           void *callback_data)
 {
-    return e->disk().openStoreIO(*e, file_callback, callback, callback_data);
+    return e->disk().openStoreIO(*e, callback, callback_data);
 }
 
 void
index f588cb1441db51cfda62549b526827d2c3f8f96b..7b280646889c3f8c021031c6228ff8fd82434e88 100644 (file)
@@ -16,7 +16,6 @@
 #include "StoreClient.h"
 
 static StoreIOState::STIOCB storeSwapInFileClosed;
-static StoreIOState::STFNCB storeSwapInFileNotify;
 
 void
 storeSwapInStart(store_client * sc)
@@ -44,7 +43,7 @@ storeSwapInStart(store_client * sc)
     }
 
     assert(e->mem_obj != nullptr);
-    sc->swapin_sio = storeOpen(e, storeSwapInFileNotify, storeSwapInFileClosed, sc);
+    sc->swapin_sio = storeOpen(e, storeSwapInFileClosed, sc);
 }
 
 static void
@@ -62,18 +61,3 @@ storeSwapInFileClosed(void *data, int errflag, StoreIOState::Pointer)
     ++statCounter.swap.ins;
 }
 
-static void
-storeSwapInFileNotify(void *data, int, StoreIOState::Pointer)
-{
-    store_client *sc = (store_client *)data;
-    StoreEntry *e = sc->entry;
-
-    debugs(1, 3, "storeSwapInFileNotify: changing " << e->swap_filen << "/" <<
-           e->swap_dirn << " to " << sc->swapin_sio->swap_filen << "/" <<
-           sc->swapin_sio->swap_dirn);
-
-    assert(e->swap_filen < 0); // if this fails, call SwapDir::disconnect(e)
-    e->swap_filen = sc->swapin_sio->swap_filen;
-    e->swap_dirn = sc->swapin_sio->swap_dirn;
-}
-
index a30828099dd40c641f86a0281745e9a4cff1a280..5c61e7238a8cb9c086fbc7e3b5cf2cb450013e53 100644 (file)
@@ -26,7 +26,6 @@
 
 static void storeSwapOutStart(StoreEntry * e);
 static StoreIOState::STIOCB storeSwapOutFileClosed;
-static StoreIOState::STFNCB storeSwapOutFileNotify;
 
 // wrapper to cross C/C++ ABI boundary. xfree is extern "C" for libraries.
 static void xfree_cppwrapper(void *x)
@@ -61,7 +60,7 @@ storeSwapOutStart(StoreEntry * e)
 
     /* Create the swap file */
     generic_cbdata *c = new generic_cbdata(e);
-    sio = storeCreate(e, storeSwapOutFileNotify, storeSwapOutFileClosed, c);
+    sio = storeCreate(e, storeSwapOutFileClosed, c);
 
     if (sio == nullptr) {
         assert(!e->hasDisk());
@@ -87,13 +86,6 @@ storeSwapOutStart(StoreEntry * e)
     storeIOWrite(mem->swapout.sio, buf, mem->swap_hdr_sz, 0, xfree_cppwrapper);
 }
 
-/// XXX: unused, see a related StoreIOState::file_callback
-static void
-storeSwapOutFileNotify(void *, int, StoreIOState::Pointer)
-{
-    assert(false);
-}
-
 static bool
 doPages(StoreEntry *anEntry)
 {
index f3346b4a97dc8bfa9f8dd0861997b9bdcd62ebd3..69fc6e85ea309af858039f3dbe17f98e323a5825 100644 (file)
@@ -55,13 +55,13 @@ TestSwapDir::canStore(const StoreEntry &, int64_t, int &load) const
 }
 
 StoreIOState::Pointer
-TestSwapDir::createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *)
+TestSwapDir::createStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *)
 {
     return nullptr;
 }
 
 StoreIOState::Pointer
-TestSwapDir::openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *)
+TestSwapDir::openStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *)
 {
     return nullptr;
 }
index fe9fd1985f0d6f1b0bdc30b469a19f2937150138..60009f35c2cbb56d388258ba8e38da6e79c576b1 100644 (file)
@@ -30,8 +30,8 @@ public:
     void init() override;
     bool unlinkdUseful() const override;
     bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const override;
-    StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) override;
-    StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) override;
+    StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) override;
+    StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STIOCB *, void *) override;
     void parse(int, char*) override;
     void evictCached(StoreEntry &) override {}
     void evictIfFound(const cache_key *) override {}