Re: [squid-dev] [PATCH] Fix broken build for ufsdump

2017-03-16 Thread Alex Rousskov
On 03/16/2017 01:43 AM, Amos Jeffries wrote:
> On 6/03/2017 3:54 p.m., Alex Rousskov wrote:
>> On 03/05/2017 12:28 PM, Eduard Bagdasaryan wrote:
>>> ufsdump build is broken now [...]
>>> This patch fixes this, however I am not sure that
>>> does it in a best possible way. For example, someone may argue that
>>> inlining storeKeyText() is wrong.

>> Yeah, I would argue that such inlining is "wrong".


> Any particular reason(s) beyond the static local variable?

* explicit inlining of a non-trivial function that should not be used on
a performance sensitive path

* exposing a "heavy" external interface: snprintf()

* exposing an external interface: SQUID_MD5_DIGEST_LENGTH

* local static

Alex.

___
squid-dev mailing list
squid-dev@lists.squid-cache.org
http://lists.squid-cache.org/listinfo/squid-dev


Re: [squid-dev] [PATCH] Fix broken build for ufsdump

2017-03-16 Thread Amos Jeffries
On 6/03/2017 3:54 p.m., Alex Rousskov wrote:
> On 03/05/2017 12:28 PM, Eduard Bagdasaryan wrote:
> 
>> ufsdump build is broken now [...]
>> This patch fixes this, however I am not sure that
>> does it in a best possible way. For example, someone may argue that
>> inlining storeKeyText() is wrong.
> 
> Yeah, I would argue that such inlining is "wrong".
> 

Any particular reason(s) beyond the static local variable?


Amos

___
squid-dev mailing list
squid-dev@lists.squid-cache.org
http://lists.squid-cache.org/listinfo/squid-dev


Re: [squid-dev] [PATCH] Fix broken build for ufsdump

2017-03-05 Thread Alex Rousskov
On 03/05/2017 12:28 PM, Eduard Bagdasaryan wrote:

> ufsdump build is broken now [...]
> This patch fixes this, however I am not sure that
> does it in a best possible way. For example, someone may argue that
> inlining storeKeyText() is wrong.

Yeah, I would argue that such inlining is "wrong".


> I am posting it in hope that somebody
> else will polish and apply it.

This preliminary patch may be very helpful if somebody decides to fix
ufsdump. Thank you!

Alex.

___
squid-dev mailing list
squid-dev@lists.squid-cache.org
http://lists.squid-cache.org/listinfo/squid-dev


[squid-dev] [PATCH] Fix broken build for ufsdump

2017-03-05 Thread Eduard Bagdasaryan

Hello,

ufsdump build is broken now and seems that it became broken quite a long
time ago (though I have not tested when exactly), probably because is
not built by default. This patch fixes this, however I am not sure that
does it in a best possible way. For example, someone may argue that
inlining storeKeyText() is wrong. I am posting it in hope that somebody
else will polish and apply it.

BTW, running ufsdump produces an error:

FATAL: StoreMeta.cc required for use of Factory

Looks like it requires StoreMeta.cc instead of stub_StoreMeta.cc,
currently used.

Thanks,

Eduard.
Fix broken build for ufsdump utility.

=== modified file 'src/Makefile.am'
--- src/Makefile.am	2017-02-19 17:13:27 +
+++ src/Makefile.am	2017-03-05 18:49:54 +
@@ -600,87 +600,93 @@
 
 ## What requires what..
 ## many things want ACLChecklist.cc
 ## ACLChecklist.cc wants AuthUserRequest.cc
 ## ACLChecklist.cc wants AuthScheme.cc
 ## ACLChecklist.cc wants ACLProxyAuth.cc directly
 ## ACLProxyAuth.cc wants ACLUserData
 ## ACLProxyAuth.cc wants ACLRegexData
 ## cache_cf.cc wants $(AUTH_LIBS)
 ## cache_cf.cc wants store/libstore.la
 ## cache_cf.cc wants AnyP::PortCfg
 ## client_side wants client_db
 ## client_db wants SNMP_SOURCE
 ## snmp_core wants ACLStringData
 ## tools.cc wants ip/libip.la
 ## client_side.cc wants ip/libip.la
 ## libbase.la wants cbdata.*
 ## libbase.la wants MemBuf.*
 ufsdump_SOURCES = \
 	ClientInfo.h \
 	cbdata.h \
 	cbdata.cc \
 	debug.cc \
 	int.h \
 	int.cc \
 	mem/forward.h \
 	MemBuf.cc \
 	MemBuf.h \
 	Parsing.h \
 	store_key_md5.h \
-	store_key_md5.cc \
 	tests/stub_StoreMeta.cc \
 	StoreMetaUnpacker.cc \
+	StatHist.cc \
+	StatHist.h \
 	String.cc \
 	SquidNew.cc \
 	tests/stub_time.cc \
 	ufsdump.cc \
 	dlink.h \
 	dlink.cc \
 	helper/ChildConfig.h \
 	tests/stub_HelperChildConfig.cc \
 	RemovalPolicy.cc \
 	$(WIN32_SOURCE) \
 	fd.h \
 	tests/stub_fd.cc
 ufsdump_LDADD = \
 	ident/libident.la \
 	acl/libacls.la \
 	eui/libeui.la \
 	acl/libstate.la \
 	acl/libapi.la \
 	base/libbase.la \
 	libsquid.la \
 	ip/libip.la \
 	fs/libfs.la \
 	ipc/libipc.la \
 	mgr/libmgr.la \
+	sbuf/libsbuf.la \
+	mem/libmem.la \
+	SquidConfig.o \
+	$(top_builddir)/lib/libmiscutil.la \
+	$(top_builddir)/lib/libmiscencoding.la \
 	$(XTRA_OBJS) \
 	$(REPL_OBJS) \
 	$(NETTLELIB) \
 	$(CRYPTLIB) \
 	$(REGEXLIB) \
 	$(SSLLIB) \
 	$(COMPAT_LIB) \
 	$(EPOLL_LIBS) \
 	$(MINGW_LIBS) \
 	$(XTRA_LIBS)
 ufsdump_DEPENDENCIES = \
 	ident/libident.la \
 	acl/libacls.la \
 	eui/libeui.la \
 	acl/libstate.la \
 	acl/libapi.la \
 	base/libbase.la \
 	libsquid.la \
 	ip/libip.la \
 	fs/libfs.la \
 	ipc/libipc.la \
 	mgr/libmgr.la \
 	DiskIO/libdiskio.la \
 	$(REPL_OBJS)
 
 nodist_ufsdump_SOURCES = \
 	globals.cc
 
 sysconf_DATA = \
 	squid.conf.default \

=== modified file 'src/store_key_md5.cc'
--- src/store_key_md5.cc	2017-01-01 00:12:22 +
+++ src/store_key_md5.cc	2017-03-05 17:27:12 +
@@ -1,63 +1,47 @@
 /*
  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
  * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
 /* DEBUG: section 20Storage Manager MD5 Cache Keys */
 
 #include "squid.h"
 #include "HttpRequest.h"
-#include "md5.h"
 #include "store_key_md5.h"
 #include "URL.h"
 
 static cache_key null_key[SQUID_MD5_DIGEST_LENGTH];
 
-const char *
-storeKeyText(const cache_key *key)
-{
-if (!key)
-return "[null_store_key]";
-
-static char buf[SQUID_MD5_DIGEST_LENGTH * 2+1];
-int i;
-
-for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i)
-snprintf([i*2],sizeof(buf) - i*2, "%02X", *(key + i));
-
-return buf;
-}
-
 const cache_key *
 storeKeyScan(const char *buf)
 {
 static unsigned char digest[SQUID_MD5_DIGEST_LENGTH];
 int i;
 int j = 0;
 char t[3];
 
 for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i) {
 t[0] = *(buf + (j++));
 t[1] = *(buf + (j++));
 t[2] = '\0';
 *(digest + i) = (unsigned char) strtol(t, NULL, 16);
 }
 
 return digest;
 }
 
 int
 storeKeyHashCmp(const void *a, const void *b)
 {
 const unsigned char *A = (const unsigned char *)a;
 const unsigned char *B = (const unsigned char *)b;
 int i;
 
 for (i = 0; i < SQUID_MD5_DIGEST_LENGTH; ++i) {
 if (A[i] < B[i])
 return -1;
 
 if (A[i] > B[i])

=== modified file 'src/store_key_md5.h'
--- src/store_key_md5.h	2017-02-26 10:24:15 +
+++ src/store_key_md5.h	2017-03-05 17:28:34 +
@@ -1,40 +1,56 @@
 /*
  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
  * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
 /* DEBUG: section 20Storage Manager MD5 Cache Keys */
 
 #ifndef SQUID_STORE_KEY_MD5_H_