From: Alex Rousskov Date: Sun, 11 Sep 2011 21:44:54 +0000 (-0600) Subject: Named StoreEntry::swap_filen maximum value to avoid magic constants. X-Git-Tag: take08~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=051dedf92c40f86c448be2bb5dae608563387030;p=thirdparty%2Fsquid.git Named StoreEntry::swap_filen maximum value to avoid magic constants. --- diff --git a/src/Store.h b/src/Store.h index 068467a288..2e0d9cb9a7 100644 --- a/src/Store.h +++ b/src/Store.h @@ -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; diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index 4e4ad97f6e..1f65934fec 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -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< DirMap;