From: hno <> Date: Tue, 9 Jan 2001 21:11:14 +0000 (+0000) Subject: More adjustments of sfileno/sdirno. X-Git-Tag: SQUID_3_0_PRE1~1666 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc986280dcedbdfc0490d4751b486dcc06727cc9;p=thirdparty%2Fsquid.git More adjustments of sfileno/sdirno. * sdirno type changed back to int, as GCC does not like to use char for integer operations (array indexing). * sizes adjusted to swap_filen:25 swap_dirn:7 This limits the cache size to files/cache_dir: 2^24 (16777216) cache_dirs : 2^6-1 (63) * a couple of asserts added to ensure the above limits. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index dab27b16ff..7a15b99f22 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.367 2001/01/07 23:36:37 hno Exp $ + * $Id: cache_cf.cc,v 1.368 2001/01/09 14:11:14 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1070,6 +1070,8 @@ parse_cachedir(cacheSwap * swap) } } + assert(swap->n_configured < 63); /* 7 bits, signed */ + fs = find_fstype(type_str); if (fs < 0) { /* If we get here, we didn't find a matching cache_dir type */ diff --git a/src/filemap.cc b/src/filemap.cc index 9faa9d5624..b547818eb4 100644 --- a/src/filemap.cc +++ b/src/filemap.cc @@ -1,6 +1,6 @@ /* - * $Id: filemap.cc,v 1.36 2000/10/13 08:45:07 wessels Exp $ + * $Id: filemap.cc,v 1.37 2001/01/09 14:11:15 hno Exp $ * * DEBUG: section 8 Swap File Bitmap * AUTHOR: Harvest Derived @@ -75,7 +75,7 @@ file_map_grow(fileMap * fm) int old_sz = fm->nwords * sizeof(*fm->file_map); void *old_map = fm->file_map; fm->max_n_files <<= 1; - assert(fm->max_n_files <= (1 << 30)); + assert(fm->max_n_files <= (1 << 24)); /* swap_filen is 25 bits, signed */ fm->nwords = fm->max_n_files >> LONG_BIT_SHIFT; debug(8, 3) ("file_map_grow: creating space for %d files\n", fm->max_n_files); fm->file_map = xcalloc(fm->nwords, sizeof(*fm->file_map)); diff --git a/src/structs.h b/src/structs.h index 12047626a3..e868acdd44 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.377 2001/01/09 01:43:08 hno Exp $ + * $Id: structs.h,v 1.378 2001/01/09 14:11:15 hno Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -1440,8 +1440,8 @@ struct _StoreEntry { time_t expires; time_t lastmod; size_t swap_file_sz; - sfileno swap_filen:24; - sdirno swap_dirn:8; + sfileno swap_filen:25; + sdirno swap_dirn:7; u_short refcount; u_short flags; u_short lock_count; /* Assume < 65536! */ diff --git a/src/typedefs.h b/src/typedefs.h index 09aa0c2ee0..34c1a08de5 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.118 2001/01/09 01:43:08 hno Exp $ + * $Id: typedefs.h,v 1.119 2001/01/09 14:11:15 hno Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -39,7 +39,7 @@ typedef unsigned int mem_status_t; typedef unsigned int ping_status_t; typedef unsigned int swap_status_t; typedef int sfileno; -typedef char sdirno; +typedef int sdirno; typedef struct { size_t bytes;