From 1328cfb7a3881632890e0785f45f7ccd09d6a332 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Tue, 25 Sep 2012 17:36:18 +0200 Subject: [PATCH] renamed acl_size_t to AclSizeLimit, moved to own header in acl/ Moved dwrite_q to disk.h, and _fde_disk to fde.h Got rid of structs.h --- src/HttpReply.cc | 4 +-- src/HttpRequest.cc | 3 ++- src/Makefile.am | 4 --- src/SquidConfig.h | 6 ++--- src/{structs.h => acl/AclSizeLimit.h} | 37 ++++++--------------------- src/acl/Makefile.am | 6 ++--- src/cache_cf.cc | 24 ++++++++--------- src/disk.h | 13 +++++++++- src/fde.h | 12 ++++++++- src/ip/QosConfig.h | 4 +-- src/mem.cc | 1 - 11 files changed, 54 insertions(+), 60 deletions(-) rename src/{structs.h => acl/AclSizeLimit.h} (76%) diff --git a/src/HttpReply.cc b/src/HttpReply.cc index 44bdc5a671..e0dd59162a 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -32,6 +32,7 @@ */ #include "squid.h" +#include "acl/AclSizeLimit.h" #include "acl/FilledChecklist.h" #include "globals.h" #include "HttpBody.h" @@ -45,7 +46,6 @@ #include "SquidTime.h" #include "Store.h" #include "StrList.h" -#include "structs.h" /* local constants */ @@ -598,7 +598,7 @@ HttpReply::calcMaxBodySize(HttpRequest& request) ACLFilledChecklist ch(NULL, &request, NULL); ch.reply = HTTPMSGLOCK(this); // XXX: this lock makes method non-const - for (acl_size_t *l = Config.ReplyBodySize; l; l = l -> next) { + for (AclSizeLimit *l = Config.ReplyBodySize; l; l = l -> next) { /* if there is no ACL list or if the ACLs listed match use this size value */ if (!l->aclList || ch.fastCheck(l->aclList) == ACCESS_ALLOWED) { debugs(58, 4, HERE << "bodySizeMax=" << bodySizeMax); diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 2556e514c1..e8e97c156a 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -33,6 +33,7 @@ #include "squid.h" #include "AccessLogEntry.h" +#include "acl/AclSizeLimit.h" #include "acl/FilledChecklist.h" #include "client_side.h" #include "DnsLookupDetails.h" @@ -642,7 +643,7 @@ HttpRequest::getRangeOffsetLimit() ch.src_addr = client_addr; ch.my_addr = my_addr; - for (acl_size_t *l = Config.rangeOffsetLimit; l; l = l -> next) { + for (AclSizeLimit *l = Config.rangeOffsetLimit; l; l = l -> next) { /* if there is no ACL list or if the ACLs listed match use this limit value */ if (!l->aclList || ch.fastCheck(l->aclList) == ACCESS_ALLOWED) { debugs(58, 4, HERE << "rangeOffsetLimit=" << rangeOffsetLimit); diff --git a/src/Makefile.am b/src/Makefile.am index 3ab295d09a..926a931929 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -529,7 +529,6 @@ squid_SOURCES = \ StoreSwapLogData.h \ Server.cc \ Server.h \ - structs.h \ swap_log_op.h \ SwapDir.cc \ SwapDir.h \ @@ -718,7 +717,6 @@ recv_announce_SOURCES = recv-announce.cc ## mem.cc wants ClientInfo.h ## libbase.la wants cbdata.* ## libbase.la wants MemBuf.* -## structs.h wants HelperChildConfig.* (stub it) ufsdump_SOURCES = \ ClientInfo.h \ cbdata.h \ @@ -2488,7 +2486,6 @@ tests_test_http_range_LDFLAGS = $(LIBADD_DL) tests_test_http_range_DEPENDENCIES = \ $(SQUID_CPPUNIT_LA) - tests_testHttpParser_SOURCES = \ Debug.h \ HttpParser.cc \ @@ -2498,7 +2495,6 @@ tests_testHttpParser_SOURCES = \ Mem.h \ mem.cc \ String.cc \ - structs.h \ cache_cf.h \ YesNoNone.h \ tests/stub_cache_cf.cc \ diff --git a/src/SquidConfig.h b/src/SquidConfig.h index bd3e9fbce8..2f2c028dba 100644 --- a/src/SquidConfig.h +++ b/src/SquidConfig.h @@ -46,7 +46,7 @@ class sslproxy_cert_adapt; #endif class acl_access; -class acl_size_t; +class AclSizeLimit; class AclDenyInfoList; namespace Mgr { class ActionPasswordList; @@ -123,7 +123,7 @@ public: int64_t maxChunkedRequestBodySize; size_t maxRequestBufferSize; size_t maxReplyHeaderSize; - acl_size_t *ReplyBodySize; + AclSizeLimit *ReplyBodySize; struct { unsigned short icp; @@ -456,7 +456,7 @@ public: } comm_incoming; int max_open_disk_fds; int uri_whitespace; - acl_size_t *rangeOffsetLimit; + AclSizeLimit *rangeOffsetLimit; #if MULTICAST_MISS_STREAM struct { diff --git a/src/structs.h b/src/acl/AclSizeLimit.h similarity index 76% rename from src/structs.h rename to src/acl/AclSizeLimit.h index 0355753f32..6a19f2df31 100644 --- a/src/structs.h +++ b/src/acl/AclSizeLimit.h @@ -1,3 +1,5 @@ +#ifndef SQUID_ACLSIZELIMIT_H_ +#define SQUID_ACLSIZELIMIT_H_ /* * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -26,38 +28,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ -#ifndef SQUID_STRUCTS_H -#define SQUID_STRUCTS_H - -#include "defines.h" -#include "typedefs.h" class ACLList; - -struct acl_size_t { - acl_size_t *next; +/// representation of a class of Size-limit ACLs +// a POD. TODO: convert to new ACL framework +class AclSizeLimit { +public: + AclSizeLimit *next; ACLList *aclList; int64_t size; }; -// POD -class dwrite_q -{ -public: - off_t file_offset; - char *buf; - size_t len; - size_t buf_offset; - dwrite_q *next; - FREE *free_func; -}; - -struct _fde_disk { - DWCB *wrt_handle; - void *wrt_handle_data; - dwrite_q *write_q; - dwrite_q *write_q_tail; - off_t offset; -}; - -#endif /* SQUID_STRUCTS_H */ +#endif /* SQUID_ACLSIZELIMIT_H_ */ diff --git a/src/acl/Makefile.am b/src/acl/Makefile.am index f9a4e54b76..8f808fb892 100644 --- a/src/acl/Makefile.am +++ b/src/acl/Makefile.am @@ -17,7 +17,6 @@ libstate_la_SOURCES = \ Strategy.h \ Strategised.cc \ Strategised.h \ - \ FilledChecklist.cc \ FilledChecklist.h \ AclAddress.h \ @@ -35,7 +34,6 @@ libacls_la_SOURCES = \ Time.h \ TimeData.cc \ TimeData.h \ - \ Asn.cc \ Asn.h \ Browser.cc \ @@ -106,11 +104,11 @@ libacls_la_SOURCES = \ UrlPort.h \ UserData.cc \ UserData.h \ - \ AclNameList.h \ AclDenyInfoList.h \ Gadgets.cc \ - Gadgets.h + Gadgets.h \ + AclSizeLimit.h ## Add conditional sources ## TODO: move these to their respectful dirs when those dirs are created diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 3c4ee2c9d4..b8cb6c8325 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -35,6 +35,7 @@ #include "acl/AclAddress.h" #include "acl/AclDenyInfoList.h" #include "acl/AclNameList.h" +#include "acl/AclSizeLimit.h" #include "acl/Gadgets.h" #include "acl/MethodData.h" #include "anyp/PortCfg.h" @@ -73,7 +74,6 @@ #include "ssl/ProxyCerts.h" #include "Store.h" #include "StoreFileSystem.h" -#include "structs.h" #include "SwapDir.h" #include "wordlist.h" #include "neighbors.h" @@ -1565,12 +1565,12 @@ free_acl_nfmark(acl_nfmark ** head) } #endif /* SO_MARK */ -CBDATA_TYPE(acl_size_t); +CBDATA_TYPE(AclSizeLimit); static void -dump_acl_b_size_t(StoreEntry * entry, const char *name, acl_size_t * head) +dump_acl_b_size_t(StoreEntry * entry, const char *name, AclSizeLimit * head) { - acl_size_t *l; + AclSizeLimit *l; for (l = head; l; l = l->next) { if (l->size != -1) @@ -1587,19 +1587,19 @@ dump_acl_b_size_t(StoreEntry * entry, const char *name, acl_size_t * head) static void freed_acl_b_size_t(void *data) { - acl_size_t *l = static_cast(data); + AclSizeLimit *l = static_cast(data); aclDestroyAclList(&l->aclList); } static void -parse_acl_b_size_t(acl_size_t ** head) +parse_acl_b_size_t(AclSizeLimit ** head) { - acl_size_t *l; - acl_size_t **tail = head; /* sane name below */ + AclSizeLimit *l; + AclSizeLimit **tail = head; /* sane name below */ - CBDATA_INIT_TYPE_FREECB(acl_size_t, freed_acl_b_size_t); + CBDATA_INIT_TYPE_FREECB(AclSizeLimit, freed_acl_b_size_t); - l = cbdataAlloc(acl_size_t); + l = cbdataAlloc(AclSizeLimit); parse_b_int64_t(&l->size); @@ -1612,10 +1612,10 @@ parse_acl_b_size_t(acl_size_t ** head) } static void -free_acl_b_size_t(acl_size_t ** head) +free_acl_b_size_t(AclSizeLimit ** head) { while (*head) { - acl_size_t *l = *head; + AclSizeLimit *l = *head; *head = l->next; l->next = NULL; cbdataFree(l); diff --git a/src/disk.h b/src/disk.h index 9910fdbdee..362842dec5 100644 --- a/src/disk.h +++ b/src/disk.h @@ -36,8 +36,8 @@ #include "typedefs.h" class MemBuf; -// POD +// POD class dread_ctrl { public: @@ -50,6 +50,17 @@ public: void *client_data; }; +// POD +class dwrite_q +{ +public: + off_t file_offset; + char *buf; + size_t len; + size_t buf_offset; + dwrite_q *next; + FREE *free_func; +}; int file_open(const char *path, int mode); void file_close(int fd); diff --git a/src/fde.h b/src/fde.h index b0f2ee17d4..57ee4241b7 100644 --- a/src/fde.h +++ b/src/fde.h @@ -31,8 +31,8 @@ #define SQUID_FDE_H #include "comm.h" +#include "defines.h" #include "ip/Address.h" -#include "structs.h" #if USE_SSL #include @@ -41,7 +41,17 @@ #if USE_DELAY_POOLS class ClientInfo; #endif + class PconnPool; +class dwrite_q; +class _fde_disk { +public: + DWCB *wrt_handle; + void *wrt_handle_data; + dwrite_q *write_q; + dwrite_q *write_q_tail; + off_t offset; +}; class fde { diff --git a/src/ip/QosConfig.h b/src/ip/QosConfig.h index 2e277ef490..2b801648cf 100644 --- a/src/ip/QosConfig.h +++ b/src/ip/QosConfig.h @@ -3,7 +3,6 @@ #include "hier_code.h" #include "ip/forward.h" -#include "structs.h" #if HAVE_LIBNETFILTER_CONNTRACK_LIBNETFILTER_CONNTRACK_H #include @@ -21,6 +20,7 @@ class ACLList; class fde; // TODO: move to new ACL framework +// not integrated in namespace, as this class uses a strange CBDATA definition // POD class acl_tos { public: @@ -29,6 +29,7 @@ public: tos_t tos; }; // TODO: move to new ACL framework +// not integrated in namespace, as this class uses a strange CBDATA definition // POD class acl_nfmark { public: @@ -37,7 +38,6 @@ public: nfmark_t nfmark; }; - namespace Ip { diff --git a/src/mem.cc b/src/mem.cc index 56cad3e3d4..4a947661ff 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -49,7 +49,6 @@ #include "SquidTime.h" #include "Store.h" #include "StoreEntryStream.h" -#include "structs.h" #if HAVE_IOMANIP #include -- 2.47.3