]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fully deprecated storeLockObject(). Everything now directly calls the
authorwessels <>
Fri, 19 May 2006 23:19:09 +0000 (23:19 +0000)
committerwessels <>
Fri, 19 May 2006 23:19:09 +0000 (23:19 +0000)
StoreEntry->lock() method.

18 files changed:
src/Server.cc
src/Store.h
src/asn.cc
src/cache_manager.cc
src/client_side_reply.cc
src/client_side_request.cc
src/errorpage.cc
src/forward.cc
src/gopher.cc
src/peer_digest.cc
src/peer_select.cc
src/repl/heap/store_repl_heap.cc
src/stat.cc
src/store.cc
src/store_swapout.cc
src/urn.cc
src/wais.cc
src/whois.cc

index a8e571bbb5402d0cb6a2b047f41258430255ce20..a3a489bbc23ebd13b9099793a5925d094bbfb2bd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: Server.cc,v 1.4 2006/05/19 17:05:18 wessels Exp $
+ * $Id: Server.cc,v 1.5 2006/05/19 17:19:09 wessels Exp $
  *
  * DEBUG:
  * AUTHOR: Duane Wessels
@@ -45,7 +45,10 @@ ServerStateData::ServerStateData(FwdState *theFwdState)
 {
     fwd = theFwdState;
     entry = fwd->entry;
-    storeLockObject(entry);
+
+    entry->lock()
+
+    ;
     request = HTTPMSGLOCK(fwd->request);
 }
 
index d13aea31323309a85919c609ce8a79f7bf2102f4..195315c15f86dbca12f43c1cf982f349aa15145e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: Store.h,v 1.21 2006/05/19 17:05:18 wessels Exp $
+ * $Id: Store.h,v 1.22 2006/05/19 17:19:09 wessels Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -283,7 +283,6 @@ SQUIDCEXTERN void storeCreateMemObject(StoreEntry *, const char *, const char *)
 SQUIDCEXTERN void storeInit(void);
 SQUIDCEXTERN void storeAbort(StoreEntry *);
 SQUIDCEXTERN void storeAppend(StoreEntry *, const char *, int);
-SQUIDCEXTERN void storeLockObject(StoreEntry *);
 SQUIDCEXTERN void storeRelease(StoreEntry *);
 SQUIDCEXTERN void storeExpireNow(StoreEntry *);
 SQUIDCEXTERN void storeReleaseRequest(StoreEntry *);
index d32783ed3f1715afc6761a00dda4dacd243576cb..248c608c9863247f30aebc457c1eedde5bc8a704 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: asn.cc,v 1.106 2006/05/19 17:05:18 wessels Exp $
+ * $Id: asn.cc,v 1.107 2006/05/19 17:19:09 wessels Exp $
  *
  * DEBUG: section 53    AS Number handling
  * AUTHOR: Duane Wessels, Kostas Anagnostakis
@@ -244,7 +244,10 @@ asnCacheStart(int as)
         asState->sc = storeClientListAdd(e, asState);
         FwdState::fwdStart(-1, e, asState->request);
     } else {
-        storeLockObject(e);
+
+        e->lock()
+
+        ;
         asState->sc = storeClientListAdd(e, asState);
     }
 
index f4c6fc04692b6a19fa084b095c9d3a1af10bd47b..8c29a0c3dc55154b461982e65c5cbc45eab850a4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_manager.cc,v 1.41 2006/05/19 17:05:18 wessels Exp $
+ * $Id: cache_manager.cc,v 1.42 2006/05/19 17:19:09 wessels Exp $
  *
  * DEBUG: section 16    Cache Manager Objects
  * AUTHOR: Duane Wessels
@@ -260,12 +260,18 @@ cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry)
     }
 
     mgr->entry = entry;
-    storeLockObject(entry);
+
+    entry->lock()
+
+    ;
     entry->expires = squid_curtime;
+
     debug(16, 5) ("CACHEMGR: %s requesting '%s'\n",
                   fd_table[fd].ipaddr, mgr->action);
+
     /* get additional info from request headers */
     cachemgrParseHeaders(mgr, request);
+
     /* Check password */
 
     if (cachemgrCheckPassword(mgr) != 0) {
index bcf5d1d47eb625b7f608cb1d651efd973857152d..866b1837b4f3c8573234ef4354f35172302dfddc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_reply.cc,v 1.106 2006/05/19 17:05:18 wessels Exp $
+ * $Id: client_side_reply.cc,v 1.107 2006/05/19 17:19:09 wessels Exp $
  *
  * DEBUG: section 88    Client-side Reply Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -256,7 +256,7 @@ clientReplyContext::processExpired()
     saveState();
     entry = storeCreateEntry(url,
                              http->log_uri, http->request->flags, http->request->method);
-    /* NOTE, don't call storeLockObject(), storeCreateEntry() does it */
+    /* NOTE, don't call StoreEntry->lock(), storeCreateEntry() does it */
     sc = storeClientListAdd(entry, this);
 #if DELAY_POOLS
     /* delay_id is already set on original store client */
@@ -927,15 +927,26 @@ clientReplyContext::purgeFoundObject(StoreEntry *entry)
     StoreIOBuffer tempBuffer;
     /* Swap in the metadata */
     http->storeEntry(entry);
-    storeLockObject(http->storeEntry());
+
+    http->storeEntry()->lock()
+
+    ;
     storeCreateMemObject(http->storeEntry(), http->uri, http->log_uri);
+
     http->storeEntry()->mem_obj->method = http->request->method;
+
     sc = storeClientListAdd(http->storeEntry(), this);
+
     http->logType = LOG_TCP_HIT;
+
     reqofs = 0;
+
     tempBuffer.offset = http->out.offset;
+
     tempBuffer.length = next()->readBuffer.length;
+
     tempBuffer.data = next()->readBuffer.data;
+
     storeClientCopy(sc, http->storeEntry(),
                     tempBuffer, CacheHit, this);
 }
@@ -1680,7 +1691,10 @@ clientReplyContext::doGetMoreData()
     if (http->storeEntry() != NULL) {
         /* someone found the object in the cache for us */
         StoreIOBuffer tempBuffer;
-        storeLockObject(http->storeEntry());
+
+        http->storeEntry()->lock()
+
+        ;
 
         if (http->storeEntry()->mem_obj == NULL) {
             /*
index 23d2c057a52cc2b7af390fe25cbc1484a2ad77f2..937bc18c83e288c11506b0c24bbc9df199f2ef29 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_request.cc,v 1.67 2006/05/19 17:05:18 wessels Exp $
+ * $Id: client_side_request.cc,v 1.68 2006/05/19 17:19:09 wessels Exp $
  * 
  * DEBUG: section 85    Client-side Request Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -1013,7 +1013,9 @@ ClientHttpRequest::loggingEntry(StoreEntry *newEntry)
     loggingEntry_ = newEntry;
 
     if (loggingEntry_)
-        storeLockObject(loggingEntry_);
+        loggingEntry_->lock()
+
+        ;
 }
 
 /*
index dee998d8ec0a0682d7a34eca22054395d4a381b1..60b45e2f3eb600b3557bcd7b65d719f30de5e999 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.213 2006/05/19 17:05:18 wessels Exp $
+ * $Id: errorpage.cc,v 1.214 2006/05/19 17:19:09 wessels Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -370,22 +370,34 @@ errorAppendEntry(StoreEntry * entry, ErrorState * err)
         }
     }
 
-    storeLockObject(entry);
+    entry->lock()
+
+    ;
     storeBuffer(entry);
+
     rep = errorBuildReply(err);
+
     /* Add authentication header */
     /* TODO: alter errorstate to be accel on|off aware. The 0 on the next line
      * depends on authenticate behaviour: all schemes to date send no extra data
      * on 407/401 responses, and do not check the accel state on 401/407 responses 
      */
     authenticateFixHeader(rep, err->auth_user_request, err->request, 0, 1);
+
     entry->replaceHttpReply(rep);
+
     EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
+
     storeBufferFlush(entry);
+
     entry->complete();
+
     storeNegativeCache(entry);
+
     storeReleaseRequest(entry);
+
     entry->unlock();
+
     errorStateFree(err);
 }
 
index 12df4ed01384039a77080adba89892c939218a7f..1eb90bfd216f25450fef83ca364987b33042f231 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.143 2006/05/19 17:05:18 wessels Exp $
+ * $Id: forward.cc,v 1.144 2006/05/19 17:19:09 wessels Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -78,8 +78,12 @@ FwdState::FwdState(int fd, StoreEntry * e, HttpRequest * r)
     server_fd = -1;
     request = HTTPMSGLOCK(r);
     start_t = squid_curtime;
-    storeLockObject(e);
+
+    e->lock()
+
+    ;
     EBIT_SET(e->flags, ENTRY_FWD_HDR_WAIT);
+
     self = this;       // refcounted
 }
 
index 3a890c3cbd4094ce809affa39c01ec9b76b9c94b..b01789b60ddaf21d6800c955816e6d409ef86162 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: gopher.cc,v 1.196 2006/05/19 17:05:18 wessels Exp $
+ * $Id: gopher.cc,v 1.197 2006/05/19 17:19:09 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -942,15 +942,24 @@ gopherStart(FwdState * fwd)
     CBDATA_INIT_TYPE(GopherStateData);
     gopherState = cbdataAlloc(GopherStateData);
     gopherState->buf = (char *)memAllocate(MEM_4K_BUF);
-    storeLockObject(entry);
+
+    entry->lock()
+
+    ;
     gopherState->entry = entry;
+
     gopherState->fwd = fwd;
+
     debug(10, 3) ("gopherStart: %s\n", storeUrl(entry));
+
     statCounter.server.all.requests++;
+
     statCounter.server.other.requests++;
+
     /* Parse url. */
     gopher_request_parse(fwd->request,
                          &gopherState->type_id, gopherState->request);
+
     comm_add_close_handler(fd, gopherStateFree, gopherState);
 
     if (((gopherState->type_id == GOPHER_INDEX) || (gopherState->type_id == GOPHER_CSO))
index dc0ce2ba8ae2ff9d32369f9bca10df99a93569f4..f0ff2e2db9f51666ae100ff643475287cfb71018 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_digest.cc,v 1.114 2006/05/19 17:05:18 wessels Exp $
+ * $Id: peer_digest.cc,v 1.115 2006/05/19 17:19:10 wessels Exp $
  *
  * DEBUG: section 72    Peer Digest Routines
  * AUTHOR: Alex Rousskov
@@ -362,8 +362,12 @@ peerDigestRequest(PeerDigest * pd)
 
     if (old_e) {
         debug(72, 5) ("peerDigestRequest: found old entry\n");
-        storeLockObject(old_e);
+
+        old_e->lock()
+
+        ;
         storeCreateMemObject(old_e, url, url);
+
         fetch->old_sc = storeClientListAdd(old_e, fetch);
     }
 
index aee93190a1e19f911f8787dac9bec22b2cf1b3cc..3d8ae69429071fcd7c1ea4042c0ca304a690bbf7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.139 2006/05/19 17:05:18 wessels Exp $
+ * $Id: peer_select.cc,v 1.140 2006/05/19 17:19:10 wessels Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -177,7 +177,9 @@ peerSelect(HttpRequest * request,
 #endif
 
     if (psstate->entry)
-        storeLockObject(psstate->entry);
+        psstate->entry->lock()
+
+        ;
 
     peerSelectFoo(psstate);
 }
index 20208eeb47a3ca4fedbdd06dfb6325656ebfc7d3..40a452a6117dc07a44bb49c147f853791fb053f4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_repl_heap.cc,v 1.19 2006/05/19 17:05:18 wessels Exp $
+ * $Id: store_repl_heap.cc,v 1.20 2006/05/19 17:19:10 wessels Exp $
  *
  * DEBUG: section ?     HEAP based removal policies
  * AUTHOR: Henrik Nordstrom
@@ -233,8 +233,12 @@ try_again:
     entry = (StoreEntry *)heap_extractmin(heap->theHeap);
 
     if (storeEntryLocked(entry)) {
-        storeLockObject(entry);
+
+        entry->lock()
+
+        ;
         linklistPush(&heap_walker->locked_entries, entry);
+
         goto try_again;
     }
 
index 430e186ec9338cc4774522abafeeef7ac9618a7a..50cd5f255f8c96845d756c4a00cabb8258eb66b0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: stat.cc,v 1.393 2006/05/19 17:05:18 wessels Exp $
+ * $Id: stat.cc,v 1.394 2006/05/19 17:19:10 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -386,8 +386,12 @@ statObjectsStart(StoreEntry * sentry, STOBJFLT * filter)
     StatObjectsState *state = new StatObjectsState;
     state->sentry = sentry;
     state->filter = filter;
-    storeLockObject(sentry);
+
+    sentry->lock()
+
+    ;
     state->theSearch = Store::Root().search(NULL, NULL);
+
     eventAdd("statObjects", statObjects, state, 0.0, 1);
 }
 
index ed8b1a8b69290d1dcac41cf7d6e856578cfa6a30..532d1509b01e3abe96b521b26854d75d93468dce 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.590 2006/05/19 17:05:18 wessels Exp $
+ * $Id: store.cc,v 1.591 2006/05/19 17:19:10 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -455,16 +455,6 @@ storePurgeMem(StoreEntry * e)
         storeRelease(e);
 }
 
-/* DEPRECATED: please use e->lock(); */
-void
-storeLockObject(StoreEntry * e)
-{
-
-    e->lock()
-
-    ;
-}
-
 /* RBC 20050104 this is wrong- memory ref counting
  * is not at all equivalent to the store 'usage' concept
  * which the replacement policies should be acting upon.
@@ -477,7 +467,7 @@ void
 StoreEntry::lock()
 {
     lock_count++;
-    debugs(20, 3, "storeLockObject: key '" << getMD5Text() <<"' count=" <<
+    debugs(20, 3, "StoreEntry::lock: key '" << getMD5Text() <<"' count=" <<
            lock_count << "\n");
     lastref = squid_curtime;
     Store::Root().reference(*this);
@@ -1143,12 +1133,20 @@ storeAbort(StoreEntry * e)
     assert(e->store_status == STORE_PENDING);
     assert(mem != NULL);
     debug(20, 6) ("storeAbort: %s\n", e->getMD5Text());
-    storeLockObject(e);         /* lock while aborting */
+
+    e->lock()
+
+    ;         /* 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()
@@ -1158,6 +1156,7 @@ storeAbort(StoreEntry * e)
      * the object length is inappropriate to set.
      */
     mem->object_sz = mem->endOffset();
+
     /* Notify the server side */
 
     if (mem->abort.callback) {
@@ -1301,8 +1300,8 @@ storeRelease(StoreEntry * e)
 
         if (e->swap_filen > -1) {
             /*
-             * Fake a call to storeLockObject().  When rebuilding is done,
-             * we'll just call e->unlock() on these.
+             * Fake a call to StoreEntry->lock()  When rebuilding is done,
+             * we'll just call StoreEntry->unlock() on these.
              */
             e->lock_count++;
             e->setReleaseFlag();
index bcf6fd7042a760857f6beab823cc53a57b292f2e..e4d2c626d084c70989720a8bd11489d94d90f387 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapout.cc,v 1.102 2006/05/19 17:05:18 wessels Exp $
+ * $Id: store_swapout.cc,v 1.103 2006/05/19 17:19:10 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Swapout Functions
  * AUTHOR: Duane Wessels
@@ -76,19 +76,26 @@ storeSwapOutStart(StoreEntry * e)
     mem->swapout.sio = sio;
     /* Don't lock until after create, or the replacement
      * code might get confused */
-    storeLockObject(e);
+
+    e->lock()
+
+    ;
     /* Pick up the file number if it was assigned immediately */
     e->swap_filen = mem->swapout.sio->swap_filen;
+
     e->swap_dirn = mem->swapout.sio->swap_dirn;
+
     /* write out the swap metadata */
     /* TODO: make some sort of data,size refcounted immutable buffer
      * for use by this sort of function.
      */
     char const *buf = e->getSerialisedMetaData ();
+
     /* If we start swapping out with out of band metadata, this assert
      * will catch it - this code needs to be adjusted if that happens
      */
     assert (buf);
+
     storeIOWrite(mem->swapout.sio, buf, mem->swap_hdr_sz, 0, xfree);
 }
 
index 4a3b6838660d1592f2df013dcd67f686db585e80..9a59b06dfd916148e5f8004e81653444747e84c2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: urn.cc,v 1.100 2006/05/19 17:05:18 wessels Exp $
+ * $Id: urn.cc,v 1.101 2006/05/19 17:19:10 wessels Exp $
  *
  * DEBUG: section 52    URN Parsing
  * AUTHOR: Kostas Anagnostakis
@@ -245,7 +245,10 @@ UrnState::start(HttpRequest * r, StoreEntry * e)
     debug(52, 3) ("urnStart: '%s'\n", storeUrl(e));
     entry = e;
     request = HTTPMSGLOCK(r);
-    storeLockObject(entry);
+
+    entry->lock()
+
+    ;
     setUriResFromRequest(r);
 
     if (urlres_r == NULL)
@@ -264,7 +267,10 @@ UrnState::created(StoreEntry *newEntry)
         sc = storeClientListAdd(urlres_e, this);
         FwdState::fwdStart(-1, urlres_e, urlres_r);
     } else {
-        storeLockObject(urlres_e);
+
+        urlres_e->lock()
+
+        ;
         sc = storeClientListAdd(urlres_e, this);
     }
 
index 2f5646836e52316b79b938a644a3757e0d8b4497..29af70d6f04459b42f7b7ac28a67c6a16f6520c6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.159 2006/05/19 17:05:18 wessels Exp $
+ * $Id: wais.cc,v 1.160 2006/05/19 17:19:10 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -266,7 +266,11 @@ waisStart(FwdState * fwd)
     waisState->request = HTTPMSGLOCK(request);
     waisState->fwd = fwd;
     comm_add_close_handler(waisState->fd, waisStateFree, waisState);
-    storeLockObject(entry);
+
+    entry->lock()
+
+    ;
     commSetTimeout(fd, Config.Timeout.read, waisTimeout, waisState);
+
     waisSendRequest(fd, waisState);
 }
index e8b0ddebd176a9008c1990f5439d9d858671505c..30f9a61119b6f53b3f0e586bbbdfa341268e5076 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: whois.cc,v 1.34 2006/05/19 17:05:18 wessels Exp $
+ * $Id: whois.cc,v 1.35 2006/05/19 17:19:10 wessels Exp $
  *
  * DEBUG: section 75    WHOIS protocol
  * AUTHOR: Duane Wessels, Kostas Anagnostakis
@@ -89,13 +89,22 @@ whoisStart(FwdState * fwd)
     p->entry = fwd->entry;
     p->fwd = fwd;
     p->dataWritten = 0;
-    storeLockObject(p->entry);
+
+    p->entry->lock()
+
+    ;
     comm_add_close_handler(fd, whoisClose, p);
+
     l = p->request->urlpath.size() + 3;
+
     buf = (char *)xmalloc(l);
+
     snprintf(buf, l, "%s\r\n", p->request->urlpath.buf() + 1);
+
     comm_write(fd, buf, strlen(buf), whoisWriteComplete, p);
+
     comm_read(fd, p->buf, BUFSIZ, whoisReadReply, p);
+
     commSetTimeout(fd, Config.Timeout.read, whoisTimeout, p);
 }