--------------------- PatchSet 4294 Date: 2007/04/20 22:31:18 Author: dwsquid Branch: squid3-largeobj Tag: (none) Log: This patch was developed on Linux to support proxying of large objects without the need to give the --with-large-files configure option. It involves changing a lot of "off_t" to "int64_t". Note that without the --with-large-files option, off_t is still 32 bits by default so this patch does not allow Squid to *store* files larger than 2GB. Members: src/AccessLogEntry.h:1.7.10.2->1.7.10.3 src/MemObject.cc:1.22->1.22.6.1 src/MemObject.h:1.13->1.13.10.1 src/Store.h:1.27.2.2->1.27.2.3 src/StoreClient.h:1.13->1.13.10.1 src/StoreIOBuffer.h:1.6.6.2->1.6.6.3 src/client_side.cc:1.121.2.3->1.121.2.4 src/client_side.h:1.18.6.2->1.18.6.3 src/client_side_reply.cc:1.91.2.3->1.91.2.4 src/client_side_request.cc:1.66->1.66.6.1 src/client_side_request.h:1.25.6.2->1.25.6.3 src/http.h:1.23->1.23.6.1 src/mem_node.cc:1.10.6.2->1.10.6.3 src/mem_node.h:1.10.14.2->1.10.14.3 src/stmem.cc:1.16.14.2->1.16.14.3 src/stmem.h:1.9.14.2->1.9.14.3 src/store_client.cc:1.29.2.2->1.29.2.3 src/store_swapout.cc:1.19.2.2->1.19.2.3 Index: squid3/src/AccessLogEntry.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/AccessLogEntry.h,v retrieving revision 1.7.10.2 retrieving revision 1.7.10.3 diff -u -r1.7.10.2 -r1.7.10.3 --- squid3/src/AccessLogEntry.h 19 Apr 2007 04:43:25 -0000 1.7.10.2 +++ squid3/src/AccessLogEntry.h 20 Apr 2007 22:31:18 -0000 1.7.10.3 @@ -1,6 +1,6 @@ /* - * $Id: AccessLogEntry.h,v 1.7.10.2 2007/04/19 04:43:25 dwsquid Exp $ + * $Id: AccessLogEntry.h,v 1.7.10.3 2007/04/20 22:31:18 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -96,7 +96,7 @@ struct IN_ADDR caddr; int64_t size; - off_t highOffset; + int64_t highOffset; int64_t objectSize; log_type code; int msec; Index: squid3/src/MemObject.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/MemObject.cc,v retrieving revision 1.22 retrieving revision 1.22.6.1 diff -u -r1.22 -r1.22.6.1 --- squid3/src/MemObject.cc 20 Sep 2006 01:50:46 -0000 1.22 +++ squid3/src/MemObject.cc 20 Apr 2007 22:31:18 -0000 1.22.6.1 @@ -1,6 +1,6 @@ /* - * $Id: MemObject.cc,v 1.22 2006/09/20 01:50:46 squidadm Exp $ + * $Id: MemObject.cc,v 1.22.6.1 2007/04/20 22:31:18 dwsquid Exp $ * * DEBUG: section 19 Store Memory Primitives * AUTHOR: Robert Collins @@ -196,7 +196,7 @@ struct LowestMemReader : public unary_function { - LowestMemReader(off_t seed):current(seed){} + LowestMemReader(int64_t seed):current(seed){} void operator() (store_client const &x) { @@ -204,7 +204,7 @@ current = x.copyInto.offset; } - off_t current; + int64_t current; }; struct StoreClientStats : public unary_function @@ -239,7 +239,7 @@ for_each(clients, statsVisitor); } -off_t +int64_t MemObject::endOffset () const { return data_hdr.endOffset(); @@ -264,7 +264,7 @@ } -off_t +int64_t MemObject::lowestMemReaderOffset() const { LowestMemReader lowest (endOffset() + 1); @@ -300,7 +300,7 @@ /* * How much of the object data is on the disk? */ -size_t +int64_t MemObject::objectBytesOnDisk() const { /* @@ -318,34 +318,36 @@ if (swapout.sio.getRaw() == NULL) return 0; - off_t nwritten = swapout.sio->offset(); + int64_t nwritten = swapout.sio->offset(); - if (nwritten <= (off_t)swap_hdr_sz) + if (nwritten <= swap_hdr_sz) return 0; - return (size_t) (nwritten - swap_hdr_sz); + return (nwritten - swap_hdr_sz); } -off_t +int64_t MemObject::policyLowestOffsetToKeep() const { /* * Careful. lowest_offset can be greater than endOffset(), such * as in the case of a range request. */ - off_t lowest_offset = lowestMemReaderOffset(); + int64_t lowest_offset = lowestMemReaderOffset(); +assert(lowest_offset >= 0); if (endOffset() < lowest_offset || - endOffset() - inmem_lo > (ssize_t)Config.Store.maxInMemObjSize) + endOffset() - inmem_lo > Config.Store.maxInMemObjSize) return lowest_offset; +assert(inmem_lo >= 0); return inmem_lo; } void MemObject::trimSwappable() { - off_t new_mem_lo = policyLowestOffsetToKeep(); + int64_t new_mem_lo = policyLowestOffsetToKeep(); /* * We should only free up to what we know has been written * to disk, not what has been queued for writing. Otherwise @@ -354,7 +356,7 @@ * The -1 makes sure the page isn't freed until storeSwapOut has * walked to the next page. (mem->swapout.memnode) */ - off_t on_disk; + int64_t on_disk; if ((on_disk = objectBytesOnDisk()) - 1 < new_mem_lo) new_mem_lo = on_disk - 1; @@ -370,7 +372,7 @@ void MemObject::trimUnSwappable() { - off_t new_mem_lo = policyLowestOffsetToKeep(); + int64_t new_mem_lo = policyLowestOffsetToKeep(); assert (new_mem_lo > 0); data_hdr.freeDataUpto(new_mem_lo); Index: squid3/src/MemObject.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/MemObject.h,v retrieving revision 1.13 retrieving revision 1.13.10.1 diff -u -r1.13 -r1.13.10.1 --- squid3/src/MemObject.h 21 Aug 2006 01:51:49 -0000 1.13 +++ squid3/src/MemObject.h 20 Apr 2007 22:31:18 -0000 1.13.10.1 @@ -1,6 +1,6 @@ /* - * $Id: MemObject.h,v 1.13 2006/08/21 01:51:49 squidadm Exp $ + * $Id: MemObject.h,v 1.13.10.1 2007/04/20 22:31:18 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -63,17 +63,17 @@ HttpReply const *getReply() const; void replaceHttpReply(HttpReply *newrep); void stat (MemBuf * mb) const; - off_t endOffset () const; + int64_t endOffset () const; size_t size() const; void reset(); - off_t lowestMemReaderOffset() const; + int64_t lowestMemReaderOffset() const; bool readAheadPolicyCanRead() const; void addClient(store_client *); /* XXX belongs in MemObject::swapout, once swaphdrsz is managed * better */ - size_t objectBytesOnDisk() const; - off_t policyLowestOffsetToKeep() const; + int64_t objectBytesOnDisk() const; + int64_t policyLowestOffsetToKeep() const; void trimSwappable(); void trimUnSwappable(); bool isContiguous() const; @@ -93,7 +93,7 @@ method_t method; char *url; mem_hdr data_hdr; - off_t inmem_lo; + int64_t inmem_lo; dlink_list clients; /* TODO: move into .cc or .cci */ size_t clientCount() const {return nclients;} @@ -106,7 +106,7 @@ { public: - off_t queue_offset; /* relative to in-mem data */ + int64_t queue_offset; /* relative to in-mem data */ mem_node *memnode; /* which node we're currently paging out */ StoreIOState::Pointer sio; }; Index: squid3/src/Store.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Store.h,v retrieving revision 1.27.2.2 retrieving revision 1.27.2.3 diff -u -r1.27.2.2 -r1.27.2.3 --- squid3/src/Store.h 19 Apr 2007 04:45:26 -0000 1.27.2.2 +++ squid3/src/Store.h 20 Apr 2007 22:31:21 -0000 1.27.2.3 @@ -1,6 +1,6 @@ /* - * $Id: Store.h,v 1.27.2.2 2007/04/19 04:45:26 dwsquid Exp $ + * $Id: Store.h,v 1.27.2.3 2007/04/20 22:31:21 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -273,7 +273,9 @@ typedef RefCount StorePointer; SQUIDCEXTERN size_t storeEntryInUse(); +#if UNUSED_CODE_20070420 SQUIDCEXTERN off_t storeLowestMemReaderOffset(const StoreEntry * entry); +#endif SQUIDCEXTERN const char *storeEntryFlags(const StoreEntry *); SQUIDCEXTERN int storeEntryLocked(const StoreEntry *); extern void storeEntryReplaceObject(StoreEntry *, HttpReply *); Index: squid3/src/StoreClient.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/StoreClient.h,v retrieving revision 1.13 retrieving revision 1.13.10.1 diff -u -r1.13 -r1.13.10.1 --- squid3/src/StoreClient.h 22 May 2006 20:50:47 -0000 1.13 +++ squid3/src/StoreClient.h 20 Apr 2007 22:31:21 -0000 1.13.10.1 @@ -1,6 +1,6 @@ /* - * $Id: StoreClient.h,v 1.13 2006/05/22 20:50:47 squidadm Exp $ + * $Id: StoreClient.h,v 1.13.10.1 2007/04/20 22:31:21 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -64,7 +64,7 @@ void operator delete (void *); store_client(StoreEntry *); ~store_client(); - bool memReaderHasLowerOffset(off_t) const; + bool memReaderHasLowerOffset(int64_t) const; int getType() const; void fail(); void callback(ssize_t len, bool error = false); @@ -73,7 +73,7 @@ void copy(StoreEntry *, StoreIOBuffer, STCB *, void *); void dumpStats(MemBuf * output, int clientNumber) const; - off_t cmp_offset; + int64_t cmp_offset; #if STORE_CLIENT_LIST_DEBUG void *owner; Index: squid3/src/StoreIOBuffer.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/StoreIOBuffer.h,v retrieving revision 1.6.6.2 retrieving revision 1.6.6.3 diff -u -r1.6.6.2 -r1.6.6.3 --- squid3/src/StoreIOBuffer.h 19 Apr 2007 04:45:29 -0000 1.6.6.2 +++ squid3/src/StoreIOBuffer.h 20 Apr 2007 22:31:21 -0000 1.6.6.3 @@ -1,6 +1,6 @@ /* - * $Id: StoreIOBuffer.h,v 1.6.6.2 2007/04/19 04:45:29 dwsquid Exp $ + * $Id: StoreIOBuffer.h,v 1.6.6.3 2007/04/20 22:31:21 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -45,7 +45,7 @@ public: StoreIOBuffer():length(0), offset (0), data (NULL){flags.error = 0;} - StoreIOBuffer(size_t aLength, off_t anOffset, char *someData) : + StoreIOBuffer(size_t aLength, int64_t anOffset, char *someData) : length (aLength), offset (anOffset), data (someData) { flags.error = 0; @@ -53,7 +53,7 @@ /* Create a StoreIOBuffer from a MemBuf and offset */ /* NOTE that MemBuf still "owns" the pointers, StoreIOBuffer is just borrowing them */ - StoreIOBuffer(MemBuf *aMemBuf, off_t anOffset) : + StoreIOBuffer(MemBuf *aMemBuf, int64_t anOffset) : length(aMemBuf->contentSize()), offset (anOffset), data(aMemBuf->content()) @@ -81,7 +81,7 @@ flags; size_t length; - off_t offset; + int64_t offset; char *data; }; Index: squid3/src/client_side.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v retrieving revision 1.121.2.3 retrieving revision 1.121.2.4 diff -u -r1.121.2.3 -r1.121.2.4 --- squid3/src/client_side.cc 20 Apr 2007 05:47:19 -0000 1.121.2.3 +++ squid3/src/client_side.cc 20 Apr 2007 22:31:21 -0000 1.121.2.4 @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.121.2.3 2007/04/20 05:47:19 dwsquid Exp $ + * $Id: client_side.cc,v 1.121.2.4 2007/04/20 22:31:21 dwsquid Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -939,7 +939,7 @@ return; } - off_t next = getNextRangeOffset(); + int64_t next = getNextRangeOffset(); assert (next >= http->out.offset); @@ -1431,25 +1431,28 @@ return http->range_iter.currentSpec() ? true : false; } -off_t +int64_t ClientSocketContext::getNextRangeOffset() const { if (http->request->range) { /* offset in range specs does not count the prefix of an http msg */ - debug (33,5) ("ClientSocketContext::getNextRangeOffset: http offset %lu\n", (long unsigned)http->out.offset); + debugs (33, 5, "ClientSocketContext::getNextRangeOffset: http offset " << http->out.offset); /* check: reply was parsed and range iterator was initialized */ assert(http->range_iter.valid); /* filter out data according to range specs */ assert (canPackMoreRanges()); { - off_t start; /* offset of still missing data */ + int64_t start; /* offset of still missing data */ assert(http->range_iter.currentSpec()); start = http->range_iter.currentSpec()->offset + http->range_iter.currentSpec()->length - http->range_iter.debt(); - debug(33, 3) ("clientPackMoreRanges: in: offset: %ld\n", - (long int) http->out.offset); - debug(33, 3) ("clientPackMoreRanges: out: start: %ld spec[%ld]: [%ld, %ld), len: %ld debt: %ld\n", - (long int) start, (long int) (http->range_iter.pos - http->request->range->begin()), (long int) http->range_iter.currentSpec()->offset, (long int) (http->range_iter.currentSpec()->offset + http->range_iter.currentSpec()->length), (long int) http->range_iter.currentSpec()->length, (long int) http->range_iter.debt()); - + debugs(33, 3, "clientPackMoreRanges: in: offset: " << http->out.offset); + debugs(33, 3, "clientPackMoreRanges: out:" + " start: " << start << + " spec[" << http->range_iter.pos - http->request->range->begin() << "]:" << + " [" << http->range_iter.currentSpec()->offset << + ", " << http->range_iter.currentSpec()->offset + http->range_iter.currentSpec()->length << ")," + " len: " << http->range_iter.currentSpec()->length << + " debt: " << http->range_iter.debt()); if (http->range_iter.currentSpec()->length != -1) assert(http->out.offset <= start); /* we did not miss it */ Index: squid3/src/client_side.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side.h,v retrieving revision 1.18.6.2 retrieving revision 1.18.6.3 diff -u -r1.18.6.2 -r1.18.6.3 --- squid3/src/client_side.h 19 Apr 2007 04:45:43 -0000 1.18.6.2 +++ squid3/src/client_side.h 20 Apr 2007 22:31:21 -0000 1.18.6.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side.h,v 1.18.6.2 2007/04/19 04:45:43 dwsquid Exp $ + * $Id: client_side.h,v 1.18.6.3 2007/04/20 22:31:21 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -96,7 +96,7 @@ DeferredParams deferredparams; off_t writtenToSocket; void pullData(); - off_t getNextRangeOffset() const; + int64_t getNextRangeOffset() const; bool canPackMoreRanges() const; clientStream_status_t socketState(); void sendBody(HttpReply * rep, StoreIOBuffer bodyData); Index: squid3/src/client_side_reply.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v retrieving revision 1.91.2.3 retrieving revision 1.91.2.4 diff -u -r1.91.2.3 -r1.91.2.4 --- squid3/src/client_side_reply.cc 19 Apr 2007 17:24:26 -0000 1.91.2.3 +++ squid3/src/client_side_reply.cc 20 Apr 2007 22:31:21 -0000 1.91.2.4 @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.91.2.3 2007/04/19 17:24:26 dwsquid Exp $ + * $Id: client_side_reply.cc,v 1.91.2.4 2007/04/20 22:31:21 dwsquid Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -1066,7 +1066,7 @@ } #endif -#if SIZEOF_OFF_T == 4 +#if SIZEOF_INT64_T == 4 if (http->out.offset > 0x7FFF0000) { debug(88, 1) ("WARNING: closing FD %d to prevent out.offset counter overflow\n", fd); @@ -1948,8 +1948,10 @@ debug(88, 5) ("clientReplyContext::sendMoreData: %s, %d bytes (%u new bytes)\n", http->uri, (int) reqofs, (unsigned int)result.length); - debug(88, 5) ("clientReplyContext::sendMoreData: FD %d '%s', out.offset=%ld \n", - fd, storeUrl(entry), (long int) http->out.offset); + debugs(88, 5, "clientReplyContext::sendMoreData:" + " FD " << fd << + " '" << storeUrl(entry) << "'" << + " out.offset=" << http->out.offset); /* update size of the request */ reqsize = reqofs; Index: squid3/src/client_side_request.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cc,v retrieving revision 1.66 retrieving revision 1.66.6.1 diff -u -r1.66 -r1.66.6.1 --- squid3/src/client_side_request.cc 6 Apr 2007 05:52:36 -0000 1.66 +++ squid3/src/client_side_request.cc 20 Apr 2007 22:31:22 -0000 1.66.6.1 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.66 2007/04/06 05:52:36 squidadm Exp $ + * $Id: client_side_request.cc,v 1.66.6.1 2007/04/20 22:31:22 dwsquid Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -933,19 +933,19 @@ } void -ClientHttpRequest::maxReplyBodySize(ssize_t clen) +ClientHttpRequest::maxReplyBodySize(int64_t clen) { maxReplyBodySize_ = clen; } -ssize_t +int64_t ClientHttpRequest::maxReplyBodySize() const { return maxReplyBodySize_; } bool -ClientHttpRequest::isReplyBodyTooLarge(ssize_t clen) const +ClientHttpRequest::isReplyBodyTooLarge(int64_t clen) const { if (0 == maxReplyBodySize()) return 0; /* disabled */ Index: squid3/src/client_side_request.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.h,v retrieving revision 1.25.6.2 retrieving revision 1.25.6.3 diff -u -r1.25.6.2 -r1.25.6.3 --- squid3/src/client_side_request.h 19 Apr 2007 04:45:53 -0000 1.25.6.2 +++ squid3/src/client_side_request.h 20 Apr 2007 22:31:22 -0000 1.25.6.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.h,v 1.25.6.2 2007/04/19 04:45:53 dwsquid Exp $ + * $Id: client_side_request.h,v 1.25.6.3 2007/04/20 22:31:22 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -100,7 +100,7 @@ struct { - off_t offset; + int64_t offset; int64_t size; size_t headers_sz; } @@ -145,16 +145,16 @@ dlink_list client_stream; int mRangeCLen(); - ssize_t maxReplyBodySize() const; - void maxReplyBodySize(ssize_t size); - bool isReplyBodyTooLarge(ssize_t len) const; + int64_t maxReplyBodySize() const; + void maxReplyBodySize(int64_t size); + bool isReplyBodyTooLarge(int64_t len) const; ClientRequestContext *calloutContext; void doCallouts(); private: CBDATA_CLASS(ClientHttpRequest); - ssize_t maxReplyBodySize_; + int64_t maxReplyBodySize_; StoreEntry *entry_; StoreEntry *loggingEntry_; ConnStateData::Pointer conn_; Index: squid3/src/http.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.h,v retrieving revision 1.23 retrieving revision 1.23.6.1 diff -u -r1.23 -r1.23.6.1 --- squid3/src/http.h 6 Apr 2007 05:52:40 -0000 1.23 +++ squid3/src/http.h 20 Apr 2007 22:31:23 -0000 1.23.6.1 @@ -1,6 +1,6 @@ /* - * $Id: http.h,v 1.23 2007/04/06 05:52:40 squidadm Exp $ + * $Id: http.h,v 1.23.6.1 2007/04/20 22:31:23 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -74,7 +74,7 @@ HttpRequest *orig_request; int fd; http_state_flags flags; - off_t currentOffset; + int64_t currentOffset; size_t read_sz; int header_bytes_read; // to find end of response, int reply_bytes_read; // without relying on StoreEntry Index: squid3/src/mem_node.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/mem_node.cc,v retrieving revision 1.10.6.2 retrieving revision 1.10.6.3 diff -u -r1.10.6.2 -r1.10.6.3 --- squid3/src/mem_node.cc 19 Apr 2007 04:45:58 -0000 1.10.6.2 +++ squid3/src/mem_node.cc 20 Apr 2007 22:31:23 -0000 1.10.6.3 @@ -1,6 +1,6 @@ /* - * $Id: mem_node.cc,v 1.10.6.2 2007/04/19 04:45:58 dwsquid Exp $ + * $Id: mem_node.cc,v 1.10.6.3 2007/04/20 22:31:23 dwsquid Exp $ * * DEBUG: section 19 Store Memory Primitives * AUTHOR: Robert Collins @@ -66,7 +66,7 @@ n->write_pending = 0; } -mem_node::mem_node(off_t offset):nodeBuffer(0,offset,data) +mem_node::mem_node(int64_t offset):nodeBuffer(0,offset,data) {} mem_node::~mem_node() Index: squid3/src/mem_node.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/mem_node.h,v retrieving revision 1.10.14.2 retrieving revision 1.10.14.3 diff -u -r1.10.14.2 -r1.10.14.3 --- squid3/src/mem_node.h 19 Apr 2007 04:46:02 -0000 1.10.14.2 +++ squid3/src/mem_node.h 20 Apr 2007 22:31:23 -0000 1.10.14.3 @@ -1,6 +1,6 @@ /* - * $Id: mem_node.h,v 1.10.14.2 2007/04/19 04:46:02 dwsquid Exp $ + * $Id: mem_node.h,v 1.10.14.3 2007/04/20 22:31:23 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -45,7 +45,7 @@ static unsigned long store_mem_size; /* 0 */ MEMPROXY_CLASS(mem_node); - mem_node(off_t); + mem_node(int64_t); ~mem_node(); size_t space() const; int64_t start() const; Index: squid3/src/stmem.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/stmem.cc,v retrieving revision 1.16.14.2 retrieving revision 1.16.14.3 diff -u -r1.16.14.2 -r1.16.14.3 --- squid3/src/stmem.cc 19 Apr 2007 04:46:15 -0000 1.16.14.2 +++ squid3/src/stmem.cc 20 Apr 2007 22:31:23 -0000 1.16.14.3 @@ -1,6 +1,6 @@ /* - * $Id: stmem.cc,v 1.16.14.2 2007/04/19 04:46:15 dwsquid Exp $ + * $Id: stmem.cc,v 1.16.14.3 2007/04/20 22:31:23 dwsquid Exp $ * * DEBUG: section 19 Store Memory Primitives * AUTHOR: Harvest Derived @@ -66,10 +66,10 @@ return 0; } -off_t +int64_t mem_hdr::endOffset () const { - off_t result = 0; + int64_t result = 0; const SplayNode *theEnd = nodes.finish(); if (theEnd) @@ -144,7 +144,7 @@ xmemcpy(aNode->nodeBuffer.data + aNode->nodeBuffer.length, source, copyLen); - if (inmem_hi <= (off_t) location) + if (inmem_hi <= location) inmem_hi = location + copyLen; /* Adjust the ptr and len according to what was deposited in the page */ @@ -274,7 +274,7 @@ size_t bytes_to_go = target.length; char *ptr_to_buf = target.data; - off_t location = target.offset; + int64_t location = target.offset; /* Start copying begining with this block until * we're satiated */ @@ -325,7 +325,7 @@ } mem_node * -mem_hdr::nodeToRecieve(off_t offset) +mem_hdr::nodeToRecieve(int64_t offset) { /* case 1: Nothing in memory */ @@ -376,7 +376,7 @@ assert (writeBuffer.offset >= 0); mem_node *target; - off_t currentOffset = writeBuffer.offset; + int64_t currentOffset = writeBuffer.offset; char *currentSource = writeBuffer.data; size_t len = writeBuffer.length; Index: squid3/src/stmem.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/stmem.h,v retrieving revision 1.9.14.2 retrieving revision 1.9.14.3 diff -u -r1.9.14.2 -r1.9.14.3 --- squid3/src/stmem.h 19 Apr 2007 04:46:19 -0000 1.9.14.2 +++ squid3/src/stmem.h 20 Apr 2007 22:31:23 -0000 1.9.14.3 @@ -1,6 +1,6 @@ /* - * $Id: stmem.h,v 1.9.14.2 2007/04/19 04:46:19 dwsquid Exp $ + * $Id: stmem.h,v 1.9.14.3 2007/04/20 22:31:23 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -50,7 +50,7 @@ ~mem_hdr(); void freeContent(); int64_t lowestOffset () const; - off_t endOffset () const; + int64_t endOffset () const; int64_t freeDataUpto (int64_t); ssize_t copy (StoreIOBuffer const &) const; bool hasContigousContentRange(Range const &range) const; @@ -80,9 +80,9 @@ void appendNode (mem_node *aNode); size_t copyAvailable(mem_node *aNode, int64_t location, size_t amount, char *target) const; bool unionNotEmpty (StoreIOBuffer const &); - mem_node *nodeToRecieve(off_t offset); + mem_node *nodeToRecieve(int64_t offset); size_t writeAvailable(mem_node *aNode, int64_t location, size_t amount, char const *source); - off_t inmem_hi; + int64_t inmem_hi; Splay nodes; }; Index: squid3/src/store_client.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_client.cc,v retrieving revision 1.29.2.2 retrieving revision 1.29.2.3 diff -u -r1.29.2.2 -r1.29.2.3 --- squid3/src/store_client.cc 19 Apr 2007 05:05:19 -0000 1.29.2.2 +++ squid3/src/store_client.cc 20 Apr 2007 22:31:23 -0000 1.29.2.3 @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.29.2.2 2007/04/19 05:05:19 dwsquid Exp $ + * $Id: store_client.cc,v 1.29.2.3 2007/04/20 22:31:23 dwsquid Exp $ * * DEBUG: section 90 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -81,7 +81,7 @@ } bool -store_client::memReaderHasLowerOffset(off_t anOffset) const +store_client::memReaderHasLowerOffset(int64_t anOffset) const { return getType() == STORE_MEM_CLIENT && copyInto.offset < anOffset; } @@ -277,7 +277,7 @@ static int storeClientNoMoreToSend(StoreEntry * e, store_client * sc) { - ssize_t len; + int64_t len; if (e->store_status == STORE_PENDING) return 0; @@ -345,6 +345,7 @@ if (storeClientNoMoreToSend(entry, this)) { /* There is no more to send! */ + debugs(33, 3, HERE << "There is no more to send!"); callback(0); flags.store_copying = 0; return; @@ -458,7 +459,7 @@ if (mem->swap_hdr_sz != 0) if (entry->swap_status == SWAPOUT_WRITING) - assert(mem->swapout.sio->offset() > copyInto.offset + (off_t)mem->swap_hdr_sz); + assert(mem->swapout.sio->offset() > copyInto.offset + (int64_t)mem->swap_hdr_sz); storeRead(swapin_sio, copyInto.data, @@ -698,11 +699,13 @@ return 1; } +#if UNUSED_CODE_20070420 off_t storeLowestMemReaderOffset(const StoreEntry * entry) { return entry->mem_obj->lowestMemReaderOffset(); } +#endif /* Call handlers waiting for data to be appended to E. */ void Index: squid3/src/store_swapout.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/store_swapout.cc,v retrieving revision 1.19.2.2 retrieving revision 1.19.2.3 diff -u -r1.19.2.2 -r1.19.2.3 --- squid3/src/store_swapout.cc 19 Apr 2007 04:46:29 -0000 1.19.2.2 +++ squid3/src/store_swapout.cc 20 Apr 2007 22:31:23 -0000 1.19.2.3 @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.cc,v 1.19.2.2 2007/04/19 04:46:29 dwsquid Exp $ + * $Id: store_swapout.cc,v 1.19.2.3 2007/04/20 22:31:23 dwsquid Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -191,14 +191,9 @@ MemObject *mem = e->mem_obj; - debug(20, 7) ("storeSwapOut: mem->inmem_lo = %d\n", - (int) mem->inmem_lo); - - debug(20, 7) ("storeSwapOut: mem->endOffset() = %d\n", - (int) mem->endOffset()); - - debug(20, 7) ("storeSwapOut: swapout.queue_offset = %d\n", - (int) mem->swapout.queue_offset); + debugs(20, 7, HERE << "storeSwapOut: mem->inmem_lo = " << mem->inmem_lo); + debugs(20, 7, HERE << "storeSwapOut: mem->endOffset() = " << mem->endOffset()); + debugs(20, 7, HERE << "storeSwapOut: swapout.queue_offset = " << mem->swapout.queue_offset); if (mem->swapout.sio.getRaw()) debug(20, 7) ("storeSwapOut: storeOffset() = %d\n", @@ -208,10 +203,9 @@ assert(swapout_maxsize >= 0); - off_t const lowest_offset = mem->lowestMemReaderOffset(); + int64_t const lowest_offset = mem->lowestMemReaderOffset(); - debug(20, 7) ("storeSwapOut: lowest_offset = %d\n", - (int) lowest_offset); + debugs(20, 7, HERE << "storeSwapOut: lowest_offset = " << lowest_offset); /* * Grab the swapout_size and check to see whether we're going to defer @@ -233,17 +227,17 @@ } e->trimMemory(); -#if SIZEOF_OFF_T == 4 +#if SIZEOF_INT64_T == 4 if (mem->endOffset() > 0x7FFF0000) { - debug(20, 0) ("WARNING: preventing off_t overflow for %s\n", storeUrl(e)); + debug(20, 0) ("WARNING: preventing int64_t overflow for %s\n", storeUrl(e)); storeAbort(e); return; } #endif if (e->swap_status == SWAPOUT_WRITING) - assert(mem->inmem_lo <= (off_t)mem->objectBytesOnDisk() ); + assert(mem->inmem_lo <= mem->objectBytesOnDisk() ); if (!storeSwapOutAble(e)) return;