From: Amos Jeffries Date: Sun, 23 Aug 2009 05:13:09 +0000 (+1200) Subject: Cleanup: Split some enums into their own files. auto-generate their text name arrays. X-Git-Tag: SQUID_3_2_0_1~767 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b9818146759f53eed44b7f1541acf7c7e3c5e69;p=thirdparty%2Fsquid.git Cleanup: Split some enums into their own files. auto-generate their text name arrays. Also updates the enum strings generator to work with any given header file. The header does however need to be named identical to the enum and not pull in any other definitions that require .cc content. The generated .cc will only contain the minimal includes and enum string array global. --- diff --git a/configure.in b/configure.in index 27fc8ab765..1fbd66d2af 100644 --- a/configure.in +++ b/configure.in @@ -34,7 +34,7 @@ new_configure_args="$ac_configure_args --with-squid=$ac_abs_confdir" ac_configure_args="$new_configure_args" -use_loadable_modules=1 +use_loadable_modules=0 AC_MSG_CHECKING(whether to use loadable modules) AC_ARG_ENABLE(loadable-modules, AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , @@ -51,6 +51,7 @@ AC_ARG_ENABLE(loadable-modules, AC_MSG_RESULT([$use_loadable_modules, implicitly]) ] ) +use_loadable_modules=0 AM_CONDITIONAL(USE_LOADABLE_MODULES, test $use_loadable_modules = yes) diff --git a/src/HierarchyLogEntry.h b/src/HierarchyLogEntry.h index 4617b26d38..9284c69955 100644 --- a/src/HierarchyLogEntry.h +++ b/src/HierarchyLogEntry.h @@ -35,10 +35,11 @@ #define SQUID_HTTPHIERARCHYLOGENTRY_H #include "hier_code.h" +#include "lookup_t.h" #include "rfc2181.h" #include "PingData.h" -/* for lookup_t and http_status */ +/* for http_status */ #include "enums.h" class HierarchyLogEntry diff --git a/src/Makefile.am b/src/Makefile.am index 906cfc7ae5..ecc1e1038e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -229,31 +229,6 @@ DiskIO/DiskIOModules_gen.cc: Makefile $(SHELL) $(srcdir)/DiskIO/modules.sh $(DISK_MODULES) > DiskIO/DiskIOModules_gen.cc -EXTRA_squid_SOURCES = \ - $(AIO_WIN32_ALL_SOURCES) \ - $(all_AUTHMODULES) \ - ConfigOption.h \ - $(DELAY_POOL_ALL_SOURCE) \ - dns.cc \ - dnsserver.cc \ - dns_internal.cc \ - DnsLookupDetails.cc \ - DnsLookupDetails.h \ - htcp.cc \ - htcp.h \ - ipc.cc \ - ipc_win32.cc \ - ProfStats.cc \ - LeakFinder.cc \ - LeakFinder.h \ - $(SNMP_ALL_SOURCE) \ - $(UNLINKDSOURCE) \ - $(SSL_ALL_SOURCE) \ - $(WIN32_ALL_SOURCE) \ - $(LOADABLE_MODULES_SOURCES) \ - DiskIO/DiskThreads/aiops.cc \ - DiskIO/DiskThreads/aiops_win32.cc - squid_COMMSOURCES = \ comm_select.cc \ comm_select.h \ @@ -330,6 +305,7 @@ squid_SOURCES = \ dlink.cc \ $(DNSSOURCE) \ enums.h \ + err_type.h \ errorpage.cc \ errorpage.h \ ETag.cc \ @@ -355,7 +331,6 @@ squid_SOURCES = \ helper.cc \ helper.h \ hier_code.h \ - hier_code.cc \ HierarchyLogEntry.h \ $(HTCPSOURCE) \ http.cc \ @@ -386,6 +361,7 @@ squid_SOURCES = \ HttpRequestMethod.h \ HttpVersion.h \ ICP.h \ + icp_opcode.h \ icp_v2.cc \ icp_v3.cc \ int.cc \ @@ -395,6 +371,7 @@ squid_SOURCES = \ $(LEAKFINDERSOURCE) \ list.cc \ logfile.cc \ + lookup_t.h \ main.cc \ mem.cc \ mem_node.cc \ @@ -477,6 +454,7 @@ squid_SOURCES = \ Server.cc \ Server.h \ structs.h \ + swap_log_op.h \ SwapDir.cc \ SwapDir.h \ time.cc \ @@ -498,6 +476,31 @@ squid_SOURCES = \ $(WIN32_SOURCE) \ $(WINSVC_SOURCE) +EXTRA_squid_SOURCES = \ + $(AIO_WIN32_ALL_SOURCES) \ + $(all_AUTHMODULES) \ + ConfigOption.h \ + $(DELAY_POOL_ALL_SOURCE) \ + dns.cc \ + dnsserver.cc \ + dns_internal.cc \ + DnsLookupDetails.cc \ + DnsLookupDetails.h \ + htcp.cc \ + htcp.h \ + ipc.cc \ + ipc_win32.cc \ + ProfStats.cc \ + LeakFinder.cc \ + LeakFinder.h \ + $(SNMP_ALL_SOURCE) \ + $(UNLINKDSOURCE) \ + $(SSL_ALL_SOURCE) \ + $(WIN32_ALL_SOURCE) \ + $(LOADABLE_MODULES_SOURCES) \ + DiskIO/DiskThreads/aiops.cc \ + DiskIO/DiskThreads/aiops_win32.cc + noinst_HEADERS = \ client_side_request.cci \ MemBuf.cci \ @@ -508,12 +511,22 @@ noinst_HEADERS = \ SquidString.h \ SquidTime.h -nodist_squid_SOURCES = \ - $(DISKIO_GEN_SOURCE) \ - repl_modules.cc \ +BUILT_SOURCES = \ + cf_gen_defines.h \ cf_parser.h \ + err_type.cc \ globals.cc \ - string_arrays.c + hier_code.cc \ + icp_opcode.cc \ + lookup_t.cc \ + repl_modules.cc \ + swap_log_op.cc + +CLEANFILES += $(BUILT_SOURCES) + +nodist_squid_SOURCES = \ + $(DISKIO_GEN_SOURCE) \ + $(BUILT_SOURCES) squid_LDADD = \ $(COMMON_LIBS) \ @@ -629,13 +642,6 @@ ufsdump_DEPENDENCIES = $(top_builddir)/lib/libmiscutil.a \ nodist_ufsdump_SOURCES = \ globals.cc -BUILT_SOURCES = \ - cf_gen_defines.h \ - cf_parser.h \ - globals.cc \ - string_arrays.c \ - repl_modules.cc - sysconf_DATA = \ squid.conf.default \ squid.conf.documented \ @@ -728,11 +734,27 @@ DEFS += -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -DDEFAULT_SQUID_DATA_DI snmp_core.o snmp_agent.o: ../snmplib/libsnmp.a $(top_srcdir)/include/cache_snmp.h -globals.cc: globals.h mk-globals-c.pl +globals.cc: globals.h mk-globals-c.awk $(AWK) -f $(srcdir)/mk-globals-c.awk < $(srcdir)/globals.h > $@ -string_arrays.c: enums.h mk-string-arrays.pl - $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/enums.h > $@ +## Generate files containing strng arrays for various enums.... +hier_code.cc: hier_code.h mk-string-arrays.awk + $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/hier_code.h > $@ + +err_type.cc: err_type.h mk-string-arrays.awk + $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/err_type.h > $@ + +lookup_t.cc: lookup_t.h mk-string-arrays.awk + $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/lookup_t.h > $@ + +icp_opcode.cc: icp_opcode.h mk-string-arrays.awk + $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/icp_opcode.h > $@ + +swap_log_op.cc: swap_log_op.h mk-string-arrays.awk + $(AWK) -f $(srcdir)/mk-string-arrays.awk < $(srcdir)/swap_log_op.h > $@ + + +## other generated files... cache_diff: cache_diff.o debug.o globals.o store_key_md5.o $(CC) -o $@ $(LDFLAGS) $@.o debug.o globals.o store_key_md5.o $(STD_APP_LIBS) @@ -810,8 +832,8 @@ uninstall-local: @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh "$(RM)" $(DESTDIR)$(DEFAULT_MIME_TABLE) @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh "$(RM)" $(DESTDIR)$(DEFAULT_CONFIG_FILE) -CLEANFILES += cf_gen_defines.h cf.data cf_parser.h squid.conf.default squid.conf.documented \ - globals.cc string_arrays.c repl_modules.cc DiskIO/DiskIOModules_gen.cc \ +CLEANFILES += cf.data squid.conf.default squid.conf.documented \ + DiskIO/DiskIOModules_gen.cc \ test_tools.cc *.a test_tools.cc: $(top_srcdir)/test-suite/test_tools.cc @@ -1091,7 +1113,6 @@ tests_testCacheManager_SOURCES = \ ftp.cc \ gopher.cc \ hier_code.h \ - hier_code.cc \ helper.cc \ $(HTCPSOURCE) \ http.cc \ @@ -1172,9 +1193,7 @@ tests_testCacheManager_SOURCES = \ $(WIN32_SOURCE) \ wordlist.cc nodist_tests_testCacheManager_SOURCES = \ - globals.cc \ - repl_modules.cc \ - string_arrays.c + $(BUILT_SOURCES) tests_testCacheManager_LDADD = \ $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ @@ -1200,7 +1219,8 @@ tests_testDiskIO_SOURCES = \ tests/testMain.cc \ tests/stub_cache_manager.cc nodist_tests_testDiskIO_SOURCES= \ - $(SWAP_TEST_GEN_SOURCES) + $(SWAP_TEST_GEN_SOURCES) \ + swap_log_op.cc tests_testDiskIO_LDADD = \ $(SWAP_TEST_LDADD) \ @DISK_LIBS@ \ @@ -1263,7 +1283,6 @@ tests_testEvent_SOURCES = \ ftp.cc \ gopher.cc \ hier_code.h \ - hier_code.cc \ helper.cc \ $(HTCPSOURCE) \ http.cc \ @@ -1343,9 +1362,7 @@ tests_testEvent_SOURCES = \ $(WIN32_SOURCE) \ wordlist.cc nodist_tests_testEvent_SOURCES = \ - globals.cc \ - repl_modules.cc \ - string_arrays.c + $(BUILT_SOURCES) tests_testEvent_LDADD = \ $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ @@ -1414,7 +1431,6 @@ tests_testEventLoop_SOURCES = \ gopher.cc \ helper.cc \ hier_code.h \ - hier_code.cc \ $(HTCPSOURCE) \ http.cc \ HttpBody.cc \ @@ -1493,9 +1509,7 @@ tests_testEventLoop_SOURCES = \ $(WIN32_SOURCE) \ wordlist.cc nodist_tests_testEventLoop_SOURCES = \ - globals.cc \ - repl_modules.cc \ - string_arrays.c + $(BUILT_SOURCES) tests_testEventLoop_LDADD = \ $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ @@ -1553,7 +1567,6 @@ tests_test_http_range_SOURCES = \ gopher.cc \ helper.cc \ hier_code.h \ - hier_code.cc \ $(HTCPSOURCE) \ http.cc \ HttpBody.cc \ @@ -1638,9 +1651,7 @@ tests_test_http_range_SOURCES = \ Packer.cc \ MemBuf.cc nodist_tests_test_http_range_SOURCES = \ - globals.cc \ - repl_modules.cc \ - string_arrays.c + $(BUILT_SOURCES) tests_test_http_range_LDADD = \ $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ @@ -1708,7 +1719,6 @@ tests_testHttpRequest_SOURCES = \ gopher.cc \ helper.cc \ hier_code.h \ - hier_code.cc \ $(HTCPSOURCE) \ http.cc \ HttpBody.cc \ @@ -1788,9 +1798,7 @@ tests_testHttpRequest_SOURCES = \ $(WIN32_SOURCE) \ wordlist.cc nodist_tests_testHttpRequest_SOURCES = \ - globals.cc \ - repl_modules.cc \ - string_arrays.c + $(BUILT_SOURCES) tests_testHttpRequest_LDADD = \ $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ @@ -1849,10 +1857,6 @@ STORE_TEST_SOURCES=\ URLScheme.cc \ wordlist.cc -STORE_TEST_GEN_SOURCES = \ - $(TESTSOURCES) \ - string_arrays.c - ## why so many sources? well httpHeaderTools requites ACLChecklist & friends. ## first line - what we are testing. tests_testStore_SOURCES= \ @@ -1876,7 +1880,8 @@ tests_testStore_SOURCES= \ $(STORE_TEST_SOURCES) nodist_tests_testStore_SOURCES= \ - $(STORE_TEST_GEN_SOURCES) + $(TESTSOURCES) \ + swap_log_op.cc tests_testStore_LDADD= \ $(COMMON_LIBS) \ @@ -1944,7 +1949,7 @@ SWAP_TEST_SOURCES = \ $(DISKIO_SOURCE) SWAP_TEST_GEN_SOURCES = \ - $(STORE_TEST_GEN_SOURCES) \ + $(TESTSOURCES) \ $(DISKIO_GEN_SOURCE) SWAP_TEST_LDADD = \ @@ -1970,7 +1975,8 @@ tests_testUfs_SOURCES = \ tests/stub_cache_manager.cc \ $(SWAP_TEST_SOURCES) nodist_tests_testUfs_SOURCES = \ - $(SWAP_TEST_GEN_SOURCES) + $(SWAP_TEST_GEN_SOURCES) \ + swap_log_op.cc tests_testUfs_LDADD = \ $(SWAP_TEST_LDADD) \ $(COMMON_LIBS) \ @@ -2062,7 +2068,6 @@ tests_testURL_SOURCES = \ gopher.cc \ helper.cc \ hier_code.h \ - hier_code.cc \ $(HTCPSOURCE) \ http.cc \ HttpBody.cc \ @@ -2139,9 +2144,7 @@ tests_testURL_SOURCES = \ $(WIN32_SOURCE) \ wordlist.cc nodist_tests_testURL_SOURCES = \ - globals.cc \ - repl_modules.cc \ - string_arrays.c + $(BUILT_SOURCES) tests_testURL_LDADD = \ $(COMMON_LIBS) \ icmp/libicmp.la icmp/libicmp-core.la \ diff --git a/src/StoreSwapLogData.cc b/src/StoreSwapLogData.cc index 1892cb53d3..91a2362bf6 100644 --- a/src/StoreSwapLogData.cc +++ b/src/StoreSwapLogData.cc @@ -33,6 +33,7 @@ */ #include "StoreSwapLogData.h" +#include "swap_log_op.h" StoreSwapLogData::StoreSwapLogData(): op(0), swap_filen (0), timestamp (0), lastref (0), expires (0), lastmod(0), swap_file_sz (0), refcount (0), flags (0) { diff --git a/src/access_log.cc b/src/access_log.cc index 9ecb48b3a9..15e497e391 100644 --- a/src/access_log.cc +++ b/src/access_log.cc @@ -1033,7 +1033,7 @@ accessLogCustom(AccessLogEntry * al, customlog * log) if (al->hier.ping.timedout) mb.append("TIMEOUT_", 8); - out = hier_strings[al->hier.code]; + out = hier_code_str[al->hier.code]; break; @@ -1664,7 +1664,7 @@ accessLogSquid(AccessLogEntry * al, Logfile * logfile) al->url, user ? user : dash_str, al->hier.ping.timedout ? "TIMEOUT_" : "", - hier_strings[al->hier.code], + hier_code_str[al->hier.code], al->hier.host, al->http.content_type); } else { @@ -1682,7 +1682,7 @@ accessLogSquid(AccessLogEntry * al, Logfile * logfile) al->url, user ? user : dash_str, al->hier.ping.timedout ? "TIMEOUT_" : "", - hier_strings[al->hier.code], + hier_code_str[al->hier.code], al->hier.host, al->http.content_type, ereq, @@ -1723,7 +1723,7 @@ accessLogCommon(AccessLogEntry * al, Logfile * logfile) al->http.code, al->cache.replySize, log_tags[al->cache.code], - hier_strings[al->hier.code]); + hier_code_str[al->hier.code]); safe_free(user1); diff --git a/src/acl/Gadgets.h b/src/acl/Gadgets.h index 6c913b1a2b..f6a8956c8b 100644 --- a/src/acl/Gadgets.h +++ b/src/acl/Gadgets.h @@ -2,7 +2,7 @@ #define SQUID_ACL_GADGETS_H #include "config.h" -#include "enums.h" /* for err_type */ +#include "err_type.h" struct dlink_list; class StoreEntry; diff --git a/src/acl/HierCodeData.cc b/src/acl/HierCodeData.cc index de8f984795..3e5e17cdea 100644 --- a/src/acl/HierCodeData.cc +++ b/src/acl/HierCodeData.cc @@ -31,7 +31,7 @@ ACLHierCodeData::dump() for (hier_code iter=HIER_NONE; iter */ +#include "config.h" #include "ufscommon.h" #include "Store.h" #include "fde.h" @@ -42,6 +42,8 @@ #include "StoreMetaUnpacker.h" #include "RefCount.h" #include "StoreSwapLogData.h" +#include "swap_log_op.h" + CBDATA_CLASS_INIT(RebuildState); diff --git a/src/globals.h b/src/globals.h index dfd234bb1f..e3e926c63b 100644 --- a/src/globals.h +++ b/src/globals.h @@ -124,10 +124,6 @@ extern "C" extern unsigned long store_swap_size; /* 0 */ extern time_t hit_only_mode_until; /* 0 */ extern StatCounters statCounter; - extern char *err_type_str[]; - extern char *icp_opcode_str[]; - extern char *swap_log_op_str[]; - extern char *lookup_t_str[]; extern double request_failure_ratio; /* 0.0 */ extern int store_hash_buckets; /* 0 */ extern hash_table *store_table; /* NULL */ diff --git a/src/hier_code.cc b/src/hier_code.cc deleted file mode 100644 index 4a5157e1f9..0000000000 --- a/src/hier_code.cc +++ /dev/null @@ -1,29 +0,0 @@ -#include "config.h" -#include "hier_code.h" - -const char *hier_strings[] = { - "NONE", /* HIER_NONE */ - "DIRECT", /* HIER_DIRECT */ - "SIBLING_HIT", - "PARENT_HIT", - "DEFAULT_PARENT", - "SINGLE_PARENT", - "FIRSTUP_PARENT", - "FIRST_PARENT_MISS", - "CLOSEST_PARENT_MISS", - "CLOSEST_PARENT", - "CLOSEST_DIRECT", - "NO_DIRECT_FAIL", - "SOURCE_FASTEST", - "ROUNDROBIN_PARENT", -#if USE_CACHE_DIGESTS - "CD_PARENT_HIT", - "CD_SIBLING_HIT", -#endif - "CARP", - "ANY_PARENT", - "USERHASH", - "SOURCEHASH", - "PINNED", - "HIER_MAX" -}; diff --git a/src/hier_code.h b/src/hier_code.h index 5b91d24eed..38adaac798 100644 --- a/src/hier_code.h +++ b/src/hier_code.h @@ -28,7 +28,7 @@ typedef enum { HIER_MAX } hier_code; -extern const char *hier_strings[]; +extern const char *hier_code_str[]; inline const hier_code operator++(hier_code &i) { return (hier_code)(i+1); } diff --git a/src/icp_opcode.h b/src/icp_opcode.h new file mode 100644 index 0000000000..84e74fac18 --- /dev/null +++ b/src/icp_opcode.h @@ -0,0 +1,35 @@ +#ifndef _SQUID_ICP_OPCODE_H +#define _SQUID_ICP_OPCODE_H + +/// \ingroup ServerProtocolICPAPI +typedef enum { + ICP_INVALID, + ICP_QUERY, + ICP_HIT, + ICP_MISS, + ICP_ERR, + ICP_SEND, + ICP_SENDA, + ICP_DATABEG, + ICP_DATA, + ICP_DATAEND, + ICP_SECHO, + ICP_DECHO, + ICP_NOTIFY, + ICP_INVALIDATE, + ICP_DELETE, + ICP_UNUSED15, + ICP_UNUSED16, + ICP_UNUSED17, + ICP_UNUSED18, + ICP_UNUSED19, + ICP_UNUSED20, + ICP_MISS_NOFETCH, + ICP_DENIED, + ICP_HIT_OBJ, + ICP_END +} icp_opcode; + +extern const char *icp_opcode_str[]; + +#endif /* _SQUID_ICP_OPCODE_H */ diff --git a/src/mk-string-arrays.awk b/src/mk-string-arrays.awk index 72995a58cc..d4b5ec3751 100644 --- a/src/mk-string-arrays.awk +++ b/src/mk-string-arrays.awk @@ -5,17 +5,23 @@ # --> awk -f mk-string-arrays.awk enum.h # # 2006 by Christopher Kerr. +# +# 2009 modified by Amos Jeffries +# Adapted to convert individual enum headers +# -BEGIN { # converted to "const char *"TypedefEnum[?]"_str[]" - TypedefEnum["err_type"] = 1 - TypedefEnum["lookup_t"] = 1 - TypedefEnum["icp_opcode"] = 1 - TypedefEnum["swap_log_op"] = 1 +BEGIN { + print "/*" + print " * Auto-Generated File. Changes will be destroyed." + print " */" + print "#include \"squid.h\"" + codeSkip = 1 + e = 0 } -/^ \*\/$/ && Copyright != 1 { Copyright = 1; print; next } -Copyright != 1 { print; next } -/^typedef/ { e = 0; next } +# Skip all lines outside of typedef {} +/^typedef/ { codeSkip = 0; next } +codeSkip == 1 { next } /^[ \t]*[A-Z]/ { split($1, t, ",") # remove , @@ -26,13 +32,13 @@ Copyright != 1 { print; next } /^} / { split($2, t, ";") # remove ; type = t[1] - if (TypedefEnum[type]) { - print "\nconst char *" type "_str[] = {" - for ( i = 1; i < e; ++i) - print "\t\"" Element[i] "\"," - print "\t\"" Element[i] "\"" - print "};" - } + codeSkip = 1 + + print "#include \"" type ".h\"" + print "\nconst char *" type "_str[] = {" + for ( i = 1; i < e; ++i) + print "\t\"" Element[i] "\"," + print "\t\"" Element[i] "\"" + print "};" next } - diff --git a/src/neighbors.cc b/src/neighbors.cc index 00ef0165c7..834d656ecb 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -877,18 +877,13 @@ void peerNoteDigestLookup(HttpRequest * request, peer * p, lookup_t lookup) { #if USE_CACHE_DIGESTS - if (p) strncpy(request->hier.cd_host, p->host, sizeof(request->hier.cd_host)); else *request->hier.cd_host = '\0'; request->hier.cd_lookup = lookup; - - debugs(15, 4, "peerNoteDigestLookup: peer " << - (p ? p->host : "") << ", lookup: " << - lookup_t_str[lookup] ); - + debugs(15, 4, "peerNoteDigestLookup: peer " << (p? p->host : "") << ", lookup: " << lookup_t_str[lookup] ); #endif } @@ -1007,21 +1002,20 @@ ignoreMulticastReply(peer * p, MemObject * mem) return 1; } -/* I should attach these records to the entry. We take the first +/** + * I should attach these records to the entry. We take the first * hit we get our wait until everyone misses. The timeout handler * call needs to nip this shopping list or call one of the misses. * * If a hit process is already started, then sobeit */ void - neighborsUdpAck(const cache_key * key, icp_common_t * header, const IpAddress &from) { peer *p = NULL; StoreEntry *entry; MemObject *mem = NULL; peer_t ntype = PEER_NONE; - char *opcode_d; icp_opcode opcode = (icp_opcode) header->opcode; debugs(15, 6, "neighborsUdpAck: opcode " << opcode << " '" << storeKeyText(key) << "'"); @@ -1035,7 +1029,7 @@ neighborsUdpAck(const cache_key * key, icp_common_t * header, const IpAddress &f if (opcode > ICP_END) return; - opcode_d = icp_opcode_str[opcode]; + const char *opcode_d = icp_opcode_str[opcode]; if (p) neighborUpdateRtt(p, mem); diff --git a/src/peer_select.cc b/src/peer_select.cc index 72e9eea8a3..b7ebe8f65b 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -438,7 +438,7 @@ peerGetSomeNeighbor(ps_state * ps) if (code != HIER_NONE) { assert(p); - debugs(44, 3, "peerSelect: " << hier_strings[code] << "/" << p->host); + debugs(44, 3, "peerSelect: " << hier_code_str[code] << "/" << p->host); peerAddFwdServer(&ps->servers, p, code); } @@ -461,7 +461,7 @@ peerGetSomeNeighborReplies(ps_state * ps) if (peerCheckNetdbDirect(ps)) { code = CLOSEST_DIRECT; - debugs(44, 3, "peerSelect: " << hier_strings[code] << "/" << request->GetHost()); + debugs(44, 3, "peerSelect: " << hier_code_str[code] << "/" << request->GetHost()); peerAddFwdServer(&ps->servers, NULL, code); return; } @@ -478,7 +478,7 @@ peerGetSomeNeighborReplies(ps_state * ps) } } if (p && code != HIER_NONE) { - debugs(44, 3, "peerSelect: " << hier_strings[code] << "/" << p->host); + debugs(44, 3, "peerSelect: " << hier_code_str[code] << "/" << p->host); peerAddFwdServer(&ps->servers, p, code); } } @@ -533,7 +533,7 @@ peerGetSomeParent(ps_state * ps) } if (code != HIER_NONE) { - debugs(44, 3, "peerSelect: " << hier_strings[code] << "/" << p->host); + debugs(44, 3, "peerSelect: " << hier_code_str[code] << "/" << p->host); peerAddFwdServer(&ps->servers, p, code); } } @@ -765,7 +765,7 @@ peerAddFwdServer(FwdServer ** FSVR, peer * p, hier_code code) FwdServer *fs = (FwdServer *)memAllocate(MEM_FWD_SERVER); debugs(44, 5, "peerAddFwdServer: adding " << (p ? p->host : "DIRECT") << " " << - hier_strings[code] ); + hier_code_str[code] ); fs->_peer = cbdataReference(p); fs->code = code; diff --git a/src/protos.h b/src/protos.h index 8d63ce34fb..f694a07ad9 100644 --- a/src/protos.h +++ b/src/protos.h @@ -40,6 +40,10 @@ /* some parameters stil need this */ #include "wordlist.h" +/* for parameters that still need these */ +#include "lookup_t.h" + + class HttpRequestMethod; @@ -355,10 +359,6 @@ SQUIDCEXTERN int mimeGetViewOption(const char *fn); SQUIDCEXTERN int mcastSetTtl(int, int); SQUIDCEXTERN IPH mcastJoinGroups; -/* Labels for hierachical log file */ -/* put them all here for easier reference when writing a logfile analyzer */ - - SQUIDCEXTERN peer *getFirstPeer(void); SQUIDCEXTERN peer *getFirstUpParent(HttpRequest *); SQUIDCEXTERN peer *getNextPeer(peer *); diff --git a/src/store.cc b/src/store.cc index 29c097384a..99531ef196 100644 --- a/src/store.cc +++ b/src/store.cc @@ -50,6 +50,7 @@ #endif #include "Stack.h" #include "SquidTime.h" +#include "swap_log_op.h" static STMCB storeWriteComplete; @@ -57,6 +58,9 @@ static STMCB storeWriteComplete; #define STORE_IN_MEM_BUCKETS (229) + +/** \todo Convert these string constants to enum string-arrays generated */ + const char *memStatusStr[] = { "NOT_IN_MEMORY", "IN_MEMORY" diff --git a/src/store_dir.cc b/src/store_dir.cc index b9f60a105f..5bfc9636c8 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -38,6 +38,7 @@ #include "MemObject.h" #include "SquidTime.h" #include "SwapDir.h" +#include "swap_log_op.h" #if HAVE_STATVFS #if HAVE_SYS_STATVFS_H diff --git a/src/store_swapout.cc b/src/store_swapout.cc index b415a92e88..6e049a6dc5 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -41,6 +41,7 @@ #include "mem_node.h" #include "MemObject.h" #include "SwapDir.h" +#include "swap_log_op.h" static void storeSwapOutStart(StoreEntry * e); static StoreIOState::STIOCB storeSwapOutFileClosed; diff --git a/src/structs.h b/src/structs.h index fd9941d9ec..e807b09d17 100644 --- a/src/structs.h +++ b/src/structs.h @@ -32,12 +32,15 @@ #include "config.h" #include "RefCount.h" #include "cbdata.h" - -/* needed for various structures still in structs.h */ #include "dlink.h" +#include "err_type.h" + /* needed for the global config */ #include "HttpHeader.h" +/* for ICP_END */ +#include "icp_opcode.h" + struct acl_name_list { char name[ACL_NAME_SZ]; acl_name_list *next; diff --git a/src/swap_log_op.h b/src/swap_log_op.h new file mode 100644 index 0000000000..0fde2337b0 --- /dev/null +++ b/src/swap_log_op.h @@ -0,0 +1,14 @@ +#ifndef _SQUID_SWAP_LOG_OP_H +#define _SQUID_SWAP_LOG_OP_H + +typedef enum { + SWAP_LOG_NOP, + SWAP_LOG_ADD, + SWAP_LOG_DEL, + SWAP_LOG_VERSION, + SWAP_LOG_MAX +} swap_log_op; + +extern const char *swap_log_op_str[]; + +#endif /* _SQUID_SWAP_LOG_OP_H */