--------------------- PatchSet 5212 Date: 2002/10/04 07:07:18 Author: rbcollins Branch: rbcollins_cxxtest Tag: (none) Log: convert store.c Members: include/Array.h:1.6.44.1->1.6.44.2 src/CacheDigest.c:1.5->1.5.10.1 src/HttpHdrCc.c:1.5.96.1->1.5.96.2 src/HttpHdrRange.c:1.7->1.7.44.1 src/HttpHeader.c:1.16.10.1->1.16.10.2 src/Makefile.am:1.29.2.2->1.29.2.3 src/Packer.c:1.4->1.4.96.1 src/StatHist.c:1.5->1.5.44.1 src/Store.h:1.1->1.1.2.1 src/asn.c:1.18->1.18.2.1 src/cache_cf.cc:1.1.2.1->1.1.2.2 src/cache_manager.c:1.7->1.7.84.1 src/carp.c:1.8->1.8.18.1 src/cbdata.c:1.16->1.16.2.1 src/client_db.c:1.7->1.7.2.1 src/client_side.c:1.76.2.1->1.76.2.2 src/client_side_reply.c:1.9.4.1->1.9.4.2 src/comm_kqueue.c:1.3->1.3.6.1 src/comm_poll.c:1.6->1.6.2.1 src/comm_select.c:1.15->1.15.2.1 src/dns_internal.c:1.17->1.17.14.1 src/errorpage.cc:1.1.2.1->1.1.2.2 src/event.c:1.5->1.5.18.1 src/forward.c:1.17->1.17.6.1 src/fqdncache.c:1.17->1.17.6.1 src/ftp.c:1.28->1.28.6.1 src/gopher.c:1.19->1.19.2.1 src/helper.c:1.26->1.26.2.1 src/htcp.c:1.12->1.12.10.1 src/http.cc:1.1.2.1->1.1.2.2 src/icp_v2.c:1.6->1.6.10.1 src/icp_v3.c:1.5->1.5.10.1 src/internal.c:1.9->1.9.18.1 src/ipcache.c:1.19->1.19.6.1 src/main.cc:1.1.2.1->1.1.2.2 src/mem.c:1.21.6.1->1.21.6.2 src/mime.c:1.12->1.12.6.1 src/neighbors.c:1.20->1.20.6.1 src/net_db.c:1.16->1.16.2.1 src/pconn.c:1.7->1.7.18.1 src/peer_digest.c:1.17->1.17.2.1 src/peer_select.c:1.16->1.16.6.1 src/protos.h:1.63.2.2->1.63.2.3 src/redirect.cc:1.1.2.1->1.1.2.2 src/refresh.c:1.8->1.8.14.1 src/repl_modules.sh:1.2->1.2.134.1 src/stat.c:1.19->1.19.2.1 src/store.c:1.19->1.19.2.1(DEAD) src/store.cc:1.1->1.1.2.1 src/store_client.c:1.16->1.16.2.1 src/store_digest.c:1.10->1.10.44.1 src/store_dir.c:1.20->1.20.22.1 src/store_io.c:1.3->1.3.44.1 src/store_log.c:1.7->1.7.44.1 src/store_modules.sh:1.2->1.2.132.1 src/store_rebuild.c:1.9->1.9.44.1 src/store_swapin.c:1.7->1.7.2.1 src/store_swapmeta.c:1.8->1.8.44.1 src/store_swapout.c:1.14->1.14.2.1 src/structs.h:1.70.2.2->1.70.2.3 src/urn.c:1.18->1.18.2.1 src/wais.c:1.9->1.9.6.1 src/whois.c:1.9->1.9.10.1 src/auth/basic/auth_basic.cc:1.1.2.1->1.1.2.2 src/auth/digest/auth_digest.cc:1.1.2.1->1.1.2.2 src/auth/ntlm/auth_ntlm.cc:1.1.2.1->1.1.2.2 src/fs/Makefile.am:1.3->1.3.18.1 src/fs/aufs/async_io.c:1.11->1.11.10.1 src/fs/aufs/store_dir_aufs.c:1.32->1.32.10.1 src/fs/aufs/store_io_aufs.c:1.19->1.19.10.1 src/fs/coss/store_dir_coss.c:1.24->1.24.10.1 src/fs/coss/store_io_coss.c:1.14->1.14.10.1 src/fs/diskd/store_dir_diskd.c:1.42->1.42.10.1 src/fs/diskd/store_io_diskd.c:1.12->1.12.10.1 src/fs/ufs/store_dir_ufs.c:1.31->1.31.6.1 src/fs/ufs/store_io_ufs.c:1.9->1.9.10.1 src/repl/Makefile.am:1.3->1.3.32.1 src/repl/heap/store_heap_replacement.c:1.8->1.8.18.1 src/repl/heap/store_repl_heap.c:1.10->1.10.18.1 src/repl/lru/store_repl_lru.c:1.10->1.10.20.1 Index: squid/include/Array.h =================================================================== RCS file: /cvsroot/squid-sf//squid/include/Array.h,v retrieving revision 1.6.44.1 retrieving revision 1.6.44.2 diff -u -r1.6.44.1 -r1.6.44.2 --- squid/include/Array.h 3 Oct 2002 01:04:32 -0000 1.6.44.1 +++ squid/include/Array.h 4 Oct 2002 07:07:18 -0000 1.6.44.2 @@ -1,5 +1,5 @@ /* - * $Id: Array.h,v 1.6.44.1 2002/10/03 01:04:32 rbcollins Exp $ + * $Id: Array.h,v 1.6.44.2 2002/10/04 07:07:18 rbcollins Exp $ * * AUTHOR: Alex Rousskov * @@ -44,7 +44,7 @@ extern Array *arrayCreate(void); -extern void arrayInit(Array * s); +SQUIDCEXTERN void arrayInit(Array * s); extern void arrayClean(Array * s); extern void arrayDestroy(Array * s); SQUIDCEXTERN void arrayAppend(Array * s, void *obj); Index: squid/src/CacheDigest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/CacheDigest.c,v retrieving revision 1.5 retrieving revision 1.5.10.1 diff -u -r1.5 -r1.5.10.1 --- squid/src/CacheDigest.c 9 Aug 2002 21:46:00 -0000 1.5 +++ squid/src/CacheDigest.c 4 Oct 2002 07:07:19 -0000 1.5.10.1 @@ -1,6 +1,6 @@ /* - * $Id: CacheDigest.c,v 1.5 2002/08/09 21:46:00 squidadm Exp $ + * $Id: CacheDigest.c,v 1.5.10.1 2002/10/04 07:07:19 rbcollins Exp $ * * DEBUG: section 70 Cache Digest * AUTHOR: Alex Rousskov @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #if USE_CACHE_DIGESTS Index: squid/src/HttpHdrCc.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHdrCc.c,v retrieving revision 1.5.96.1 retrieving revision 1.5.96.2 diff -u -r1.5.96.1 -r1.5.96.2 --- squid/src/HttpHdrCc.c 3 Oct 2002 14:33:23 -0000 1.5.96.1 +++ squid/src/HttpHdrCc.c 4 Oct 2002 07:07:19 -0000 1.5.96.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrCc.c,v 1.5.96.1 2002/10/03 14:33:23 rbcollins Exp $ + * $Id: HttpHdrCc.c,v 1.5.96.2 2002/10/04 07:07:19 rbcollins Exp $ * * DEBUG: section 65 HTTP Cache Control Header * AUTHOR: Alex Rousskov @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" /* this table is used for parsing cache control header */ static const HttpHeaderFieldAttrs CcAttrs[CC_ENUM_END] = Index: squid/src/HttpHdrRange.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHdrRange.c,v retrieving revision 1.7 retrieving revision 1.7.44.1 diff -u -r1.7 -r1.7.44.1 --- squid/src/HttpHdrRange.c 24 Oct 2001 09:42:11 -0000 1.7 +++ squid/src/HttpHdrRange.c 4 Oct 2002 07:07:19 -0000 1.7.44.1 @@ -1,6 +1,6 @@ /* - * $Id: HttpHdrRange.c,v 1.7 2001/10/24 09:42:11 squidadm Exp $ + * $Id: HttpHdrRange.c,v 1.7.44.1 2002/10/04 07:07:19 rbcollins Exp $ * * DEBUG: section 64 HTTP Range Header * AUTHOR: Alex Rousskov @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" /* * Currently only byte ranges are supported Index: squid/src/HttpHeader.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/HttpHeader.c,v retrieving revision 1.16.10.1 retrieving revision 1.16.10.2 diff -u -r1.16.10.1 -r1.16.10.2 --- squid/src/HttpHeader.c 3 Oct 2002 14:33:23 -0000 1.16.10.1 +++ squid/src/HttpHeader.c 4 Oct 2002 07:07:19 -0000 1.16.10.2 @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.c,v 1.16.10.1 2002/10/03 14:33:23 rbcollins Exp $ + * $Id: HttpHeader.c,v 1.16.10.2 2002/10/04 07:07:19 rbcollins Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" /* * On naming conventions: Index: squid/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Makefile.am,v retrieving revision 1.29.2.2 retrieving revision 1.29.2.3 diff -u -r1.29.2.2 -r1.29.2.3 --- squid/src/Makefile.am 3 Oct 2002 14:33:23 -0000 1.29.2.2 +++ squid/src/Makefile.am 4 Oct 2002 07:07:19 -0000 1.29.2.3 @@ -201,7 +201,7 @@ StatHist.c \ String.c \ stmem.c \ - store.c \ + store.cc \ store_io.c \ StoreIOBuffer.h \ store_client.c \ Index: squid/src/Packer.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Packer.c,v retrieving revision 1.4 retrieving revision 1.4.96.1 diff -u -r1.4 -r1.4.96.1 --- squid/src/Packer.c 12 Jan 2001 08:20:32 -0000 1.4 +++ squid/src/Packer.c 4 Oct 2002 07:07:19 -0000 1.4.96.1 @@ -1,6 +1,6 @@ /* - * $Id: Packer.c,v 1.4 2001/01/12 08:20:32 hno Exp $ + * $Id: Packer.c,v 1.4.96.1 2002/10/04 07:07:19 rbcollins Exp $ * * DEBUG: section 60 Packer: A uniform interface to store-like modules * AUTHOR: Alex Rousskov @@ -72,6 +72,7 @@ #include "squid.h" +#include "Store.h" /* local types */ Index: squid/src/StatHist.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/StatHist.c,v retrieving revision 1.5 retrieving revision 1.5.44.1 diff -u -r1.5 -r1.5.44.1 --- squid/src/StatHist.c 24 Oct 2001 09:42:11 -0000 1.5 +++ squid/src/StatHist.c 4 Oct 2002 07:07:19 -0000 1.5.44.1 @@ -1,6 +1,6 @@ /* - * $Id: StatHist.c,v 1.5 2001/10/24 09:42:11 squidadm Exp $ + * $Id: StatHist.c,v 1.5.44.1 2002/10/04 07:07:19 rbcollins Exp $ * * DEBUG: section 62 Generic Histogram * AUTHOR: Duane Wessels @@ -46,6 +46,7 @@ */ #include "squid.h" +#include "Store.h" /* Local functions */ static void statHistInit(StatHist * H, int capacity, hbase_f * val_in, hbase_f * val_out, double min, double max); --- /dev/null Wed Feb 14 01:05:20 2007 +++ squid/src/Store.h Wed Feb 14 01:07:17 2007 @@ -0,0 +1,122 @@ + +/* + * $Id: Store.h,v 1.1.2.1 2002/10/04 07:07:19 rbcollins Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#ifndef SQUID_STORE_H +#define SQUID_STORE_H + +struct _StoreEntry { + hash_link hash; /* must be first */ + MemObject *mem_obj; + RemovalPolicyNode repl; + /* START OF ON-DISK STORE_META_STD TLV field */ + time_t timestamp; + time_t lastref; + time_t expires; + time_t lastmod; + size_t swap_file_sz; + u_short refcount; + u_short flags; + /* END OF ON-DISK STORE_META_STD */ + sfileno swap_filen:25; + sdirno swap_dirn:7; + u_short lock_count; /* Assume < 65536! */ + mem_status_t mem_status:3; + ping_status_t ping_status:3; + store_status_t store_status:3; + swap_status_t swap_status:3; +}; + + +SQUIDCEXTERN const char *storeEntryFlags(const StoreEntry *); +SQUIDCEXTERN int storeEntryLocked(const StoreEntry *); + +SQUIDCEXTERN StoreEntry *new_StoreEntry(int, const char *, const char *); +SQUIDCEXTERN StoreEntry *storeGet(const cache_key *); +SQUIDCEXTERN StoreEntry *storeGetPublic(const char *uri, const method_t method); +SQUIDCEXTERN StoreEntry *storeGetPublicByRequest(request_t * request); +SQUIDCEXTERN StoreEntry *storeGetPublicByRequestMethod(request_t * request, const method_t method); +SQUIDCEXTERN StoreEntry *storeCreateEntry(const char *, const char *, request_flags, method_t); +SQUIDCEXTERN void storeSetPublicKey(StoreEntry *); +SQUIDCEXTERN void storeComplete(StoreEntry *); +SQUIDCEXTERN void storeInit(void); +SQUIDCEXTERN void storeAbort(StoreEntry *); +SQUIDCEXTERN void storeAppend(StoreEntry *, const char *, int); +SQUIDCEXTERN void storeLockObject(StoreEntry *); +SQUIDCEXTERN void storeRelease(StoreEntry *); +SQUIDCEXTERN int storeUnlockObject(StoreEntry *); +SQUIDCEXTERN EVH storeMaintainSwapSpace; +SQUIDCEXTERN void storeExpireNow(StoreEntry *); +SQUIDCEXTERN void storeReleaseRequest(StoreEntry *); +SQUIDCEXTERN void storeConfigure(void); +SQUIDCEXTERN int storeCheckNegativeHit(StoreEntry *); +SQUIDCEXTERN void storeNegativeCache(StoreEntry *); +SQUIDCEXTERN void storeFreeMemory(void); +SQUIDCEXTERN int expiresMoreThan(time_t, time_t); +SQUIDCEXTERN int storeEntryValidToSend(StoreEntry *); +SQUIDCEXTERN void storeTimestampsSet(StoreEntry *); +SQUIDCEXTERN void storeRegisterAbort(StoreEntry * e, STABH * cb, void *); +SQUIDCEXTERN void storeUnregisterAbort(StoreEntry * e); +SQUIDCEXTERN void storeMemObjectDump(MemObject * mem); +SQUIDCEXTERN void storeEntryDump(const StoreEntry * e, int debug_lvl); +SQUIDCEXTERN const char *storeUrl(const StoreEntry *); +SQUIDCEXTERN void storeCreateMemObject(StoreEntry *, const char *, const char *); +SQUIDCEXTERN void storeCopyNotModifiedReplyHeaders(MemObject * O, MemObject * N); +SQUIDCEXTERN void storeBuffer(StoreEntry *); +SQUIDCEXTERN void storeBufferFlush(StoreEntry *); +SQUIDCEXTERN void storeHashInsert(StoreEntry * e, const cache_key *); +SQUIDCEXTERN void storeSetMemStatus(StoreEntry * e, int); +#if STDC_HEADERS +SQUIDCEXTERN void +storeAppendPrintf(StoreEntry *, const char *,...) PRINTF_FORMAT_ARG2; +#else +SQUIDCEXTERN void storeAppendPrintf(); +#endif +SQUIDCEXTERN void storeAppendVPrintf(StoreEntry *, const char *, va_list ap); +SQUIDCEXTERN int storeCheckCachable(StoreEntry * e); +SQUIDCEXTERN void storeSetPrivateKey(StoreEntry *); +SQUIDCEXTERN int objectLen(const StoreEntry * e); +SQUIDCEXTERN int contentLen(const StoreEntry * e); +SQUIDCEXTERN HttpReply *storeEntryReply(StoreEntry *); +SQUIDCEXTERN int storeTooManyDiskFilesOpen(void); +SQUIDCEXTERN void storeEntryReset(StoreEntry *); +SQUIDCEXTERN void storeHeapPositionUpdate(StoreEntry *, SwapDir *); +SQUIDCEXTERN void storeSwapFileNumberSet(StoreEntry * e, sfileno filn); +SQUIDCEXTERN void storeFsInit(void); +SQUIDCEXTERN void storeFsDone(void); +SQUIDCEXTERN void storeFsAdd(const char *, STSETUP *); +SQUIDCEXTERN void storeReplAdd(const char *, REMOVALPOLICYCREATE *); + +/* store_modules.c */ +SQUIDCEXTERN void storeFsSetup(void); + +#endif /* SQUID_STORE_H */ Index: squid/src/asn.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/asn.c,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -u -r1.18 -r1.18.2.1 --- squid/src/asn.c 24 Sep 2002 10:59:13 -0000 1.18 +++ squid/src/asn.c 4 Oct 2002 07:07:19 -0000 1.18.2.1 @@ -1,6 +1,6 @@ /* - * $Id: asn.c,v 1.18 2002/09/24 10:59:13 rbcollins Exp $ + * $Id: asn.c,v 1.18.2.1 2002/10/04 07:07:19 rbcollins Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -36,6 +36,7 @@ #include "squid.h" #include "radix.h" #include "StoreClient.h" +#include "Store.h" #define WHOIS_PORT 43 #define AS_REQBUF_SZ 4096 Index: squid/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/cache_cf.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/cache_cf.cc 3 Oct 2002 01:04:33 -0000 1.1.2.1 +++ squid/src/cache_cf.cc 4 Oct 2002 07:07:19 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.1.2.1 2002/10/03 01:04:33 rbcollins Exp $ + * $Id: cache_cf.cc,v 1.1.2.2 2002/10/04 07:07:19 rbcollins Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -35,6 +35,7 @@ #include "squid.h" #include "authenticate.h" +#include "Store.h" #if SQUID_SNMP #include "snmp.h" Index: squid/src/cache_manager.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_manager.c,v retrieving revision 1.7 retrieving revision 1.7.84.1 diff -u -r1.7 -r1.7.84.1 --- squid/src/cache_manager.c 23 Feb 2001 21:03:30 -0000 1.7 +++ squid/src/cache_manager.c 4 Oct 2002 07:07:20 -0000 1.7.84.1 @@ -1,6 +1,6 @@ /* - * $Id: cache_manager.c,v 1.7 2001/02/23 21:03:30 hno Exp $ + * $Id: cache_manager.c,v 1.7.84.1 2002/10/04 07:07:20 rbcollins Exp $ * * DEBUG: section 16 Cache Manager Objects * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #define MGR_PASSWD_SZ 128 Index: squid/src/carp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/carp.c,v retrieving revision 1.8 retrieving revision 1.8.18.1 diff -u -r1.8 -r1.8.18.1 --- squid/src/carp.c 13 Apr 2002 23:09:15 -0000 1.8 +++ squid/src/carp.c 4 Oct 2002 07:07:20 -0000 1.8.18.1 @@ -1,6 +1,6 @@ /* - * $Id: carp.c,v 1.8 2002/04/13 23:09:15 squidadm Exp $ + * $Id: carp.c,v 1.8.18.1 2002/10/04 07:07:20 rbcollins Exp $ * * DEBUG: section 39 Cache Array Routing Protocol * AUTHOR: Henrik Nordstrom @@ -35,6 +35,7 @@ */ #include "squid.h" +#include "Store.h" #if USE_CARP Index: squid/src/cbdata.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cbdata.c,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -u -r1.16 -r1.16.2.1 --- squid/src/cbdata.c 24 Sep 2002 10:59:13 -0000 1.16 +++ squid/src/cbdata.c 4 Oct 2002 07:07:20 -0000 1.16.2.1 @@ -1,6 +1,6 @@ /* - * $Id: cbdata.c,v 1.16 2002/09/24 10:59:13 rbcollins Exp $ + * $Id: cbdata.c,v 1.16.2.1 2002/10/04 07:07:20 rbcollins Exp $ * * DEBUG: section 45 Callback Data Registry * ORIGINAL AUTHOR: Duane Wessels @@ -45,6 +45,7 @@ */ #include "squid.h" +#include "Store.h" static int cbdataCount = 0; #if CBDATA_DEBUG Index: squid/src/client_db.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_db.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -r1.7 -r1.7.2.1 --- squid/src/client_db.c 24 Sep 2002 10:59:14 -0000 1.7 +++ squid/src/client_db.c 4 Oct 2002 07:07:21 -0000 1.7.2.1 @@ -1,6 +1,6 @@ /* - * $Id: client_db.c,v 1.7 2002/09/24 10:59:14 rbcollins Exp $ + * $Id: client_db.c,v 1.7.2.1 2002/10/04 07:07:21 rbcollins Exp $ * * DEBUG: section 0 Client Database * AUTHOR: Duane Wessels @@ -34,6 +34,8 @@ */ #include "squid.h" +#include "Store.h" + static hash_table *client_table = NULL; static ClientInfo *clientdbAdd(struct in_addr addr); Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.76.2.1 retrieving revision 1.76.2.2 diff -u -r1.76.2.1 -r1.76.2.2 --- squid/src/client_side.c 3 Oct 2002 01:04:34 -0000 1.76.2.1 +++ squid/src/client_side.c 4 Oct 2002 07:07:21 -0000 1.76.2.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.76.2.1 2002/10/03 01:04:34 rbcollins Exp $ + * $Id: client_side.c,v 1.76.2.2 2002/10/04 07:07:21 rbcollins Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -59,6 +59,8 @@ #include "clientStream.h" #include "IPInterception.h" #include "authenticate.h" +#include "Store.h" + #if LINGERING_CLOSE #define comm_close comm_lingering_close Index: squid/src/client_side_reply.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client_side_reply.c,v retrieving revision 1.9.4.1 retrieving revision 1.9.4.2 diff -u -r1.9.4.1 -r1.9.4.2 --- squid/src/client_side_reply.c 3 Oct 2002 01:04:34 -0000 1.9.4.1 +++ squid/src/client_side_reply.c 4 Oct 2002 07:07:23 -0000 1.9.4.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.c,v 1.9.4.1 2002/10/03 01:04:34 rbcollins Exp $ + * $Id: client_side_reply.c,v 1.9.4.2 2002/10/04 07:07:23 rbcollins Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -35,6 +35,8 @@ #include "squid.h" #include "StoreClient.h" +#include "Store.h" + #include "clientStream.h" #include "authenticate.h" Index: squid/src/comm_kqueue.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/comm_kqueue.c,v retrieving revision 1.3 retrieving revision 1.3.6.1 diff -u -r1.3 -r1.3.6.1 --- squid/src/comm_kqueue.c 15 Sep 2002 11:06:31 -0000 1.3 +++ squid/src/comm_kqueue.c 4 Oct 2002 07:07:24 -0000 1.3.6.1 @@ -54,6 +54,7 @@ */ #include "squid.h" +#include "Store.h" #ifdef USE_KQUEUE Index: squid/src/comm_poll.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/comm_poll.c,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -r1.6 -r1.6.2.1 --- squid/src/comm_poll.c 2 Oct 2002 11:10:46 -0000 1.6 +++ squid/src/comm_poll.c 4 Oct 2002 07:07:24 -0000 1.6.2.1 @@ -33,6 +33,7 @@ */ #include "squid.h" +#include "Store.h" #ifdef USE_POLL Index: squid/src/comm_select.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/comm_select.c,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -r1.15 -r1.15.2.1 --- squid/src/comm_select.c 2 Oct 2002 11:10:46 -0000 1.15 +++ squid/src/comm_select.c 4 Oct 2002 07:07:24 -0000 1.15.2.1 @@ -1,6 +1,6 @@ /* - * $Id: comm_select.c,v 1.15 2002/10/02 11:10:46 squidadm Exp $ + * $Id: comm_select.c,v 1.15.2.1 2002/10/04 07:07:24 rbcollins Exp $ * * DEBUG: section 5 Socket Functions * @@ -33,6 +33,7 @@ */ #include "squid.h" +#include "Store.h" #ifdef USE_SELECT Index: squid/src/dns_internal.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/dns_internal.c,v retrieving revision 1.17 retrieving revision 1.17.14.1 diff -u -r1.17 -r1.17.14.1 --- squid/src/dns_internal.c 26 Jun 2002 17:28:32 -0000 1.17 +++ squid/src/dns_internal.c 4 Oct 2002 07:07:24 -0000 1.17.14.1 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.c,v 1.17 2002/06/26 17:28:32 squidadm Exp $ + * $Id: dns_internal.c,v 1.17.14.1 2002/10/04 07:07:24 rbcollins Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) #include Index: squid/src/errorpage.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/errorpage.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/errorpage.cc 3 Oct 2002 01:04:35 -0000 1.1.2.1 +++ squid/src/errorpage.cc 4 Oct 2002 07:07:25 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.1.2.1 2002/10/03 01:04:35 rbcollins Exp $ + * $Id: errorpage.cc,v 1.1.2.2 2002/10/04 07:07:25 rbcollins Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -42,6 +42,7 @@ #include "squid.h" #include "authenticate.h" +#include "Store.h" /* local types */ Index: squid/src/event.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/event.c,v retrieving revision 1.5 retrieving revision 1.5.18.1 diff -u -r1.5 -r1.5.18.1 --- squid/src/event.c 13 Apr 2002 23:09:17 -0000 1.5 +++ squid/src/event.c 4 Oct 2002 07:07:25 -0000 1.5.18.1 @@ -1,6 +1,6 @@ /* - * $Id: event.c,v 1.5 2002/04/13 23:09:17 squidadm Exp $ + * $Id: event.c,v 1.5.18.1 2002/10/04 07:07:25 rbcollins Exp $ * * DEBUG: section 41 Event Processing * AUTHOR: Henrik Nordstrom @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" /* The list of event processes */ struct ev_entry { Index: squid/src/forward.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/forward.c,v retrieving revision 1.17 retrieving revision 1.17.6.1 diff -u -r1.17 -r1.17.6.1 --- squid/src/forward.c 15 Sep 2002 11:06:32 -0000 1.17 +++ squid/src/forward.c 4 Oct 2002 07:07:25 -0000 1.17.6.1 @@ -1,6 +1,6 @@ /* - * $Id: forward.c,v 1.17 2002/09/15 11:06:32 rbcollins Exp $ + * $Id: forward.c,v 1.17.6.1 2002/10/04 07:07:25 rbcollins Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -35,6 +35,8 @@ #include "squid.h" +#include "Store.h" + static PSC fwdStartComplete; static void fwdDispatch(FwdState *); Index: squid/src/fqdncache.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fqdncache.c,v retrieving revision 1.17 retrieving revision 1.17.6.1 diff -u -r1.17 -r1.17.6.1 --- squid/src/fqdncache.c 15 Sep 2002 11:06:32 -0000 1.17 +++ squid/src/fqdncache.c 4 Oct 2002 07:07:25 -0000 1.17.6.1 @@ -1,6 +1,6 @@ /* - * $Id: fqdncache.c,v 1.17 2002/09/15 11:06:32 rbcollins Exp $ + * $Id: fqdncache.c,v 1.17.6.1 2002/10/04 07:07:25 rbcollins Exp $ * * DEBUG: section 35 FQDN Cache * AUTHOR: Harvest Derived @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #define FQDN_LOW_WATER 90 #define FQDN_HIGH_WATER 95 Index: squid/src/ftp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ftp.c,v retrieving revision 1.28 retrieving revision 1.28.6.1 diff -u -r1.28 -r1.28.6.1 --- squid/src/ftp.c 15 Sep 2002 11:06:32 -0000 1.28 +++ squid/src/ftp.c 4 Oct 2002 07:07:25 -0000 1.28.6.1 @@ -1,6 +1,6 @@ /* - * $Id: ftp.c,v 1.28 2002/09/15 11:06:32 rbcollins Exp $ + * $Id: ftp.c,v 1.28.6.1 2002/10/04 07:07:25 rbcollins Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -34,6 +34,8 @@ */ #include "squid.h" +#include "Store.h" + static const char *const crlf = "\r\n"; static char cbuf[1024]; Index: squid/src/gopher.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/gopher.c,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -u -r1.19 -r1.19.2.1 --- squid/src/gopher.c 24 Sep 2002 10:59:15 -0000 1.19 +++ squid/src/gopher.c 4 Oct 2002 07:07:25 -0000 1.19.2.1 @@ -1,6 +1,6 @@ /* - * $Id: gopher.c,v 1.19 2002/09/24 10:59:15 rbcollins Exp $ + * $Id: gopher.c,v 1.19.2.1 2002/10/04 07:07:25 rbcollins Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" /* gopher type code from rfc. Anawat. */ #define GOPHER_FILE '0' Index: squid/src/helper.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/helper.c,v retrieving revision 1.26 retrieving revision 1.26.2.1 diff -u -r1.26 -r1.26.2.1 --- squid/src/helper.c 29 Sep 2002 12:39:30 -0000 1.26 +++ squid/src/helper.c 4 Oct 2002 07:07:25 -0000 1.26.2.1 @@ -1,6 +1,6 @@ /* - * $Id: helper.c,v 1.26 2002/09/29 12:39:30 rbcollins Exp $ + * $Id: helper.c,v 1.26.2.1 2002/10/04 07:07:25 rbcollins Exp $ * * DEBUG: section 84 Helper process maintenance * AUTHOR: Harvest Derived? @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #define HELPER_MAX_ARGS 64 Index: squid/src/htcp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/htcp.c,v retrieving revision 1.12 retrieving revision 1.12.10.1 diff -u -r1.12 -r1.12.10.1 --- squid/src/htcp.c 9 Aug 2002 21:46:02 -0000 1.12 +++ squid/src/htcp.c 4 Oct 2002 07:07:26 -0000 1.12.10.1 @@ -1,6 +1,6 @@ /* - * $Id: htcp.c,v 1.12 2002/08/09 21:46:02 squidadm Exp $ + * $Id: htcp.c,v 1.12.10.1 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 31 Hypertext Caching Protocol * AUTHOR: Duane Wesssels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" typedef struct _Countstr Countstr; typedef struct _htcpHeader htcpHeader; Index: squid/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/http.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/http.cc 3 Oct 2002 01:04:35 -0000 1.1.2.1 +++ squid/src/http.cc 4 Oct 2002 07:07:26 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.1.2.1 2002/10/03 01:04:35 rbcollins Exp $ + * $Id: http.cc,v 1.1.2.2 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -40,6 +40,8 @@ #include "squid.h" #include "authenticate.h" +#include "Store.h" + static const char *const crlf = "\r\n"; Index: squid/src/icp_v2.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/icp_v2.c,v retrieving revision 1.6 retrieving revision 1.6.10.1 diff -u -r1.6 -r1.6.10.1 --- squid/src/icp_v2.c 9 Aug 2002 21:46:02 -0000 1.6 +++ squid/src/icp_v2.c 4 Oct 2002 07:07:26 -0000 1.6.10.1 @@ -1,6 +1,6 @@ /* - * $Id: icp_v2.c,v 1.6 2002/08/09 21:46:02 squidadm Exp $ + * $Id: icp_v2.c,v 1.6.10.1 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" static void icpLogIcp(struct in_addr, log_type, int, const char *, int); static void icpHandleIcpV2(int, struct sockaddr_in, char *, int); Index: squid/src/icp_v3.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/icp_v3.c,v retrieving revision 1.5 retrieving revision 1.5.10.1 diff -u -r1.5 -r1.5.10.1 --- squid/src/icp_v3.c 9 Aug 2002 21:46:02 -0000 1.5 +++ squid/src/icp_v3.c 4 Oct 2002 07:07:26 -0000 1.5.10.1 @@ -1,6 +1,6 @@ /* - * $Id: icp_v3.c,v 1.5 2002/08/09 21:46:02 squidadm Exp $ + * $Id: icp_v3.c,v 1.5.10.1 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" /* Currently Harvest cached-2.x uses ICP_VERSION_3 */ void Index: squid/src/internal.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/internal.c,v retrieving revision 1.9 retrieving revision 1.9.18.1 diff -u -r1.9 -r1.9.18.1 --- squid/src/internal.c 11 Apr 2002 22:30:30 -0000 1.9 +++ squid/src/internal.c 4 Oct 2002 07:07:26 -0000 1.9.18.1 @@ -1,6 +1,6 @@ /* - * $Id: internal.c,v 1.9 2002/04/11 22:30:30 squidadm Exp $ + * $Id: internal.c,v 1.9.18.1 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 76 Internal Squid Object handling * AUTHOR: Duane, Alex, Henrik @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" /* called when we "miss" on an internal object; * generate known dynamic objects, Index: squid/src/ipcache.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ipcache.c,v retrieving revision 1.19 retrieving revision 1.19.6.1 diff -u -r1.19 -r1.19.6.1 --- squid/src/ipcache.c 15 Sep 2002 11:06:33 -0000 1.19 +++ squid/src/ipcache.c 4 Oct 2002 07:07:26 -0000 1.19.6.1 @@ -1,6 +1,6 @@ /* - * $Id: ipcache.c,v 1.19 2002/09/15 11:06:33 rbcollins Exp $ + * $Id: ipcache.c,v 1.19.6.1 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" typedef struct _ipcache_entry ipcache_entry; Index: squid/src/main.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/main.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/main.cc 3 Oct 2002 01:04:35 -0000 1.1.2.1 +++ squid/src/main.cc 4 Oct 2002 07:07:26 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.1.2.1 2002/10/03 01:04:35 rbcollins Exp $ + * $Id: main.cc,v 1.1.2.2 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -35,6 +35,7 @@ #include "squid.h" #include "authenticate.h" +#include "Store.h" /* for error reporting from xmalloc and friends */ extern void (*failure_notify) (const char *); Index: squid/src/mem.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mem.c,v retrieving revision 1.21.6.1 retrieving revision 1.21.6.2 diff -u -r1.21.6.1 -r1.21.6.2 --- squid/src/mem.c 3 Oct 2002 01:04:35 -0000 1.21.6.1 +++ squid/src/mem.c 4 Oct 2002 07:07:26 -0000 1.21.6.2 @@ -1,6 +1,6 @@ /* - * $Id: mem.c,v 1.21.6.1 2002/10/03 01:04:35 rbcollins Exp $ + * $Id: mem.c,v 1.21.6.2 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -35,6 +35,7 @@ #include "squid.h" #include "memMeter.h" +#include "Store.h" /* module globals */ Index: squid/src/mime.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mime.c,v retrieving revision 1.12 retrieving revision 1.12.6.1 diff -u -r1.12 -r1.12.6.1 --- squid/src/mime.c 1 Sep 2002 16:30:42 -0000 1.12 +++ squid/src/mime.c 4 Oct 2002 07:07:26 -0000 1.12.6.1 @@ -1,6 +1,6 @@ /* - * $Id: mime.c,v 1.12 2002/09/01 16:30:42 squidadm Exp $ + * $Id: mime.c,v 1.12.6.1 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #define GET_HDR_SZ 1024 Index: squid/src/neighbors.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/neighbors.c,v retrieving revision 1.20 retrieving revision 1.20.6.1 diff -u -r1.20 -r1.20.6.1 --- squid/src/neighbors.c 15 Sep 2002 11:06:33 -0000 1.20 +++ squid/src/neighbors.c 4 Oct 2002 07:07:26 -0000 1.20.6.1 @@ -1,6 +1,6 @@ /* - * $Id: neighbors.c,v 1.20 2002/09/15 11:06:33 rbcollins Exp $ + * $Id: neighbors.c,v 1.20.6.1 2002/10/04 07:07:26 rbcollins Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" /* count mcast group peers every 15 minutes */ #define MCAST_COUNT_RATE 900 Index: squid/src/net_db.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/net_db.c,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -u -r1.16 -r1.16.2.1 --- squid/src/net_db.c 25 Sep 2002 22:25:13 -0000 1.16 +++ squid/src/net_db.c 4 Oct 2002 07:07:27 -0000 1.16.2.1 @@ -1,6 +1,6 @@ /* - * $Id: net_db.c,v 1.16 2002/09/25 22:25:13 rbcollins Exp $ + * $Id: net_db.c,v 1.16.2.1 2002/10/04 07:07:27 rbcollins Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -42,6 +42,8 @@ */ #include "squid.h" +#include "Store.h" + #if USE_ICMP #include "StoreClient.h" Index: squid/src/pconn.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/pconn.c,v retrieving revision 1.7 retrieving revision 1.7.18.1 diff -u -r1.7 -r1.7.18.1 --- squid/src/pconn.c 13 Apr 2002 23:09:17 -0000 1.7 +++ squid/src/pconn.c 4 Oct 2002 07:07:27 -0000 1.7.18.1 @@ -1,6 +1,6 @@ /* - * $Id: pconn.c,v 1.7 2002/04/13 23:09:17 squidadm Exp $ + * $Id: pconn.c,v 1.7.18.1 2002/10/04 07:07:27 rbcollins Exp $ * * DEBUG: section 48 Persistent Connections * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" struct _pconn { hash_link hash; /* must be first */ Index: squid/src/peer_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/peer_digest.c,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -u -r1.17 -r1.17.2.1 --- squid/src/peer_digest.c 29 Sep 2002 12:39:30 -0000 1.17 +++ squid/src/peer_digest.c 4 Oct 2002 07:07:27 -0000 1.17.2.1 @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.c,v 1.17 2002/09/29 12:39:30 rbcollins Exp $ + * $Id: peer_digest.c,v 1.17.2.1 2002/10/04 07:07:27 rbcollins Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #if USE_CACHE_DIGESTS Index: squid/src/peer_select.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/peer_select.c,v retrieving revision 1.16 retrieving revision 1.16.6.1 diff -u -r1.16 -r1.16.6.1 --- squid/src/peer_select.c 15 Sep 2002 11:06:33 -0000 1.16 +++ squid/src/peer_select.c 4 Oct 2002 07:07:27 -0000 1.16.6.1 @@ -1,6 +1,6 @@ /* - * $Id: peer_select.c,v 1.16 2002/09/15 11:06:33 rbcollins Exp $ + * $Id: peer_select.c,v 1.16.6.1 2002/10/04 07:07:27 rbcollins Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" const char *hier_strings[] = { Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.63.2.2 retrieving revision 1.63.2.3 diff -u -r1.63.2.2 -r1.63.2.3 --- squid/src/protos.h 3 Oct 2002 14:33:24 -0000 1.63.2.2 +++ squid/src/protos.h 4 Oct 2002 07:07:27 -0000 1.63.2.3 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.63.2.2 2002/10/03 14:33:24 rbcollins Exp $ + * $Id: protos.h,v 1.63.2.3 2002/10/04 07:07:27 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -770,13 +770,10 @@ SQUIDCEXTERN void pconnHistCount(int, int); SQUIDCEXTERN int stat5minClientRequests(void); SQUIDCEXTERN double stat5minCPUUsage(void); -SQUIDCEXTERN const char *storeEntryFlags(const StoreEntry *); SQUIDCEXTERN double statRequestHitRatio(int minutes); SQUIDCEXTERN double statRequestHitMemoryRatio(int minutes); SQUIDCEXTERN double statRequestHitDiskRatio(int minutes); SQUIDCEXTERN double statByteHitRatio(int minutes); -SQUIDCEXTERN int storeEntryLocked(const StoreEntry *); - /* StatHist */ SQUIDCEXTERN void statHistClean(StatHist * H); @@ -840,65 +837,6 @@ /* ----------------------------------------------------------------- */ -/* - * store.c - */ -SQUIDCEXTERN StoreEntry *new_StoreEntry(int, const char *, const char *); -SQUIDCEXTERN StoreEntry *storeGet(const cache_key *); -SQUIDCEXTERN StoreEntry *storeGetPublic(const char *uri, const method_t method); -SQUIDCEXTERN StoreEntry *storeGetPublicByRequest(request_t * request); -SQUIDCEXTERN StoreEntry *storeGetPublicByRequestMethod(request_t * request, const method_t method); -SQUIDCEXTERN StoreEntry *storeCreateEntry(const char *, const char *, request_flags, method_t); -SQUIDCEXTERN void storeSetPublicKey(StoreEntry *); -SQUIDCEXTERN void storeComplete(StoreEntry *); -SQUIDCEXTERN void storeInit(void); -SQUIDCEXTERN void storeAbort(StoreEntry *); -SQUIDCEXTERN void storeAppend(StoreEntry *, const char *, int); -SQUIDCEXTERN void storeLockObject(StoreEntry *); -SQUIDCEXTERN void storeRelease(StoreEntry *); -SQUIDCEXTERN int storeUnlockObject(StoreEntry *); -SQUIDCEXTERN EVH storeMaintainSwapSpace; -SQUIDCEXTERN void storeExpireNow(StoreEntry *); -SQUIDCEXTERN void storeReleaseRequest(StoreEntry *); -SQUIDCEXTERN void storeConfigure(void); -SQUIDCEXTERN int storeCheckNegativeHit(StoreEntry *); -SQUIDCEXTERN void storeNegativeCache(StoreEntry *); -SQUIDCEXTERN void storeFreeMemory(void); -SQUIDCEXTERN int expiresMoreThan(time_t, time_t); -SQUIDCEXTERN int storeEntryValidToSend(StoreEntry *); -SQUIDCEXTERN void storeTimestampsSet(StoreEntry *); -SQUIDCEXTERN void storeRegisterAbort(StoreEntry * e, STABH * cb, void *); -SQUIDCEXTERN void storeUnregisterAbort(StoreEntry * e); -SQUIDCEXTERN void storeMemObjectDump(MemObject * mem); -SQUIDCEXTERN void storeEntryDump(const StoreEntry * e, int debug_lvl); -SQUIDCEXTERN const char *storeUrl(const StoreEntry *); -SQUIDCEXTERN void storeCreateMemObject(StoreEntry *, const char *, const char *); -SQUIDCEXTERN void storeCopyNotModifiedReplyHeaders(MemObject * O, MemObject * N); -SQUIDCEXTERN void storeBuffer(StoreEntry *); -SQUIDCEXTERN void storeBufferFlush(StoreEntry *); -SQUIDCEXTERN void storeHashInsert(StoreEntry * e, const cache_key *); -SQUIDCEXTERN void storeSetMemStatus(StoreEntry * e, int); -#if STDC_HEADERS -SQUIDCEXTERN void -storeAppendPrintf(StoreEntry *, const char *,...) PRINTF_FORMAT_ARG2; -#else -SQUIDCEXTERN void storeAppendPrintf(); -#endif -SQUIDCEXTERN void storeAppendVPrintf(StoreEntry *, const char *, va_list ap); -SQUIDCEXTERN int storeCheckCachable(StoreEntry * e); -SQUIDCEXTERN void storeSetPrivateKey(StoreEntry *); -SQUIDCEXTERN int objectLen(const StoreEntry * e); -SQUIDCEXTERN int contentLen(const StoreEntry * e); -SQUIDCEXTERN HttpReply *storeEntryReply(StoreEntry *); -SQUIDCEXTERN int storeTooManyDiskFilesOpen(void); -SQUIDCEXTERN void storeEntryReset(StoreEntry *); -SQUIDCEXTERN void storeHeapPositionUpdate(StoreEntry *, SwapDir *); -SQUIDCEXTERN void storeSwapFileNumberSet(StoreEntry * e, sfileno filn); -SQUIDCEXTERN void storeFsInit(void); -SQUIDCEXTERN void storeFsDone(void); -SQUIDCEXTERN void storeFsAdd(const char *, STSETUP *); -SQUIDCEXTERN void storeReplAdd(const char *, REMOVALPOLICYCREATE *); - /* store_modules.c */ SQUIDCEXTERN void storeFsSetup(void); Index: squid/src/redirect.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/redirect.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/redirect.cc 3 Oct 2002 01:04:36 -0000 1.1.2.1 +++ squid/src/redirect.cc 4 Oct 2002 07:07:27 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: redirect.cc,v 1.1.2.1 2002/10/03 01:04:36 rbcollins Exp $ + * $Id: redirect.cc,v 1.1.2.2 2002/10/04 07:07:27 rbcollins Exp $ * * DEBUG: section 61 Redirector * AUTHOR: Duane Wessels @@ -35,6 +35,7 @@ #include "squid.h" #include "authenticate.h" +#include "Store.h" typedef struct { void *data; Index: squid/src/refresh.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/refresh.c,v retrieving revision 1.8 retrieving revision 1.8.14.1 diff -u -r1.8 -r1.8.14.1 --- squid/src/refresh.c 16 Jun 2002 08:50:41 -0000 1.8 +++ squid/src/refresh.c 4 Oct 2002 07:07:27 -0000 1.8.14.1 @@ -1,6 +1,6 @@ /* - * $Id: refresh.c,v 1.8 2002/06/16 08:50:41 squidadm Exp $ + * $Id: refresh.c,v 1.8.14.1 2002/10/04 07:07:27 rbcollins Exp $ * * DEBUG: section 22 Refresh Calculation * AUTHOR: Harvest Derived @@ -38,6 +38,7 @@ #endif #include "squid.h" +#include "Store.h" typedef enum { rcHTTP, Index: squid/src/repl_modules.sh =================================================================== RCS file: /cvsroot/squid-sf//squid/src/repl_modules.sh,v retrieving revision 1.2 retrieving revision 1.2.134.1 diff -u -r1.2 -r1.2.134.1 --- squid/src/repl_modules.sh 21 Oct 2000 15:16:13 -0000 1.2 +++ squid/src/repl_modules.sh 4 Oct 2002 07:07:28 -0000 1.2.134.1 @@ -3,6 +3,7 @@ echo " * do not edit" echo " */" echo "#include \"squid.h\"" +echo "#include \"Store.h\"" echo "" for module in "$@"; do echo "extern REMOVALPOLICYCREATE createRemovalPolicy_${module};" Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stat.c,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -u -r1.19 -r1.19.2.1 --- squid/src/stat.c 24 Sep 2002 10:59:16 -0000 1.19 +++ squid/src/stat.c 4 Oct 2002 07:07:28 -0000 1.19.2.1 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.19 2002/09/24 10:59:16 rbcollins Exp $ + * $Id: stat.c,v 1.19.2.1 2002/10/04 07:07:28 rbcollins Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -35,6 +35,7 @@ #include "squid.h" #include "StoreClient.h" +#include "Store.h" #define DEBUG_OPENFD 1 --- squid/src/store.c Wed Feb 14 01:07:18 2007 +++ /dev/null Wed Feb 14 01:05:20 2007 @@ -1,1413 +0,0 @@ - -/* - * $Id: store.c,v 1.19 2002/10/02 11:10:47 squidadm Exp $ - * - * DEBUG: section 20 Storage Manager - * AUTHOR: Harvest Derived - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#include "squid.h" - -#define REBUILD_TIMESTAMP_DELTA_MAX 2 - -#define STORE_IN_MEM_BUCKETS (229) - -const char *memStatusStr[] = -{ - "NOT_IN_MEMORY", - "IN_MEMORY" -}; - -const char *pingStatusStr[] = -{ - "PING_NONE", - "PING_WAITING", - "PING_DONE" -}; - -const char *storeStatusStr[] = -{ - "STORE_OK", - "STORE_PENDING" -}; - -const char *swapStatusStr[] = -{ - "SWAPOUT_NONE", - "SWAPOUT_WRITING", - "SWAPOUT_DONE" -}; - -typedef struct lock_ctrl_t { - SIH *callback; - void *callback_data; - StoreEntry *e; -} lock_ctrl_t; - -extern OBJH storeIOStats; - -/* - * local function prototypes - */ -static int storeEntryValidLength(const StoreEntry *); -static void storeGetMemSpace(int); -static void storeHashDelete(StoreEntry *); -static MemObject *new_MemObject(const char *, const char *); -static void destroy_MemObject(StoreEntry *); -static FREE destroy_StoreEntry; -static void storePurgeMem(StoreEntry *); -static void storeEntryReferenced(StoreEntry *); -static void storeEntryDereferenced(StoreEntry *); -static int getKeyCounter(void); -static int storeKeepInMemory(const StoreEntry *); -static OBJH storeCheckCachableStats; -static EVH storeLateRelease; - -/* - * local variables - */ -static Stack LateReleaseStack; - -#if URL_CHECKSUM_DEBUG -unsigned int -url_checksum(const char *url) -{ - unsigned int ck; - MD5_CTX M; - static unsigned char digest[16]; - MD5Init(&M); - MD5Update(&M, (unsigned char *) url, strlen(url)); - MD5Final(digest, &M); - xmemcpy(&ck, digest, sizeof(ck)); - return ck; -} -#endif - -static MemObject * -new_MemObject(const char *url, const char *log_url) -{ - MemObject *mem = memAllocate(MEM_MEMOBJECT); - mem->reply = httpReplyCreate(); - mem->url = xstrdup(url); -#if URL_CHECKSUM_DEBUG - mem->chksum = url_checksum(mem->url); -#endif - mem->log_url = xstrdup(log_url); - mem->object_sz = -1; - mem->fd = -1; - /* XXX account log_url */ - debug(20, 3) ("new_MemObject: returning %p\n", mem); - return mem; -} - -StoreEntry * -new_StoreEntry(int mem_obj_flag, const char *url, const char *log_url) -{ - StoreEntry *e = NULL; - e = memAllocate(MEM_STOREENTRY); - if (mem_obj_flag) - e->mem_obj = new_MemObject(url, log_url); - debug(20, 3) ("new_StoreEntry: returning %p\n", e); - e->expires = e->lastmod = e->lastref = e->timestamp = -1; - e->swap_filen = -1; - e->swap_dirn = -1; - return e; -} - -static void -destroy_MemObject(StoreEntry * e) -{ - MemObject *mem = e->mem_obj; - const Ctx ctx = ctx_enter(mem->url); - debug(20, 3) ("destroy_MemObject: destroying %p\n", mem); -#if URL_CHECKSUM_DEBUG - assert(mem->chksum == url_checksum(mem->url)); -#endif - e->mem_obj = NULL; - if (!shutting_down) - assert(mem->swapout.sio == NULL); - stmemFree(&mem->data_hdr); - mem->inmem_hi = 0; - /* - * There is no way to abort FD-less clients, so they might - * still have mem->clients set if mem->fd == -1 - */ - assert(mem->fd == -1 || mem->clients.head == NULL); - httpReplyDestroy(mem->reply); - requestUnlink(mem->request); - mem->request = NULL; - ctx_exit(ctx); /* must exit before we free mem->url */ - safe_free(mem->url); - safe_free(mem->log_url); /* XXX account log_url */ - safe_free(mem->vary_headers); - memFree(mem, MEM_MEMOBJECT); -} - -static void -destroy_StoreEntry(void *data) -{ - StoreEntry *e = data; - debug(20, 3) ("destroy_StoreEntry: destroying %p\n", e); - assert(e != NULL); - if (e->mem_obj) - destroy_MemObject(e); - storeHashDelete(e); - assert(e->hash.key == NULL); - memFree(e, MEM_STOREENTRY); -} - -/* ----- INTERFACE BETWEEN STORAGE MANAGER AND HASH TABLE FUNCTIONS --------- */ - -void -storeHashInsert(StoreEntry * e, const cache_key * key) -{ - debug(20, 3) ("storeHashInsert: Inserting Entry %p key '%s'\n", - e, storeKeyText(key)); - e->hash.key = storeKeyDup(key); - hash_join(store_table, &e->hash); -} - -static void -storeHashDelete(StoreEntry * e) -{ - hash_remove_link(store_table, &e->hash); - storeKeyFree(e->hash.key); - e->hash.key = NULL; -} - -/* -------------------------------------------------------------------------- */ - - -/* get rid of memory copy of the object */ -/* Only call this if storeCheckPurgeMem(e) returns 1 */ -static void -storePurgeMem(StoreEntry * e) -{ - if (e->mem_obj == NULL) - return; - debug(20, 3) ("storePurgeMem: Freeing memory-copy of %s\n", - storeKeyText(e->hash.key)); - storeSetMemStatus(e, NOT_IN_MEMORY); - destroy_MemObject(e); - if (e->swap_status != SWAPOUT_DONE) - storeRelease(e); -} - -static void -storeEntryReferenced(StoreEntry * e) -{ - SwapDir *SD; - - /* Notify the fs that we're referencing this object again */ - if (e->swap_dirn > -1) { - SD = INDEXSD(e->swap_dirn); - if (SD->refobj) - SD->refobj(SD, e); - } - /* Notify the memory cache that we're referencing this object again */ - if (e->mem_obj) { - if (mem_policy->Referenced) - mem_policy->Referenced(mem_policy, e, &e->mem_obj->repl); - } -} - -static void -storeEntryDereferenced(StoreEntry * e) -{ - SwapDir *SD; - - /* Notify the fs that we're not referencing this object any more */ - if (e->swap_filen > -1) { - SD = INDEXSD(e->swap_dirn); - if (SD->unrefobj != NULL) - SD->unrefobj(SD, e); - } - /* Notify the memory cache that we're not referencing this object any more */ - if (e->mem_obj) { - if (mem_policy->Dereferenced) - mem_policy->Dereferenced(mem_policy, e, &e->mem_obj->repl); - } -} - -void -storeLockObject(StoreEntry * e) -{ - e->lock_count++; - debug(20, 3) ("storeLockObject: key '%s' count=%d\n", - storeKeyText(e->hash.key), (int) e->lock_count); - e->lastref = squid_curtime; - storeEntryReferenced(e); -} - -void -storeReleaseRequest(StoreEntry * e) -{ - if (EBIT_TEST(e->flags, RELEASE_REQUEST)) - return; - debug(20, 3) ("storeReleaseRequest: '%s'\n", storeKeyText(e->hash.key)); - EBIT_SET(e->flags, RELEASE_REQUEST); - /* - * Clear cachable flag here because we might get called before - * anyone else even looks at the cachability flag. Also, this - * prevents httpMakePublic from really setting a public key. - */ - EBIT_CLR(e->flags, ENTRY_CACHABLE); - storeSetPrivateKey(e); -} - -/* unlock object, return -1 if object get released after unlock - * otherwise lock_count */ -int -storeUnlockObject(StoreEntry * e) -{ - e->lock_count--; - debug(20, 3) ("storeUnlockObject: key '%s' count=%d\n", - storeKeyText(e->hash.key), e->lock_count); - if (e->lock_count) - return (int) e->lock_count; - if (e->store_status == STORE_PENDING) - EBIT_SET(e->flags, RELEASE_REQUEST); - assert(storePendingNClients(e) == 0); - if (EBIT_TEST(e->flags, RELEASE_REQUEST)) - storeRelease(e); - else if (storeKeepInMemory(e)) { - storeEntryDereferenced(e); - storeSetMemStatus(e, IN_MEMORY); - requestUnlink(e->mem_obj->request); - e->mem_obj->request = NULL; - } else { - storePurgeMem(e); - storeEntryDereferenced(e); - if (EBIT_TEST(e->flags, KEY_PRIVATE)) - debug(20, 1) ("WARNING: %s:%d: found KEY_PRIVATE\n", __FILE__, __LINE__); - } - return 0; -} - -/* Lookup an object in the cache. - * return just a reference to object, don't start swapping in yet. */ -StoreEntry * -storeGet(const cache_key * key) -{ - void *p; - PROF_start(storeGet); - debug(20, 3) ("storeGet: looking up %s\n", storeKeyText(key)); - p = hash_lookup(store_table, key); - PROF_stop(storeGet); - return (StoreEntry *) p; -} - -StoreEntry * -storeGetPublic(const char *uri, const method_t method) -{ - return storeGet(storeKeyPublic(uri, method)); -} - -StoreEntry * -storeGetPublicByRequestMethod(request_t * req, const method_t method) -{ - return storeGet(storeKeyPublicByRequestMethod(req, method)); -} - -StoreEntry * -storeGetPublicByRequest(request_t * req) -{ - StoreEntry *e = storeGetPublicByRequestMethod(req, req->method); - if (e == NULL && req->method == METHOD_HEAD) - /* We can generate a HEAD reply from a cached GET object */ - e = storeGetPublicByRequestMethod(req, METHOD_GET); - return e; -} - -static int -getKeyCounter(void) -{ - static int key_counter = 0; - if (++key_counter < 0) - key_counter = 1; - return key_counter; -} - -void -storeSetPrivateKey(StoreEntry * e) -{ - const cache_key *newkey; - MemObject *mem = e->mem_obj; - if (e->hash.key && EBIT_TEST(e->flags, KEY_PRIVATE)) - return; /* is already private */ - if (e->hash.key) { - if (e->swap_filen > -1) - storeDirSwapLog(e, SWAP_LOG_DEL); - storeHashDelete(e); - } - if (mem != NULL) { - mem->id = getKeyCounter(); - newkey = storeKeyPrivate(mem->url, mem->method, mem->id); - } else { - newkey = storeKeyPrivate("JUNK", METHOD_NONE, getKeyCounter()); - } - assert(hash_lookup(store_table, newkey) == NULL); - EBIT_SET(e->flags, KEY_PRIVATE); - storeHashInsert(e, newkey); -} - -void -storeSetPublicKey(StoreEntry * e) -{ - StoreEntry *e2 = NULL; - const cache_key *newkey; - MemObject *mem = e->mem_obj; - if (e->hash.key && !EBIT_TEST(e->flags, KEY_PRIVATE)) - return; /* is already public */ - assert(mem); - /* - * We can't make RELEASE_REQUEST objects public. Depending on - * when RELEASE_REQUEST gets set, we might not be swapping out - * the object. If we're not swapping out, then subsequent - * store clients won't be able to access object data which has - * been freed from memory. - * - * If RELEASE_REQUEST is set, then ENTRY_CACHABLE should not - * be set, and storeSetPublicKey() should not be called. - */ -#if MORE_DEBUG_OUTPUT - if (EBIT_TEST(e->flags, RELEASE_REQUEST)) - debug(20, 1) ("assertion failed: RELEASE key %s, url %s\n", - e->hash.key, mem->url); -#endif - assert(!EBIT_TEST(e->flags, RELEASE_REQUEST)); - if (mem->request) { - StoreEntry *pe; - request_t *request = mem->request; - if (!mem->vary_headers) { - /* First handle the case where the object no longer varies */ - safe_free(request->vary_headers); - } else { - if (request->vary_headers && strcmp(request->vary_headers, mem->vary_headers) != 0) { - /* Oops.. the variance has changed. Kill the base object - * to record the new variance key - */ - safe_free(request->vary_headers); /* free old "bad" variance key */ - pe = storeGetPublic(mem->url, mem->method); - if (pe) - storeRelease(pe); - } - /* Make sure the request knows the variance status */ - if (!request->vary_headers) { - const char *vary = httpMakeVaryMark(request, mem->reply); - if (vary) - request->vary_headers = xstrdup(vary); - } - } - if (mem->vary_headers && !storeGetPublic(mem->url, mem->method)) { - /* Create "vary" base object */ - http_version_t version; - String vary; - pe = storeCreateEntry(mem->url, mem->log_url, request->flags, request->method); - httpBuildVersion(&version, 1, 0); - httpReplySetHeaders(pe->mem_obj->reply, version, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000); - vary = httpHeaderGetList(&mem->reply->header, HDR_VARY); - if (strBuf(vary)) { - httpHeaderPutStr(&pe->mem_obj->reply->header, HDR_VARY, strBuf(vary)); - stringClean(&vary); - } -#if X_ACCELERATOR_VARY - vary = httpHeaderGetList(&mem->reply->header, HDR_X_ACCELERATOR_VARY); - if (strBuf(vary)) { - httpHeaderPutStr(&pe->mem_obj->reply->header, HDR_X_ACCELERATOR_VARY, strBuf(vary)); - stringClean(&vary); - } -#endif - storeSetPublicKey(pe); - httpReplySwapOut(pe->mem_obj->reply, pe); - storeBufferFlush(pe); - storeTimestampsSet(pe); - storeComplete(pe); - storeUnlockObject(pe); - } - newkey = storeKeyPublicByRequest(mem->request); - } else - newkey = storeKeyPublic(mem->url, mem->method); - if ((e2 = (StoreEntry *) hash_lookup(store_table, newkey))) { - debug(20, 3) ("storeSetPublicKey: Making old '%s' private.\n", mem->url); - storeSetPrivateKey(e2); - storeRelease(e2); - if (mem->request) - newkey = storeKeyPublicByRequest(mem->request); - else - newkey = storeKeyPublic(mem->url, mem->method); - } - if (e->hash.key) - storeHashDelete(e); - EBIT_CLR(e->flags, KEY_PRIVATE); - storeHashInsert(e, newkey); - if (e->swap_filen > -1) - storeDirSwapLog(e, SWAP_LOG_ADD); -} - -StoreEntry * -storeCreateEntry(const char *url, const char *log_url, request_flags flags, method_t method) -{ - StoreEntry *e = NULL; - MemObject *mem = NULL; - debug(20, 3) ("storeCreateEntry: '%s'\n", url); - - e = new_StoreEntry(STORE_ENTRY_WITH_MEMOBJ, url, log_url); - e->lock_count = 1; /* Note lock here w/o calling storeLock() */ - mem = e->mem_obj; - mem->method = method; - if (neighbors_do_private_keys || !flags.hierarchical) - storeSetPrivateKey(e); - else - storeSetPublicKey(e); - if (flags.cachable) { - EBIT_SET(e->flags, ENTRY_CACHABLE); - EBIT_CLR(e->flags, RELEASE_REQUEST); - } else { - EBIT_CLR(e->flags, ENTRY_CACHABLE); - storeReleaseRequest(e); - } - e->store_status = STORE_PENDING; - storeSetMemStatus(e, NOT_IN_MEMORY); - e->swap_status = SWAPOUT_NONE; - e->swap_filen = -1; - e->swap_dirn = -1; - e->refcount = 0; - e->lastref = squid_curtime; - e->timestamp = -1; /* set in storeTimestampsSet() */ - e->ping_status = PING_NONE; - EBIT_SET(e->flags, ENTRY_VALIDATED); - return e; -} - -/* Mark object as expired */ -void -storeExpireNow(StoreEntry * e) -{ - debug(20, 3) ("storeExpireNow: '%s'\n", storeKeyText(e->hash.key)); - e->expires = squid_curtime; -} - -/* Append incoming data from a primary server to an entry. */ -void -storeAppend(StoreEntry * e, const char *buf, int len) -{ - MemObject *mem = e->mem_obj; - assert(mem != NULL); - assert(len >= 0); - assert(e->store_status == STORE_PENDING); - if (len) { - debug(20, 5) ("storeAppend: appending %d bytes for '%s'\n", - len, - storeKeyText(e->hash.key)); - storeGetMemSpace(len); - stmemAppend(&mem->data_hdr, buf, len); - mem->inmem_hi += len; - } - if (EBIT_TEST(e->flags, DELAY_SENDING)) - return; - InvokeHandlers(e); - storeSwapOut(e); -} - -void -#if STDC_HEADERS -storeAppendPrintf(StoreEntry * e, const char *fmt,...) -#else -storeAppendPrintf(va_alist) - va_dcl -#endif -{ -#if STDC_HEADERS - va_list args; - va_start(args, fmt); -#else - va_list args; - StoreEntry *e = NULL; - const char *fmt = NULL; - va_start(args); - e = va_arg(args, StoreEntry *); - fmt = va_arg(args, char *); -#endif - storeAppendVPrintf(e, fmt, args); - va_end(args); -} - -/* used be storeAppendPrintf and Packer */ -void -storeAppendVPrintf(StoreEntry * e, const char *fmt, va_list vargs) -{ - LOCAL_ARRAY(char, buf, 4096); - buf[0] = '\0'; - vsnprintf(buf, 4096, fmt, vargs); - storeAppend(e, buf, strlen(buf)); -} - -struct _store_check_cachable_hist { - struct { - int non_get; - int not_entry_cachable; - int release_request; - int wrong_content_length; - int negative_cached; - int too_big; - int too_small; - int private_key; - int too_many_open_files; - int too_many_open_fds; - } no; - struct { - int Default; - } yes; -} store_check_cachable_hist; - -int -storeTooManyDiskFilesOpen(void) -{ - if (Config.max_open_disk_fds == 0) - return 0; - if (store_open_disk_fd > Config.max_open_disk_fds) - return 1; - return 0; -} - -static int -storeCheckTooSmall(StoreEntry * e) -{ - MemObject *mem = e->mem_obj; - if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) - return 0; - if (STORE_OK == e->store_status) - if (mem->object_sz < Config.Store.minObjectSize) - return 1; - if (mem->reply->content_length > -1) - if (mem->reply->content_length < (int) Config.Store.minObjectSize) - return 1; - return 0; -} - -int -storeCheckCachable(StoreEntry * e) -{ -#if CACHE_ALL_METHODS - if (e->mem_obj->method != METHOD_GET) { - debug(20, 2) ("storeCheckCachable: NO: non-GET method\n"); - store_check_cachable_hist.no.non_get++; - } else -#endif - if (!EBIT_TEST(e->flags, ENTRY_CACHABLE)) { - debug(20, 2) ("storeCheckCachable: NO: not cachable\n"); - store_check_cachable_hist.no.not_entry_cachable++; - } else if (EBIT_TEST(e->flags, RELEASE_REQUEST)) { - debug(20, 2) ("storeCheckCachable: NO: release requested\n"); - store_check_cachable_hist.no.release_request++; - } else if (e->store_status == STORE_OK && EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) { - debug(20, 2) ("storeCheckCachable: NO: wrong content-length\n"); - store_check_cachable_hist.no.wrong_content_length++; - } else if (EBIT_TEST(e->flags, ENTRY_NEGCACHED)) { - debug(20, 3) ("storeCheckCachable: NO: negative cached\n"); - store_check_cachable_hist.no.negative_cached++; - return 0; /* avoid release call below */ - } else if ((e->mem_obj->reply->content_length > 0 && - e->mem_obj->reply->content_length > Config.Store.maxObjectSize) || - e->mem_obj->inmem_hi > Config.Store.maxObjectSize) { - debug(20, 2) ("storeCheckCachable: NO: too big\n"); - store_check_cachable_hist.no.too_big++; - } else if (e->mem_obj->reply->content_length > (int) Config.Store.maxObjectSize) { - debug(20, 2) ("storeCheckCachable: NO: too big\n"); - store_check_cachable_hist.no.too_big++; - } else if (storeCheckTooSmall(e)) { - debug(20, 2) ("storeCheckCachable: NO: too small\n"); - store_check_cachable_hist.no.too_small++; - } else if (EBIT_TEST(e->flags, KEY_PRIVATE)) { - debug(20, 3) ("storeCheckCachable: NO: private key\n"); - store_check_cachable_hist.no.private_key++; - } else if (e->swap_status != SWAPOUT_NONE) { - /* - * here we checked the swap_status because the remaining - * cases are only relevant only if we haven't started swapping - * out the object yet. - */ - return 1; - } else if (storeTooManyDiskFilesOpen()) { - debug(20, 2) ("storeCheckCachable: NO: too many disk files open\n"); - store_check_cachable_hist.no.too_many_open_files++; - } else if (fdNFree() < RESERVED_FD) { - debug(20, 2) ("storeCheckCachable: NO: too many FD's open\n"); - store_check_cachable_hist.no.too_many_open_fds++; - } else { - store_check_cachable_hist.yes.Default++; - return 1; - } - storeReleaseRequest(e); - EBIT_CLR(e->flags, ENTRY_CACHABLE); - return 0; -} - -static void -storeCheckCachableStats(StoreEntry * sentry) -{ - storeAppendPrintf(sentry, "Category\t Count\n"); - - storeAppendPrintf(sentry, "no.non_get\t%d\n", - store_check_cachable_hist.no.non_get); - storeAppendPrintf(sentry, "no.not_entry_cachable\t%d\n", - store_check_cachable_hist.no.not_entry_cachable); - storeAppendPrintf(sentry, "no.release_request\t%d\n", - store_check_cachable_hist.no.release_request); - storeAppendPrintf(sentry, "no.wrong_content_length\t%d\n", - store_check_cachable_hist.no.wrong_content_length); - storeAppendPrintf(sentry, "no.negative_cached\t%d\n", - store_check_cachable_hist.no.negative_cached); - storeAppendPrintf(sentry, "no.too_big\t%d\n", - store_check_cachable_hist.no.too_big); - storeAppendPrintf(sentry, "no.too_small\t%d\n", - store_check_cachable_hist.no.too_small); - storeAppendPrintf(sentry, "no.private_key\t%d\n", - store_check_cachable_hist.no.private_key); - storeAppendPrintf(sentry, "no.too_many_open_files\t%d\n", - store_check_cachable_hist.no.too_many_open_files); - storeAppendPrintf(sentry, "no.too_many_open_fds\t%d\n", - store_check_cachable_hist.no.too_many_open_fds); - storeAppendPrintf(sentry, "yes.default\t%d\n", - store_check_cachable_hist.yes.Default); -} - -/* Complete transfer into the local cache. */ -void -storeComplete(StoreEntry * e) -{ - debug(20, 3) ("storeComplete: '%s'\n", storeKeyText(e->hash.key)); - if (e->store_status != STORE_PENDING) { - /* - * if we're not STORE_PENDING, then probably we got aborted - * and there should be NO clients on this entry - */ - assert(EBIT_TEST(e->flags, ENTRY_ABORTED)); - assert(e->mem_obj->nclients == 0); - return; - } - e->mem_obj->object_sz = e->mem_obj->inmem_hi; - e->store_status = STORE_OK; - assert(e->mem_status == NOT_IN_MEMORY); - if (!storeEntryValidLength(e)) { - EBIT_SET(e->flags, ENTRY_BAD_LENGTH); - storeReleaseRequest(e); - } -#if USE_CACHE_DIGESTS - if (e->mem_obj->request) - e->mem_obj->request->hier.store_complete_stop = current_time; -#endif - /* - * We used to call InvokeHandlers, then storeSwapOut. However, - * Madhukar Reddy reported that - * responses without content length would sometimes get released - * in client_side, thinking that the response is incomplete. - */ - storeSwapOut(e); - InvokeHandlers(e); -} - -/* - * Someone wants to abort this transfer. Set the reason in the - * request structure, call the server-side callback and mark the - * entry for releasing - */ -void -storeAbort(StoreEntry * e) -{ - MemObject *mem = e->mem_obj; - assert(e->store_status == STORE_PENDING); - assert(mem != NULL); - debug(20, 6) ("storeAbort: %s\n", storeKeyText(e->hash.key)); - storeLockObject(e); /* lock while aborting */ - storeNegativeCache(e); - storeReleaseRequest(e); - EBIT_SET(e->flags, ENTRY_ABORTED); - storeSetMemStatus(e, NOT_IN_MEMORY); - e->store_status = STORE_OK; - /* - * We assign an object length here. The only other place we assign - * the object length is in storeComplete() - */ - mem->object_sz = mem->inmem_hi; - /* Notify the server side */ - if (mem->abort.callback) { - eventAdd("mem->abort.callback", - mem->abort.callback, - mem->abort.data, - 0.0, - 0); - mem->abort.callback = NULL; - mem->abort.data = NULL; - } - /* Notify the client side */ - InvokeHandlers(e); - /* Close any swapout file */ - storeSwapOutFileClose(e); - storeUnlockObject(e); /* unlock */ -} - -/* Clear Memory storage to accommodate the given object len */ -static void -storeGetMemSpace(int size) -{ - StoreEntry *e = NULL; - int released = 0; - static time_t last_check = 0; - int pages_needed; - RemovalPurgeWalker *walker; - if (squid_curtime == last_check) - return; - last_check = squid_curtime; - pages_needed = (size / SM_PAGE_SIZE) + 1; - if (memInUse(MEM_MEM_NODE) + pages_needed < store_pages_max) - return; - debug(20, 2) ("storeGetMemSpace: Starting, need %d pages\n", pages_needed); - /* XXX what to set as max_scan here? */ - walker = mem_policy->PurgeInit(mem_policy, 100000); - while ((e = walker->Next(walker))) { - storePurgeMem(e); - released++; - if (memInUse(MEM_MEM_NODE) + pages_needed < store_pages_max) - break; - } - walker->Done(walker); - debug(20, 3) ("storeGetMemSpace stats:\n"); - debug(20, 3) (" %6d HOT objects\n", hot_obj_count); - debug(20, 3) (" %6d were released\n", released); -} - -/* The maximum objects to scan for maintain storage space */ -#define MAINTAIN_MAX_SCAN 1024 -#define MAINTAIN_MAX_REMOVE 64 - -/* - * This routine is to be called by main loop in main.c. - * It removes expired objects on only one bucket for each time called. - * returns the number of objects removed - * - * This should get called 1/s from main(). - */ -void -storeMaintainSwapSpace(void *datanotused) -{ - int i; - SwapDir *SD; - static time_t last_warn_time = 0; - - PROF_start(storeMaintainSwapSpace); - /* walk each fs */ - for (i = 0; i < Config.cacheSwap.n_configured; i++) { - /* call the maintain function .. */ - SD = INDEXSD(i); - /* XXX FixMe: This should be done "in parallell" on the different - * cache_dirs, not one at a time. - */ - if (SD->maintainfs != NULL) - SD->maintainfs(SD); - } - if (store_swap_size > Config.Swap.maxSize) { - if (squid_curtime - last_warn_time > 10) { - debug(20, 0) ("WARNING: Disk space over limit: %ld KB > %ld KB\n", - (long int) store_swap_size, (long int) Config.Swap.maxSize); - last_warn_time = squid_curtime; - } - } - /* Reregister a maintain event .. */ - eventAdd("MaintainSwapSpace", storeMaintainSwapSpace, NULL, 1.0, 1); - PROF_stop(storeMaintainSwapSpace); -} - - -/* release an object from a cache */ -void -storeRelease(StoreEntry * e) -{ - PROF_start(storeRelease); - debug(20, 3) ("storeRelease: Releasing: '%s'\n", storeKeyText(e->hash.key)); - /* If, for any reason we can't discard this object because of an - * outstanding request, mark it for pending release */ - if (storeEntryLocked(e)) { - storeExpireNow(e); - debug(20, 3) ("storeRelease: Only setting RELEASE_REQUEST bit\n"); - storeReleaseRequest(e); - PROF_stop(storeRelease); - return; - } - if (store_dirs_rebuilding && e->swap_filen > -1) { - storeSetPrivateKey(e); - if (e->mem_obj) { - storeSetMemStatus(e, NOT_IN_MEMORY); - destroy_MemObject(e); - } - if (e->swap_filen > -1) { - /* - * Fake a call to storeLockObject(). When rebuilding is done, - * we'll just call storeUnlockObject() on these. - */ - e->lock_count++; - EBIT_SET(e->flags, RELEASE_REQUEST); - stackPush(&LateReleaseStack, e); - PROF_stop(storeRelease); - return; - } else { - destroy_StoreEntry(e); - } - } - storeLog(STORE_LOG_RELEASE, e); - if (e->swap_filen > -1) { - storeUnlink(e); - if (e->swap_status == SWAPOUT_DONE) - if (EBIT_TEST(e->flags, ENTRY_VALIDATED)) - storeDirUpdateSwapSize(&Config.cacheSwap.swapDirs[e->swap_dirn], e->swap_file_sz, -1); - if (!EBIT_TEST(e->flags, KEY_PRIVATE)) - storeDirSwapLog(e, SWAP_LOG_DEL); -#if 0 - /* From 2.4. I think we do this in storeUnlink? */ - storeSwapFileNumberSet(e, -1); -#endif - } - storeSetMemStatus(e, NOT_IN_MEMORY); - destroy_StoreEntry(e); - PROF_stop(storeRelease); -} - -static void -storeLateRelease(void *unused) -{ - StoreEntry *e; - int i; - static int n = 0; - if (store_dirs_rebuilding) { - eventAdd("storeLateRelease", storeLateRelease, NULL, 1.0, 1); - return; - } - for (i = 0; i < 10; i++) { - e = stackPop(&LateReleaseStack); - if (e == NULL) { - /* done! */ - debug(20, 1) ("storeLateRelease: released %d objects\n", n); - return; - } - storeUnlockObject(e); - n++; - } - eventAdd("storeLateRelease", storeLateRelease, NULL, 0.0, 1); -} - -/* return 1 if a store entry is locked */ -int -storeEntryLocked(const StoreEntry * e) -{ - if (e->lock_count) - return 1; - if (e->swap_status == SWAPOUT_WRITING) - return 1; - if (e->store_status == STORE_PENDING) - return 1; - /* - * SPECIAL, PUBLIC entries should be "locked" - */ - if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) - if (!EBIT_TEST(e->flags, KEY_PRIVATE)) - return 1; - return 0; -} - -static int -storeEntryValidLength(const StoreEntry * e) -{ - int diff; - const HttpReply *reply; - assert(e->mem_obj != NULL); - reply = e->mem_obj->reply; - debug(20, 3) ("storeEntryValidLength: Checking '%s'\n", storeKeyText(e->hash.key)); - debug(20, 5) ("storeEntryValidLength: object_len = %d\n", - objectLen(e)); - debug(20, 5) ("storeEntryValidLength: hdr_sz = %d\n", - reply->hdr_sz); - debug(20, 5) ("storeEntryValidLength: content_length = %d\n", - reply->content_length); - if (reply->content_length < 0) { - debug(20, 5) ("storeEntryValidLength: Unspecified content length: %s\n", - storeKeyText(e->hash.key)); - return 1; - } - if (reply->hdr_sz == 0) { - debug(20, 5) ("storeEntryValidLength: Zero header size: %s\n", - storeKeyText(e->hash.key)); - return 1; - } - if (e->mem_obj->method == METHOD_HEAD) { - debug(20, 5) ("storeEntryValidLength: HEAD request: %s\n", - storeKeyText(e->hash.key)); - return 1; - } - if (reply->sline.status == HTTP_NOT_MODIFIED) - return 1; - if (reply->sline.status == HTTP_NO_CONTENT) - return 1; - diff = reply->hdr_sz + reply->content_length - objectLen(e); - if (diff == 0) - return 1; - debug(20, 3) ("storeEntryValidLength: %d bytes too %s; '%s'\n", - diff < 0 ? -diff : diff, - diff < 0 ? "big" : "small", - storeKeyText(e->hash.key)); - return 0; -} - -static void -storeInitHashValues(void) -{ - long int i; - /* Calculate size of hash table (maximum currently 64k buckets). */ - i = Config.Swap.maxSize / Config.Store.avgObjectSize; - debug(20, 1) ("Swap maxSize %ld KB, estimated %ld objects\n", - (long int) Config.Swap.maxSize, i); - i /= Config.Store.objectsPerBucket; - debug(20, 1) ("Target number of buckets: %ld\n", i); - /* ideally the full scan period should be configurable, for the - * moment it remains at approximately 24 hours. */ - store_hash_buckets = storeKeyHashBuckets(i); - debug(20, 1) ("Using %d Store buckets\n", store_hash_buckets); - debug(20, 1) ("Max Mem size: %ld KB\n", (long int) Config.memMaxSize >> 10); - debug(20, 1) ("Max Swap size: %ld KB\n", (long int) Config.Swap.maxSize); -} - -void -storeInit(void) -{ - storeKeyInit(); - storeInitHashValues(); - store_table = hash_create(storeKeyHashCmp, - store_hash_buckets, storeKeyHashHash); - mem_policy = createRemovalPolicy(Config.memPolicy); - storeDigestInit(); - storeLogOpen(); - stackInit(&LateReleaseStack); - eventAdd("storeLateRelease", storeLateRelease, NULL, 1.0, 1); - storeDirInit(); - storeRebuildStart(); - cachemgrRegister("storedir", - "Store Directory Stats", - storeDirStats, 0, 1); - cachemgrRegister("store_check_cachable_stats", - "storeCheckCachable() Stats", - storeCheckCachableStats, 0, 1); - cachemgrRegister("store_io", - "Store IO Interface Stats", - storeIOStats, 0, 1); -} - -void -storeConfigure(void) -{ - store_swap_high = (long) (((float) Config.Swap.maxSize * - (float) Config.Swap.highWaterMark) / (float) 100); - store_swap_low = (long) (((float) Config.Swap.maxSize * - (float) Config.Swap.lowWaterMark) / (float) 100); - store_pages_max = Config.memMaxSize / SM_PAGE_SIZE; -} - -static int -storeKeepInMemory(const StoreEntry * e) -{ - MemObject *mem = e->mem_obj; - if (mem == NULL) - return 0; - if (mem->data_hdr.head == NULL) - return 0; - return mem->inmem_lo == 0; -} - -int -storeCheckNegativeHit(StoreEntry * e) -{ - if (!EBIT_TEST(e->flags, ENTRY_NEGCACHED)) - return 0; - if (e->expires <= squid_curtime) - return 0; - if (e->store_status != STORE_OK) - return 0; - return 1; -} - -void -storeNegativeCache(StoreEntry * e) -{ - e->expires = squid_curtime + Config.negativeTtl; - EBIT_SET(e->flags, ENTRY_NEGCACHED); -} - -void -storeFreeMemory(void) -{ - hashFreeItems(store_table, destroy_StoreEntry); - hashFreeMemory(store_table); - store_table = NULL; -#if USE_CACHE_DIGESTS - if (store_digest) - cacheDigestDestroy(store_digest); -#endif - store_digest = NULL; -} - -int -expiresMoreThan(time_t expires, time_t when) -{ - if (expires < 0) /* No Expires given */ - return 1; - return (expires > (squid_curtime + when)); -} - -int -storeEntryValidToSend(StoreEntry * e) -{ - if (EBIT_TEST(e->flags, RELEASE_REQUEST)) - return 0; - if (EBIT_TEST(e->flags, ENTRY_NEGCACHED)) - if (e->expires <= squid_curtime) - return 0; - if (EBIT_TEST(e->flags, ENTRY_ABORTED)) - return 0; - return 1; -} - -void -storeTimestampsSet(StoreEntry * entry) -{ - const HttpReply *reply = entry->mem_obj->reply; - time_t served_date = reply->date; - int age = httpHeaderGetInt(&reply->header, HDR_AGE); - /* - * The timestamp calculations below tries to mimic the properties - * of the age calculation in RFC2616 section 13.2.3. The implementaion - * isn't complete, and the most notable exception from the RFC is that - * this does not account for response_delay, but it probably does - * not matter much as this is calculated immediately when the headers - * are received, not when the whole response has been received. - */ - /* make sure that 0 <= served_date <= squid_curtime */ - if (served_date < 0 || served_date > squid_curtime) - served_date = squid_curtime; - /* - * Compensate with Age header if origin server clock is ahead - * of us and there is a cache in between us and the origin - * server. But DONT compensate if the age value is larger than - * squid_curtime because it results in a negative served_date. - */ - if (age > squid_curtime - served_date) - if (squid_curtime > age) - served_date = squid_curtime - age; - entry->expires = reply->expires; - entry->lastmod = reply->last_modified; - entry->timestamp = served_date; -} - -void -storeRegisterAbort(StoreEntry * e, STABH * cb, void *data) -{ - MemObject *mem = e->mem_obj; - assert(mem); - assert(mem->abort.callback == NULL); - mem->abort.callback = cb; - mem->abort.data = data; -} - -void -storeUnregisterAbort(StoreEntry * e) -{ - MemObject *mem = e->mem_obj; - assert(mem); - mem->abort.callback = NULL; -} - -void -storeMemObjectDump(MemObject * mem) -{ - debug(20, 1) ("MemObject->data.head: %p\n", - mem->data_hdr.head); - debug(20, 1) ("MemObject->data.tail: %p\n", - mem->data_hdr.tail); - debug(20, 1) ("MemObject->data.origin_offset: %d\n", - mem->data_hdr.origin_offset); - debug(20, 1) ("MemObject->start_ping: %d.%06d\n", - (int) mem->start_ping.tv_sec, - (int) mem->start_ping.tv_usec); - debug(20, 1) ("MemObject->inmem_hi: %d\n", - (int) mem->inmem_hi); - debug(20, 1) ("MemObject->inmem_lo: %d\n", - (int) mem->inmem_lo); - debug(20, 1) ("MemObject->nclients: %d\n", - mem->nclients); - debug(20, 1) ("MemObject->reply: %p\n", - mem->reply); - debug(20, 1) ("MemObject->request: %p\n", - mem->request); - debug(20, 1) ("MemObject->log_url: %p %s\n", - mem->log_url, - checkNullString(mem->log_url)); -} - -void -storeEntryDump(const StoreEntry * e, int l) -{ - debug(20, l) ("StoreEntry->key: %s\n", storeKeyText(e->hash.key)); - debug(20, l) ("StoreEntry->next: %p\n", e->hash.next); - debug(20, l) ("StoreEntry->mem_obj: %p\n", e->mem_obj); - debug(20, l) ("StoreEntry->timestamp: %d\n", (int) e->timestamp); - debug(20, l) ("StoreEntry->lastref: %d\n", (int) e->lastref); - debug(20, l) ("StoreEntry->expires: %d\n", (int) e->expires); - debug(20, l) ("StoreEntry->lastmod: %d\n", (int) e->lastmod); - debug(20, l) ("StoreEntry->swap_file_sz: %d\n", (int) e->swap_file_sz); - debug(20, l) ("StoreEntry->refcount: %d\n", e->refcount); - debug(20, l) ("StoreEntry->flags: %s\n", storeEntryFlags(e)); - debug(20, l) ("StoreEntry->swap_dirn: %d\n", (int) e->swap_dirn); - debug(20, l) ("StoreEntry->swap_filen: %d\n", (int) e->swap_filen); - debug(20, l) ("StoreEntry->lock_count: %d\n", (int) e->lock_count); - debug(20, l) ("StoreEntry->mem_status: %d\n", (int) e->mem_status); - debug(20, l) ("StoreEntry->ping_status: %d\n", (int) e->ping_status); - debug(20, l) ("StoreEntry->store_status: %d\n", (int) e->store_status); - debug(20, l) ("StoreEntry->swap_status: %d\n", (int) e->swap_status); -} - -/* - * NOTE, this function assumes only two mem states - */ -void -storeSetMemStatus(StoreEntry * e, int new_status) -{ - MemObject *mem = e->mem_obj; - if (new_status == e->mem_status) - return; - assert(mem != NULL); - if (new_status == IN_MEMORY) { - assert(mem->inmem_lo == 0); - if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) { - debug(20, 4) ("storeSetMemStatus: not inserting special %s into policy\n", - mem->url); - } else { - mem_policy->Add(mem_policy, e, &mem->repl); - debug(20, 4) ("storeSetMemStatus: inserted mem node %s\n", - mem->url); - } - hot_obj_count++; - } else { - if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) { - debug(20, 4) ("storeSetMemStatus: special entry %s\n", - mem->url); - } else { - mem_policy->Remove(mem_policy, e, &mem->repl); - debug(20, 4) ("storeSetMemStatus: removed mem node %s\n", - mem->url); - } - hot_obj_count--; - } - e->mem_status = new_status; -} - -const char * -storeUrl(const StoreEntry * e) -{ - if (e == NULL) - return "[null_entry]"; - else if (e->mem_obj == NULL) - return "[null_mem_obj]"; - else - return e->mem_obj->url; -} - -void -storeCreateMemObject(StoreEntry * e, const char *url, const char *log_url) -{ - if (e->mem_obj) - return; - e->mem_obj = new_MemObject(url, log_url); -} - -/* this just sets DELAY_SENDING */ -void -storeBuffer(StoreEntry * e) -{ - EBIT_SET(e->flags, DELAY_SENDING); -} - -/* this just clears DELAY_SENDING and Invokes the handlers */ -void -storeBufferFlush(StoreEntry * e) -{ - EBIT_CLR(e->flags, DELAY_SENDING); - InvokeHandlers(e); - storeSwapOut(e); -} - -int -objectLen(const StoreEntry * e) -{ - assert(e->mem_obj != NULL); - return e->mem_obj->object_sz; -} - -int -contentLen(const StoreEntry * e) -{ - assert(e->mem_obj != NULL); - assert(e->mem_obj->reply != NULL); - return e->mem_obj->object_sz - e->mem_obj->reply->hdr_sz; -} - -HttpReply * -storeEntryReply(StoreEntry * e) -{ - if (NULL == e) - return NULL; - if (NULL == e->mem_obj) - return NULL; - return e->mem_obj->reply; -} - -void -storeEntryReset(StoreEntry * e) -{ - MemObject *mem = e->mem_obj; - debug(20, 3) ("storeEntryReset: %s\n", storeUrl(e)); - assert(mem->swapout.sio == NULL); - stmemFree(&mem->data_hdr); - mem->inmem_hi = mem->inmem_lo = 0; - httpReplyDestroy(mem->reply); - mem->reply = httpReplyCreate(); - e->expires = e->lastmod = e->timestamp = -1; -} - -/* - * storeFsInit - * - * This routine calls the SETUP routine for each fs type. - * I don't know where the best place for this is, and I'm not going to shuffle - * around large chunks of code right now (that can be done once its working.) - */ -void -storeFsInit(void) -{ - storeReplSetup(); - storeFsSetup(); -} - - -/* - * similar to above, but is called when a graceful shutdown is to occur - * of each fs module. - */ -void -storeFsDone(void) -{ - int i = 0; - - while (storefs_list[i].typestr != NULL) { - storefs_list[i].donefunc(); - i++; - } -} - -/* - * called to add another store fs module - */ -void -storeFsAdd(const char *type, STSETUP * setup) -{ - int i; - /* find the number of currently known storefs types */ - for (i = 0; storefs_list && storefs_list[i].typestr; i++) { - assert(strcmp(storefs_list[i].typestr, type) != 0); - } - /* add the new type */ - storefs_list = xrealloc(storefs_list, (i + 2) * sizeof(storefs_entry_t)); - memset(&storefs_list[i + 1], 0, sizeof(storefs_entry_t)); - storefs_list[i].typestr = type; - /* Call the FS to set up capabilities and initialize the FS driver */ - setup(&storefs_list[i]); -} - -/* - * called to add another store removal policy module - */ -void -storeReplAdd(const char *type, REMOVALPOLICYCREATE * create) -{ - int i; - /* find the number of currently known repl types */ - for (i = 0; storerepl_list && storerepl_list[i].typestr; i++) { - assert(strcmp(storerepl_list[i].typestr, type) != 0); - } - /* add the new type */ - storerepl_list = xrealloc(storerepl_list, (i + 2) * sizeof(storerepl_entry_t)); - memset(&storerepl_list[i + 1], 0, sizeof(storerepl_entry_t)); - storerepl_list[i].typestr = type; - storerepl_list[i].create = create; -} - -/* - * Create a removal policy instance - */ -RemovalPolicy * -createRemovalPolicy(RemovalPolicySettings * settings) -{ - storerepl_entry_t *r; - for (r = storerepl_list; r && r->typestr; r++) { - if (strcmp(r->typestr, settings->type) == 0) - return r->create(settings->args); - } - debug(20, 1) ("ERROR: Unknown policy %s\n", settings->type); - debug(20, 1) ("ERROR: Be sure to have set cache_replacement_policy\n"); - debug(20, 1) ("ERROR: and memory_replacement_policy in squid.conf!\n"); - fatalf("ERROR: Unknown policy %s\n", settings->type); - return NULL; /* NOTREACHED */ -} - -#if 0 -void -storeSwapFileNumberSet(StoreEntry * e, sfileno filn) -{ - if (e->swap_file_number == filn) - return; - if (filn < 0) { - assert(-1 == filn); - storeDirMapBitReset(e->swap_file_number); - storeDirLRUDelete(e); - e->swap_file_number = -1; - } else { - assert(-1 == e->swap_file_number); - storeDirMapBitSet(e->swap_file_number = filn); - storeDirLRUAdd(e); - } -} -#endif --- /dev/null Wed Feb 14 01:05:20 2007 +++ squid/src/store.cc Wed Feb 14 01:07:18 2007 @@ -0,0 +1,1414 @@ + +/* + * $Id: store.cc,v 1.1.2.1 2002/10/04 07:07:28 rbcollins Exp $ + * + * DEBUG: section 20 Storage Manager + * AUTHOR: Harvest Derived + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. + * + */ + +#include "squid.h" +#include "Store.h" + +#define REBUILD_TIMESTAMP_DELTA_MAX 2 + +#define STORE_IN_MEM_BUCKETS (229) + +const char *memStatusStr[] = +{ + "NOT_IN_MEMORY", + "IN_MEMORY" +}; + +const char *pingStatusStr[] = +{ + "PING_NONE", + "PING_WAITING", + "PING_DONE" +}; + +const char *storeStatusStr[] = +{ + "STORE_OK", + "STORE_PENDING" +}; + +const char *swapStatusStr[] = +{ + "SWAPOUT_NONE", + "SWAPOUT_WRITING", + "SWAPOUT_DONE" +}; + +typedef struct lock_ctrl_t { + SIH *callback; + void *callback_data; + StoreEntry *e; +} lock_ctrl_t; + +extern "C" OBJH storeIOStats; + +/* + * local function prototypes + */ +static int storeEntryValidLength(const StoreEntry *); +static void storeGetMemSpace(int); +static void storeHashDelete(StoreEntry *); +static MemObject *new_MemObject(const char *, const char *); +static void destroy_MemObject(StoreEntry *); +static FREE destroy_StoreEntry; +static void storePurgeMem(StoreEntry *); +static void storeEntryReferenced(StoreEntry *); +static void storeEntryDereferenced(StoreEntry *); +static int getKeyCounter(void); +static int storeKeepInMemory(const StoreEntry *); +static OBJH storeCheckCachableStats; +static EVH storeLateRelease; + +/* + * local variables + */ +static Stack LateReleaseStack; + +#if URL_CHECKSUM_DEBUG +unsigned int +url_checksum(const char *url) +{ + unsigned int ck; + MD5_CTX M; + static unsigned char digest[16]; + MD5Init(&M); + MD5Update(&M, (unsigned char *) url, strlen(url)); + MD5Final(digest, &M); + xmemcpy(&ck, digest, sizeof(ck)); + return ck; +} +#endif + +static MemObject * +new_MemObject(const char *url, const char *log_url) +{ + MemObject *mem = static_cast(memAllocate(MEM_MEMOBJECT)); + mem->reply = httpReplyCreate(); + mem->url = xstrdup(url); +#if URL_CHECKSUM_DEBUG + mem->chksum = url_checksum(mem->url); +#endif + mem->log_url = xstrdup(log_url); + mem->object_sz = -1; + mem->fd = -1; + /* XXX account log_url */ + debug(20, 3) ("new_MemObject: returning %p\n", mem); + return mem; +} + +StoreEntry * +new_StoreEntry(int mem_obj_flag, const char *url, const char *log_url) +{ + StoreEntry *e = NULL; + e = static_cast(memAllocate(MEM_STOREENTRY)); + if (mem_obj_flag) + e->mem_obj = new_MemObject(url, log_url); + debug(20, 3) ("new_StoreEntry: returning %p\n", e); + e->expires = e->lastmod = e->lastref = e->timestamp = -1; + e->swap_filen = -1; + e->swap_dirn = -1; + return e; +} + +static void +destroy_MemObject(StoreEntry * e) +{ + MemObject *mem = e->mem_obj; + const Ctx ctx = ctx_enter(mem->url); + debug(20, 3) ("destroy_MemObject: destroying %p\n", mem); +#if URL_CHECKSUM_DEBUG + assert(mem->chksum == url_checksum(mem->url)); +#endif + e->mem_obj = NULL; + if (!shutting_down) + assert(mem->swapout.sio == NULL); + stmemFree(&mem->data_hdr); + mem->inmem_hi = 0; + /* + * There is no way to abort FD-less clients, so they might + * still have mem->clients set if mem->fd == -1 + */ + assert(mem->fd == -1 || mem->clients.head == NULL); + httpReplyDestroy(mem->reply); + requestUnlink(mem->request); + mem->request = NULL; + ctx_exit(ctx); /* must exit before we free mem->url */ + safe_free(mem->url); + safe_free(mem->log_url); /* XXX account log_url */ + safe_free(mem->vary_headers); + memFree(mem, MEM_MEMOBJECT); +} + +static void +destroy_StoreEntry(void *data) +{ + StoreEntry *e = static_cast(data); + debug(20, 3) ("destroy_StoreEntry: destroying %p\n", e); + assert(e != NULL); + if (e->mem_obj) + destroy_MemObject(e); + storeHashDelete(e); + assert(e->hash.key == NULL); + memFree(e, MEM_STOREENTRY); +} + +/* ----- INTERFACE BETWEEN STORAGE MANAGER AND HASH TABLE FUNCTIONS --------- */ + +void +storeHashInsert(StoreEntry * e, const cache_key * key) +{ + debug(20, 3) ("storeHashInsert: Inserting Entry %p key '%s'\n", + e, storeKeyText(key)); + e->hash.key = storeKeyDup(key); + hash_join(store_table, &e->hash); +} + +static void +storeHashDelete(StoreEntry * e) +{ + hash_remove_link(store_table, &e->hash); + storeKeyFree((unsigned char *)e->hash.key); + e->hash.key = NULL; +} + +/* -------------------------------------------------------------------------- */ + + +/* get rid of memory copy of the object */ +/* Only call this if storeCheckPurgeMem(e) returns 1 */ +static void +storePurgeMem(StoreEntry * e) +{ + if (e->mem_obj == NULL) + return; + debug(20, 3) ("storePurgeMem: Freeing memory-copy of %s\n", + storeKeyText((unsigned char *)e->hash.key)); + storeSetMemStatus(e, NOT_IN_MEMORY); + destroy_MemObject(e); + if (e->swap_status != SWAPOUT_DONE) + storeRelease(e); +} + +static void +storeEntryReferenced(StoreEntry * e) +{ + SwapDir *SD; + + /* Notify the fs that we're referencing this object again */ + if (e->swap_dirn > -1) { + SD = INDEXSD(e->swap_dirn); + if (SD->refobj) + SD->refobj(SD, e); + } + /* Notify the memory cache that we're referencing this object again */ + if (e->mem_obj) { + if (mem_policy->Referenced) + mem_policy->Referenced(mem_policy, e, &e->mem_obj->repl); + } +} + +static void +storeEntryDereferenced(StoreEntry * e) +{ + SwapDir *SD; + + /* Notify the fs that we're not referencing this object any more */ + if (e->swap_filen > -1) { + SD = INDEXSD(e->swap_dirn); + if (SD->unrefobj != NULL) + SD->unrefobj(SD, e); + } + /* Notify the memory cache that we're not referencing this object any more */ + if (e->mem_obj) { + if (mem_policy->Dereferenced) + mem_policy->Dereferenced(mem_policy, e, &e->mem_obj->repl); + } +} + +void +storeLockObject(StoreEntry * e) +{ + e->lock_count++; + debug(20, 3) ("storeLockObject: key '%s' count=%d\n", + storeKeyText((unsigned char *)e->hash.key), (int) e->lock_count); + e->lastref = squid_curtime; + storeEntryReferenced(e); +} + +void +storeReleaseRequest(StoreEntry * e) +{ + if (EBIT_TEST(e->flags, RELEASE_REQUEST)) + return; + debug(20, 3) ("storeReleaseRequest: '%s'\n", storeKeyText((unsigned char *)e->hash.key)); + EBIT_SET(e->flags, RELEASE_REQUEST); + /* + * Clear cachable flag here because we might get called before + * anyone else even looks at the cachability flag. Also, this + * prevents httpMakePublic from really setting a public key. + */ + EBIT_CLR(e->flags, ENTRY_CACHABLE); + storeSetPrivateKey(e); +} + +/* unlock object, return -1 if object get released after unlock + * otherwise lock_count */ +int +storeUnlockObject(StoreEntry * e) +{ + e->lock_count--; + debug(20, 3) ("storeUnlockObject: key '%s' count=%d\n", + storeKeyText((unsigned char *)e->hash.key), e->lock_count); + if (e->lock_count) + return (int) e->lock_count; + if (e->store_status == STORE_PENDING) + EBIT_SET(e->flags, RELEASE_REQUEST); + assert(storePendingNClients(e) == 0); + if (EBIT_TEST(e->flags, RELEASE_REQUEST)) + storeRelease(e); + else if (storeKeepInMemory(e)) { + storeEntryDereferenced(e); + storeSetMemStatus(e, IN_MEMORY); + requestUnlink(e->mem_obj->request); + e->mem_obj->request = NULL; + } else { + storePurgeMem(e); + storeEntryDereferenced(e); + if (EBIT_TEST(e->flags, KEY_PRIVATE)) + debug(20, 1) ("WARNING: %s:%d: found KEY_PRIVATE\n", __FILE__, __LINE__); + } + return 0; +} + +/* Lookup an object in the cache. + * return just a reference to object, don't start swapping in yet. */ +StoreEntry * +storeGet(const cache_key * key) +{ + void *p; + PROF_start(storeGet); + debug(20, 3) ("storeGet: looking up %s\n", storeKeyText(key)); + p = hash_lookup(store_table, key); + PROF_stop(storeGet); + return (StoreEntry *) p; +} + +StoreEntry * +storeGetPublic(const char *uri, const method_t method) +{ + return storeGet(storeKeyPublic(uri, method)); +} + +StoreEntry * +storeGetPublicByRequestMethod(request_t * req, const method_t method) +{ + return storeGet(storeKeyPublicByRequestMethod(req, method)); +} + +StoreEntry * +storeGetPublicByRequest(request_t * req) +{ + StoreEntry *e = storeGetPublicByRequestMethod(req, req->method); + if (e == NULL && req->method == METHOD_HEAD) + /* We can generate a HEAD reply from a cached GET object */ + e = storeGetPublicByRequestMethod(req, METHOD_GET); + return e; +} + +static int +getKeyCounter(void) +{ + static int key_counter = 0; + if (++key_counter < 0) + key_counter = 1; + return key_counter; +} + +void +storeSetPrivateKey(StoreEntry * e) +{ + const cache_key *newkey; + MemObject *mem = e->mem_obj; + if (e->hash.key && EBIT_TEST(e->flags, KEY_PRIVATE)) + return; /* is already private */ + if (e->hash.key) { + if (e->swap_filen > -1) + storeDirSwapLog(e, SWAP_LOG_DEL); + storeHashDelete(e); + } + if (mem != NULL) { + mem->id = getKeyCounter(); + newkey = storeKeyPrivate(mem->url, mem->method, mem->id); + } else { + newkey = storeKeyPrivate("JUNK", METHOD_NONE, getKeyCounter()); + } + assert(hash_lookup(store_table, newkey) == NULL); + EBIT_SET(e->flags, KEY_PRIVATE); + storeHashInsert(e, newkey); +} + +void +storeSetPublicKey(StoreEntry * e) +{ + StoreEntry *e2 = NULL; + const cache_key *newkey; + MemObject *mem = e->mem_obj; + if (e->hash.key && !EBIT_TEST(e->flags, KEY_PRIVATE)) + return; /* is already public */ + assert(mem); + /* + * We can't make RELEASE_REQUEST objects public. Depending on + * when RELEASE_REQUEST gets set, we might not be swapping out + * the object. If we're not swapping out, then subsequent + * store clients won't be able to access object data which has + * been freed from memory. + * + * If RELEASE_REQUEST is set, then ENTRY_CACHABLE should not + * be set, and storeSetPublicKey() should not be called. + */ +#if MORE_DEBUG_OUTPUT + if (EBIT_TEST(e->flags, RELEASE_REQUEST)) + debug(20, 1) ("assertion failed: RELEASE key %s, url %s\n", + e->hash.key, mem->url); +#endif + assert(!EBIT_TEST(e->flags, RELEASE_REQUEST)); + if (mem->request) { + StoreEntry *pe; + request_t *request = mem->request; + if (!mem->vary_headers) { + /* First handle the case where the object no longer varies */ + safe_free(request->vary_headers); + } else { + if (request->vary_headers && strcmp(request->vary_headers, mem->vary_headers) != 0) { + /* Oops.. the variance has changed. Kill the base object + * to record the new variance key + */ + safe_free(request->vary_headers); /* free old "bad" variance key */ + pe = storeGetPublic(mem->url, mem->method); + if (pe) + storeRelease(pe); + } + /* Make sure the request knows the variance status */ + if (!request->vary_headers) { + const char *vary = httpMakeVaryMark(request, mem->reply); + if (vary) + request->vary_headers = xstrdup(vary); + } + } + if (mem->vary_headers && !storeGetPublic(mem->url, mem->method)) { + /* Create "vary" base object */ + http_version_t version; + String vary; + pe = storeCreateEntry(mem->url, mem->log_url, request->flags, request->method); + httpBuildVersion(&version, 1, 0); + httpReplySetHeaders(pe->mem_obj->reply, version, HTTP_OK, "Internal marker object", "x-squid-internal/vary", -1, -1, squid_curtime + 100000); + vary = httpHeaderGetList(&mem->reply->header, HDR_VARY); + if (strBuf(vary)) { + httpHeaderPutStr(&pe->mem_obj->reply->header, HDR_VARY, strBuf(vary)); + stringClean(&vary); + } +#if X_ACCELERATOR_VARY + vary = httpHeaderGetList(&mem->reply->header, HDR_X_ACCELERATOR_VARY); + if (strBuf(vary)) { + httpHeaderPutStr(&pe->mem_obj->reply->header, HDR_X_ACCELERATOR_VARY, strBuf(vary)); + stringClean(&vary); + } +#endif + storeSetPublicKey(pe); + httpReplySwapOut(pe->mem_obj->reply, pe); + storeBufferFlush(pe); + storeTimestampsSet(pe); + storeComplete(pe); + storeUnlockObject(pe); + } + newkey = storeKeyPublicByRequest(mem->request); + } else + newkey = storeKeyPublic(mem->url, mem->method); + if ((e2 = (StoreEntry *) hash_lookup(store_table, newkey))) { + debug(20, 3) ("storeSetPublicKey: Making old '%s' private.\n", mem->url); + storeSetPrivateKey(e2); + storeRelease(e2); + if (mem->request) + newkey = storeKeyPublicByRequest(mem->request); + else + newkey = storeKeyPublic(mem->url, mem->method); + } + if (e->hash.key) + storeHashDelete(e); + EBIT_CLR(e->flags, KEY_PRIVATE); + storeHashInsert(e, newkey); + if (e->swap_filen > -1) + storeDirSwapLog(e, SWAP_LOG_ADD); +} + +StoreEntry * +storeCreateEntry(const char *url, const char *log_url, request_flags flags, method_t method) +{ + StoreEntry *e = NULL; + MemObject *mem = NULL; + debug(20, 3) ("storeCreateEntry: '%s'\n", url); + + e = new_StoreEntry(STORE_ENTRY_WITH_MEMOBJ, url, log_url); + e->lock_count = 1; /* Note lock here w/o calling storeLock() */ + mem = e->mem_obj; + mem->method = method; + if (neighbors_do_private_keys || !flags.hierarchical) + storeSetPrivateKey(e); + else + storeSetPublicKey(e); + if (flags.cachable) { + EBIT_SET(e->flags, ENTRY_CACHABLE); + EBIT_CLR(e->flags, RELEASE_REQUEST); + } else { + EBIT_CLR(e->flags, ENTRY_CACHABLE); + storeReleaseRequest(e); + } + e->store_status = STORE_PENDING; + storeSetMemStatus(e, NOT_IN_MEMORY); + e->swap_status = SWAPOUT_NONE; + e->swap_filen = -1; + e->swap_dirn = -1; + e->refcount = 0; + e->lastref = squid_curtime; + e->timestamp = -1; /* set in storeTimestampsSet() */ + e->ping_status = PING_NONE; + EBIT_SET(e->flags, ENTRY_VALIDATED); + return e; +} + +/* Mark object as expired */ +void +storeExpireNow(StoreEntry * e) +{ + debug(20, 3) ("storeExpireNow: '%s'\n", storeKeyText((unsigned char *)e->hash.key)); + e->expires = squid_curtime; +} + +/* Append incoming data from a primary server to an entry. */ +void +storeAppend(StoreEntry * e, const char *buf, int len) +{ + MemObject *mem = e->mem_obj; + assert(mem != NULL); + assert(len >= 0); + assert(e->store_status == STORE_PENDING); + if (len) { + debug(20, 5) ("storeAppend: appending %d bytes for '%s'\n", + len, + storeKeyText((unsigned char *)e->hash.key)); + storeGetMemSpace(len); + stmemAppend(&mem->data_hdr, buf, len); + mem->inmem_hi += len; + } + if (EBIT_TEST(e->flags, DELAY_SENDING)) + return; + InvokeHandlers(e); + storeSwapOut(e); +} + +void +#if STDC_HEADERS +storeAppendPrintf(StoreEntry * e, const char *fmt,...) +#else +storeAppendPrintf(va_alist) + va_dcl +#endif +{ +#if STDC_HEADERS + va_list args; + va_start(args, fmt); +#else + va_list args; + StoreEntry *e = NULL; + const char *fmt = NULL; + va_start(args); + e = va_arg(args, StoreEntry *); + fmt = va_arg(args, char *); +#endif + storeAppendVPrintf(e, fmt, args); + va_end(args); +} + +/* used be storeAppendPrintf and Packer */ +void +storeAppendVPrintf(StoreEntry * e, const char *fmt, va_list vargs) +{ + LOCAL_ARRAY(char, buf, 4096); + buf[0] = '\0'; + vsnprintf(buf, 4096, fmt, vargs); + storeAppend(e, buf, strlen(buf)); +} + +struct _store_check_cachable_hist { + struct { + int non_get; + int not_entry_cachable; + int release_request; + int wrong_content_length; + int negative_cached; + int too_big; + int too_small; + int private_key; + int too_many_open_files; + int too_many_open_fds; + } no; + struct { + int Default; + } yes; +} store_check_cachable_hist; + +int +storeTooManyDiskFilesOpen(void) +{ + if (Config.max_open_disk_fds == 0) + return 0; + if (store_open_disk_fd > Config.max_open_disk_fds) + return 1; + return 0; +} + +static int +storeCheckTooSmall(StoreEntry * e) +{ + MemObject *mem = e->mem_obj; + if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) + return 0; + if (STORE_OK == e->store_status) + if (mem->object_sz < Config.Store.minObjectSize) + return 1; + if (mem->reply->content_length > -1) + if (mem->reply->content_length < (int) Config.Store.minObjectSize) + return 1; + return 0; +} + +int +storeCheckCachable(StoreEntry * e) +{ +#if CACHE_ALL_METHODS + if (e->mem_obj->method != METHOD_GET) { + debug(20, 2) ("storeCheckCachable: NO: non-GET method\n"); + store_check_cachable_hist.no.non_get++; + } else +#endif + if (!EBIT_TEST(e->flags, ENTRY_CACHABLE)) { + debug(20, 2) ("storeCheckCachable: NO: not cachable\n"); + store_check_cachable_hist.no.not_entry_cachable++; + } else if (EBIT_TEST(e->flags, RELEASE_REQUEST)) { + debug(20, 2) ("storeCheckCachable: NO: release requested\n"); + store_check_cachable_hist.no.release_request++; + } else if (e->store_status == STORE_OK && EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) { + debug(20, 2) ("storeCheckCachable: NO: wrong content-length\n"); + store_check_cachable_hist.no.wrong_content_length++; + } else if (EBIT_TEST(e->flags, ENTRY_NEGCACHED)) { + debug(20, 3) ("storeCheckCachable: NO: negative cached\n"); + store_check_cachable_hist.no.negative_cached++; + return 0; /* avoid release call below */ + } else if ((e->mem_obj->reply->content_length > 0 && + e->mem_obj->reply->content_length > Config.Store.maxObjectSize) || + e->mem_obj->inmem_hi > Config.Store.maxObjectSize) { + debug(20, 2) ("storeCheckCachable: NO: too big\n"); + store_check_cachable_hist.no.too_big++; + } else if (e->mem_obj->reply->content_length > (int) Config.Store.maxObjectSize) { + debug(20, 2) ("storeCheckCachable: NO: too big\n"); + store_check_cachable_hist.no.too_big++; + } else if (storeCheckTooSmall(e)) { + debug(20, 2) ("storeCheckCachable: NO: too small\n"); + store_check_cachable_hist.no.too_small++; + } else if (EBIT_TEST(e->flags, KEY_PRIVATE)) { + debug(20, 3) ("storeCheckCachable: NO: private key\n"); + store_check_cachable_hist.no.private_key++; + } else if (e->swap_status != SWAPOUT_NONE) { + /* + * here we checked the swap_status because the remaining + * cases are only relevant only if we haven't started swapping + * out the object yet. + */ + return 1; + } else if (storeTooManyDiskFilesOpen()) { + debug(20, 2) ("storeCheckCachable: NO: too many disk files open\n"); + store_check_cachable_hist.no.too_many_open_files++; + } else if (fdNFree() < RESERVED_FD) { + debug(20, 2) ("storeCheckCachable: NO: too many FD's open\n"); + store_check_cachable_hist.no.too_many_open_fds++; + } else { + store_check_cachable_hist.yes.Default++; + return 1; + } + storeReleaseRequest(e); + EBIT_CLR(e->flags, ENTRY_CACHABLE); + return 0; +} + +static void +storeCheckCachableStats(StoreEntry * sentry) +{ + storeAppendPrintf(sentry, "Category\t Count\n"); + + storeAppendPrintf(sentry, "no.non_get\t%d\n", + store_check_cachable_hist.no.non_get); + storeAppendPrintf(sentry, "no.not_entry_cachable\t%d\n", + store_check_cachable_hist.no.not_entry_cachable); + storeAppendPrintf(sentry, "no.release_request\t%d\n", + store_check_cachable_hist.no.release_request); + storeAppendPrintf(sentry, "no.wrong_content_length\t%d\n", + store_check_cachable_hist.no.wrong_content_length); + storeAppendPrintf(sentry, "no.negative_cached\t%d\n", + store_check_cachable_hist.no.negative_cached); + storeAppendPrintf(sentry, "no.too_big\t%d\n", + store_check_cachable_hist.no.too_big); + storeAppendPrintf(sentry, "no.too_small\t%d\n", + store_check_cachable_hist.no.too_small); + storeAppendPrintf(sentry, "no.private_key\t%d\n", + store_check_cachable_hist.no.private_key); + storeAppendPrintf(sentry, "no.too_many_open_files\t%d\n", + store_check_cachable_hist.no.too_many_open_files); + storeAppendPrintf(sentry, "no.too_many_open_fds\t%d\n", + store_check_cachable_hist.no.too_many_open_fds); + storeAppendPrintf(sentry, "yes.default\t%d\n", + store_check_cachable_hist.yes.Default); +} + +/* Complete transfer into the local cache. */ +void +storeComplete(StoreEntry * e) +{ + debug(20, 3) ("storeComplete: '%s'\n", storeKeyText((unsigned char *)e->hash.key)); + if (e->store_status != STORE_PENDING) { + /* + * if we're not STORE_PENDING, then probably we got aborted + * and there should be NO clients on this entry + */ + assert(EBIT_TEST(e->flags, ENTRY_ABORTED)); + assert(e->mem_obj->nclients == 0); + return; + } + e->mem_obj->object_sz = e->mem_obj->inmem_hi; + e->store_status = STORE_OK; + assert(e->mem_status == NOT_IN_MEMORY); + if (!storeEntryValidLength(e)) { + EBIT_SET(e->flags, ENTRY_BAD_LENGTH); + storeReleaseRequest(e); + } +#if USE_CACHE_DIGESTS + if (e->mem_obj->request) + e->mem_obj->request->hier.store_complete_stop = current_time; +#endif + /* + * We used to call InvokeHandlers, then storeSwapOut. However, + * Madhukar Reddy reported that + * responses without content length would sometimes get released + * in client_side, thinking that the response is incomplete. + */ + storeSwapOut(e); + InvokeHandlers(e); +} + +/* + * Someone wants to abort this transfer. Set the reason in the + * request structure, call the server-side callback and mark the + * entry for releasing + */ +void +storeAbort(StoreEntry * e) +{ + MemObject *mem = e->mem_obj; + assert(e->store_status == STORE_PENDING); + assert(mem != NULL); + debug(20, 6) ("storeAbort: %s\n", storeKeyText((unsigned char *)e->hash.key)); + storeLockObject(e); /* lock while aborting */ + storeNegativeCache(e); + storeReleaseRequest(e); + EBIT_SET(e->flags, ENTRY_ABORTED); + storeSetMemStatus(e, NOT_IN_MEMORY); + e->store_status = STORE_OK; + /* + * We assign an object length here. The only other place we assign + * the object length is in storeComplete() + */ + mem->object_sz = mem->inmem_hi; + /* Notify the server side */ + if (mem->abort.callback) { + eventAdd("mem->abort.callback", + mem->abort.callback, + mem->abort.data, + 0.0, + 0); + mem->abort.callback = NULL; + mem->abort.data = NULL; + } + /* Notify the client side */ + InvokeHandlers(e); + /* Close any swapout file */ + storeSwapOutFileClose(e); + storeUnlockObject(e); /* unlock */ +} + +/* Clear Memory storage to accommodate the given object len */ +static void +storeGetMemSpace(int size) +{ + StoreEntry *e = NULL; + int released = 0; + static time_t last_check = 0; + int pages_needed; + RemovalPurgeWalker *walker; + if (squid_curtime == last_check) + return; + last_check = squid_curtime; + pages_needed = (size / SM_PAGE_SIZE) + 1; + if (memInUse(MEM_MEM_NODE) + pages_needed < store_pages_max) + return; + debug(20, 2) ("storeGetMemSpace: Starting, need %d pages\n", pages_needed); + /* XXX what to set as max_scan here? */ + walker = mem_policy->PurgeInit(mem_policy, 100000); + while ((e = walker->Next(walker))) { + storePurgeMem(e); + released++; + if (memInUse(MEM_MEM_NODE) + pages_needed < store_pages_max) + break; + } + walker->Done(walker); + debug(20, 3) ("storeGetMemSpace stats:\n"); + debug(20, 3) (" %6d HOT objects\n", hot_obj_count); + debug(20, 3) (" %6d were released\n", released); +} + +/* The maximum objects to scan for maintain storage space */ +#define MAINTAIN_MAX_SCAN 1024 +#define MAINTAIN_MAX_REMOVE 64 + +/* + * This routine is to be called by main loop in main.c. + * It removes expired objects on only one bucket for each time called. + * returns the number of objects removed + * + * This should get called 1/s from main(). + */ +void +storeMaintainSwapSpace(void *datanotused) +{ + int i; + SwapDir *SD; + static time_t last_warn_time = 0; + + PROF_start(storeMaintainSwapSpace); + /* walk each fs */ + for (i = 0; i < Config.cacheSwap.n_configured; i++) { + /* call the maintain function .. */ + SD = INDEXSD(i); + /* XXX FixMe: This should be done "in parallell" on the different + * cache_dirs, not one at a time. + */ + if (SD->maintainfs != NULL) + SD->maintainfs(SD); + } + if (store_swap_size > Config.Swap.maxSize) { + if (squid_curtime - last_warn_time > 10) { + debug(20, 0) ("WARNING: Disk space over limit: %ld KB > %ld KB\n", + (long int) store_swap_size, (long int) Config.Swap.maxSize); + last_warn_time = squid_curtime; + } + } + /* Reregister a maintain event .. */ + eventAdd("MaintainSwapSpace", storeMaintainSwapSpace, NULL, 1.0, 1); + PROF_stop(storeMaintainSwapSpace); +} + + +/* release an object from a cache */ +void +storeRelease(StoreEntry * e) +{ + PROF_start(storeRelease); + debug(20, 3) ("storeRelease: Releasing: '%s'\n", storeKeyText((unsigned char *)e->hash.key)); + /* If, for any reason we can't discard this object because of an + * outstanding request, mark it for pending release */ + if (storeEntryLocked(e)) { + storeExpireNow(e); + debug(20, 3) ("storeRelease: Only setting RELEASE_REQUEST bit\n"); + storeReleaseRequest(e); + PROF_stop(storeRelease); + return; + } + if (store_dirs_rebuilding && e->swap_filen > -1) { + storeSetPrivateKey(e); + if (e->mem_obj) { + storeSetMemStatus(e, NOT_IN_MEMORY); + destroy_MemObject(e); + } + if (e->swap_filen > -1) { + /* + * Fake a call to storeLockObject(). When rebuilding is done, + * we'll just call storeUnlockObject() on these. + */ + e->lock_count++; + EBIT_SET(e->flags, RELEASE_REQUEST); + stackPush(&LateReleaseStack, e); + PROF_stop(storeRelease); + return; + } else { + destroy_StoreEntry(e); + } + } + storeLog(STORE_LOG_RELEASE, e); + if (e->swap_filen > -1) { + storeUnlink(e); + if (e->swap_status == SWAPOUT_DONE) + if (EBIT_TEST(e->flags, ENTRY_VALIDATED)) + storeDirUpdateSwapSize(&Config.cacheSwap.swapDirs[e->swap_dirn], e->swap_file_sz, -1); + if (!EBIT_TEST(e->flags, KEY_PRIVATE)) + storeDirSwapLog(e, SWAP_LOG_DEL); +#if 0 + /* From 2.4. I think we do this in storeUnlink? */ + storeSwapFileNumberSet(e, -1); +#endif + } + storeSetMemStatus(e, NOT_IN_MEMORY); + destroy_StoreEntry(e); + PROF_stop(storeRelease); +} + +static void +storeLateRelease(void *unused) +{ + StoreEntry *e; + int i; + static int n = 0; + if (store_dirs_rebuilding) { + eventAdd("storeLateRelease", storeLateRelease, NULL, 1.0, 1); + return; + } + for (i = 0; i < 10; i++) { + e = static_cast(stackPop(&LateReleaseStack)); + if (e == NULL) { + /* done! */ + debug(20, 1) ("storeLateRelease: released %d objects\n", n); + return; + } + storeUnlockObject(e); + n++; + } + eventAdd("storeLateRelease", storeLateRelease, NULL, 0.0, 1); +} + +/* return 1 if a store entry is locked */ +int +storeEntryLocked(const StoreEntry * e) +{ + if (e->lock_count) + return 1; + if (e->swap_status == SWAPOUT_WRITING) + return 1; + if (e->store_status == STORE_PENDING) + return 1; + /* + * SPECIAL, PUBLIC entries should be "locked" + */ + if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) + if (!EBIT_TEST(e->flags, KEY_PRIVATE)) + return 1; + return 0; +} + +static int +storeEntryValidLength(const StoreEntry * e) +{ + int diff; + const HttpReply *reply; + assert(e->mem_obj != NULL); + reply = e->mem_obj->reply; + debug(20, 3) ("storeEntryValidLength: Checking '%s'\n", storeKeyText((unsigned char *)e->hash.key)); + debug(20, 5) ("storeEntryValidLength: object_len = %d\n", + objectLen(e)); + debug(20, 5) ("storeEntryValidLength: hdr_sz = %d\n", + reply->hdr_sz); + debug(20, 5) ("storeEntryValidLength: content_length = %d\n", + reply->content_length); + if (reply->content_length < 0) { + debug(20, 5) ("storeEntryValidLength: Unspecified content length: %s\n", + storeKeyText((unsigned char *)e->hash.key)); + return 1; + } + if (reply->hdr_sz == 0) { + debug(20, 5) ("storeEntryValidLength: Zero header size: %s\n", + storeKeyText((unsigned char *)e->hash.key)); + return 1; + } + if (e->mem_obj->method == METHOD_HEAD) { + debug(20, 5) ("storeEntryValidLength: HEAD request: %s\n", + storeKeyText((unsigned char *)e->hash.key)); + return 1; + } + if (reply->sline.status == HTTP_NOT_MODIFIED) + return 1; + if (reply->sline.status == HTTP_NO_CONTENT) + return 1; + diff = reply->hdr_sz + reply->content_length - objectLen(e); + if (diff == 0) + return 1; + debug(20, 3) ("storeEntryValidLength: %d bytes too %s; '%s'\n", + diff < 0 ? -diff : diff, + diff < 0 ? "big" : "small", + storeKeyText((unsigned char *)e->hash.key)); + return 0; +} + +static void +storeInitHashValues(void) +{ + long int i; + /* Calculate size of hash table (maximum currently 64k buckets). */ + i = Config.Swap.maxSize / Config.Store.avgObjectSize; + debug(20, 1) ("Swap maxSize %ld KB, estimated %ld objects\n", + (long int) Config.Swap.maxSize, i); + i /= Config.Store.objectsPerBucket; + debug(20, 1) ("Target number of buckets: %ld\n", i); + /* ideally the full scan period should be configurable, for the + * moment it remains at approximately 24 hours. */ + store_hash_buckets = storeKeyHashBuckets(i); + debug(20, 1) ("Using %d Store buckets\n", store_hash_buckets); + debug(20, 1) ("Max Mem size: %ld KB\n", (long int) Config.memMaxSize >> 10); + debug(20, 1) ("Max Swap size: %ld KB\n", (long int) Config.Swap.maxSize); +} + +void +storeInit(void) +{ + storeKeyInit(); + storeInitHashValues(); + store_table = hash_create(storeKeyHashCmp, + store_hash_buckets, storeKeyHashHash); + mem_policy = createRemovalPolicy(Config.memPolicy); + storeDigestInit(); + storeLogOpen(); + stackInit(&LateReleaseStack); + eventAdd("storeLateRelease", storeLateRelease, NULL, 1.0, 1); + storeDirInit(); + storeRebuildStart(); + cachemgrRegister("storedir", + "Store Directory Stats", + storeDirStats, 0, 1); + cachemgrRegister("store_check_cachable_stats", + "storeCheckCachable() Stats", + storeCheckCachableStats, 0, 1); + cachemgrRegister("store_io", + "Store IO Interface Stats", + storeIOStats, 0, 1); +} + +void +storeConfigure(void) +{ + store_swap_high = (long) (((float) Config.Swap.maxSize * + (float) Config.Swap.highWaterMark) / (float) 100); + store_swap_low = (long) (((float) Config.Swap.maxSize * + (float) Config.Swap.lowWaterMark) / (float) 100); + store_pages_max = Config.memMaxSize / SM_PAGE_SIZE; +} + +static int +storeKeepInMemory(const StoreEntry * e) +{ + MemObject *mem = e->mem_obj; + if (mem == NULL) + return 0; + if (mem->data_hdr.head == NULL) + return 0; + return mem->inmem_lo == 0; +} + +int +storeCheckNegativeHit(StoreEntry * e) +{ + if (!EBIT_TEST(e->flags, ENTRY_NEGCACHED)) + return 0; + if (e->expires <= squid_curtime) + return 0; + if (e->store_status != STORE_OK) + return 0; + return 1; +} + +void +storeNegativeCache(StoreEntry * e) +{ + e->expires = squid_curtime + Config.negativeTtl; + EBIT_SET(e->flags, ENTRY_NEGCACHED); +} + +void +storeFreeMemory(void) +{ + hashFreeItems(store_table, destroy_StoreEntry); + hashFreeMemory(store_table); + store_table = NULL; +#if USE_CACHE_DIGESTS + if (store_digest) + cacheDigestDestroy(store_digest); +#endif + store_digest = NULL; +} + +int +expiresMoreThan(time_t expires, time_t when) +{ + if (expires < 0) /* No Expires given */ + return 1; + return (expires > (squid_curtime + when)); +} + +int +storeEntryValidToSend(StoreEntry * e) +{ + if (EBIT_TEST(e->flags, RELEASE_REQUEST)) + return 0; + if (EBIT_TEST(e->flags, ENTRY_NEGCACHED)) + if (e->expires <= squid_curtime) + return 0; + if (EBIT_TEST(e->flags, ENTRY_ABORTED)) + return 0; + return 1; +} + +void +storeTimestampsSet(StoreEntry * entry) +{ + const HttpReply *reply = entry->mem_obj->reply; + time_t served_date = reply->date; + int age = httpHeaderGetInt(&reply->header, HDR_AGE); + /* + * The timestamp calculations below tries to mimic the properties + * of the age calculation in RFC2616 section 13.2.3. The implementaion + * isn't complete, and the most notable exception from the RFC is that + * this does not account for response_delay, but it probably does + * not matter much as this is calculated immediately when the headers + * are received, not when the whole response has been received. + */ + /* make sure that 0 <= served_date <= squid_curtime */ + if (served_date < 0 || served_date > squid_curtime) + served_date = squid_curtime; + /* + * Compensate with Age header if origin server clock is ahead + * of us and there is a cache in between us and the origin + * server. But DONT compensate if the age value is larger than + * squid_curtime because it results in a negative served_date. + */ + if (age > squid_curtime - served_date) + if (squid_curtime > age) + served_date = squid_curtime - age; + entry->expires = reply->expires; + entry->lastmod = reply->last_modified; + entry->timestamp = served_date; +} + +void +storeRegisterAbort(StoreEntry * e, STABH * cb, void *data) +{ + MemObject *mem = e->mem_obj; + assert(mem); + assert(mem->abort.callback == NULL); + mem->abort.callback = cb; + mem->abort.data = data; +} + +void +storeUnregisterAbort(StoreEntry * e) +{ + MemObject *mem = e->mem_obj; + assert(mem); + mem->abort.callback = NULL; +} + +void +storeMemObjectDump(MemObject * mem) +{ + debug(20, 1) ("MemObject->data.head: %p\n", + mem->data_hdr.head); + debug(20, 1) ("MemObject->data.tail: %p\n", + mem->data_hdr.tail); + debug(20, 1) ("MemObject->data.origin_offset: %d\n", + mem->data_hdr.origin_offset); + debug(20, 1) ("MemObject->start_ping: %d.%06d\n", + (int) mem->start_ping.tv_sec, + (int) mem->start_ping.tv_usec); + debug(20, 1) ("MemObject->inmem_hi: %d\n", + (int) mem->inmem_hi); + debug(20, 1) ("MemObject->inmem_lo: %d\n", + (int) mem->inmem_lo); + debug(20, 1) ("MemObject->nclients: %d\n", + mem->nclients); + debug(20, 1) ("MemObject->reply: %p\n", + mem->reply); + debug(20, 1) ("MemObject->request: %p\n", + mem->request); + debug(20, 1) ("MemObject->log_url: %p %s\n", + mem->log_url, + checkNullString(mem->log_url)); +} + +void +storeEntryDump(const StoreEntry * e, int l) +{ + debug(20, l) ("StoreEntry->key: %s\n", storeKeyText((unsigned char *)e->hash.key)); + debug(20, l) ("StoreEntry->next: %p\n", e->hash.next); + debug(20, l) ("StoreEntry->mem_obj: %p\n", e->mem_obj); + debug(20, l) ("StoreEntry->timestamp: %d\n", (int) e->timestamp); + debug(20, l) ("StoreEntry->lastref: %d\n", (int) e->lastref); + debug(20, l) ("StoreEntry->expires: %d\n", (int) e->expires); + debug(20, l) ("StoreEntry->lastmod: %d\n", (int) e->lastmod); + debug(20, l) ("StoreEntry->swap_file_sz: %d\n", (int) e->swap_file_sz); + debug(20, l) ("StoreEntry->refcount: %d\n", e->refcount); + debug(20, l) ("StoreEntry->flags: %s\n", storeEntryFlags(e)); + debug(20, l) ("StoreEntry->swap_dirn: %d\n", (int) e->swap_dirn); + debug(20, l) ("StoreEntry->swap_filen: %d\n", (int) e->swap_filen); + debug(20, l) ("StoreEntry->lock_count: %d\n", (int) e->lock_count); + debug(20, l) ("StoreEntry->mem_status: %d\n", (int) e->mem_status); + debug(20, l) ("StoreEntry->ping_status: %d\n", (int) e->ping_status); + debug(20, l) ("StoreEntry->store_status: %d\n", (int) e->store_status); + debug(20, l) ("StoreEntry->swap_status: %d\n", (int) e->swap_status); +} + +/* + * NOTE, this function assumes only two mem states + */ +void +storeSetMemStatus(StoreEntry * e, int new_status) +{ + MemObject *mem = e->mem_obj; + if (new_status == e->mem_status) + return; + assert(mem != NULL); + if (new_status == IN_MEMORY) { + assert(mem->inmem_lo == 0); + if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) { + debug(20, 4) ("storeSetMemStatus: not inserting special %s into policy\n", + mem->url); + } else { + mem_policy->Add(mem_policy, e, &mem->repl); + debug(20, 4) ("storeSetMemStatus: inserted mem node %s\n", + mem->url); + } + hot_obj_count++; + } else { + if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) { + debug(20, 4) ("storeSetMemStatus: special entry %s\n", + mem->url); + } else { + mem_policy->Remove(mem_policy, e, &mem->repl); + debug(20, 4) ("storeSetMemStatus: removed mem node %s\n", + mem->url); + } + hot_obj_count--; + } + e->mem_status = new_status; +} + +const char * +storeUrl(const StoreEntry * e) +{ + if (e == NULL) + return "[null_entry]"; + else if (e->mem_obj == NULL) + return "[null_mem_obj]"; + else + return e->mem_obj->url; +} + +void +storeCreateMemObject(StoreEntry * e, const char *url, const char *log_url) +{ + if (e->mem_obj) + return; + e->mem_obj = new_MemObject(url, log_url); +} + +/* this just sets DELAY_SENDING */ +void +storeBuffer(StoreEntry * e) +{ + EBIT_SET(e->flags, DELAY_SENDING); +} + +/* this just clears DELAY_SENDING and Invokes the handlers */ +void +storeBufferFlush(StoreEntry * e) +{ + EBIT_CLR(e->flags, DELAY_SENDING); + InvokeHandlers(e); + storeSwapOut(e); +} + +int +objectLen(const StoreEntry * e) +{ + assert(e->mem_obj != NULL); + return e->mem_obj->object_sz; +} + +int +contentLen(const StoreEntry * e) +{ + assert(e->mem_obj != NULL); + assert(e->mem_obj->reply != NULL); + return e->mem_obj->object_sz - e->mem_obj->reply->hdr_sz; +} + +HttpReply * +storeEntryReply(StoreEntry * e) +{ + if (NULL == e) + return NULL; + if (NULL == e->mem_obj) + return NULL; + return e->mem_obj->reply; +} + +void +storeEntryReset(StoreEntry * e) +{ + MemObject *mem = e->mem_obj; + debug(20, 3) ("storeEntryReset: %s\n", storeUrl(e)); + assert(mem->swapout.sio == NULL); + stmemFree(&mem->data_hdr); + mem->inmem_hi = mem->inmem_lo = 0; + httpReplyDestroy(mem->reply); + mem->reply = httpReplyCreate(); + e->expires = e->lastmod = e->timestamp = -1; +} + +/* + * storeFsInit + * + * This routine calls the SETUP routine for each fs type. + * I don't know where the best place for this is, and I'm not going to shuffle + * around large chunks of code right now (that can be done once its working.) + */ +void +storeFsInit(void) +{ + storeReplSetup(); + storeFsSetup(); +} + + +/* + * similar to above, but is called when a graceful shutdown is to occur + * of each fs module. + */ +void +storeFsDone(void) +{ + int i = 0; + + while (storefs_list[i].typestr != NULL) { + storefs_list[i].donefunc(); + i++; + } +} + +/* + * called to add another store fs module + */ +void +storeFsAdd(const char *type, STSETUP * setup) +{ + int i; + /* find the number of currently known storefs types */ + for (i = 0; storefs_list && storefs_list[i].typestr; i++) { + assert(strcmp(storefs_list[i].typestr, type) != 0); + } + /* add the new type */ + storefs_list = static_cast(xrealloc(storefs_list, (i + 2) * sizeof(storefs_entry_t))); + memset(&storefs_list[i + 1], 0, sizeof(storefs_entry_t)); + storefs_list[i].typestr = type; + /* Call the FS to set up capabilities and initialize the FS driver */ + setup(&storefs_list[i]); +} + +/* + * called to add another store removal policy module + */ +void +storeReplAdd(const char *type, REMOVALPOLICYCREATE * create) +{ + int i; + /* find the number of currently known repl types */ + for (i = 0; storerepl_list && storerepl_list[i].typestr; i++) { + assert(strcmp(storerepl_list[i].typestr, type) != 0); + } + /* add the new type */ + storerepl_list = static_cast(xrealloc(storerepl_list, (i + 2) * sizeof(storerepl_entry_t))); + memset(&storerepl_list[i + 1], 0, sizeof(storerepl_entry_t)); + storerepl_list[i].typestr = type; + storerepl_list[i].create = create; +} + +/* + * Create a removal policy instance + */ +RemovalPolicy * +createRemovalPolicy(RemovalPolicySettings * settings) +{ + storerepl_entry_t *r; + for (r = storerepl_list; r && r->typestr; r++) { + if (strcmp(r->typestr, settings->type) == 0) + return r->create(settings->args); + } + debug(20, 1) ("ERROR: Unknown policy %s\n", settings->type); + debug(20, 1) ("ERROR: Be sure to have set cache_replacement_policy\n"); + debug(20, 1) ("ERROR: and memory_replacement_policy in squid.conf!\n"); + fatalf("ERROR: Unknown policy %s\n", settings->type); + return NULL; /* NOTREACHED */ +} + +#if 0 +void +storeSwapFileNumberSet(StoreEntry * e, sfileno filn) +{ + if (e->swap_file_number == filn) + return; + if (filn < 0) { + assert(-1 == filn); + storeDirMapBitReset(e->swap_file_number); + storeDirLRUDelete(e); + e->swap_file_number = -1; + } else { + assert(-1 == e->swap_file_number); + storeDirMapBitSet(e->swap_file_number = filn); + storeDirLRUAdd(e); + } +} +#endif Index: squid/src/store_client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_client.c,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -u -r1.16 -r1.16.2.1 --- squid/src/store_client.c 26 Sep 2002 21:46:06 -0000 1.16 +++ squid/src/store_client.c 4 Oct 2002 07:07:28 -0000 1.16.2.1 @@ -1,6 +1,6 @@ /* - * $Id: store_client.c,v 1.16 2002/09/26 21:46:06 squidadm Exp $ + * $Id: store_client.c,v 1.16.2.1 2002/10/04 07:07:28 rbcollins Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -35,6 +35,8 @@ #include "squid.h" #include "StoreClient.h" +#include "Store.h" + CBDATA_TYPE(store_client); Index: squid/src/store_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_digest.c,v retrieving revision 1.10 retrieving revision 1.10.44.1 diff -u -r1.10 -r1.10.44.1 --- squid/src/store_digest.c 24 Oct 2001 09:42:14 -0000 1.10 +++ squid/src/store_digest.c 4 Oct 2002 07:07:28 -0000 1.10.44.1 @@ -1,6 +1,6 @@ /* - * $Id: store_digest.c,v 1.10 2001/10/24 09:42:14 squidadm Exp $ + * $Id: store_digest.c,v 1.10.44.1 2002/10/04 07:07:28 rbcollins Exp $ * * DEBUG: section 71 Store Digest Manager * AUTHOR: Alex Rousskov @@ -41,6 +41,8 @@ */ #include "squid.h" +#include "Store.h" + #if USE_CACHE_DIGESTS Index: squid/src/store_dir.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_dir.c,v retrieving revision 1.20 retrieving revision 1.20.22.1 diff -u -r1.20 -r1.20.22.1 --- squid/src/store_dir.c 21 Mar 2002 11:44:04 -0000 1.20 +++ squid/src/store_dir.c 4 Oct 2002 07:07:28 -0000 1.20.22.1 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.c,v 1.20 2002/03/21 11:44:04 squidadm Exp $ + * $Id: store_dir.c,v 1.20.22.1 2002/10/04 07:07:28 rbcollins Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #if HAVE_STATVFS #if HAVE_SYS_STATVFS_H Index: squid/src/store_io.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_io.c,v retrieving revision 1.3 retrieving revision 1.3.44.1 diff -u -r1.3 -r1.3.44.1 --- squid/src/store_io.c 24 Oct 2001 09:42:14 -0000 1.3 +++ squid/src/store_io.c 4 Oct 2002 07:07:28 -0000 1.3.44.1 @@ -1,4 +1,6 @@ #include "squid.h" +#include "Store.h" + static struct { struct { Index: squid/src/store_log.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_log.c,v retrieving revision 1.7 retrieving revision 1.7.44.1 diff -u -r1.7 -r1.7.44.1 --- squid/src/store_log.c 18 Oct 2001 20:52:11 -0000 1.7 +++ squid/src/store_log.c 4 Oct 2002 07:07:29 -0000 1.7.44.1 @@ -1,6 +1,6 @@ /* - * $Id: store_log.c,v 1.7 2001/10/18 20:52:11 squidadm Exp $ + * $Id: store_log.c,v 1.7.44.1 2002/10/04 07:07:29 rbcollins Exp $ * * DEBUG: section 20 Storage Manager Logging Functions * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" static const char *storeLogTags[] = { Index: squid/src/store_modules.sh =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_modules.sh,v retrieving revision 1.2 retrieving revision 1.2.132.1 diff -u -r1.2 -r1.2.132.1 --- squid/src/store_modules.sh 21 Oct 2000 15:16:13 -0000 1.2 +++ squid/src/store_modules.sh 4 Oct 2002 07:07:29 -0000 1.2.132.1 @@ -3,6 +3,7 @@ echo " * do not edit" echo " */" echo "#include \"squid.h\"" +echo "#include \"Store.h\"" echo "" for module in "$@"; do echo "extern STSETUP storeFsSetup_${module};" Index: squid/src/store_rebuild.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_rebuild.c,v retrieving revision 1.9 retrieving revision 1.9.44.1 diff -u -r1.9 -r1.9.44.1 --- squid/src/store_rebuild.c 17 Oct 2001 12:42:59 -0000 1.9 +++ squid/src/store_rebuild.c 4 Oct 2002 07:07:29 -0000 1.9.44.1 @@ -1,6 +1,6 @@ /* - * $Id: store_rebuild.c,v 1.9 2001/10/17 12:42:59 squidadm Exp $ + * $Id: store_rebuild.c,v 1.9.44.1 2002/10/04 07:07:29 rbcollins Exp $ * * DEBUG: section 20 Store Rebuild Routines * AUTHOR: Duane Wessels @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" static struct _store_rebuild_data counts; static struct timeval rebuild_start; Index: squid/src/store_swapin.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_swapin.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -r1.7 -r1.7.2.1 --- squid/src/store_swapin.c 24 Sep 2002 10:59:16 -0000 1.7 +++ squid/src/store_swapin.c 4 Oct 2002 07:07:29 -0000 1.7.2.1 @@ -1,6 +1,6 @@ /* - * $Id: store_swapin.c,v 1.7 2002/09/24 10:59:16 rbcollins Exp $ + * $Id: store_swapin.c,v 1.7.2.1 2002/10/04 07:07:29 rbcollins Exp $ * * DEBUG: section 20 Storage Manager Swapin Functions * AUTHOR: Duane Wessels @@ -35,6 +35,7 @@ #include "squid.h" #include "StoreClient.h" +#include "Store.h" static STIOCB storeSwapInFileClosed; static STFNCB storeSwapInFileNotify; Index: squid/src/store_swapmeta.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_swapmeta.c,v retrieving revision 1.8 retrieving revision 1.8.44.1 diff -u -r1.8 -r1.8.44.1 --- squid/src/store_swapmeta.c 24 Oct 2001 09:42:14 -0000 1.8 +++ squid/src/store_swapmeta.c 4 Oct 2002 07:07:29 -0000 1.8.44.1 @@ -1,6 +1,6 @@ /* - * $Id: store_swapmeta.c,v 1.8 2001/10/24 09:42:14 squidadm Exp $ + * $Id: store_swapmeta.c,v 1.8.44.1 2002/10/04 07:07:29 rbcollins Exp $ * * DEBUG: section 20 Storage Manager Swapfile Metadata * AUTHOR: Kostas Anagnostakis @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" static tlv ** storeSwapTLVAdd(int type, const void *ptr, size_t len, tlv ** tail) Index: squid/src/store_swapout.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_swapout.c,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -u -r1.14 -r1.14.2.1 --- squid/src/store_swapout.c 24 Sep 2002 10:59:17 -0000 1.14 +++ squid/src/store_swapout.c 4 Oct 2002 07:07:29 -0000 1.14.2.1 @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.c,v 1.14 2002/09/24 10:59:17 rbcollins Exp $ + * $Id: store_swapout.c,v 1.14.2.1 2002/10/04 07:07:29 rbcollins Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -35,6 +35,7 @@ #include "squid.h" #include "StoreClient.h" +#include "Store.h" static off_t storeSwapOutObjectBytesOnDisk(const MemObject *); static void storeSwapOutStart(StoreEntry * e); Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.70.2.2 retrieving revision 1.70.2.3 diff -u -r1.70.2.2 -r1.70.2.3 --- squid/src/structs.h 3 Oct 2002 14:33:24 -0000 1.70.2.2 +++ squid/src/structs.h 4 Oct 2002 07:07:29 -0000 1.70.2.3 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.70.2.2 2002/10/03 14:33:24 rbcollins Exp $ + * $Id: structs.h,v 1.70.2.3 2002/10/04 07:07:29 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1395,28 +1395,6 @@ const char *vary_headers; }; -struct _StoreEntry { - hash_link hash; /* must be first */ - MemObject *mem_obj; - RemovalPolicyNode repl; - /* START OF ON-DISK STORE_META_STD TLV field */ - time_t timestamp; - time_t lastref; - time_t expires; - time_t lastmod; - size_t swap_file_sz; - u_short refcount; - u_short flags; - /* END OF ON-DISK STORE_META_STD */ - sfileno swap_filen:25; - sdirno swap_dirn:7; - u_short lock_count; /* Assume < 65536! */ - mem_status_t mem_status:3; - ping_status_t ping_status:3; - store_status_t store_status:3; - swap_status_t swap_status:3; -}; - struct _SwapDir { const char *type; int cur_size; Index: squid/src/urn.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/urn.c,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -u -r1.18 -r1.18.2.1 --- squid/src/urn.c 24 Sep 2002 10:59:17 -0000 1.18 +++ squid/src/urn.c 4 Oct 2002 07:07:29 -0000 1.18.2.1 @@ -1,6 +1,6 @@ /* - * $Id: urn.c,v 1.18 2002/09/24 10:59:17 rbcollins Exp $ + * $Id: urn.c,v 1.18.2.1 2002/10/04 07:07:29 rbcollins Exp $ * * DEBUG: section 52 URN Parsing * AUTHOR: Kostas Anagnostakis @@ -35,6 +35,7 @@ #include "squid.h" #include "StoreClient.h" +#include "Store.h" #define URN_REQBUF_SZ 4096 Index: squid/src/wais.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/wais.c,v retrieving revision 1.9 retrieving revision 1.9.6.1 diff -u -r1.9 -r1.9.6.1 --- squid/src/wais.c 15 Sep 2002 11:06:34 -0000 1.9 +++ squid/src/wais.c 4 Oct 2002 07:07:29 -0000 1.9.6.1 @@ -1,6 +1,6 @@ /* - * $Id: wais.c,v 1.9 2002/09/15 11:06:34 rbcollins Exp $ + * $Id: wais.c,v 1.9.6.1 2002/10/04 07:07:29 rbcollins Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" typedef struct { int fd; Index: squid/src/whois.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/whois.c,v retrieving revision 1.9 retrieving revision 1.9.10.1 diff -u -r1.9 -r1.9.10.1 --- squid/src/whois.c 22 Aug 2002 12:30:09 -0000 1.9 +++ squid/src/whois.c 4 Oct 2002 07:07:29 -0000 1.9.10.1 @@ -1,6 +1,6 @@ /* - * $Id: whois.c,v 1.9 2002/08/22 12:30:09 squidadm Exp $ + * $Id: whois.c,v 1.9.10.1 2002/10/04 07:07:29 rbcollins Exp $ * * DEBUG: section 75 WHOIS protocol * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #define WHOIS_PORT 43 Index: squid/src/auth/basic/auth_basic.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/basic/Attic/auth_basic.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/auth/basic/auth_basic.cc 3 Oct 2002 01:04:37 -0000 1.1.2.1 +++ squid/src/auth/basic/auth_basic.cc 4 Oct 2002 07:07:30 -0000 1.1.2.2 @@ -1,5 +1,5 @@ /* - * $Id: auth_basic.cc,v 1.1.2.1 2002/10/03 01:04:37 rbcollins Exp $ + * $Id: auth_basic.cc,v 1.1.2.2 2002/10/04 07:07:30 rbcollins Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -40,6 +40,7 @@ #include "squid.h" #include "auth_basic.h" #include "authenticate.h" +#include "Store.h" static void authenticateStateFree(AuthenticateStateData * r) Index: squid/src/auth/digest/auth_digest.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/digest/Attic/auth_digest.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/auth/digest/auth_digest.cc 3 Oct 2002 01:04:37 -0000 1.1.2.1 +++ squid/src/auth/digest/auth_digest.cc 4 Oct 2002 07:07:30 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: auth_digest.cc,v 1.1.2.1 2002/10/03 01:04:37 rbcollins Exp $ + * $Id: auth_digest.cc,v 1.1.2.2 2002/10/04 07:07:30 rbcollins Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Robert Collins @@ -42,6 +42,7 @@ #include "rfc2617.h" #include "auth_digest.h" #include "authenticate.h" +#include "Store.h" extern AUTHSSETUP authSchemeSetup_digest; Index: squid/src/auth/ntlm/auth_ntlm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid/src/auth/ntlm/Attic/auth_ntlm.cc,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/auth/ntlm/auth_ntlm.cc 3 Oct 2002 01:04:38 -0000 1.1.2.1 +++ squid/src/auth/ntlm/auth_ntlm.cc 4 Oct 2002 07:07:30 -0000 1.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: auth_ntlm.cc,v 1.1.2.1 2002/10/03 01:04:38 rbcollins Exp $ + * $Id: auth_ntlm.cc,v 1.1.2.2 2002/10/04 07:07:30 rbcollins Exp $ * * DEBUG: section 29 NTLM Authenticator * AUTHOR: Robert Collins @@ -41,6 +41,7 @@ #include "squid.h" #include "auth_ntlm.h" #include "authenticate.h" +#include "Store.h" extern AUTHSSETUP authSchemeSetup_ntlm; Index: squid/src/fs/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/Makefile.am,v retrieving revision 1.3 retrieving revision 1.3.18.1 diff -u -r1.3 -r1.3.18.1 --- squid/src/fs/Makefile.am 21 May 2002 06:58:31 -0000 1.3 +++ squid/src/fs/Makefile.am 4 Oct 2002 07:07:30 -0000 1.3.18.1 @@ -4,6 +4,7 @@ # AUTOMAKE_OPTIONS = subdir-objects +AM_CFLAGS = -Werror -Wall DIST_SUBDIRS = aufs coss diskd null ufs SUBDIRS = @STORE_MODULE_SUBDIRS@ Index: squid/src/fs/aufs/async_io.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/aufs/async_io.c,v retrieving revision 1.11 retrieving revision 1.11.10.1 diff -u -r1.11 -r1.11.10.1 --- squid/src/fs/aufs/async_io.c 8 Aug 2002 19:41:58 -0000 1.11 +++ squid/src/fs/aufs/async_io.c 4 Oct 2002 07:07:31 -0000 1.11.10.1 @@ -36,6 +36,7 @@ #include "squid.h" #include "store_asyncufs.h" +#include "Store.h" #define _AIO_OPEN 0 #define _AIO_READ 1 Index: squid/src/fs/aufs/store_dir_aufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/aufs/store_dir_aufs.c,v retrieving revision 1.32 retrieving revision 1.32.10.1 diff -u -r1.32 -r1.32.10.1 --- squid/src/fs/aufs/store_dir_aufs.c 23 Aug 2002 22:33:39 -0000 1.32 +++ squid/src/fs/aufs/store_dir_aufs.c 4 Oct 2002 07:07:31 -0000 1.32.10.1 @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #include "store_asyncufs.h" Index: squid/src/fs/aufs/store_io_aufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/aufs/store_io_aufs.c,v retrieving revision 1.19 retrieving revision 1.19.10.1 diff -u -r1.19 -r1.19.10.1 --- squid/src/fs/aufs/store_io_aufs.c 11 Aug 2002 23:33:41 -0000 1.19 +++ squid/src/fs/aufs/store_io_aufs.c 4 Oct 2002 07:07:31 -0000 1.19.10.1 @@ -5,6 +5,7 @@ #include "squid.h" #include "store_asyncufs.h" +#include "Store.h" #if ASYNC_READ static AIOCB storeAufsReadDone; Index: squid/src/fs/coss/store_dir_coss.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/coss/store_dir_coss.c,v retrieving revision 1.24 retrieving revision 1.24.10.1 diff -u -r1.24 -r1.24.10.1 --- squid/src/fs/coss/store_dir_coss.c 9 Aug 2002 21:46:02 -0000 1.24 +++ squid/src/fs/coss/store_dir_coss.c 4 Oct 2002 07:07:32 -0000 1.24.10.1 @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #include #include "async_io.h" Index: squid/src/fs/coss/store_io_coss.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/coss/store_io_coss.c,v retrieving revision 1.14 retrieving revision 1.14.10.1 diff -u -r1.14 -r1.14.10.1 --- squid/src/fs/coss/store_io_coss.c 8 Aug 2002 20:15:20 -0000 1.14 +++ squid/src/fs/coss/store_io_coss.c 4 Oct 2002 07:07:32 -0000 1.14.10.1 @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #include #include "async_io.h" #include "store_coss.h" Index: squid/src/fs/diskd/store_dir_diskd.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/diskd/store_dir_diskd.c,v retrieving revision 1.42 retrieving revision 1.42.10.1 diff -u -r1.42 -r1.42.10.1 --- squid/src/fs/diskd/store_dir_diskd.c 9 Aug 2002 21:46:03 -0000 1.42 +++ squid/src/fs/diskd/store_dir_diskd.c 4 Oct 2002 07:07:32 -0000 1.42.10.1 @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #include #include Index: squid/src/fs/diskd/store_io_diskd.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/diskd/store_io_diskd.c,v retrieving revision 1.12 retrieving revision 1.12.10.1 diff -u -r1.12 -r1.12.10.1 --- squid/src/fs/diskd/store_io_diskd.c 8 Aug 2002 20:15:20 -0000 1.12 +++ squid/src/fs/diskd/store_io_diskd.c 4 Oct 2002 07:07:33 -0000 1.12.10.1 @@ -35,6 +35,7 @@ #include "config.h" #include "squid.h" +#include "Store.h" #include #include Index: squid/src/fs/ufs/store_dir_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/ufs/store_dir_ufs.c,v retrieving revision 1.31 retrieving revision 1.31.6.1 diff -u -r1.31 -r1.31.6.1 --- squid/src/fs/ufs/store_dir_ufs.c 1 Sep 2002 16:30:43 -0000 1.31 +++ squid/src/fs/ufs/store_dir_ufs.c 4 Oct 2002 07:07:33 -0000 1.31.6.1 @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" #include "store_ufs.h" Index: squid/src/fs/ufs/store_io_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/ufs/store_io_ufs.c,v retrieving revision 1.9 retrieving revision 1.9.10.1 diff -u -r1.9 -r1.9.10.1 --- squid/src/fs/ufs/store_io_ufs.c 8 Aug 2002 20:15:21 -0000 1.9 +++ squid/src/fs/ufs/store_io_ufs.c 4 Oct 2002 07:07:33 -0000 1.9.10.1 @@ -35,6 +35,7 @@ #include "squid.h" #include "store_ufs.h" +#include "Store.h" static DRCB storeUfsReadDone; Index: squid/src/repl/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/repl/Makefile.am,v retrieving revision 1.3 retrieving revision 1.3.32.1 diff -u -r1.3 -r1.3.32.1 --- squid/src/repl/Makefile.am 27 Dec 2001 01:25:30 -0000 1.3 +++ squid/src/repl/Makefile.am 4 Oct 2002 07:07:33 -0000 1.3.32.1 @@ -4,6 +4,7 @@ # AUTOMAKE_OPTIONS = subdir-objects +AM_CFLAGS = -Werror -Wall DIST_SUBDIRS = lru heap SUBDIRS = Index: squid/src/repl/heap/store_heap_replacement.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/repl/heap/store_heap_replacement.c,v retrieving revision 1.8 retrieving revision 1.8.18.1 diff -u -r1.8 -r1.8.18.1 --- squid/src/repl/heap/store_heap_replacement.c 8 Apr 2002 09:58:31 -0000 1.8 +++ squid/src/repl/heap/store_heap_replacement.c 4 Oct 2002 07:07:34 -0000 1.8.18.1 @@ -44,6 +44,7 @@ #include "squid.h" #include "heap.h" #include "store_heap_replacement.h" +#include "Store.h" /* * Key generation function to implement the LFU-DA policy (Least Index: squid/src/repl/heap/store_repl_heap.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/repl/heap/store_repl_heap.c,v retrieving revision 1.10 retrieving revision 1.10.18.1 diff -u -r1.10 -r1.10.18.1 --- squid/src/repl/heap/store_repl_heap.c 8 Apr 2002 09:58:31 -0000 1.10 +++ squid/src/repl/heap/store_repl_heap.c 4 Oct 2002 07:07:34 -0000 1.10.18.1 @@ -44,6 +44,7 @@ #include "squid.h" #include "heap.h" #include "store_heap_replacement.h" +#include "Store.h" REMOVALPOLICYCREATE createRemovalPolicy_heap; Index: squid/src/repl/lru/store_repl_lru.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/repl/lru/store_repl_lru.c,v retrieving revision 1.10 retrieving revision 1.10.20.1 diff -u -r1.10 -r1.10.20.1 --- squid/src/repl/lru/store_repl_lru.c 6 Apr 2002 11:34:51 -0000 1.10 +++ squid/src/repl/lru/store_repl_lru.c 4 Oct 2002 07:07:34 -0000 1.10.20.1 @@ -34,6 +34,7 @@ */ #include "squid.h" +#include "Store.h" REMOVALPOLICYCREATE createRemovalPolicy_lru;