[master] fa6d649 Isolate VCL-internals more in cache_vcl.c

Poul-Henning Kamp phk at FreeBSD.org
Wed Jun 17 11:39:04 CEST 2015


commit fa6d649095d8b3018a92d48bad7c6ffe83e10b2b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jun 17 08:51:47 2015 +0000

    Isolate VCL-internals more in cache_vcl.c

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 042e176..e8836fb 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1065,15 +1065,16 @@ enum vry_finish_flag { KEEP, DISCARD };
 void VRY_Finish(struct req *req, enum vry_finish_flag);
 
 /* cache_vcl.c */
+struct director *VCL_DefaultDirector(const struct VCL_conf *);
 void VCL_Init(void);
+const char *VCL_Method_Name(unsigned);
+const char *VCL_Name(const struct VCL_conf *);
 void VCL_Panic(struct vsb *, const struct VCL_conf *);
-void VCL_Refresh(struct VCL_conf **vcc);
-void VCL_Ref(struct VCL_conf *vcc);
-void VCL_Rel(struct VCL_conf **vcc);
 void VCL_Poll(void);
-struct director *VCL_DefaultDirector(const struct VCL_conf *);
+void VCL_Ref(struct VCL_conf *);
+void VCL_Refresh(struct VCL_conf **);
+void VCL_Rel(struct VCL_conf **);
 const char *VCL_Return_Name(unsigned);
-const char *VCL_Method_Name(unsigned);
 
 #define VCL_MET_MAC(l,u,b) \
     void VCL_##l##_method(struct VCL_conf *, struct worker *, struct req *, \
diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c
index 9fa64b5..fc15baa 100644
--- a/bin/varnishd/cache/cache_backend_cfg.c
+++ b/bin/varnishd/cache/cache_backend_cfg.c
@@ -41,7 +41,6 @@
 #include "cache_backend.h"
 #include "vcli.h"
 #include "vcli_priv.h"
-#include "vcl.h"
 #include "vsa.h"
 #include "vrt.h"
 #include "vtim.h"
@@ -162,13 +161,13 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv)
 	AN(vsb);
 	if (matcher == NULL || *matcher == '\0' || !strcmp(matcher, "*")) {
 		// all backends in active VCL
-		VSB_printf(vsb, "%s.*", vcc->loaded_name);
+		VSB_printf(vsb, "%s.*", VCL_Name(vcc));
 	} else if (strchr(matcher, '.') != NULL) {
 		// use pattern as is
 		VSB_cat(vsb, matcher);
 	} else {
 		// pattern applies to active vcl
-		VSB_printf(vsb, "%s.%s", vcc->loaded_name, matcher);
+		VSB_printf(vsb, "%s.%s", VCL_Name(vcc), matcher);
 	}
 	AZ(VSB_finish(vsb));
 	Lck_Lock(&backends_mtx);
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index e45f186..bca73c2 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -253,6 +253,13 @@ VCL_DefaultDirector(const struct VCL_conf *vcc)
 	return (*vcc->default_director);
 }
 
+const char *
+VCL_Name(const struct VCL_conf *vcc)
+{
+	AN(vcc);
+	return (vcc->loaded_name);
+}
+
 /*--------------------------------------------------------------------*/
 
 static struct vcl *



More information about the varnish-commit mailing list