]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/fs/ufs/UFSSwapDir.h
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / fs / ufs / UFSSwapDir.h
index dc6776e5e76916964751e2612758a49ded8bafe4..e3afa9cb6d964e8b36df082ef6631fae83cc5228 100644 (file)
@@ -1,29 +1,9 @@
 /*
- * SQUID Web Proxy Cache          http://www.squid-cache.org/
- * ----------------------------------------------------------
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
  *
- *  Squid is the result of efforts by numerous individuals from
- *  the Internet community; see the CONTRIBUTORS file for full
- *  details.   Many organizations have provided support for Squid's
- *  development; see the SPONSORS file for full details.  Squid is
- *  Copyrighted (C) 2001 by the Regents of the University of
- *  California; see the COPYRIGHT file for full details.  Squid
- *  incorporates software developed and/or copyrighted by other
- *  sources; see the CREDITS file for full details.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
 #ifndef SQUID_FS_UFS_UFSSWAPDIR_H
 
 #include "SquidString.h"
 #include "Store.h"
+#include "store/Disk.h"
 #include "StoreIOState.h"
 #include "StoreSearch.h"
 #include "swap_log_op.h"
-#include "SwapDir.h"
 #include "UFSStrategy.h"
 
 class HttpRequest;
@@ -61,55 +41,37 @@ public:
     static bool FilenoBelongsHere(int fn, int cachedir, int level1dir, int level2dir);
 
     UFSSwapDir(char const *aType, const char *aModuleType);
-    /** Initial setup / end destruction */
-    virtual void init();
-    /** Create a new SwapDir (-z command-line option) */
-    virtual void create();
-    virtual void dump(StoreEntry &) const;
-    ~UFSSwapDir();
-    virtual StoreSearch *search(String const url, HttpRequest *);
-    /** double-check swap during rebuild (-S command-line option)
-     *
-     * called by storeCleanup if needed
-     */
-    virtual bool doubleCheck(StoreEntry &);
-    virtual bool unlinkdUseful() const;
-    /** unlink a file, and remove its entry from the filemap */
-    virtual void unlink(StoreEntry &);
-    virtual void statfs(StoreEntry &)const;
-    virtual void maintain();
-    /** check whether this filesystem can store the given object
-     *
-     * UFS filesystems will happily store anything as long as
-     * the LRU time isn't too small
-     */
-    virtual bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const;
-    /** reference an object
-     *
-     * This routine is called whenever an object is referenced, so we can
-     * maintain replacement information within the storage fs.
-     */
-    virtual void reference(StoreEntry &);
-    /** de-reference an object
-     *
-     * This routine is called whenever the last reference to an object is
-     * removed, to maintain replacement information within the storage fs.
-     */
-    virtual bool dereference(StoreEntry &, bool);
-    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); ///parse configuration and setup new SwapDir
-    virtual void reconfigure(); ///reconfigure the SwapDir
-    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; }
+    virtual ~UFSSwapDir();
+
+    /* Store::Disk API */
+    virtual void create() override;
+    virtual void init() override;
+    virtual void dump(StoreEntry &) const override;
+    virtual bool doubleCheck(StoreEntry &) override;
+    virtual bool unlinkdUseful() const override;
+    virtual void unlink(StoreEntry &) override;
+    virtual void statfs(StoreEntry &) const override;
+    virtual void maintain() override;
+    virtual void markForUnlink(StoreEntry &) override {}
+    virtual bool canStore(const StoreEntry &e, int64_t diskSpaceNeeded, int &load) const override;
+    virtual void reference(StoreEntry &) override;
+    virtual bool dereference(StoreEntry &) override;
+    virtual StoreIOState::Pointer createStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) override;
+    virtual StoreIOState::Pointer openStoreIO(StoreEntry &, StoreIOState::STFNCB *, StoreIOState::STIOCB *, void *) override;
+    virtual void openLog() override;
+    virtual void closeLog() override;
+    virtual int writeCleanStart() override;
+    virtual void writeCleanDone() override;
+    virtual void logEntry(const StoreEntry & e, int op) const override;
+    virtual void parse(int index, char *path) override;
+    virtual void reconfigure() override;
+    virtual int callback() override;
+    virtual void sync() override;
+    virtual void swappedOut(const StoreEntry &e) override;
+    virtual uint64_t currentSize() const override { return cur_size; }
+    virtual uint64_t currentCount() const override { return n_disk_objects; }
+    virtual ConfigOption *getOptionTree() const override;
+    virtual bool smpAware() const override { return false; }
 
     void unlinkFile(sfileno f);
     // move down when unlink is a virtual method
@@ -141,7 +103,6 @@ public:
     void undoAddDiskRestore(StoreEntry *e);
     int validFileno(sfileno filn, int flag) const;
     int mapBitAllocate();
-    virtual ConfigOption *getOptionTree() const;
 
     void *fsdata;
 
@@ -165,6 +126,7 @@ private:
     bool pathIsDirectory(const char *path)const;
     int swaplog_fd;
     static EVH CleanEvent;
+    static int HandleCleanEvent();
     /** Verify that the the CacheDir exists
      *
      * If this returns < 0, then Squid exits, complains about swap
@@ -184,8 +146,10 @@ private:
     char const *ioType;
     uint64_t cur_size; ///< currently used space in the storage area
     uint64_t n_disk_objects; ///< total number of objects stored
+    bool rebuilding_; ///< whether RebuildState is writing the new swap.state
 };
 
 } //namespace Ufs
 } //namespace Fs
 #endif /* SQUID_FS_UFS_UFSSWAPDIR_H */
+