[master] 9957868 Pass the type of VCL method (B(ackend)/C(lient)/H(ousekeeping) into the macro-table.

Poul-Henning Kamp phk at FreeBSD.org
Mon Jan 18 23:46:13 CET 2016


commit 9957868abaae3bdb0954d6b6fe5700ad96756b60
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 18 22:45:32 2016 +0000

    Pass the type of VCL method (B(ackend)/C(lient)/H(ousekeeping)
    into the macro-table.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index b5f67f8..cdcfc3a 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -994,7 +994,7 @@ void VCL_Refresh(struct vcl **);
 void VCL_Rel(struct vcl **);
 const char *VCL_Return_Name(unsigned);
 
-#define VCL_MET_MAC(l,u,b) \
+#define VCL_MET_MAC(l,u,t,b) \
     void VCL_##l##_method(struct vcl *, struct worker *, struct req *, \
 	struct busyobj *bo, void *specific);
 #include "tbl/vcl_returns.h"
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 694b486..824a8c5 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -129,7 +129,7 @@ VCL_Method_Name(unsigned m)
 {
 
 	switch (m) {
-#define VCL_MET_MAC(func, upper, bitmap) case VCL_MET_##upper: return (#upper);
+#define VCL_MET_MAC(func, upper, typ, bitmap) case VCL_MET_##upper: return (#upper);
 #include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
 	default:
@@ -905,7 +905,7 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
 	assert(aws == WS_Snapshot(wrk->aws));
 }
 
-#define VCL_MET_MAC(func, upper, bitmap)				\
+#define VCL_MET_MAC(func, upper, typ, bitmap)				\
 void									\
 VCL_##func##_method(struct vcl *vcl, struct worker *wrk,		\
      struct req *req, struct busyobj *bo, void *specific)		\
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index c799bed..a54eaa2 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -139,11 +139,11 @@ returns =(
 	# Housekeeping
 
 	('init',
-		"",
+		"H",
 		('ok', 'fail')
 	),
 	('fini',
-		"",
+		"H",
 		('ok',)
 	),
 )
@@ -993,7 +993,8 @@ fo.write("#endif\n")
 
 fo.write("\n#ifdef VCL_MET_MAC\n")
 for i in ll:
-	fo.write("VCL_MET_MAC(%s, %s," % (i[0].lower(), i[0].upper()))
+	fo.write("VCL_MET_MAC(%s, %s, %s," %
+	    (i[0].lower(), i[0].upper(), i[1]))
 	p = " (\n\t"
 	lll = list(i[2])
 	lll.sort()
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index cc22496..87331ff 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -66,7 +66,7 @@
 
 struct method method_tab[] = {
 	{ "none", 0U, 0},
-#define VCL_MET_MAC(l,U,m)	{ "vcl_"#l, m, VCL_MET_##U },
+#define VCL_MET_MAC(l,U,t,b)	{ "vcl_"#l, b, VCL_MET_##U },
 #include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
 	{ NULL, 0U, 0}
@@ -483,7 +483,7 @@ EmitStruct(const struct vcc *tl)
 	Fc(tl, 0, "\t.nsrc = VGC_NSRCS,\n");
 	Fc(tl, 0, "\t.srcname = srcname,\n");
 	Fc(tl, 0, "\t.srcbody = srcbody,\n");
-#define VCL_MET_MAC(l,u,b) \
+#define VCL_MET_MAC(l,u,t,b) \
 	Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n");
 #include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
diff --git a/lib/libvcc/vcc_storage.c b/lib/libvcc/vcc_storage.c
index 3882e5a..2c3f81c 100644
--- a/lib/libvcc/vcc_storage.c
+++ b/lib/libvcc/vcc_storage.c
@@ -77,7 +77,7 @@ vcc_Stv_mkvar(struct vcc *tl, const struct token *t, enum var_type fmt)
 
 	v->name = TlDupTok(tl, t);
 	v->r_methods = 0;
-#define VCL_MET_MAC(l,u,b)	v->r_methods |= VCL_MET_##u;
+#define VCL_MET_MAC(l,u,t,b)	v->r_methods |= VCL_MET_##u;
 #include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
 	v->fmt = fmt;



More information about the varnish-commit mailing list