]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Named StoreEntry::swap_filen maximum value to avoid magic constants.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 11 Sep 2011 21:44:54 +0000 (15:44 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sun, 11 Sep 2011 21:44:54 +0000 (15:44 -0600)
src/Store.h
src/fs/coss/store_dir_coss.cc
src/fs/rock/RockSwapDir.h

index 068467a288ef5de01adf44869c51eff420c3916f..2e0d9cb9a7e6b780491ed945602e8c05f051762e 100644 (file)
@@ -73,6 +73,9 @@ typedef struct {
 
 extern StoreIoStats store_io_stats;
 
+/// maximum number of entries per cache_dir
+enum { SwapFilenMax = 0xFFFFFF }; // keep in sync with StoreEntry::swap_filen
+
 /**
  \ingroup StoreAPI
  */
@@ -160,7 +163,8 @@ public:
     uint16_t flags;
     /* END OF ON-DISK STORE_META_STD */
 
-    sfileno swap_filen:25;
+    /// unique ID inside a cache_dir for swapped out entries; -1 for others
+    sfileno swap_filen:25; // keep in sync with SwapFilenMax
 
     sdirno swap_dirn:7;
 
index 4e4ad97f6e932d6658dce671033d2b77fa49833c..1f65934fece5a90db5b11d0996f7dedfdfa6d164 100644 (file)
@@ -1023,12 +1023,8 @@ CossSwapDir::parse(int anIndex, char *aPath)
         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.  0xFFFFFF is the
-     * largest possible sfileno, assuming sfileno is a 25-bit
-     * signed integer, as defined in structs.h.
-     */
-    const uint64_t max_offset = (uint64_t) 0xFFFFFF << blksz_bits;
+    // 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");
index 4efb619ef43d91ab2776be9d757d15748d4f7104..08895d513897eba9ec2d4b75c5298c08492ac597 100644 (file)
@@ -33,7 +33,7 @@ public:
     virtual bool doReportStat() const;
     virtual void swappedOut(const StoreEntry &e);
 
-    int64_t entryLimitHigh() const { return 0xFFFFFF; } /// Core sfileno maximum
+    int64_t entryLimitHigh() const { return SwapFilenMax; } ///< Core limit
     int64_t entryLimitAllowed() const;
 
     typedef Ipc::StoreMapWithExtras<DbCellHeader> DirMap;