--------------------- PatchSet 913 Date: 2000/12/13 09:45:02 Author: rbcollins Branch: modio Tag: (none) Log: implemented examination functions for the mem_obj data items inmem_lo & hi. This is to allow future work to move these into a per store basis. Members: src/asn.c:1.2.2.1->1.2.2.2 src/client_side.c:1.2.2.3->1.2.2.4 src/errorpage.c:1.2.2.3->1.2.2.4 src/forward.c:1.2.2.2->1.2.2.3 src/ftp.c:1.2.2.2->1.2.2.3 src/gopher.c:1.2.2.2->1.2.2.3 src/http.c:1.2.2.2->1.2.2.3 src/mime.c:1.2.2.2->1.2.2.3 src/net_db.c:1.2.2.2->1.2.2.3 src/peer_digest.c:1.2->1.2.2.1 src/protos.h:1.2.2.3->1.2.2.4 src/pump.c:1.2.2.1->1.2.2.2 src/stat.c:1.2.2.1->1.2.2.2 src/store.c:1.2.2.3->1.2.2.4 src/store_client.c:1.2.2.1->1.2.2.2 src/store_log.c:1.2.2.1->1.2.2.2 src/store_swapout.c:1.2.2.1->1.2.2.2 src/wais.c:1.2->1.2.2.1 src/whois.c:1.2->1.2.2.1 Index: squid/src/asn.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/asn.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- squid/src/asn.c 9 Nov 2000 15:25:07 -0000 1.2.2.1 +++ squid/src/asn.c 13 Dec 2000 09:45:02 -0000 1.2.2.2 @@ -1,6 +1,6 @@ /* - * $Id: asn.c,v 1.2.2.1 2000/11/09 15:25:07 adri Exp $ + * $Id: asn.c,v 1.2.2.2 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -229,7 +229,7 @@ asStateFree(asState); return; } - if (size == 0 && e->mem_obj->inmem_hi > 0) { + if (size == 0 && storeMemHiOffset(e) > 0) { memFree(buf, MEM_4K_BUF); asStateFree(asState); return; @@ -276,8 +276,8 @@ buf, asHandleReply, asState); - } else if (asState->seen < e->mem_obj->inmem_hi) { - debug(53, 3) ("asHandleReply: asState->seen < e->mem_obj->inmem_hi %s\n", storeUrl(e)); + } else if (asState->seen < storeMemHiOffset(e)) { + debug(53, 3) ("asHandleReply: asState->seen < storeMemHiOffset(e) %s\n", storeUrl(e)); storeClientCopy(asState->sc, e, asState->seen, Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- squid/src/client_side.c 13 Dec 2000 07:57:54 -0000 1.2.2.3 +++ squid/src/client_side.c 13 Dec 2000 09:45:02 -0000 1.2.2.4 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.2.2.3 2000/12/13 07:57:54 adri Exp $ + * $Id: client_side.c,v 1.2.2.4 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2002,7 +2002,7 @@ * force a miss. */ assert(NULL != entry->mem_obj); - if (httpHdrRangeFirstOffset(range) <= entry->mem_obj->inmem_hi) + if (httpHdrRangeFirstOffset(range) <= storeMemHiOffset(entry)) return 0; /* * Even though we have a PENDING copy of the object, we Index: squid/src/errorpage.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/errorpage.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- squid/src/errorpage.c 13 Dec 2000 07:57:54 -0000 1.2.2.3 +++ squid/src/errorpage.c 13 Dec 2000 09:45:02 -0000 1.2.2.4 @@ -1,6 +1,6 @@ /* - * $Id: errorpage.c,v 1.2.2.3 2000/12/13 07:57:54 adri Exp $ + * $Id: errorpage.c,v 1.2.2.4 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -263,7 +263,7 @@ HttpReply *rep; MemObject *mem = entry->mem_obj; assert(mem != NULL); - assert(mem->inmem_hi == 0); + assert(storeMemHiOffset(entry)); if (entry->store_status != STORE_PENDING) { /* * If the entry is not STORE_PENDING, then no clients Index: squid/src/forward.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/forward.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- squid/src/forward.c 13 Dec 2000 07:57:54 -0000 1.2.2.2 +++ squid/src/forward.c 13 Dec 2000 09:45:02 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: forward.c,v 1.2.2.2 2000/12/13 07:57:54 adri Exp $ + * $Id: forward.c,v 1.2.2.3 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -92,7 +92,7 @@ fwdLog(fwdState); #endif if (e->store_status == STORE_PENDING) { - if (e->mem_obj->inmem_hi == 0) { + if (storeMemHiOffset(e) == 0) { assert(fwdState->err); errorAppendEntry(e, fwdState->err); fwdState->err = NULL; @@ -130,7 +130,7 @@ { if (fwdState->entry->store_status != STORE_PENDING) return 0; - if (fwdState->entry->mem_obj->inmem_hi > 0) + if (storeMemHiOffset(fwdState->entry) > 0) return 0; if (fwdState->n_tries > 10) return 0; @@ -250,7 +250,7 @@ peer *p = fwdStateServerPeer(fwdState); debug(17, 2) ("fwdConnectTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); assert(fd == fwdState->server_fd); - if (entry->mem_obj->inmem_hi == 0) { + if (storeMemHiOffset(entry) == 0) { err = errorCon(ERR_CONNECT_FAIL, HTTP_GATEWAY_TIMEOUT); err->request = requestLink(fwdState->request); err->xerrno = ETIMEDOUT; @@ -587,7 +587,7 @@ #endif if (EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT)) return rc; - if (mem->inmem_hi - storeLowestMemReaderOffset(e) < READ_AHEAD_GAP) + if (storeMemHiOffset(e) - storeLowestMemReaderOffset(e) < READ_AHEAD_GAP) return rc; return 1; } Index: squid/src/ftp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/ftp.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- squid/src/ftp.c 2 Dec 2000 22:45:14 -0000 1.2.2.2 +++ squid/src/ftp.c 13 Dec 2000 09:45:02 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: ftp.c,v 1.2.2.2 2000/12/02 22:45:14 adri Exp $ + * $Id: ftp.c,v 1.2.2.3 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -921,7 +921,7 @@ storeAppend(entry, ftpState->data.buf, len); ftpState->data.offset = 0; } - if (ftpState->size > 0 && mem->inmem_hi >= ftpState->size + mem->reply->hdr_sz) + if (ftpState->size > 0 && storeMemHiOffset(entry) >= ftpState->size + mem->reply->hdr_sz) ftpReadComplete(ftpState); else commSetSelect(fd, @@ -2308,7 +2308,7 @@ ftpFailed(FtpStateData * ftpState, err_type error) { StoreEntry *entry = ftpState->entry; - if (entry->mem_obj->inmem_hi == 0) + if (storeMemHiOffset(entry) == 0) ftpFailedErrorMessage(ftpState, error); if (ftpState->data.fd > -1) { comm_close(ftpState->data.fd); @@ -2466,7 +2466,7 @@ if (ftpState->flags.http_header_sent) return; ftpState->flags.http_header_sent = 1; - assert(e->mem_obj->inmem_hi == 0); + assert(storeMemHiOffset(e) == 0); EBIT_CLR(e->flags, ENTRY_FWD_HDR_WAIT); filename = (t = strRChr(urlpath, '/')) ? t + 1 : strBuf(urlpath); if (ftpState->flags.isdir) { @@ -2509,7 +2509,7 @@ httpHeaderPutStr(&reply->header, HDR_CONTENT_ENCODING, mime_enc); httpReplySwapOut(reply, e); storeBufferFlush(e); - reply->hdr_sz = e->mem_obj->inmem_hi; + reply->hdr_sz = storeMemHiOffset(e); storeTimestampsSet(e); if (ftpState->flags.authenticated) { /* Index: squid/src/gopher.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/gopher.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- squid/src/gopher.c 13 Dec 2000 07:57:55 -0000 1.2.2.2 +++ squid/src/gopher.c 13 Dec 2000 09:45:02 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: gopher.c,v 1.2.2.2 2000/12/13 07:57:55 adri Exp $ + * $Id: gopher.c,v 1.2.2.3 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -577,7 +577,7 @@ StoreEntry *entry = gopherState->entry; debug(10, 4) ("gopherTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); if (entry->store_status == STORE_PENDING) { - if (entry->mem_obj->inmem_hi == 0) { + if (storeMemHiOffset(entry) == 0) { fwdFail(gopherState->fwdState, errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); } @@ -633,7 +633,7 @@ debug(50, 1) ("gopherReadReply: error reading: %s\n", xstrerror()); if (ignoreErrno(errno)) { commSetSelect(fd, COMM_SELECT_READ, gopherReadReply, data, 0); - } else if (entry->mem_obj->inmem_hi == 0) { + } else if (storeMemHiOffset(entry) == 0) { ErrorState *err; err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR); err->xerrno = errno; @@ -643,7 +643,7 @@ } else { comm_close(fd); } - } else if (len == 0 && entry->mem_obj->inmem_hi == 0) { + } else if (len == 0 && storeMemHiOffset(entry) == 0) { ErrorState *err; err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE); err->xerrno = errno; Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- squid/src/http.c 2 Dec 2000 22:45:14 -0000 1.2.2.2 +++ squid/src/http.c 13 Dec 2000 09:45:02 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.2.2.2 2000/12/02 22:45:14 adri Exp $ + * $Id: http.c,v 1.2.2.3 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -94,7 +94,7 @@ StoreEntry *entry = httpState->entry; debug(11, 4) ("httpTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); if (entry->store_status == STORE_PENDING) { - if (entry->mem_obj->inmem_hi == 0) { + if (storeMemHiOffset(entry) == 0) { fwdFail(httpState->fwd, errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); } @@ -406,8 +406,8 @@ httpPconnTransferDone(HttpStateData * httpState) { /* return 1 if we got the last of the data on a persistent connection */ - MemObject *mem = httpState->entry->mem_obj; - HttpReply *reply = mem->reply; + StoreEntry *entry = httpState->entry; + HttpReply *reply = entry->mem_obj->reply; int clen; debug(11, 3) ("httpPconnTransferDone: FD %d\n", httpState->fd); /* @@ -443,7 +443,7 @@ if (clen < 0) return 0; /* If the body size is known, we must wait until we've gotten all of it. */ - if (mem->inmem_hi < reply->content_length + reply->hdr_sz) + if (storeMemHiOffset(entry) < reply->content_length + reply->hdr_sz) return 0; /* We got it all */ return 1; @@ -513,7 +513,7 @@ fd, xstrerror()); if (ignoreErrno(errno)) { commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0); - } else if (entry->mem_obj->inmem_hi == 0) { + } else if (storeMemHiOffset(entry) == 0) { ErrorState *err; err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR); err->xerrno = errno; @@ -522,7 +522,7 @@ } else { comm_close(fd); } - } else if (len == 0 && entry->mem_obj->inmem_hi == 0) { + } else if (len == 0 && storeMemHiOffset(entry) == 0) { ErrorState *err; err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE); err->xerrno = errno; Index: squid/src/mime.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mime.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- squid/src/mime.c 13 Dec 2000 07:57:55 -0000 1.2.2.2 +++ squid/src/mime.c 13 Dec 2000 09:45:02 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: mime.c,v 1.2.2.2 2000/12/13 07:57:55 adri Exp $ + * $Id: mime.c,v 1.2.2.3 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -429,7 +429,7 @@ httpHdrCcSetMaxAge(reply->cache_control, 86400); httpHeaderPutCc(&reply->header, reply->cache_control); httpReplySwapOut(reply, e); - reply->hdr_sz = e->mem_obj->inmem_hi; /* yuk */ + reply->hdr_sz = storeMemHiOffset(e); /* yuk */ /* read the file into the buffer and append it to store */ buf = memAllocate(MEM_4K_BUF); while ((n = read(fd, buf, 4096)) > 0) Index: squid/src/net_db.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/net_db.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- squid/src/net_db.c 2 Dec 2000 22:45:14 -0000 1.2.2.2 +++ squid/src/net_db.c 13 Dec 2000 09:45:02 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: net_db.c,v 1.2.2.2 2000/12/02 22:45:14 adri Exp $ + * $Id: net_db.c,v 1.2.2.3 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -627,8 +627,8 @@ debug(38, 3) ("netdbExchangeHandleReply: STORE_PENDING\n"); storeClientCopy(ex->sc, ex->e, ex->seen, ex->used, ex->buf_sz, ex->buf, netdbExchangeHandleReply, ex); - } else if (ex->seen < ex->e->mem_obj->inmem_hi) { - debug(38, 3) ("netdbExchangeHandleReply: ex->e->mem_obj->inmem_hi\n"); + } else if (ex->seen < storeMemHiOffset(ex->e)) { + debug(38, 3) ("netdbExchangeHandleReply: storeMemHiOffset(ex->e)\n"); storeClientCopy(ex->sc, ex->e, ex->seen, ex->used, ex->buf_sz, ex->buf, netdbExchangeHandleReply, ex); } else { Index: squid/src/peer_digest.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/peer_digest.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- squid/src/peer_digest.c 21 Oct 2000 15:16:13 -0000 1.2 +++ squid/src/peer_digest.c 13 Dec 2000 09:45:02 -0000 1.2.2.1 @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.c,v 1.2 2000/10/21 15:16:13 hno Exp $ + * $Id: peer_digest.c,v 1.2.2.1 2000/12/13 09:45:02 rbcollins Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -720,7 +720,7 @@ /* XXX: we must distinguish between 304 hits and misses here */ fetch->sent.bytes = httpRequestPrefixLen(fetch->request); fetch->recv.bytes = fetch->entry->store_status == STORE_PENDING ? - mem->inmem_hi : mem->object_sz; + storeMemHiOffset(fetch->entry) : mem->object_sz; fetch->sent.msg = fetch->recv.msg = 1; fetch->expires = fetch->entry->expires; fetch->resp_time = squid_curtime - fetch->start_time; Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- squid/src/protos.h 13 Dec 2000 07:57:55 -0000 1.2.2.3 +++ squid/src/protos.h 13 Dec 2000 09:45:02 -0000 1.2.2.4 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.2.2.3 2000/12/13 07:57:55 adri Exp $ + * $Id: protos.h,v 1.2.2.4 2000/12/13 09:45:02 rbcollins Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -862,6 +862,8 @@ extern void storeFsDone(void); extern void storeFsAdd(char *, STSETUP *); extern void storeReplAdd(char *, REMOVALPOLICYCREATE *); +extern off_t storeMemHiOffset(const StoreEntry *); +extern off_t storeMemLoOffset(const StoreEntry *); /* store_modules.c */ extern void storeFsSetup(void); Index: squid/src/pump.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/pump.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- squid/src/pump.c 9 Nov 2000 15:25:07 -0000 1.2.2.1 +++ squid/src/pump.c 13 Dec 2000 09:45:03 -0000 1.2.2.2 @@ -1,6 +1,6 @@ /* - * $Id: pump.c,v 1.2.2.1 2000/11/09 15:25:07 adri Exp $ + * $Id: pump.c,v 1.2.2.2 2000/12/13 09:45:03 rbcollins Exp $ * * DEBUG: section 61 PUMP handler * AUTHOR: Kostas Anagnostakis @@ -249,7 +249,7 @@ pumpClose(p); } return; - } else if (req->mem_obj->inmem_hi == 0) { + } else if (storeMemHiOffset(req) == 0) { debug(61, 2) ("pumpReadFromClient: FD %d: failed.\n", fd); pumpClose(p); return; @@ -415,9 +415,9 @@ debug(61, 3) ("pumpRestart: NO: request_entry->mem_obj == NULL!\n"); return 0; } - if (mem->inmem_lo > 0) { - debug(61, 3) ("pumpRestart: NO: mem->inmem_lo == %d\n", - (int) mem->inmem_lo); + if (storeMemLoOffset(p->request_entry) > 0) { + debug(61, 3) ("pumpRestart: NO: storeMemLoOffset == %d\n", + (int) storeMemLoOffset(p->request_entry)); return 0; } debug(61, 3) ("pumpRestart: YES!\n"); Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stat.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- squid/src/stat.c 9 Nov 2000 15:25:07 -0000 1.2.2.1 +++ squid/src/stat.c 13 Dec 2000 09:45:03 -0000 1.2.2.2 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.2.2.1 2000/11/09 15:25:07 adri Exp $ + * $Id: stat.c,v 1.2.2.2 2000/12/13 09:45:03 rbcollins Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -273,8 +273,8 @@ storeAppendPrintf(s, "\tSwap Dir %d, File %#08X\n", e->swap_dirn, e->swap_filen); if (mem != NULL) { - storeAppendPrintf(s, "\tinmem_lo: %d\n", (int) mem->inmem_lo); - storeAppendPrintf(s, "\tinmem_hi: %d\n", (int) mem->inmem_hi); + storeAppendPrintf(s, "\tInMem_LoOffset: %d\n", (int) storeMemLoOffset(e)); + storeAppendPrintf(s, "\tInMem_HiOffset: %d\n", (int) storeMemHiOffset(e)); storeAppendPrintf(s, "\tswapout: %d bytes queued\n", (int) mem->swapout.queue_offset); if (mem->swapout.sio) Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- squid/src/store.c 13 Dec 2000 07:57:55 -0000 1.2.2.3 +++ squid/src/store.c 13 Dec 2000 09:45:03 -0000 1.2.2.4 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.2.2.3 2000/12/13 07:57:55 adri Exp $ + * $Id: store.c,v 1.2.2.4 2000/12/13 09:45:03 rbcollins Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -562,7 +562,7 @@ 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) { + storeMemHiOffset(e) > 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) { @@ -639,7 +639,7 @@ assert(e->mem_obj->nclients == 0); return; } - e->mem_obj->object_sz = e->mem_obj->inmem_hi; + e->mem_obj->object_sz = storeMemHiOffset(e); e->store_status = STORE_OK; assert(e->mem_status == NOT_IN_MEMORY); if (!storeEntryValidLength(e)) { @@ -682,7 +682,7 @@ * We assign an object length here. The only other place we assign * the object length is in storeComplete() */ - mem->object_sz = mem->inmem_hi; + mem->object_sz = storeMemHiOffset(e); /* Notify the server side */ if (mem->abort.callback) { eventAdd("mem->abort.callback", @@ -965,7 +965,7 @@ return 0; if (mem->data_hdr.head == NULL) return 0; - return mem->inmem_lo == 0; + return storeMemLoOffset(e) == 0; } void @@ -1117,7 +1117,7 @@ return; assert(mem != NULL); if (new_status == IN_MEMORY) { - assert(mem->inmem_lo == 0); + assert(storeMemLoOffset(e) == 0); if (EBIT_TEST(e->flags, ENTRY_SPECIAL)) { debug(20, 4) ("storeSetMemStatus: not inserting special %s into policy\n", mem->url); @@ -1299,6 +1299,23 @@ /* NOTREACHED */ } +/* + * Peek into the amount of an object that is in memory + */ +off_t +storeMemHiOffset(const StoreEntry *e) +{ + assert(e->mem_obj != NULL); + return e->mem_obj->inmem_hi; +} + +off_t +storeMemLoOffset(const StoreEntry *e) +{ + assert(e->mem_obj != NULL); + return e->mem_obj->inmem_lo; +} + #if 0 void storeSwapFileNumberSet(StoreEntry * e, sfileno filn) Index: squid/src/store_client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_client.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- squid/src/store_client.c 9 Nov 2000 15:25:07 -0000 1.2.2.1 +++ squid/src/store_client.c 13 Dec 2000 09:45:03 -0000 1.2.2.2 @@ -1,6 +1,6 @@ /* - * $Id: store_client.c,v 1.2.2.1 2000/11/09 15:25:07 adri Exp $ + * $Id: store_client.c,v 1.2.2.2 2000/12/13 09:45:03 rbcollins Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -85,7 +85,7 @@ storeClientType(StoreEntry * e) { MemObject *mem = e->mem_obj; - if (mem->inmem_lo) + if (storeMemLoOffset(e)) return STORE_DISK_CLIENT; if (EBIT_TEST(e->flags, ENTRY_ABORTED)) { /* I don't think we should be adding clients to aborted entries */ @@ -93,7 +93,7 @@ return STORE_MEM_CLIENT; } if (e->store_status == STORE_OK) { - if (mem->inmem_lo == 0 && mem->inmem_hi > 0) + if (storeMemLoOffset(e) == 0 && storeMemHiOffset(e) > 0) return STORE_MEM_CLIENT; else return STORE_DISK_CLIENT; @@ -274,7 +274,7 @@ storeClientCallback(sc, 0); return; } - if (e->store_status == STORE_PENDING && sc->seen_offset >= mem->inmem_hi) { + if (e->store_status == STORE_PENDING && sc->seen_offset >= storeMemHiOffset(e)) { /* client has already seen this, wait for more */ debug(20, 3) ("storeClientCopy3: Waiting for more\n"); return; @@ -313,7 +313,7 @@ return; } } - if (sc->copy_offset >= mem->inmem_lo && sc->copy_offset < mem->inmem_hi) { + if (sc->copy_offset >= storeMemLoOffset(e) && sc->copy_offset < storeMemHiOffset(e)) { /* What the client wants is in memory */ debug(20, 3) ("storeClientCopy3: Copying from memory\n"); sz = stmemCopy(&mem->data_hdr, @@ -543,7 +543,7 @@ storeLowestMemReaderOffset(const StoreEntry * entry) { const MemObject *mem = entry->mem_obj; - off_t lowest = mem->inmem_hi + 1; + off_t lowest = storeMemHiOffset(entry) + 1; store_client *sc; dlink_node *nx = NULL; dlink_node *node; @@ -618,7 +618,7 @@ return 1; } expectlen = mem->reply->content_length + mem->reply->hdr_sz; - curlen = (int) mem->inmem_hi; + curlen = (int) storeMemHiOffset(entry); minlen = (int) Config.quickAbort.min << 10; if (minlen < 0) { debug(20, 3) ("CheckQuickAbort2: NO disabled\n"); Index: squid/src/store_log.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_log.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- squid/src/store_log.c 9 Nov 2000 15:25:07 -0000 1.2.2.1 +++ squid/src/store_log.c 13 Dec 2000 09:45:03 -0000 1.2.2.2 @@ -1,6 +1,6 @@ /* - * $Id: store_log.c,v 1.2.2.1 2000/11/09 15:25:07 adri Exp $ + * $Id: store_log.c,v 1.2.2.2 2000/12/13 09:45:03 rbcollins Exp $ * * DEBUG: section 20 Storage Manager Logging Functions * AUTHOR: Duane Wessels @@ -80,7 +80,7 @@ (int) reply->expires, strLen(reply->content_type) ? strBuf(reply->content_type) : "unknown", reply->content_length, - (int) (mem->inmem_hi - mem->reply->hdr_sz), + (int) (storeMemHiOffset(e) - mem->reply->hdr_sz), RequestMethodStr[mem->method], mem->log_url); } else { Index: squid/src/store_swapout.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_swapout.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- squid/src/store_swapout.c 9 Nov 2000 15:25:07 -0000 1.2.2.1 +++ squid/src/store_swapout.c 13 Dec 2000 09:45:03 -0000 1.2.2.2 @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.c,v 1.2.2.1 2000/11/09 15:25:07 adri Exp $ + * $Id: store_swapout.c,v 1.2.2.2 2000/12/13 09:45:03 rbcollins Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -116,16 +116,16 @@ storeSwapOutFileClose(e); return; } - debug(20, 7) ("storeSwapOut: mem->inmem_lo = %d\n", - (int) mem->inmem_lo); - debug(20, 7) ("storeSwapOut: mem->inmem_hi = %d\n", - (int) mem->inmem_hi); + debug(20, 7) ("storeSwapOut: storeMemLoOffset = %d\n", + (int) storeMemLoOffset(e)); + debug(20, 7) ("storeSwapOut: storeMemHiOffset = %d\n", + (int) storeMemHiOffset(e)); debug(20, 7) ("storeSwapOut: swapout.queue_offset = %d\n", (int) mem->swapout.queue_offset); if (mem->swapout.sio) debug(20, 7) ("storeSwapOut: storeOffset() = %d\n", (int) storeOffset(mem->swapout.sio)); - assert(mem->inmem_hi >= mem->swapout.queue_offset); + assert(storeMemHiOffset(e) >= mem->swapout.queue_offset); lowest_offset = storeLowestMemReaderOffset(e); debug(20, 7) ("storeSwapOut: lowest_offset = %d\n", (int) lowest_offset); @@ -133,22 +133,22 @@ * Grab the swapout_size and check to see whether we're going to defer * the swapout based upon size */ - swapout_size = (ssize_t) (mem->inmem_hi - mem->swapout.queue_offset); + swapout_size = (ssize_t) (storeMemHiOffset(e) - mem->swapout.queue_offset); if ((e->store_status != STORE_OK) && (swapout_size < store_maxobjsize)) { debug(20, 5) ("storeSwapOut: Deferring starting swapping out\n"); return; } /* - * Careful. lowest_offset can be greater than inmem_hi, such + * Careful. lowest_offset can be greater than storeMemHiOffset, such * as in the case of a range request. */ - if (mem->inmem_hi < lowest_offset) + if (storeMemHiOffset(e) < lowest_offset) new_mem_lo = lowest_offset; - else if (mem->inmem_hi - lowest_offset > Config.Store.maxInMemObjSize) + else if (storeMemHiOffset(e) - lowest_offset > Config.Store.maxInMemObjSize) new_mem_lo = lowest_offset; else - new_mem_lo = mem->inmem_lo; - assert(new_mem_lo >= mem->inmem_lo); + new_mem_lo = storeMemLoOffset(e); + assert(new_mem_lo >= storeMemLoOffset(e)); if (storeSwapOutAble(e)) { /* * We should only free up to what we know has been written @@ -173,7 +173,7 @@ stmemFreeDataUpto(&mem->data_hdr, new_mem_lo); mem->inmem_lo = new_mem_lo; if (e->swap_status == SWAPOUT_WRITING) - assert(mem->inmem_lo <= on_disk); + assert(storeMemLoOffset(e) <= on_disk); if (!storeSwapOutAble(e)) return; debug(20, 7) ("storeSwapOut: swapout_size = %d\n", @@ -197,7 +197,7 @@ /* Ok, we have stuff to swap out. Is there a swapout.sio open? */ if (e->swap_status == SWAPOUT_NONE) { assert(mem->swapout.sio == NULL); - assert(mem->inmem_lo == 0); + assert(storeMemLoOffset(e) == 0); if (storeCheckCachable(e)) storeSwapOutStart(e); else @@ -240,7 +240,7 @@ /* the storeWrite() call might generate an error */ if (e->swap_status != SWAPOUT_WRITING) break; - swapout_size = (ssize_t) (mem->inmem_hi - mem->swapout.queue_offset); + swapout_size = (ssize_t) (storeMemHiOffset(e) - mem->swapout.queue_offset); if (e->store_status == STORE_PENDING) if (swapout_size < SM_PAGE_SIZE) break; @@ -254,7 +254,7 @@ * to the filesystem at this point because storeSwapOut() is * not going to be called again for this entry. */ - assert(mem->inmem_hi == mem->swapout.queue_offset); + assert(storeMemHiOffset(e) == mem->swapout.queue_offset); storeSwapOutFileClose(e); } } @@ -347,7 +347,7 @@ dlink_node *node; if (e->mem_obj->swapout.sio != NULL) return 1; - if (e->mem_obj->inmem_lo > 0) + if (storeMemLoOffset(e) > 0) return 0; /* * If there are DISK clients, we must write to disk Index: squid/src/wais.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/wais.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- squid/src/wais.c 21 Oct 2000 15:16:13 -0000 1.2 +++ squid/src/wais.c 13 Dec 2000 09:45:03 -0000 1.2.2.1 @@ -1,6 +1,6 @@ /* - * $Id: wais.c,v 1.2 2000/10/21 15:16:13 hno Exp $ + * $Id: wais.c,v 1.2.2.1 2000/12/13 09:45:03 rbcollins Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -70,7 +70,7 @@ StoreEntry *entry = waisState->entry; debug(24, 4) ("waisTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); if (entry->store_status == STORE_PENDING) { - if (entry->mem_obj->inmem_hi == 0) { + if (storeMemHiOffset(entry) == 0) { fwdFail(waisState->fwd, errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT)); } @@ -138,7 +138,7 @@ errorAppendEntry(entry, err); comm_close(fd); } - } else if (len == 0 && entry->mem_obj->inmem_hi == 0) { + } else if (len == 0 && storeMemHiOffset(entry) == 0) { ErrorState *err; err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE); err->xerrno = errno; Index: squid/src/whois.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/whois.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- squid/src/whois.c 21 Oct 2000 15:16:13 -0000 1.2 +++ squid/src/whois.c 13 Dec 2000 09:45:03 -0000 1.2.2.1 @@ -1,6 +1,6 @@ /* - * $Id: whois.c,v 1.2 2000/10/21 15:16:13 hno Exp $ + * $Id: whois.c,v 1.2.2.1 2000/12/13 09:45:03 rbcollins Exp $ * * DEBUG: section 75 WHOIS protocol * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -94,7 +94,7 @@ debug(75, 3) ("whoisReadReply: FD %d read %d bytes\n", fd, len); debug(75, 5) ("{%s}\n", buf); if (len > 0) { - if (0 == mem->inmem_hi) + if (0 == storeMemHiOffset(entry)) mem->reply->sline.status = HTTP_OK; fd_bytes(fd, len, FD_READ); kb_incr(&statCounter.server.all.kbytes_in, len); @@ -106,7 +106,7 @@ fd, xstrerror()); if (ignoreErrno(errno)) { commSetSelect(fd, COMM_SELECT_READ, whoisReadReply, p, Config.Timeout.read); - } else if (mem->inmem_hi == 0) { + } else if (storeMemHiOffset(entry) == 0) { ErrorState *err; err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR); err->xerrno = errno;