]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Another storeDirClean() fix. Had to write a 'belongs here' function.
authorwessels <>
Thu, 12 Feb 1998 01:48:50 +0000 (01:48 +0000)
committerwessels <>
Thu, 12 Feb 1998 01:48:50 +0000 (01:48 +0000)
src/protos.h
src/store_dir.cc

index b4e7ebc8335a4aed3a78455250a4d2bb37fcd6ed..e1124d2ca0fab0607f9a920215d20e651f82f298 100644 (file)
@@ -503,6 +503,7 @@ extern void storeCreateSwapDirectories(void);
 extern int storeVerifyCacheDirs(void);
 extern int storeDirWriteCleanLogs(int reopen);
 extern int storeDirValidFileno(int fn);
+extern int storeFilenoBelongsHere(int, int, int, int);
 
 
 /*
index c16a21448ea9859ab893a103fea6d7f906078cc7..492f94dcb5716f1b7d82c335f910545da6a98147 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_dir.cc,v 1.52 1998/02/11 03:14:39 wessels Exp $
+ * $Id: store_dir.cc,v 1.53 1998/02/11 18:48:52 wessels Exp $
  *
  * DEBUG: section 47    Store Directory Routines
  * AUTHOR: Duane Wessels
@@ -94,6 +94,33 @@ storeSwapSubSubDir(int fn, char *fullpath)
     return fullpath;
 }
 
+/*
+ * Does swapfile number 'fn' belong in cachedir #F0,
+ * level1 dir #F1, level2 dir #F2?
+ *
+ * This is called by storeDirClean(), but placed here because
+ * the algorithm needs to match storeSwapSubSubDir().
+ */
+int
+storeFilenoBelongsHere(int fn, int F0, int F1, int F2)
+{
+    int D0, D1, D2;
+    int L1, L2;
+    int filn = fn & SWAP_FILE_MASK;
+    D0 = (fn >> SWAP_DIR_SHIFT) % Config.cacheSwap.n_configured;
+    if (F0 != D0)
+       return 0;
+    L1 = Config.cacheSwap.swapDirs[D0].l1;
+    L2 = Config.cacheSwap.swapDirs[D0].l2;
+    D1 = ((filn / L2) / L2) % L1;
+    if (F1 != D1)
+       return 0;
+    D2 = (filn / L2) % L2;
+    if (F2 != D2)
+       return 0;
+    return 1;
+}
+
 static void
 storeCreateDirectory(const char *path, int lvl)
 {