Skip to content

Commit a79a04c

Browse files
authored
Cleanup: Remove unused args from open_read and open_write (#12181)
1 parent 7eb355f commit a79a04c

6 files changed

Lines changed: 16 additions & 19 deletions

File tree

include/iocore/cache/Cache.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ struct CacheProcessor : public Processor {
8383
Action *scan(Continuation *cont, char *hostname = nullptr, int host_len = 0, int KB_per_second = SCAN_KB_PER_SECOND);
8484
Action *lookup(Continuation *cont, const HttpCacheKey *key, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
8585
Action *open_read(Continuation *cont, const HttpCacheKey *key, CacheHTTPHdr *request, const HttpConfigAccessor *params,
86-
time_t pin_in_cache = 0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
87-
Action *open_write(Continuation *cont, int expected_size, const HttpCacheKey *key, CacheHTTPHdr *request, CacheHTTPInfo *old_info,
88-
time_t pin_in_cache = 0, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
86+
CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
87+
Action *open_write(Continuation *cont, const HttpCacheKey *key, CacheHTTPInfo *old_info, time_t pin_in_cache = 0,
88+
CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
8989
Action *remove(Continuation *cont, const HttpCacheKey *key, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP);
9090
Action *link(Continuation *cont, CacheKey *from, CacheKey *to, CacheFragType frag_type = CACHE_FRAG_TYPE_HTTP,
9191
char *hostname = nullptr, int host_len = 0);

src/iocore/cache/Cache.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,8 @@ Cache::open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request,
606606

607607
// main entry point for writing of http documents
608608
Action *
609-
Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *info, time_t apin_in_cache,
610-
const CacheKey * /* key1 ATS_UNUSED */, CacheFragType type, const char *hostname, int host_len) const
609+
Cache::open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *info, time_t apin_in_cache, CacheFragType type,
610+
const char *hostname, int host_len) const
611611
{
612612
if (!CacheProcessor::IsCacheReady(type)) {
613613
cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, reinterpret_cast<void *>(-ECACHE_NOT_READY));

src/iocore/cache/CacheProcessor.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,21 +405,18 @@ CacheProcessor::lookup(Continuation *cont, const HttpCacheKey *key, CacheFragTyp
405405
return lookup(cont, &key->hash, frag_type, key->hostname, key->hostlen);
406406
}
407407

408-
//----------------------------------------------------------------------------
409408
Action *
410409
CacheProcessor::open_read(Continuation *cont, const HttpCacheKey *key, CacheHTTPHdr *request, const HttpConfigAccessor *params,
411-
time_t /* pin_in_cache ATS_UNUSED */, CacheFragType type)
410+
CacheFragType type)
412411
{
413412
return caches[type]->open_read(cont, &key->hash, request, params, type, key->hostname, key->hostlen);
414413
}
415414

416-
//----------------------------------------------------------------------------
417415
Action *
418-
CacheProcessor::open_write(Continuation *cont, int /* expected_size ATS_UNUSED */, const HttpCacheKey *key,
419-
CacheHTTPHdr * /* request ATS_UNUSED */, CacheHTTPInfo *old_info, time_t pin_in_cache,
416+
CacheProcessor::open_write(Continuation *cont, const HttpCacheKey *key, CacheHTTPInfo *old_info, time_t pin_in_cache,
420417
CacheFragType type)
421418
{
422-
return caches[type]->open_write(cont, &key->hash, old_info, pin_in_cache, nullptr /* key1 */, type, key->hostname, key->hostlen);
419+
return caches[type]->open_write(cont, &key->hash, old_info, pin_in_cache, type, key->hostname, key->hostlen);
423420
}
424421

425422
//----------------------------------------------------------------------------

src/iocore/cache/P_CacheInternal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,7 @@ struct Cache {
466466
Action *open_read(Continuation *cont, const CacheKey *key, CacheHTTPHdr *request, const HttpConfigAccessor *params,
467467
CacheFragType type, const char *hostname, int host_len) const;
468468
Action *open_write(Continuation *cont, const CacheKey *key, CacheHTTPInfo *old_info, time_t pin_in_cache = 0,
469-
const CacheKey *key1 = nullptr, CacheFragType type = CACHE_FRAG_TYPE_HTTP, const char *hostname = nullptr,
470-
int host_len = 0) const;
469+
CacheFragType type = CACHE_FRAG_TYPE_HTTP, const char *hostname = nullptr, int host_len = 0) const;
471470
static void generate_key(CryptoHash *hash, CacheURL *url);
472471
static void generate_key(HttpCacheKey *hash, CacheURL *url, bool ignore_query = false, cache_generation_t generation = -1);
473472

src/iocore/cache/unit_tests/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ CacheWriteTest::start_test(int /* event ATS_UNUSED */, void * /* e ATS_UNUSED */
299299
}
300300

301301
SET_HANDLER(&CacheWriteTest::write_event);
302-
cacheProcessor.open_write(this, 0, &key, static_cast<CacheHTTPHdr *>(this->info.request_get()), old_info);
302+
cacheProcessor.open_write(this, &key, old_info);
303303
return 0;
304304
}
305305

src/proxy/http/HttpCacheSM.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include "proxy/http/HttpSM.h"
3535
#include "proxy/http/HttpDebugNames.h"
3636

37+
#include "iocore/cache/Cache.h"
38+
3739
#define SM_REMEMBER(sm, e, r) \
3840
{ \
3941
sm->history.push_back(MakeSourceLocation(), e, r); \
@@ -322,7 +324,7 @@ HttpCacheSM::do_cache_open_read(const HttpCacheKey &key)
322324
ink_assert(open_read_cb == false);
323325
// Initialising read-while-write-inprogress flag
324326
this->readwhilewrite_inprogress = false;
325-
Action *action_handle = cacheProcessor.open_read(this, &key, this->read_request_hdr, &http_params, this->read_pin_in_cache);
327+
Action *action_handle = cacheProcessor.open_read(this, &key, this->read_request_hdr, &http_params);
326328

327329
if (action_handle != ACTION_RESULT_DONE) {
328330
pending_action = action_handle;
@@ -416,10 +418,9 @@ HttpCacheSM::open_write(const HttpCacheKey *key, URL *url, HTTPHdr *request, Cac
416418
return ACTION_RESULT_DONE;
417419
}
418420

419-
Action *action_handle =
420-
cacheProcessor.open_write(this, 0, key, request,
421-
// INKqa11166
422-
allow_multiple ? (CacheHTTPInfo *)CACHE_ALLOW_MULTIPLE_WRITES : old_info, pin_in_cache);
421+
// INKqa11166
422+
CacheHTTPInfo *info = allow_multiple ? reinterpret_cast<CacheHTTPInfo *>(CACHE_ALLOW_MULTIPLE_WRITES) : old_info;
423+
Action *action_handle = cacheProcessor.open_write(this, key, info, pin_in_cache);
423424

424425
if (action_handle != ACTION_RESULT_DONE) {
425426
pending_action = action_handle;

0 commit comments

Comments
 (0)