From: Francesco Chemolli Date: Thu, 6 Sep 2012 14:22:03 +0000 (+0200) Subject: Renamed _store_rebuild_data to StoreRebuildData, moved it to store_rebuild.h X-Git-Tag: sourceformat-review-1~6^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=211e9ce212db2fda5fab8bd6c194665076af0179;p=thirdparty%2Fsquid.git Renamed _store_rebuild_data to StoreRebuildData, moved it to store_rebuild.h --- diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index b797edd12e..6601d20aa8 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -77,7 +77,7 @@ struct _RebuildState { unsigned int clean:1; } flags; - struct _store_rebuild_data counts; + StoreRebuildData counts; }; static char *storeCossDirSwapLogFile(SwapDir *, const char *); diff --git a/src/fs/rock/RockRebuild.h b/src/fs/rock/RockRebuild.h index 20d025156a..f4864633bd 100644 --- a/src/fs/rock/RockRebuild.h +++ b/src/fs/rock/RockRebuild.h @@ -2,7 +2,8 @@ #define SQUID_FS_ROCK_REBUILD_H #include "base/AsyncJob.h" -#include "structs.h" +#include "cbdata.h" +#include "store_rebuild.h" namespace Rock { @@ -39,7 +40,7 @@ private: int64_t dbOffset; int filen; - struct _store_rebuild_data counts; + StoreRebuildData counts; static void Steps(void *data); diff --git a/src/fs/ufs/RebuildState.h b/src/fs/ufs/RebuildState.h index 9a7d7c5760..29f69fea2e 100644 --- a/src/fs/ufs/RebuildState.h +++ b/src/fs/ufs/RebuildState.h @@ -32,8 +32,8 @@ #include "RefCount.h" #include "UFSSwapDir.h" -#include "structs.h" #include "UFSSwapLogParser.h" +#include "store_rebuild.h" class StoreEntry; @@ -76,7 +76,7 @@ public: char fullpath[MAXPATHLEN]; char fullfilename[MAXPATHLEN]; - struct _store_rebuild_data counts; + StoreRebuildData counts; private: CBDATA_CLASS2(RebuildState); diff --git a/src/store_rebuild.cc b/src/store_rebuild.cc index 5098bfd4b7..a601b06e6c 100644 --- a/src/store_rebuild.cc +++ b/src/store_rebuild.cc @@ -47,7 +47,7 @@ #if HAVE_ERRNO_H #include #endif -static struct _store_rebuild_data counts; +static StoreRebuildData counts; static struct timeval rebuild_start; static void storeCleanup(void *); @@ -137,7 +137,7 @@ storeCleanup(void *datanotused) /* meta data recreated from disk image in swap directory */ void -storeRebuildComplete(struct _store_rebuild_data *dc) +storeRebuildComplete(StoreRebuildData *dc) { double dt; counts.objcount += dc->objcount; @@ -295,7 +295,7 @@ struct InitStoreEntry : public unary_function { bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, - struct _store_rebuild_data &counts) + StoreRebuildData &counts) { if (fd < 0) return false; @@ -317,7 +317,7 @@ storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &tmpe, cache_key *key, - struct _store_rebuild_data &counts, + StoreRebuildData &counts, uint64_t expectedSize) { int swap_hdr_len = 0; @@ -383,7 +383,7 @@ storeRebuildParseEntry(MemBuf &buf, StoreEntry &tmpe, cache_key *key, bool storeRebuildKeepEntry(const StoreEntry &tmpe, const cache_key *key, - struct _store_rebuild_data &counts) + StoreRebuildData &counts) { /* this needs to become * 1) unpack url diff --git a/src/store_rebuild.h b/src/store_rebuild.h index 4088fe2505..ae8947a6d3 100644 --- a/src/store_rebuild.h +++ b/src/store_rebuild.h @@ -31,17 +31,30 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ +class StoreRebuildData { +public: + int objcount; /* # objects successfully reloaded */ + int expcount; /* # objects expired */ + int scancount; /* # entries scanned or read from state file */ + int clashcount; /* # swapfile clashes avoided */ + int dupcount; /* # duplicates purged */ + int cancelcount; /* # SWAP_LOG_DEL objects purged */ + int invalid; /* # bad lines */ + int badflags; /* # bad e->flags */ + int bad_log_op; + int zero_object_sz; +}; extern void storeRebuildStart(void); -extern void storeRebuildComplete(struct _store_rebuild_data *); +extern void storeRebuildComplete(StoreRebuildData *); extern void storeRebuildProgress(int sd_index, int total, int sofar); /// loads entry from disk; fills supplied memory buffer on success -extern bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, struct _store_rebuild_data &counts); +extern bool storeRebuildLoadEntry(int fd, int diskIndex, MemBuf &buf, StoreRebuildData &counts); /// parses entry buffer and validates entry metadata; fills e on success -extern bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, struct _store_rebuild_data &counts, uint64_t expectedSize); +extern bool storeRebuildParseEntry(MemBuf &buf, StoreEntry &e, cache_key *key, StoreRebuildData &counts, uint64_t expectedSize); /// checks whether the loaded entry should be kept; updates counters -extern bool storeRebuildKeepEntry(const StoreEntry &e, const cache_key *key, struct _store_rebuild_data &counts); +extern bool storeRebuildKeepEntry(const StoreEntry &e, const cache_key *key, StoreRebuildData &counts); diff --git a/src/structs.h b/src/structs.h index 5744ce0724..49f6faf509 100644 --- a/src/structs.h +++ b/src/structs.h @@ -352,19 +352,6 @@ public: int del_count; /* number of deletions performed so far */ }; -struct _store_rebuild_data { - int objcount; /* # objects successfully reloaded */ - int expcount; /* # objects expired */ - int scancount; /* # entries scanned or read from state file */ - int clashcount; /* # swapfile clashes avoided */ - int dupcount; /* # duplicates purged */ - int cancelcount; /* # SWAP_LOG_DEL objects purged */ - int invalid; /* # bad lines */ - int badflags; /* # bad e->flags */ - int bad_log_op; - int zero_object_sz; -}; - #if USE_SSL struct _sslproxy_cert_sign { int alg; diff --git a/src/tests/stub_store_rebuild.cc b/src/tests/stub_store_rebuild.cc index 014b2aea65..8d95239474 100644 --- a/src/tests/stub_store_rebuild.cc +++ b/src/tests/stub_store_rebuild.cc @@ -32,15 +32,16 @@ #include "squid.h" #include "MemBuf.h" +#include "store_rebuild.h" #define STUB_API "stub_store_rebuild.cc" #include "tests/STUB.h" void storeRebuildProgress(int sd_index, int total, int sofar) STUB -void storeRebuildComplete(struct _store_rebuild_data *dc) STUB_NOP -bool storeRebuildLoadEntry(int, int, MemBuf&, _store_rebuild_data&) +void storeRebuildComplete(StoreRebuildData *dc) STUB_NOP +bool storeRebuildLoadEntry(int, int, MemBuf&, StoreRebuildData&) { return false; } -bool storeRebuildKeepEntry(const StoreEntry &tmpe, const cache_key *key, struct _store_rebuild_data &counts) STUB_RETVAL(false) -bool storeRebuildParseEntry(MemBuf &, StoreEntry &, cache_key *, struct _store_rebuild_data &, uint64_t) STUB_RETVAL(false) +bool storeRebuildKeepEntry(const StoreEntry &tmpe, const cache_key *key, StoreRebuildData &counts) STUB_RETVAL(false) +bool storeRebuildParseEntry(MemBuf &, StoreEntry &, cache_key *, StoreRebuildData &, uint64_t) STUB_RETVAL(false)