[master] 01fbdac Complete namespace cleanup.

Poul-Henning Kamp phk at varnish-cache.org
Tue May 31 13:15:06 CEST 2011


commit 01fbdaca96e7e94c85fad6d532f8f4a617b40deb
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue May 31 11:08:27 2011 +0000

    Complete namespace cleanup.
    
    Add stuff to libvarnishapi to make it self-sufficient.
    
    Remove libvarnish from tools' Makefiles, they should not link
    against it, to ensure that libvarnishapi is enough for such tasks.
    
    Where we need special stuff from libvarnish, like VPF, pull
    it into tools' Makefile directly.

diff --git a/bin/varnishadm/Makefile.am b/bin/varnishadm/Makefile.am
index 03fb471..2eb182a 100644
--- a/bin/varnishadm/Makefile.am
+++ b/bin/varnishadm/Makefile.am
@@ -12,7 +12,6 @@ varnishadm_SOURCES = \
 varnishadm_CFLAGS = @LIBEDIT_CFLAGS@
 
 varnishadm_LDADD = \
-	$(top_builddir)/lib/libvarnish/libvarnish.la \
 	$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
 	$(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \
 	${PTHREAD_LIBS} ${NET_LIBS} @LIBEDIT_LIBS@
diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index e460367..22717de 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -110,7 +110,7 @@ cli_sock(const char *T_arg, const char *S_arg)
 			AZ(close(sock));
 			return (-1);
 		}
-		VCLI_response(fd, answer, buf);
+		VCLI_AuthResponse(fd, answer, buf);
 		AZ(close(fd));
 		free(answer);
 
diff --git a/bin/varnishd/mgt_cli.c b/bin/varnishd/mgt_cli.c
index f155c0f..70f5828 100644
--- a/bin/varnishd/mgt_cli.c
+++ b/bin/varnishd/mgt_cli.c
@@ -292,7 +292,7 @@ mcf_auth(struct cli *cli, const char *const *av, void *priv)
 		return;
 	}
 	mgt_got_fd(fd);
-	VCLI_response(fd, cli->challenge, buf);
+	VCLI_AuthResponse(fd, cli->challenge, buf);
 	AZ(close(fd));
 	if (strcasecmp(buf, av[2])) {
 		mgt_cli_challenge(cli);
diff --git a/bin/varnishlog/Makefile.am b/bin/varnishlog/Makefile.am
index 17474fc..1a359f7 100644
--- a/bin/varnishlog/Makefile.am
+++ b/bin/varnishlog/Makefile.am
@@ -6,10 +6,12 @@ bin_PROGRAMS = varnishlog
 
 dist_man_MANS = varnishlog.1
 
-varnishlog_SOURCES = varnishlog.c
+varnishlog_SOURCES = \
+	varnishlog.c \
+	$(top_builddir)/lib/libvarnish/flopen.c \
+	$(top_builddir)/lib/libvarnish/vpf.c
 
 varnishlog_LDADD = \
-	$(top_builddir)/lib/libvarnish/libvarnish.la \
 	$(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \
 	$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
 	${PTHREAD_LIBS}
diff --git a/bin/varnishncsa/Makefile.am b/bin/varnishncsa/Makefile.am
index 69ec4de..e4a2880 100644
--- a/bin/varnishncsa/Makefile.am
+++ b/bin/varnishncsa/Makefile.am
@@ -6,10 +6,12 @@ bin_PROGRAMS = varnishncsa
 
 dist_man_MANS = varnishncsa.1
 
-varnishncsa_SOURCES = varnishncsa.c
+varnishncsa_SOURCES = \
+	varnishncsa.c \
+	$(top_builddir)/lib/libvarnish/flopen.c \
+	$(top_builddir)/lib/libvarnish/vpf.c
 
 varnishncsa_LDADD = \
-	$(top_builddir)/lib/libvarnish/libvarnish.la \
 	$(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \
 	$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
 	${PTHREAD_LIBS}
diff --git a/bin/varnishreplay/Makefile.am b/bin/varnishreplay/Makefile.am
index bca6b10..2df4616 100644
--- a/bin/varnishreplay/Makefile.am
+++ b/bin/varnishreplay/Makefile.am
@@ -10,7 +10,6 @@ varnishreplay_SOURCES = \
 	varnishreplay.c
 
 varnishreplay_LDADD = \
-	$(top_builddir)/lib/libvarnish/libvarnish.la \
 	$(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \
 	$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
 	${PTHREAD_LIBS} ${NET_LIBS}
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 3cd6431..c706487 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -341,7 +341,7 @@ varnish_launch(struct varnish *v)
 
 	assert(sizeof abuf >= CLI_AUTH_RESPONSE_LEN + 6);
 	strcpy(abuf, "auth ");
-	VCLI_response(nfd, r, abuf + 5);
+	VCLI_AuthResponse(nfd, r, abuf + 5);
 	AZ(close(nfd));
 	free(r);
 	strcat(abuf, "\n");
diff --git a/include/cli_common.h b/include/cli_common.h
index 5041f6d..0e8ba8c 100644
--- a/include/cli_common.h
+++ b/include/cli_common.h
@@ -49,5 +49,5 @@ int VCLI_ReadResult(int fd, unsigned *status, char **ptr, double tmo);
 
 #define CLI_AUTH_RESPONSE_LEN		65	/* 64 hex + NUL */
 
-void VCLI_response(int S_fd, const char *challenge,
+void VCLI_AuthResponse(int S_fd, const char *challenge,
     char reponse[CLI_AUTH_RESPONSE_LEN]);
diff --git a/include/varnishapi.h b/include/varnishapi.h
index 6e3529c..74ec7a1 100644
--- a/include/varnishapi.h
+++ b/include/varnishapi.h
@@ -188,9 +188,9 @@ struct VSC_point {
 	const volatile void *ptr;	/* field value			*/
 };
 
-typedef int vsc_iter_f(void *priv, const struct VSC_point *const pt);
+typedef int VSC_iter_f(void *priv, const struct VSC_point *const pt);
 
-int VSC_Iter(struct VSM_data *vd, vsc_iter_f *func, void *priv);
+int VSC_Iter(struct VSM_data *vd, VSC_iter_f *func, void *priv);
 	/*
 	 * Iterate over all statistics counters, calling "func" for
 	 * each counter not suppressed by any "-f" arguments.
diff --git a/lib/libvarnish/cli_auth.c b/lib/libvarnish/cli_auth.c
index 3d9f44e..87e113e 100644
--- a/lib/libvarnish/cli_auth.c
+++ b/lib/libvarnish/cli_auth.c
@@ -39,7 +39,7 @@
 
 
 void
-VCLI_response(int S_fd, const char *challenge,
+VCLI_AuthResponse(int S_fd, const char *challenge,
     char response[CLI_AUTH_RESPONSE_LEN])
 {
 	SHA256_CTX ctx;
diff --git a/lib/libvarnishapi/Makefile.am b/lib/libvarnishapi/Makefile.am
index d60dd13..24422c1 100644
--- a/lib/libvarnishapi/Makefile.am
+++ b/lib/libvarnishapi/Makefile.am
@@ -14,9 +14,15 @@ libvarnishapi_la_SOURCES = \
 	../libvarnish/argv.c \
 	../libvarnish/vcs_version.c \
 	../libvarnish/version.c \
+	../libvarnish/cli_common.c \
+	../libvarnish/cli_auth.c \
+	../libvarnish/tcp.c \
 	../libvarnish/vin.c \
 	../libvarnish/vmb.c \
 	../libvarnish/vre.c \
+	../libvarnish/vsb.c \
+	../libvarnish/vsha256.c \
+	../libvarnish/vss.c \
 	base64.c \
 	vsm.c \
 	vsl_arg.c \
@@ -26,4 +32,4 @@ libvarnishapi_la_SOURCES = \
 libvarnishapi_la_CFLAGS = \
 	-DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"'
 
-libvarnishapi_la_LIBADD = @PCRE_LIBS@
+libvarnishapi_la_LIBADD = @PCRE_LIBS@ ${LIBM}
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index 907a4d0..6e1eea5 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -250,7 +250,7 @@ iter_test(const char *s1, const char *s2, int wc)
 }
 
 static int
-iter_call(const struct vsc *vsc, vsc_iter_f *func, void *priv,
+iter_call(const struct vsc *vsc, VSC_iter_f *func, void *priv,
     const struct VSC_point *const sp)
 {
 	struct vsc_sf *sf;
@@ -283,7 +283,7 @@ iter_call(const struct vsc *vsc, vsc_iter_f *func, void *priv,
 #define VSC_DO(U,l,t)							\
 	static int							\
 	iter_##l(const struct vsc *vsc, struct VSM_chunk *sha,		\
-	    vsc_iter_f *func, void *priv)				\
+	    VSC_iter_f *func, void *priv)				\
 	{								\
 		struct VSC_C_##l *st;					\
 		struct VSC_point sp;					\
@@ -315,7 +315,7 @@ iter_call(const struct vsc *vsc, vsc_iter_f *func, void *priv,
 #undef VSC_DONE
 
 int
-VSC_Iter(struct VSM_data *vd, vsc_iter_f *func, void *priv)
+VSC_Iter(struct VSM_data *vd, VSC_iter_f *func, void *priv)
 {
 	struct vsc *vsc;
 	struct VSM_chunk *sha;



More information about the varnish-commit mailing list