You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2013/10/26 04:12:14 UTC

git commit: TS-2301: replace CACHE_READY with CacheProcessor::IsCacheReady

Updated Branches:
  refs/heads/master 7afc91bf5 -> 3b1759579


TS-2301: replace CACHE_READY with CacheProcessor::IsCacheReady


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3b175957
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3b175957
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3b175957

Branch: refs/heads/master
Commit: 3b17595794e5a13e705a54f01ca9f8d201d5cc05
Parents: 7afc91b
Author: James Peach <jp...@apache.org>
Authored: Thu Oct 24 16:07:54 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Fri Oct 25 19:11:26 2013 -0700

----------------------------------------------------------------------
 CHANGES                        | 2 ++
 ci/regression                  | 1 -
 iocore/cache/Cache.cc          | 4 ++--
 iocore/cache/CacheLink.cc      | 4 ++--
 iocore/cache/CacheRead.cc      | 4 ++--
 iocore/cache/CacheVol.cc       | 2 +-
 iocore/cache/CacheWrite.cc     | 4 ++--
 iocore/cache/I_Cache.h         | 2 +-
 iocore/cache/P_CacheInternal.h | 6 ++----
 9 files changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b175957/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 7255533..1034fa0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
 Changes with Apache Traffic Server 4.1.0
 
 
+  *) [TS-2301] Replace the CACHE_READY macro with CacheProcessor::IsCacheReady.
+
   *) [TS-2300] Remove the HIT_EVACUATE build option.
 
   *) [TS-2227] Allow for multiple config files for a header_rewrite plugin

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b175957/ci/regression
----------------------------------------------------------------------
diff --git a/ci/regression b/ci/regression
index 9303955..495b380 100755
--- a/ci/regression
+++ b/ci/regression
@@ -87,7 +87,6 @@ configure() {
     $SRCROOT/configure \
       --prefix=$DSTROOT \
       --enable-debug \
-      --enable-wccp \
       --enable-experimental-plugins \
       $(extras) \
       CC="$CC" \

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b175957/iocore/cache/Cache.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 8eba0cd..e903a90 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -2623,7 +2623,7 @@ LmemHit:
 Action *
 Cache::lookup(Continuation *cont, CacheKey *key, CacheFragType type, char *hostname, int host_len)
 {
-  if (!CACHE_READY(type)) {
+  if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_LOOKUP_FAILED, 0);
     return ACTION_RESULT_DONE;
   }
@@ -2746,7 +2746,7 @@ Action *
 Cache::remove(Continuation *cont, CacheKey *key, CacheFragType type, bool /* user_agents ATS_UNUSED */,
               bool /* link ATS_UNUSED */, char *hostname, int host_len)
 {
-  if (!CACHE_READY(type)) {
+  if (!CacheProcessor::IsCacheReady(type)) {
     if (cont)
       cont->handleEvent(CACHE_EVENT_REMOVE_FAILED, 0);
     return ACTION_RESULT_DONE;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b175957/iocore/cache/CacheLink.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheLink.cc b/iocore/cache/CacheLink.cc
index 9766d64..30f05b8 100644
--- a/iocore/cache/CacheLink.cc
+++ b/iocore/cache/CacheLink.cc
@@ -27,7 +27,7 @@ Action *
 Cache::link(Continuation * cont, CacheKey * from, CacheKey * to, CacheFragType type, char *hostname, int host_len)
 {
 
-  if (!CACHE_READY(type)) {
+  if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_LINK_FAILED, 0);
     return ACTION_RESULT_DONE;
   }
@@ -75,7 +75,7 @@ Action *
 Cache::deref(Continuation * cont, CacheKey * key, CacheFragType type, char *hostname, int host_len)
 {
 
-  if (!CACHE_READY(type)) {
+  if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_DEREF_FAILED, 0);
     return ACTION_RESULT_DONE;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b175957/iocore/cache/CacheRead.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 48de9c1..f11aee4 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -32,7 +32,7 @@
 Action *
 Cache::open_read(Continuation * cont, CacheKey * key, CacheFragType type, char *hostname, int host_len)
 {
-  if (!CACHE_READY(type)) {
+  if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }
@@ -93,7 +93,7 @@ Cache::open_read(Continuation * cont, CacheKey * key, CacheHTTPHdr * request,
                  CacheLookupHttpConfig * params, CacheFragType type, char *hostname, int host_len)
 {
 
-  if (!CACHE_READY(type)) {
+  if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b175957/iocore/cache/CacheVol.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheVol.cc b/iocore/cache/CacheVol.cc
index 8ce0361..9fb690c 100644
--- a/iocore/cache/CacheVol.cc
+++ b/iocore/cache/CacheVol.cc
@@ -32,7 +32,7 @@ Action *
 Cache::scan(Continuation * cont, char *hostname, int host_len, int KB_per_second)
 {
   Debug("cache_scan_truss", "inside scan");
-  if (!CACHE_READY(CACHE_FRAG_TYPE_HTTP)) {
+  if (!CacheProcessor::IsCacheReady(CACHE_FRAG_TYPE_HTTP)) {
     cont->handleEvent(CACHE_EVENT_SCAN_FAILED, 0);
     return ACTION_RESULT_DONE;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b175957/iocore/cache/CacheWrite.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index 841bcbf..1a35b3f 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -1613,7 +1613,7 @@ Cache::open_write(Continuation *cont, CacheKey *key, CacheFragType frag_type,
                   int options, time_t apin_in_cache, char *hostname, int host_len)
 {
 
-  if (!CACHE_READY(frag_type)) {
+  if (!CacheProcessor::IsCacheReady(frag_type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }
@@ -1681,7 +1681,7 @@ Action *
 Cache::open_write(Continuation *cont, CacheKey *key, CacheHTTPInfo *info, time_t apin_in_cache,
                   CacheKey */* key1 ATS_UNUSED */, CacheFragType type, char *hostname, int host_len)
 {
-  if (!CACHE_READY(type)) {
+  if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b175957/iocore/cache/I_Cache.h
----------------------------------------------------------------------
diff --git a/iocore/cache/I_Cache.h b/iocore/cache/I_Cache.h
index 00e4791..b89357f 100644
--- a/iocore/cache/I_Cache.h
+++ b/iocore/cache/I_Cache.h
@@ -134,7 +134,7 @@ struct CacheProcessor:public Processor
                 CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP, char *hostname = 0, int host_len = 0);
   static int IsCacheEnabled();
 
-  static unsigned int IsCacheReady(CacheFragType type);
+  static bool IsCacheReady(CacheFragType type);
 
   /// Type for callback function.
   typedef void (*CALLBACK_FUNC)();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b175957/iocore/cache/P_CacheInternal.h
----------------------------------------------------------------------
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 02bf78d..3c180ac 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -60,8 +60,6 @@ struct EvacuationBlock;
 // retry read from writer delay
 #define WRITER_RETRY_DELAY  HRTIME_MSECONDS(50)
 
-#define CACHE_READY(_x) (CacheProcessor::cache_ready & (1 << (_x)))
-
 #ifndef CACHE_LOCK_FAIL_RATE
 #define CACHE_TRY_LOCK(_l, _m, _t) MUTEX_TRY_LOCK(_l, _m, _t)
 #else
@@ -1382,12 +1380,12 @@ CacheProcessor::IsCacheEnabled()
   return CacheProcessor::initialized;
 }
 
-TS_INLINE unsigned int
+TS_INLINE bool
 CacheProcessor::IsCacheReady(CacheFragType type)
 {
   if (IsCacheEnabled() != CACHE_INITIALIZED)
     return 0;
-  return (cache_ready & (1 << type));
+  return (bool)(cache_ready & (1 << type));
 }
 
 TS_INLINE Cache *