]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/store_swapin.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / store_swapin.cc
index 39a4e33f91a95650c58076834ff535b6150e2135..a05d7e3002eeba57e2510611f5931632b2d411ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -31,27 +31,24 @@ storeSwapInStart(store_client * sc)
     if (e->mem_status != NOT_IN_MEMORY)
         debugs(20, 3, HERE << "already IN_MEMORY");
 
-    debugs(20, 3, "storeSwapInStart: called for : " << e->swap_dirn << " " <<
-           std::hex << std::setw(8) << std::setfill('0') << std::uppercase <<
-           e->swap_filen << " " <<  e->getMD5Text());
+    debugs(20, 3, *e << " " <<  e->getMD5Text());
 
-    if (e->swap_status != SWAPOUT_WRITING && e->swap_status != SWAPOUT_DONE) {
-        debugs(20, DBG_IMPORTANT, "storeSwapInStart: bad swap_status (" << swapStatusStr[e->swap_status] << ")");
+    if (!e->hasDisk()) {
+        debugs(20, DBG_IMPORTANT, "BUG: Attempt to swap in a not-stored entry " << *e << ". Salvaged.");
         return;
     }
 
-    if (e->swap_filen < 0) {
-        debugs(20, DBG_IMPORTANT, "storeSwapInStart: swap_filen < 0");
+    if (e->swapoutFailed()) {
+        debugs(20, DBG_IMPORTANT, "BUG: Attempt to swap in a failed-to-store entry " << *e << ". Salvaged.");
         return;
     }
 
     assert(e->mem_obj != NULL);
-    debugs(20, 3, "storeSwapInStart: Opening fileno " << std::hex << std::setw(8) << std::setfill('0') << std::uppercase << e->swap_filen);
     sc->swapin_sio = storeOpen(e, storeSwapInFileNotify, storeSwapInFileClosed, sc);
 }
 
 static void
-storeSwapInFileClosed(void *data, int errflag, StoreIOState::Pointer self)
+storeSwapInFileClosed(void *data, int errflag, StoreIOState::Pointer)
 {
     store_client *sc = (store_client *)data;
     debugs(20, 3, "storeSwapInFileClosed: sio=" << sc->swapin_sio.getRaw() << ", errflag=" << errflag);
@@ -66,7 +63,7 @@ storeSwapInFileClosed(void *data, int errflag, StoreIOState::Pointer self)
 }
 
 static void
-storeSwapInFileNotify(void *data, int errflag, StoreIOState::Pointer self)
+storeSwapInFileNotify(void *data, int, StoreIOState::Pointer)
 {
     store_client *sc = (store_client *)data;
     StoreEntry *e = sc->entry;