]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
More adjustments of sfileno/sdirno.
authorhno <>
Tue, 9 Jan 2001 21:11:14 +0000 (21:11 +0000)
committerhno <>
Tue, 9 Jan 2001 21:11:14 +0000 (21:11 +0000)
* 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.

src/cache_cf.cc
src/filemap.cc
src/structs.h
src/typedefs.h

index dab27b16ffb9dc559cc1425dd4a5d352b5a4aafd..7a15b99f2233fc99b4f5399d56e8e3d46596571d 100644 (file)
@@ -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 */
index 9faa9d56246440b20d8bb39be41cce4a8ffb9a38..b547818eb4c7a692f2de6d9fa6b86e108095d0a8 100644 (file)
@@ -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));
index 12047626a3c2f3619810fc977adee4a1060e7479..e868acdd44519c950bd5372e07d583bfca199521 100644 (file)
@@ -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! */
index 09aa0c2ee041c3f5386476d600f1409269e4d1a2..34c1a08de5c5fce5f09cd9ad982655c3c84676f3 100644 (file)
@@ -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;