This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit b65f3b565795e5ee639b4e8fc6ec3e2f836d5d6c
Author: Masaori Koshiba <[email protected]>
AuthorDate: Tue Apr 15 07:16:54 2025 +0900

    Cleanup: Remove unused args from open_read and open_write (#12181)
    
    (cherry picked from commit a79a04ca24fdf0c20f5d9528d0e257f58f63f725)
---
 include/iocore/cache/Cache.h        |  6 +++---
 src/iocore/cache/Cache.cc           |  4 ++--
 src/iocore/cache/CacheProcessor.cc  |  9 +++------
 src/iocore/cache/P_CacheInternal.h  |  3 +--
 src/iocore/cache/unit_tests/main.cc |  2 +-
 src/proxy/http/HttpCacheSM.cc       | 11 ++++++-----
 6 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/include/iocore/cache/Cache.h b/include/iocore/cache/Cache.h
index 6749c00998..4de07a36a8 100644
--- a/include/iocore/cache/Cache.h
+++ b/include/iocore/cache/Cache.h
@@ -83,9 +83,9 @@ struct CacheProcessor : public Processor {
   Action *scan(Continuation *cont, char *hostname = nullptr, int host_len = 0, 
int KB_per_second = SCAN_KB_PER_SECOND);
   Action *lookup(Continuation *cont, const HttpCacheKey *key, CacheFragType 
frag_type = CACHE_FRAG_TYPE_HTTP);
   Action *open_read(Continuation *cont, const HttpCacheKey *key, CacheHTTPHdr 
*request, const HttpConfigAccessor *params,
-                    time_t pin_in_cache = 0, CacheFragType frag_type = 
CACHE_FRAG_TYPE_HTTP);
-  Action *open_write(Continuation *cont, int expected_size, const HttpCacheKey 
*key, CacheHTTPHdr *request, CacheHTTPInfo *old_info,
-                     time_t pin_in_cache = 0, CacheFragType frag_type = 
CACHE_FRAG_TYPE_HTTP);
+                    CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
+  Action *open_write(Continuation *cont, const HttpCacheKey *key, 
CacheHTTPInfo *old_info, time_t pin_in_cache = 0,
+                     CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
   Action *remove(Continuation *cont, const HttpCacheKey *key, CacheFragType 
frag_type = CACHE_FRAG_TYPE_HTTP);
   Action *link(Continuation *cont, CacheKey *from, CacheKey *to, CacheFragType 
frag_type = CACHE_FRAG_TYPE_HTTP,
                char *hostname = nullptr, int host_len = 0);
diff --git a/src/iocore/cache/Cache.cc b/src/iocore/cache/Cache.cc
index 275eb480fe..11e12ce479 100644
--- a/src/iocore/cache/Cache.cc
+++ b/src/iocore/cache/Cache.cc
@@ -606,8 +606,8 @@ Lcallreturn:
 
 // main entry point for writing of http documents
 Action *
-Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo 
*info, time_t apin_in_cache,
-                  const CacheKey * /* key1 ATS_UNUSED */, CacheFragType type, 
const char *hostname, int host_len) const
+Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo 
*info, time_t apin_in_cache, CacheFragType type,
+                  const char *hostname, int host_len) const
 {
   if (!CacheProcessor::IsCacheReady(type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, reinterpret_cast<void 
*>(-ECACHE_NOT_READY));
diff --git a/src/iocore/cache/CacheProcessor.cc 
b/src/iocore/cache/CacheProcessor.cc
index 7b759c1b1f..7c941fcb09 100644
--- a/src/iocore/cache/CacheProcessor.cc
+++ b/src/iocore/cache/CacheProcessor.cc
@@ -405,21 +405,18 @@ CacheProcessor::lookup(Continuation *cont, const 
HttpCacheKey *key, CacheFragTyp
   return lookup(cont, &key->hash, frag_type, key->hostname, key->hostlen);
 }
 
-//----------------------------------------------------------------------------
 Action *
 CacheProcessor::open_read(Continuation *cont, const HttpCacheKey *key, 
CacheHTTPHdr *request, const HttpConfigAccessor *params,
-                          time_t /* pin_in_cache ATS_UNUSED */, CacheFragType 
type)
+                          CacheFragType type)
 {
   return caches[type]->open_read(cont, &key->hash, request, params, type, 
key->hostname, key->hostlen);
 }
 
-//----------------------------------------------------------------------------
 Action *
-CacheProcessor::open_write(Continuation *cont, int /* expected_size ATS_UNUSED 
*/, const HttpCacheKey *key,
-                           CacheHTTPHdr * /* request ATS_UNUSED */, 
CacheHTTPInfo *old_info, time_t pin_in_cache,
+CacheProcessor::open_write(Continuation *cont, const HttpCacheKey *key, 
CacheHTTPInfo *old_info, time_t pin_in_cache,
                            CacheFragType type)
 {
-  return caches[type]->open_write(cont, &key->hash, old_info, pin_in_cache, 
nullptr /* key1 */, type, key->hostname, key->hostlen);
+  return caches[type]->open_write(cont, &key->hash, old_info, pin_in_cache, 
type, key->hostname, key->hostlen);
 }
 
 //----------------------------------------------------------------------------
diff --git a/src/iocore/cache/P_CacheInternal.h 
b/src/iocore/cache/P_CacheInternal.h
index c11a38d0da..bf324266de 100644
--- a/src/iocore/cache/P_CacheInternal.h
+++ b/src/iocore/cache/P_CacheInternal.h
@@ -466,8 +466,7 @@ struct Cache {
   Action     *open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr 
*request, const HttpConfigAccessor *params,
                         CacheFragType type, const char *hostname, int 
host_len) const;
   Action     *open_write(Continuation *cont, const CacheKey *key, 
CacheHTTPInfo *old_info, time_t pin_in_cache = 0,
-                         const CacheKey *key1 = nullptr, CacheFragType type = 
CACHE_FRAG_TYPE_HTTP, const char *hostname = nullptr,
-                         int host_len = 0) const;
+                         CacheFragType type = CACHE_FRAG_TYPE_HTTP, const char 
*hostname = nullptr, int host_len = 0) const;
   static void generate_key(CryptoHash *hash, CacheURL *url);
   static void generate_key(HttpCacheKey *hash, CacheURL *url, bool 
ignore_query = false, cache_generation_t generation = -1);
 
diff --git a/src/iocore/cache/unit_tests/main.cc 
b/src/iocore/cache/unit_tests/main.cc
index 027f839234..d4be25f340 100644
--- a/src/iocore/cache/unit_tests/main.cc
+++ b/src/iocore/cache/unit_tests/main.cc
@@ -299,7 +299,7 @@ CacheWriteTest::start_test(int /* event ATS_UNUSED */, void 
* /* e ATS_UNUSED */
   }
 
   SET_HANDLER(&CacheWriteTest::write_event);
-  cacheProcessor.open_write(this, 0, &key, static_cast<CacheHTTPHdr 
*>(this->info.request_get()), old_info);
+  cacheProcessor.open_write(this, &key, old_info);
   return 0;
 }
 
diff --git a/src/proxy/http/HttpCacheSM.cc b/src/proxy/http/HttpCacheSM.cc
index f2ff756f6f..d436bdfc84 100644
--- a/src/proxy/http/HttpCacheSM.cc
+++ b/src/proxy/http/HttpCacheSM.cc
@@ -34,6 +34,8 @@
 #include "proxy/http/HttpSM.h"
 #include "proxy/http/HttpDebugNames.h"
 
+#include "iocore/cache/Cache.h"
+
 #define SM_REMEMBER(sm, e, r)                          \
   {                                                    \
     sm->history.push_back(MakeSourceLocation(), e, r); \
@@ -303,7 +305,7 @@ HttpCacheSM::do_cache_open_read(const HttpCacheKey &key)
   ink_assert(open_read_cb == false);
   // Initialising read-while-write-inprogress flag
   this->readwhilewrite_inprogress = false;
-  Action *action_handle = cacheProcessor.open_read(this, &key, 
this->read_request_hdr, &http_params, this->read_pin_in_cache);
+  Action *action_handle           = cacheProcessor.open_read(this, &key, 
this->read_request_hdr, &http_params);
 
   if (action_handle != ACTION_RESULT_DONE) {
     pending_action = action_handle;
@@ -397,10 +399,9 @@ HttpCacheSM::open_write(const HttpCacheKey *key, URL *url, 
HTTPHdr *request, Cac
     return ACTION_RESULT_DONE;
   }
 
-  Action *action_handle =
-    cacheProcessor.open_write(this, 0, key, request,
-                              // INKqa11166
-                              allow_multiple ? (CacheHTTPInfo 
*)CACHE_ALLOW_MULTIPLE_WRITES : old_info, pin_in_cache);
+  // INKqa11166
+  CacheHTTPInfo *info          = allow_multiple ? 
reinterpret_cast<CacheHTTPInfo *>(CACHE_ALLOW_MULTIPLE_WRITES) : old_info;
+  Action        *action_handle = cacheProcessor.open_write(this, key, info, 
pin_in_cache);
 
   if (action_handle != ACTION_RESULT_DONE) {
     pending_action = action_handle;

Reply via email to